Migrate from npm to pnpm workspaces - #82
Open
sleeyax wants to merge 1 commit into
Open
Conversation
Replace npm workspaces with pnpm, using the default strict isolated node_modules layout. Every package now declares the tools its own scripts invoke rather than relying on npm's flat hoisting, and internal dependencies use the workspace protocol. The Dockerfile builds with `pnpm deploy`, which collects the addon and its workspace dependencies into a single self-contained directory, so the final image no longer needs a package manager at runtime. `forceLegacyDeploy` is set because the alternative, `injectWorkspacePackages`, would replace the workspace symlinks with copies and break live local development. Node is unified on 24 across the engines field, the Dockerfile and CI, which previously disagreed. Also drops the stale empty .yalc directory, adds a .dockerignore, and keeps prettier away from the lockfile.
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.
Replaces npm workspaces with pnpm, using pnpm's default strict isolated
node_moduleslayout.What changed
pnpm-workspace.yamlreplaces the rootworkspacesarray. pnpm 11 gates dependency build scripts behindallowBuilds:esbuild/workerdare allowed for wrangler,ssh2/cpu-featuresdenied since they're optional native speedups for beamup-cli's SSH transport and it falls back to pure JS.workspace:*, andtypescript/@types/node/vitest/tsx/cross-envare declared in the packages that actually use them instead of being borrowed from the root via npm's flat hoisting.files: ["dist"]was added toapiandaddon, and the deprecatedprepublishhook becameprepublishOnly.pnpm install --frozen-lockfile --filter "@easynews/addon..."(so the worker's toolchain stays out of the image), thenpnpm deploycollects the addon plus its workspace deps into one self-contained directory. The final image is a plainnode dist/server.jsand needs no package manager at runtime. New.dockerignoretoo, since there wasn't one andCOPY packages/...was dragging in whatever the host had.pnpm/action-setup@v4beforesetup-nodesocache: 'pnpm'can find the binary.engines, the Dockerfile and CI, which previously said 20, 22 and 23 respectively..yalc/tree (noyalc.lock, nofile:/link:deps anywhere) and adds a.prettierignoresopnpm formatstops reformatting the lockfile that pnpm rewrites on every install.Notes
forceLegacyDeploy: trueis set inpnpm-workspace.yamlbecausepnpm deployotherwise requiresinjectWorkspacePackages: true, which would replace the workspace symlinks with copies and break live local development against@easynews/api.Verified
pnpm install --frozen-lockfile->pnpm build-> 20/20 tests passpnpm start:addonandpnpm start:addon:devboth serve/manifest.jsonpnpm start:cloudflare-worker:devbundles the linked addon and serves the manifestdocker build --no-cachesucceeds; the container serves/manifest.json(167 MB image)pnpm packon the addon produces a tarball containingdist/pnpm version patchpropagates to all four manifests and stages themNot verified: the actual beamup deploy. beamup is Dokku, which prefers a root
Dockerfileover buildpacks, so it should go through the updated Dockerfile — but that only proves out on a realpnpm deploy:beamup.