diff --git a/.github/workflows/jsr.yml b/.github/workflows/jsr.yml new file mode 100644 index 0000000..2de3f3a --- /dev/null +++ b/.github/workflows/jsr.yml @@ -0,0 +1,27 @@ +name: jsr + +env: + DENO_VERSION: 1.x + +on: + push: + tags: + - "v*" + +permissions: + contents: read + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: denoland/setup-deno@v1 + with: + deno-version: ${{ env.DENO_VERSION }} + - name: Publish + run: | + deno run -A jsr:@david/publish-on-tag@0.1.3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60717c1..045fbcb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,12 +10,13 @@ on: branches: - main pull_request: + workflow_dispatch: jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: denoland/setup-deno@v1 with: deno-version: ${{ env.DENO_VERSION }} @@ -30,7 +31,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: denoland/setup-deno@v1 with: deno-version: ${{ env.DENO_VERSION }} @@ -38,3 +39,6 @@ jobs: run: | deno task test timeout-minutes: 5 + - name: JSR publish (dry-run) + run: | + deno publish --dry-run diff --git a/.github/workflows/udd.yml b/.github/workflows/udd.yml deleted file mode 100644 index 3fa4eed..0000000 --- a/.github/workflows/udd.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Update - -on: - schedule: - - cron: "0 0 * * *" - workflow_dispatch: - -jobs: - udd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: denoland/setup-deno@v1 - with: - deno-version: "1.x" - - name: Update dependencies - run: | - deno task upgrade > ../output.txt - env: - NO_COLOR: 1 - - name: Read ../output.txt - id: log - uses: juliangruber/read-file-action@v1 - with: - path: ../output.txt - - name: Commit changes - run: | - git config user.name '${{ github.actor }}' - git config user.email '${{ github.actor }}@users.noreply.github.com' - git commit -a -F- < 0)); // -> undefined @@ -67,14 +68,6 @@ console.log(unnullish(undefined, () => 0) ?? null); // -> null ``` -##### Deno - -Use `import { unnullish } from "https://deno.land/x/unnullish/mod.ts"`; - -##### Node - -Use `import { unnullish } from "unnullish"`; - ## License The code follows MIT license written in [LICENSE](./LICENSE). Contributors need diff --git a/deno.jsonc b/deno.jsonc index 5df9813..c498e2d 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,9 +1,16 @@ { - "lock": false, + "name": "@lambdalisue/unnullish", + "version": "0.0.0", + "exports": "./mod.ts", "tasks": { "build-npm": "deno run -A scripts/build_npm.ts $(git describe --tags --always --dirty)", - "test": "deno test --unstable -A --parallel", - "check": "deno check --unstable $(find . -name '*.ts')", - "upgrade": "deno run -A https://deno.land/x/udd/main.ts $(find . -name '*.ts' -not -path '*/npm/*')" + "test": "deno test -A --parallel --doc --shuffle", + "check": "deno check **/*.ts" + }, + "imports": { + "@deno/dnt": "jsr:@deno/dnt@^0.41.1", + "@lambdalisue/unreachable": "jsr:@lambdalisue/unreachable@^1.0.1", + "@std/assert": "jsr:@std/assert@^0.221.0", + "https://deno.land/x/unnullish@$MODULE_VERSION/": "./" } } diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index 3616986..874ec52 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -1,4 +1,4 @@ -import { build, emptyDir } from "https://deno.land/x/dnt@0.34.0/mod.ts"; +import { build, emptyDir } from "@deno/dnt"; const name = "unnullish"; const version = Deno.args[0]; diff --git a/unnullish_test.ts b/unnullish_test.ts index 47a8aaa..726e1ee 100644 --- a/unnullish_test.ts +++ b/unnullish_test.ts @@ -1,5 +1,5 @@ -import { assertEquals } from "https://deno.land/std@0.186.0/testing/asserts.ts"; -import { unreachable } from "https://deno.land/x/unreachable@v0.1.0/mod.ts"; +import { assertEquals } from "@std/assert"; +import { unreachable } from "@lambdalisue/unreachable"; import { unnullish } from "./unnullish.ts"; Deno.test("unnullish() returns undefined when the value is undefined", () => {