Skip to content

feat(node): support package.json5 manifests#566

Merged
iloveitaly merged 13 commits into
railwayapp:mainfrom
iloveitaly:package-json5
May 30, 2026
Merged

feat(node): support package.json5 manifests#566
iloveitaly merged 13 commits into
railwayapp:mainfrom
iloveitaly:package-json5

Conversation

@iloveitaly

@iloveitaly iloveitaly commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Motivation

pnpm reads package.json5 natively, but Railpack only detected and parsed package.json, so JSON5-based Node projects were not recognized.

Description

  • Add a findPackageManifest helper that searches package.json then package.json5, with package.json taking precedence when both exist, and route detection, dependency parsing, install copying, workspace parsing, and local-file detection through it. JSON5 manifests work because App.ReadJSON pipes through hujson, which accepts the comments and trailing commas commonly used in real manifests.
  • Improve pnpm version resolution by reordering it so engines.pnpm overrides lockfile-based inference, since lockfileVersion is ambiguous across major versions while engines reflects explicit developer intent.
  • Broaden pnpm lockfile-to-version mapping (covering the 6.0/6.1 and 9.0 formats, including quoted and unquoted forms) and refactor the checks into a switch that warns when a lockfile version can't be identified.

Test

  • Added a node-pnpm-json5 example project with a build plan snapshot to exercise native package.json5 support end to end.
  • Added unit tests for pnpm version resolution covering the lockfile, engines, and packageManager precedence hierarchy.
  • Extended the node-pnpm-workspaces example to report the resolved pnpm version for verification.

- introduce findPackageManifest to prioritize package.json over package.json5
- update dependency detection and installation logic to include package.json5
- ensure local file detection and workspace parsing support the new manifest format

Generated-by: aiautocommit
* Add a new example project to demonstrate native pnpm support for package.json5 manifests.
* Include a test configuration to verify environment detection and CLI version reporting.

Generated-by: aiautocommit
Generated-by: aiautocommit
…ion notes

* Update the `install_before` setting name to `minimum_release_age` to match current configuration.
* Add clarification on how Railpack handles semver constraints from manifest files by simplifying ranges to major versions.

Generated-by: aiautocommit
- Add checks for pnpm version via npm_config_user_agent and the pnpm CLI.
- Update test expectations to verify pnpm version reporting.

Generated-by: aiautocommit
- Add support for pnpm lockfile versions 6.1 and 9.0 to ensure correct tool version detection.
- Refactor the lockfile version check into a switch statement to improve readability and maintainability.
- Add logging for cases where the pnpm lockfile version cannot be identified.

Generated-by: aiautocommit
- Verify that pnpm versions are correctly derived from pnpm-lock.yaml versioning.
- Ensure proper precedence hierarchy between lockfile, engines, and packageManager fields.

Generated-by: aiautocommit
- Reprioritize pnpm version resolution to prefer `engines` over lockfile-based inference.
- Lockfile version parsing can be ambiguous across major versions, whereas `engines` provides an explicit developer intent.

Generated-by: aiautocommit
@iloveitaly iloveitaly changed the title feat(node): package.json5 support feat(node): support package.json5 manifests May 30, 2026
@iloveitaly iloveitaly merged commit de98d44 into railwayapp:main May 30, 2026
454 of 456 checks passed
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.

1 participant