Publishing packages
Prepare, verify, and publish a coordinated KetJS release to npm.
KetJS releases five public packages with one version:
@ketvietlab/ketjs-view@ketvietlab/ketjs-view-tools@ketvietlab/create-view@ketvietlab/ketjs@ketvietlab/ketjs-postgres
The KetSuite packages (design-system, ketsuite, flow-ui, flow-client and website-client) are
released from the KetSuite source, not from this repository.
Internal dependencies use that exact version. Publish in this order so every dependency exists before the package that names it.
One-time npm setup#
The @ketvietlab scope must belong to the npm account or organization performing the release. Configure the
GitHub npm environment with required reviewers and an NPM_TOKEN secret that can publish public packages
under that scope. Keep two-factor authentication enabled for the npm account.
The workflow requests an OIDC token and publishes with npm provenance. After the first release creates the packages, configure npm trusted publishing for this repository and remove the long-lived token when the npm account supports that transition.
Prepare a version#
Update the root and all workspace package versions together. Also update every internal dependency and the
version used by ket new. The release checker rejects drift between any of these locations.
Only the scoped @ketvietlab packages are part of the supported package set. Preview releases follow semantic
versioning but do not promise API stability before 1.0.
Verification gates#
Locally, verify only the deployment being changed and its directly affected producer contracts, as
specified in AGENTS.md. Inspect scripts before running them; do not use the aggregate release checker
as a routine local test command. Documentation-only edits need content and diff checks.
Broad release verification belongs to promotion into develop and the release pull request into
master. The release gate performs formatter, lint, build, dependency, type and test checks. It also:
- verifies package metadata, repository links, license, exports, versions, and exact internal dependencies;
- creates the same tarballs npm will receive and enforces package-size ceilings;
- installs all tarballs into a clean consumer and imports every public entry point;
- invokes the installed
ket newandcreate-viewbinaries; - installs the local tarballs into that generated project, resolves its development CLI entry, then runs its check and integration test.
The KetJS package has a 1.2 MB packed-size ceiling. Its baseline includes the three licensed Inter font faces embedded by the deterministic PDF renderer. A release that crosses a ceiling must inspect the tarball contents before changing the budget.
To retain inspectable tarballs under .release/:
# Run from: /path/to/ketjs
npm run release:packNo publish command is part of either local script.
Publish#
- Create
release/<version>frommasterand merge thedevelophead into it. Do not release an arbitrary feature branch. - Update the coordinated version, then open the release pull request into
masterand let the required checks pass. Feature pull requests are verified locally by their authors, so a failure here is fixed ondevelopbefore the release is retried. - Merge the release pull request into
master. The resultingmastercommit is the immutable KetJS source used by downstream applications;developmust never be used as a production dependency pin. - Create and publish GitHub release
v0.2.0at that exactmastercommit. - Approve the protected
npmenvironment when prompted. - Confirm all five packages and provenance attestations on npm.
- Update each downstream repository to the released npm version, then run that repository's release process.
- Run the public smoke path without local tarballs:
# Run from: /path/to/projects
npx -y @ketvietlab/ketjs@0.2.0 new public_smoke
cd public_smoke
npm install
npm testThe workflow also supports manual dispatch for an existing tag. It refuses a tag that does not exactly match the coordinated package version.
Failure and recovery#
Do not overwrite or unpublish a released version. The workflow is resumable: it skips an existing package only when the registry tarball checksum matches the local release tarball, and stops on any mismatch. If a package is defective, deprecate that version and release a corrected patch.