feat(adapters/deno): publish to JSR (#5465)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* feat(adapters/deno): publish to JSR * update * update readme * refactor * refactor
authored by Yusuke Wada · committed by GitHub · parent b877827 · Browse files · 10 files·+57 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
10 files+57 added−9 removed
- tests:+2 added−2 removed
- other:+55 added−7 removed
Provenance
- Commit
1c6e060- Tree
2436b09- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
GitHub <noreply@github.com>- Parent
b877827
10 files changed+57 added−9 removed
modified:.github/workflows/release.yml+10 added
95 unmodified lines9697989910010110210310410510610710810995 unmodified lines - name: Pack run: pnpm --filter "${{ steps.pkg.outputs.name }}" pack --pack-destination "$RUNNER_TEMP" - name: Publish to npm run: npm stage publish "$RUNNER_TEMP"/*.tgz --provenance --access public # Adapters with a deno.json are also published to JSR - uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2 if: hashFiles(format('{0}/deno.json', steps.pkg.outputs.dir)) != '' with: deno-version-file: '.tool-versions' - name: Publish to JSR if: hashFiles(format('{0}/deno.json', steps.pkg.outputs.dir)) != '' working-directory: ${{ steps.pkg.outputs.dir }} # deno.json keeps version 0.0.0; the version comes from the tag, like jsr.json for hono run: deno publish --set-version "${GITHUB_REF_NAME##*@}"modified:adapters/deno/src/conninfo.test.ts+1 added-1 removed
122345619 unmodified linesimport { Context } from 'hono'import { getConnInfo } from './conninfo'import { getConnInfo } from './conninfo.ts'
describe('getConnInfo', () => { it('Should info is valid', () => { const transport = 'tcp'19 unmodified linesmodified:adapters/deno/src/index.ts+4 added-4 removed
1234567896789/** * @module * Deno Adapter for Hono. */
export { serveStatic } from './serve-static'export { toSSG, denoFileSystemModule } from './ssg'export { upgradeWebSocket } from './websocket'export { getConnInfo } from './conninfo'export { serveStatic } from './serve-static.ts'export { toSSG, denoFileSystemModule } from './ssg.ts'export { upgradeWebSocket } from './websocket.ts'export { getConnInfo } from './conninfo.ts'modified:adapters/deno/src/websocket.test.ts+1 added-1 removed
1 import { Context, Hono } from 'hono'2-import { upgradeWebSocket } from './websocket'2+import { upgradeWebSocket } from './websocket.ts'3 4 globalThis.Deno = {} as typeof Deno5 6 describe('WebSockets', () => {155 unmodified linesadded:adapters/deno/deno.json+23 added
1234567891011121314151617181920212223{ "name": "@hono/deno", "version": "0.0.0", "license": "MIT", "exports": "./src/index.ts", "imports": { "hono": "jsr:@hono/hono@^4.13.9", "hono/types": "jsr:@hono/hono@^4.13.9/types", "hono/conninfo": "jsr:@hono/hono@^4.13.9/conninfo", "hono/serve-static": "jsr:@hono/hono@^4.13.9/serve-static", "hono/ssg": "jsr:@hono/hono@^4.13.9/ssg", "hono/ws": "jsr:@hono/hono@^4.13.9/ws" }, "publish": { "include": [ "src/**/*.ts", "README.md" ], "exclude": [ "src/**/*.test.ts" ] }}modified:adapters/deno/package.json+2 added-1 removed
30 unmodified lines31323334353536373830 unmodified lines "engines": { "node": ">=16.9.0" }, "devDependencies": { "hono": "workspace:*" "hono": "workspace:*", "@types/node": "^24.3.0" }}modified:adapters/deno/README.md+3 added-1 removed
1 unmodified line2 3 Deno adapter for [Hono](https://hono.dev).4 5 ```sh6-deno add npm:@hono/deno6+deno add jsr:@hono/deno7 ```8 9+The package is also published to npm, so `deno add npm:@hono/deno` works too.10+11 ## Migrating from `hono/deno`12 13 The exports are the same. Change the import path:14 10 unmodified linesmodified:adapters/deno/tsconfig.json+2 added-1 removed
6 unmodified lines7 "types": [8 "node",9 "vitest/globals"10 ],11- "noEmit": true11+ "noEmit": true,12+ "allowImportingTsExtensions": true13 },14 "include": [15 "src/**/*.ts"16 ]1 unmodified linemodified:docs/MAINTAINING.md+8 added
42 unmodified lines43 This bumps `adapters/bun/package.json`, commits, creates an annotated tag `@hono/bun@<version>` and pushes. The `release.yml` workflow then packs the adapter and runs `npm stage publish`. Approve the staged version on npm (2FA) to make it public.44 45 At the end the script prints a release-note draft built from the commits that touched `adapters/bun` since the previous adapter tag, plus a prefilled GitHub "new release" link. Creating a GitHub Release is optional.46 47+### JSR48+49+`@hono/deno` is also published to JSR. `adapters/deno/deno.json` is the JSR package config: its `imports`50+map `hono` to `jsr:@hono/hono`, and its `version` stays `0.0.0` like the root `jsr.json`.51+The `release.yml` workflow runs `deno publish --set-version <version from the tag>` when the tagged adapter has a `deno.json`.52+Before the first release, create the package on jsr.io under the `@hono` scope and link the `honojs/hono`53+repository so the workflow can publish with OIDC. `deno publish --dry-run --set-version 0.0.1` in `adapters/deno` checks the package locally.54+55 ### Adding a new adapter56 57 1. Copy `adapters/bun` as `adapters/<name>` and adjust `package.json` (`name`, `description`) and the sources.58 2. The workspace picks it up automatically (`pnpm-workspace.yaml` has `adapters/*`).12 unmodified linesmodified:pnpm-lock.yaml+3 added
251 unmodified lines252 version: link:../..253 254 adapters/deno:255 devDependencies:256+ '@types/node':257+ specifier: ^24.3.0258+ version: 24.13.6259 hono:260 specifier: workspace:*261 version: link:../..262 9792 unmodified lines