Skip to content

feat(zero-swift): bundle the shared generator instead of publishing zerogen - #126

Merged
tmm merged 1 commit into
mainfrom
bundle-zerogen
Nov 10, 2026
Merged

tmm merged 1 commit into
mainfrom
bundle-zerogen

Conversation

@tmm

@tmm tmm commented Nov 10, 2026

Copy link
Copy Markdown
Member

tmm decided against a single published generator CLI: each native client gets its own, zero-swift now and zero-rust later. zerogen stays in the repo as private shared code, and zero-swift bundles it at build time, so the published package has no zerogen dependency and installs only Swift's generator.

What changes

  • packages/zerogen is now private. It has no bin, exports, publishConfig or build. Its own CLI (zerogen codegen --target, zerogen.json, compat.ts) is removed, since nothing ships it anymore. What remains is shared code: cli.ts (the Swift CLI builder, which loads the schema, writes or --checks the output, and has the drift command), types.ts, drift.ts and targets/swift.ts.

  • zero-swift builds exactly as 0.7.9 did. It uses the same esbuild command (--splitting, externals @rocicorp/zero, typescript, incur) and the same runtime dependencies, incur 0.7.1 and typescript 6.0.3. It imports ../../zerogen/src/cli.ts like the repo's other workspace sources, and lists zerogen only as a dev dependency.

  • Release workflow: the zerogen version, lookup, build, pack and publish steps are gone. It's back to one npm package. It keeps two improvements from feat(zerogen): move the Swift generator into a zerogen package #122 for zero-swift: a version only counts as unpublished on a registry 404, and the packed smoke test runs before packing.

  • Changesets: zerogen's pending minor changeset is dropped. The zero-swift patch changeset stays, reworded. Because zerogen is private (privatePackages.version: false), Changesets never versions it.

  • Smoke test: moved to pnpm --filter zero-swift smoke. It installs the packed tarball outside the workspace with @rocicorp/zero@1.11.0 and asserts:

    • the dependencies are exactly incur and typescript;
    • there's no zerogen in dependencies, peer or optional dependencies, or node_modules;
    • no file in dist/ imports zerogen.

    Then it runs codegen (legacy flags, --check) and drift record.

  • Docs: the zero-swift README, .changeset/README.md and .syncpackrc are back to their pre-feat(zerogen): move the Swift generator into a zerogen package #122 text. The TypeScript 6 pin now covers both packages. The zerogen README and swift/DESIGN.md describe it as private shared code.

Verified

Check Result
pnpm --filter zero-swift test 29 passed: the byte-for-byte fixture and zbugs checks, the Swift compile sweep (Swift 6.2.4, Linux) and drift.
Parity: published zero-swift@0.7.9 and @0.7.10 vs this packed tarball, on @rocicorp/zero@1.11.0 All 32 cases (help, --llms, bare --schema, legacy and kebab flags, --json, --check fresh and stale, every error code, drift record, --target rejected) are identical to 0.7.10 in stdout, stderr and exit code. They're also identical to 0.7.9, except where --version and --help print the version. All 5 generated files (4 Swift, 1 vectors) are identical to both. The tarball has the same files as 0.7.10's and the same dependencies.
pnpm --filter zero-swift smoke Passed.
check-types (zero-conformance, zerogen, zero-swift), oxlint, oxfmt, syncpack lint, git diff --check Clean.
actionlint 1.7.7 with ShellCheck Only the pre-existing SC2016 info in "Create release".
Plan script vs. live npm and mirror With 0.7.10, which is released, it plans nothing (npm, mirror and release all false). Simulated 0.7.11: all three true. Its outputs are back to version, npm, mirror and release.
Changesets dry run zero-swift 0.7.10→0.7.11 and swift/VERSION; zerogen untouched (0.0.0, no changelog).
pnpm install --frozen-lockfile Passes and leaves pnpm-lock.yaml byte-identical. Compared with before #122, the lockfile only swaps the wrapper's zero-types link for zerogen and adds the zerogen importer.

The packed manifest's devDependencies lists zerogen: 0.0.0 where 0.7.10 had zero-types: 0.0.0. That's how pnpm writes private workspace dev dependencies, as it already does for zero-schema and zql; npm doesn't install a package's dev dependencies for its users.

#125, the version PR that would have published zerogen 0.1.0, is closed without merging. After this merges, Changesets opens a version PR for zero-swift alone.

This is a feature PR, so it needs tmm's OK to merge.

…erogen

Each native client gets its own CLI, zero-swift now and zero-rust later,
so zerogen is no longer a published package. It stays in the repository
as private shared code (packages/zerogen), and zero-swift's build
bundles it, as 0.7.9's did with the generator, so the published package
depends only on incur and typescript again and installs only Swift's
generator. Its commands, config, and output are unchanged: next to
zero-swift 0.7.9 and 0.7.10 from npm, the packed CLI prints the same
help, results, and errors and writes the same files.

zerogen's own CLI (`zerogen codegen --target`, zerogen.json) is gone,
with nothing left to ship it. The release workflow no longer versions or
publishes zerogen, and its pending changeset is dropped, so the next
release is zero-swift alone. The packed smoke test moved to zero-swift
and also checks that the package doesn't depend on or import zerogen.

Amp-Thread-ID: https://ampcode.com/threads/T-25ebc75a-8a01-4e52-bb02-ea048d34e417
Co-authored-by: tmm <tmm@tmm.dev>
@tmm
tmm merged commit a0df53f into main Nov 10, 2026
15 checks passed
@tmm
tmm deleted the bundle-zerogen branch November 10, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants