Skip to content

Conversation

@kokoichi206
Copy link

@kokoichi206 kokoichi206 commented Nov 14, 2025

Summary

This PR adds support for package.json5 format when reading the packageManager field, making this action consistent with pnpm's own support for JSON5.

Note:
I'm submitting this PR directly with implementation instead of opening an issue first, as the change is small and straightforward. I hope this approach is acceptable
- please let me know if you'd prefer to discuss this in an issue first!

Motivation

According to pnpm's documentation:

In addition to the traditional package.json format, pnpm also supports package.json5 (via json5) and package.yaml (via js-yaml).

This action already supports package.json and package.yaml, but not package.json5. This PR adds the missing support to be consistent with pnpm itself.

Changes

  1. Added json5 package as a dependency
  2. Updated parser logic to use JSON5.parse() instead of JSON.parse() for non-YAML files
  3. Updated README to document package.json5 support

Note:
Since JSON5 is a superset of JSON, the JSON5.parse() can parse both standard JSON and JSON5 formats.
This means existing package.json files continue to work without any changes
- this is a fully backward-compatible enhancement.

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