diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 37c1ccc..88b18d7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,21 +1,13 @@ # .github/workflows/publish.yml -name: Publish to JSR - +name: Publish to jsr.io on: - workflow_run: - workflows: ["CI Tests"] - types: - - completed + release: + types: [released] + workflow_dispatch: jobs: publish: - runs-on: ubuntu-latest permissions: contents: read - id-token: write - - steps: - - uses: actions/checkout@v4 - - - name: Publish package - run: npx jsr publish \ No newline at end of file + id-token: write + uses: cross-org/workflows/.github/workflows/jsr-publish.yml@main \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5cfb733..c6b2740 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,4 +21,4 @@ jobs: uses: cross-org/workflows/.github/workflows/node-ci.yml@main with: jsr_dependencies: "@cross/deepmerge @cross/runtime @cross/test @std/assert" - test_target: "tests/*.test.ts" \ No newline at end of file + test_target: "*.test.ts" \ No newline at end of file diff --git a/deno.jsonc b/deno.jsonc index e256f19..4c677b4 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,13 +1,13 @@ { "name": "@cross/env", - "version": "0.2.7", + "version": "1.0.0", "exports": { ".": "./mod.ts", "./load": "./load.ts" }, "tasks": { - "test": "cd tests && deno test --allow-env --allow-read", + "test": "deno test --allow-env --allow-read", "publish-dry": "deno publish --dry-run" }, "lock": false, @@ -16,8 +16,8 @@ "indentWidth": 4 }, "imports": { - "@cross/deepmerge": "jsr:@cross/deepmerge@^0.2.0", - "@cross/runtime": "jsr:@cross/runtime@^0.0.17", + "@cross/deepmerge": "jsr:@cross/deepmerge@^01.0.0", + "@cross/runtime": "jsr:@cross/runtime@^1.0.0", "@cross/test": "jsr:@cross/test@^0.0.8", "@std/assert": "jsr:@std/assert@^0.219.1" } diff --git a/load.test.ts b/load.test.ts new file mode 100644 index 0000000..d0ec170 --- /dev/null +++ b/load.test.ts @@ -0,0 +1,15 @@ +import { assertEquals } from "@std/assert"; +import { test } from "@cross/test"; +import { getEnv } from "./mod.ts"; + +/** + * Part of the test. + * simulating using the auto .env-load as it would have been with + * import "@cross/env/load"; + */ +import "./load.ts"; + +test("Using import @cross/env/load", () => { + const value = getEnv("TEST_VALUE"); + assertEquals(value, "1"); +}); diff --git a/tests/mod.test.ts b/mod.test.ts similarity index 97% rename from tests/mod.test.ts rename to mod.test.ts index b0ae6f4..1729ed0 100644 --- a/tests/mod.test.ts +++ b/mod.test.ts @@ -1,5 +1,5 @@ import { assert, assertEquals, assertThrows } from "@std/assert"; -import { ValidationError } from "../lib/helpers.ts"; +import { ValidationError } from "./lib/helpers.ts"; import { getAllEnv, getEnv, @@ -10,7 +10,7 @@ import { validateAndGetEnv, validateEnv, ValidatorFunction, -} from "../mod.ts"; +} from "./mod.ts"; import { test } from "@cross/test"; /** ==== getEnv() ==== */