Repository navigation
docs(website): start the TypeScript guide from the Hono template repository - #1341
Conversation
|
🚀 Website Preview Deployed! Preview your changes at: https://pr-1341-common-grants.agile6.workers.dev Built from commit cadb2df |
5c9c7a5 to
001bb3e
Compare
…list The TypeScript guide starts from the Hono template repository and no longer runs cg init.
…sitory Replace the cg init and Express setup steps and project tree with the Hono template's Use this template flow, Node.js 24 prerequisite, and structure.
…ript guide The Hono template has no TypeSpec spec and currently fails cg check spec. Restoring the check is tracked in #1239.
…the Hono template Point the schema, services, and plugin examples at the Hono template's files: the repository interface, src/data/schema.ts, and ESM import paths.
The Hono template already ships SDK 0.9. Keep the module table and the 0.9 changes, and drop the pinned TypeSpec installs and tsconfig step that only applied to cg init projects.
Upgrade zod alongside the SDK and dedupe so the SDK no longer keeps zod 4.6.5 (GHSA-mrhx-c7xc-m3w5). List .nvmrc and PORTING.md in the template tree and drop the orphaned TypeSpec link.
karinamzalez
left a comment
There was a problem hiding this comment.
Approved! Good to merge once common-grants/cg-api-template-hono#2 · feat: serve Swagger UI at /docs… merges since template main doesn’t serve /docs yet and is still on SDK ^0.7.2.
Quick question! Template main is still on SDK ^0.7.2, and the description tests the upgrade from 0.8. Does this command also work for projects starting from 0.7, or do you know if 0.7 -> 0.9 needs extra steps?
d55e013 to
518dfb8
Compare
|
Thanks for the review! Yeah, it works from 0.7 too. The only breaking change in 0.8 was removing the package root entrypoint, and the guide already says to import from the subpaths. Template main only imports from |
### Summary - Supports HHS/simpler-grants-protocol#1184: the TypeScript guide in HHS/simpler-grants-protocol#1341 starts from this template. - Time to review: 10 minutes ### Changes proposed Template users get Swagger UI at `/docs`, `@common-grants/sdk` 0.9, and a passing `pnpm run audit`. - Bump `@common-grants/sdk` to `^0.9.0`. SDK 0.9 publishes ESM, so `.openapi()` now works on SDK schemas. PORTING §6 drops the caveat that said it throws, and the route comment that repeated it. PORTING §6 states the subpath exports as the supported surface, since the SDK has no root entrypoint. The bug-report form's version placeholder follows the bump. - Raise the `zod` floor to `^4.6.6` (resolves to 4.6.7) to clear the high advisory [GHSA-mrhx-c7xc-m3w5](GHSA-mrhx-c7xc-m3w5), which reaches the served API through the SDK and `@hono/zod-openapi`. - Add `@hono/swagger-ui` 0.6.1 and serve Swagger UI at `/docs` from `/openapi.json`, with a test. The startup output lists `/docs`. - README: `/docs` in Endpoints and Get started, docs UI dropped from Scope, and Maintenance opens with the owner line. CONTRIBUTING and the feature-request template drop the docs UI from their out-of-scope lists. - Exempt `@common-grants/*` from pnpm's release-age hold. - Refresh postcss and vite in the lockfile to clear two high advisories in dev tooling only: [GHSA-68fv-2mgg-jv7q](GHSA-68fv-2mgg-jv7q) (source-map-js) and [GHSA-587h-7wmj-h5pm](GHSA-587h-7wmj-h5pm) (vite). ### Context for reviewers Builds on template `b266c8cfa10b35b9a9b47322a46ff93923bc97f8`. Swagger UI loads its assets from jsDelivr by default, floating within swagger-ui-dist 5.x. PORTING §9 notes `baseUrl` for a mirror and `version` to pin a release. The `pnpm-workspace.yaml` exemption is a first-party name pattern, not a version pin, so SDK releases install the day they ship. Third-party packages keep pnpm's one-day hold. Verified on Node 24 with pnpm 11.20.0: `pnpm install --frozen-lockfile`, `pnpm run ci` (90 tests) and `pnpm run audit` all pass. Under `pnpm run dev`, `/docs` returns 200 and the README's list, search and `/openapi.json` requests return 200. ### Additional information To try it, run `pnpm install` and `pnpm run dev`, then open <http://localhost:3000/docs> and send a search from Swagger UI.
# Conflicts: # lib/cli/DEVELOPMENT.md
Summary
main.Changes proposed
The TypeScript guide now starts from the Hono API template instead of
cg initand the Express template. This PR builds on #1345 and keeps her page: the SDK module table, the SDK validation example, the plugin and custom-fields walkthrough, and the overall section order.On top of #1345, it:
cg initsetup steps and project tree with the template's Use this template flow, the Node.js 24 prerequisite, and the template's structure.src/data/schema.ts, and ESM import paths.tsconfigstep.cg initchecklist inlib/cli/DEVELOPMENT.md.Context for reviewers
common-grants/cg-api-template-expressis archived, and [Monorepo] Remove the root templates/ projects and their CI #1186 tracks removing the monorepo copy (templates/express-js).cg check spec. Restoring it is tracked in [Template] Add automated CommonGrants contract validation to the API template repositories #1239.Verification: on a fresh clone of the Hono template at 25f20b7 with Node 24 and pnpm 11.20.0, I ran each command on the page plus the README's curl examples, applied the plugin and custom-field code, and
pnpm run cipassed. The upgrade steps (SDK, Zod, thenpnpm dedupe) took the template at 0342f2d from SDK 0.8 to 0.9 withpnpm run ciandpnpm run auditpassing. The website build, lint, format, and spelling checks pass.Additional information
None.