Skip to content

fix: make eject produce standalone applications - #924

Open
big-kahuna-burger wants to merge 1 commit into
fastify:mainfrom
big-kahuna-burger:fix/eject-683
Open

big-kahuna-burger wants to merge 1 commit into
fastify:mainfrom
big-kahuna-burger:fix/eject-683

Conversation

@big-kahuna-burger

Copy link
Copy Markdown
Contributor

fastify eject currently requires an explicit --esm flag and leaves generated scripts and test helpers dependent on fastify-cli.

This change detects ESM from package.json and TypeScript from src/app.ts, with explicit flags taking precedence. It updates generated scripts to run standalone servers, replaces unmodified generated test helpers, adds close-with-grace as a runtime dependency, and removes fastify-cli when no scripts or source files still use it.

TypeScript servers are generated under src/ and compiled to dist/server.js. Generated TypeScript test scripts and configurations are updated to run compiled tests.

Custom scripts, helpers, and TypeScript configurations are preserved. Customized server files are protected from overwriting, and the CLI dependency is retained when still needed.

Closes #683.

Validation

  • Full npm test suite passes, including type tests and the 100% coverage gate.
  • npm run lint passes.
  • Integration tests verify CJS and ESM JavaScript and TypeScript apps run tests, serve requests, and shut down without fastify-cli installed.
  • Coverage includes repeated ejection, explicit overrides, custom files, and filesystem errors.

This branch has not been deployed

No deployments
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.

Need better eject

1 participant