Repository navigation
fix: make generated projects build, ship and work with pnpm - #1
Merged
Merged
Conversation
A project generated today failed `npm run build` with TypeScript errors, because the dependency ranges had moved on. Docker failed too: the production stage ran husky's prepare script without husky installed. - Update dependencies (Zod 4, Express 5.3, Pino 10, ESLint 10, Vitest 5, TypeScript 6.0) and drop dotenv for process.loadEnvFile() - Build Docker images on Node 24 with --ignore-scripts, add .dockerignore - Read Swagger docs relative to the config file so production lists routes - Fix validate(schema, 'query') on Express 5, where req.query is a getter - Return 400 for malformed JSON and 413 for oversized bodies, not 500 - Add the missing pre-commit hook and @vitest/coverage-v8 - Hide memory and environment from /api/health in production - One log line per request instead of every header - Tests for validation, error handling, Swagger and production health
- Run git init before installing so husky can set up its hook, and make the initial commit last so it includes the lockfile - pnpm 10+ blocks dependency build scripts and newer versions fail the install. Allow esbuild's, pin the pnpm version for corepack, and switch the Dockerfile and README to pnpm - Print the package manager's output when an install fails - Show next steps for the chosen package manager - Reject unknown --package-manager values and drop yarn, which the Dockerfile never supported - Read the CLI version from package.json
CI only scaffolded a project and ran its tests, so a template that no longer built went unnoticed. It now builds, lints and boots the production build on Node 22, 24 and 26, builds the Docker image, and runs weekly to catch dependency changes.
Node 20 reached end of life in April 2026. Changelog entry for the fixes.
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.
Description
I installed 1.0.0 from npm and used it the way three different people would: someone building their first API, a senior engineer checking whether it's production-ready, and a team lead setting it up with pnpm. The first few minutes are fine, but a project generated today can't be built or shipped:
npm run buildfails with 6 TypeScript errors on a fresh project. The dependency ranges moved on since June.preparescript without husky installed (exit 127).src/, which isn't in the build.validate(schema, 'query'), the usage shown in its own comment, returns a 500 on Express 5.--package-manager pnpmfails on current pnpm, and the CLI hides the reason.This PR fixes those and adds CI that would have caught them.
Type of Change
Changes Made
Template
process.loadEnvFile().--ignore-scripts, plus.dockerignore.src/anddist/./api/healthhides memory and environment in production. Request logs are one line each.CLI
git initbefore install so husky sets up its hook; the initial commit comes last and includes the lockfile.--package-manageronly accepts npm or pnpm. yarn was offered by the wizard but the Dockerfile never supported it.CI
The wizard's Gatekeeper and Prisma options still have their own problems. They're for a separate PR before the next release.
Testing
npx tsx src/index.ts test-project)npm run dev)npm test)npm run lintwith no errorsLocally on Node 26 with npm 11.20 and pnpm 12.16, for both package managers: typecheck, build, test, test:coverage, lint and format:check pass on a freshly generated project. The production build was started from a folder with only
dist/and production dependencies, the same as the Docker image. The Docker image itself is only built by the new CI jobs.Screenshots / Logs
Production build, before and after:
Checklist