Repository navigation
feat(zero-swift): bundle the shared generator instead of publishing zerogen - #126
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tmm decided against a single published generator CLI: each native client gets its own,
zero-swiftnow andzero-rustlater.zerogenstays in the repo as private shared code, andzero-swiftbundles it at build time, so the published package has nozerogendependency and installs only Swift's generator.What changes
packages/zerogenis nowprivate. It has nobin,exports,publishConfigor 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.tsandtargets/swift.ts.zero-swiftbuilds exactly as 0.7.9 did. It uses the same esbuild command (--splitting, externals@rocicorp/zero,typescript,incur) and the same runtime dependencies,incur0.7.1 andtypescript6.0.3. It imports../../zerogen/src/cli.tslike the repo's other workspace sources, and listszerogenonly as a dev dependency.Release workflow: the
zerogenversion, 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 forzero-swift: a version only counts as unpublished on a registry 404, and the packed smoke test runs before packing.Changesets:
zerogen's pendingminorchangeset is dropped. Thezero-swiftpatch changeset stays, reworded. Becausezerogenis 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.0and asserts:incurandtypescript;zerogenin dependencies, peer or optional dependencies, ornode_modules;dist/importszerogen.Then it runs codegen (legacy flags,
--check) anddrift record.Docs: the
zero-swiftREADME,.changeset/README.mdand.syncpackrcare back to their pre-feat(zerogen): move the Swift generator into a zerogen package #122 text. The TypeScript 6 pin now covers both packages. ThezerogenREADME andswift/DESIGN.mddescribe it as private shared code.Verified
pnpm --filter zero-swift testzero-swift@0.7.9and@0.7.10vs this packed tarball, on@rocicorp/zero@1.11.0--llms, bare--schema, legacy and kebab flags,--json,--checkfresh and stale, every error code,drift record,--targetrejected) are identical to 0.7.10 in stdout, stderr and exit code. They're also identical to 0.7.9, except where--versionand--helpprint 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 samedependencies.pnpm --filter zero-swift smokecheck-types(zero-conformance, zerogen, zero-swift), oxlint, oxfmt,syncpack lint,git diff --checkactionlint1.7.7 with ShellCheckSC2016info in "Create release".npm,mirrorandreleaseall false). Simulated 0.7.11: all three true. Its outputs are back toversion,npm,mirrorandrelease.zero-swift0.7.10→0.7.11 andswift/VERSION;zerogenuntouched (0.0.0, no changelog).pnpm install --frozen-lockfilepnpm-lock.yamlbyte-identical. Compared with before #122, the lockfile only swaps the wrapper'szero-typeslink forzerogenand adds thezerogenimporter.The packed manifest's
devDependencieslistszerogen: 0.0.0where 0.7.10 hadzero-types: 0.0.0. That's how pnpm writes private workspace dev dependencies, as it already does forzero-schemaandzql; npm doesn't install a package's dev dependencies for its users.#125, the version PR that would have published
zerogen0.1.0, is closed without merging. After this merges, Changesets opens a version PR forzero-swiftalone.This is a feature PR, so it needs tmm's OK to merge.