Migrate from npm to pnpm workspace #29
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Can you instead of using npm run dev for running all the monorepo can you use pnpm workspaces instead? Here you have a reference
https://pnpm.io/workspaces
Migration complete and verified. Here's what changed and why.
Workspace wiring
pnpm-workspace.yaml(new) —backend,frontend,discord-bot. pnpm 10 blocks dependency install scripts by default, soesbuildand@parcel/watcherare allowlisted (they place their native binaries through theirs; without them the Nuxt build is broken).package.json(root) — addedname/private,packageManager: "pnpm@10.28.2"for corepack, and switched thedevorchestration to workspace filtering, keepingconcurrently(the Foundry launcher is not a package, and-k/ names / colors stay as they were) plus one-shot helpers replacingnpm --prefix X run dev:Lockfiles — the four
package-lock.jsonfiles are gone, onepnpm-lock.yamlat the root.dragonroll-foundry/bridgedeliberately stays out of the workspace (Node built-ins only, not part ofpnpm dev, its README runs it standalone).Images and CI
Docker builds now use the repository root as context (
docker build -f ./<pkg>/Dockerfile .indeploy.yml) so the Dockerfiles can read the workspace manifests; each installs withcorepack enable+pnpm install --frozen-lockfile [--prod] --filter ./<pkg>.... Backend/botWORKDIRmoves to…/<package>sodotenv's cwd-relative.env.productionlookup is unchanged. Added a root.dockerignore(the per-package ones are no longer read once the context is the root);.env.productionis kept, only.envis ignored.test.ymlrunscorepack pnpm test.Companion fix that was required
A fresh resolution of the existing
^ranges is unavoidable (npm lockfiles can't be converted), so the frontend now resolves Nuxt 4.6.1 / Vite 8, whoselightningcssminifier rejectsRollWidgetDisplay.vue's nested> { font-size: 12px }— the scoped-style transform turned it into a dangling combinator. The old locked toolchain tolerated it. I rewrote it as.steps > * { font-size: 12px }(the author's evident intent, and it matches the sibling.steps :deep(.roll-val)rule). I confirmed with annpm install+npm run buildbaseline fromHEADthat master built only because the old lockfile pinned the older toolchain — so this is version drift from the migration, not a pre-existing broken build. Heads-up: the newpnpm-lock.yamltherefore freezes those newer versions.Tests
tests/pnpm-workspace.test.js(new, dependency-free like the other tests): workspace membership, root pinned/private, no npm lockfiles,pnpm devfilters every package and never calls npm, per-packagedev:*scripts exist, the three Dockerfiles install from the lockfile via corepack with nonpm ci/npm installfallback, the workflow builds from the root context, and the build-script allowlist.Ran here:
pnpm install,pnpm install --frozen-lockfile(root),pnpm test→ 70 pass / 0 fail,pnpm --filter ./frontend run build→ build complete,pnpm dev→ all four prefixed commands launch and shut down cleanly (no orphaned dev server, port 3000 released), and the exact--frozen-lockfile --prod --filterinstall commands of the backend/bot Docker layers in scratch dirs withrequire('express'|'mongoose'|'discord.js')resolving afterwards. Not run: the Docker builds themselves — the daemon is not reachable in this environment.Untouched on purpose:
ecosystem.config.js(still the stale PM2 config from §9),README.md(points atinstall.sh/start.shthat do not exist — separate known problem), and the "Run withnpm test" header comments in the five existing test files (those tests need no dependencies, sonpm teststill works there).Implementation is ready for review: #31