Skip to content

feat: support package.json5 and package.yaml#234

Merged
pi0 merged 6 commits into
unjs:mainfrom
outslept:feat/package-json5-yaml-support
Aug 19, 2025
Merged

feat: support package.json5 and package.yaml#234
pi0 merged 6 commits into
unjs:mainfrom
outslept:feat/package-json5-yaml-support

Conversation

@outslept

Copy link
Copy Markdown
Contributor

closes #227 :)

@codecov

codecov Bot commented Jun 30, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.74074% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.11%. Comparing base (afdf7cb) to head (249b787).
⚠️ Report is 89 commits behind head on main.

Files with missing lines Patch % Lines
src/packagejson/utils.ts 90.74% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
+ Coverage   89.40%   91.11%   +1.71%     
==========================================
  Files           5       10       +5     
  Lines         434      315     -119     
  Branches       37       72      +35     
==========================================
- Hits          388      287     -101     
+ Misses         46       28      -18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@danielroe danielroe requested a review from pi0 June 30, 2025 20:19
@pi0

pi0 commented Jun 30, 2025

Copy link
Copy Markdown
Member

Thanks for PR!

It would be nice if we could merge them also into one simple util like findPackage(), readPackage(), .. this way users can simply use one standard util to support all possible formats (bun for instance allows jsonc for package.json)

@outslept

outslept commented Jul 1, 2025

Copy link
Copy Markdown
Contributor Author

If I understand correctly, merging the existing functions (readPackageJSON, writePackageJSON, resolvePackageJSON + the new JSON5/YAML variants) into unified ones would be a breaking change. What concerns me is that we'd either need to maintain both APIs or break existing users who rely on format-specific functions. The unified approach is so clean but requires a major version bump (?). What's do you think?

@pi0

pi0 commented Jul 1, 2025

Copy link
Copy Markdown
Member

thats why i suggested to use new readPackage (vs current readPackageJSON) — also for new formats we could merge them directly to it to reduce confusion with many exported utils.

@outslept

outslept commented Jul 1, 2025

Copy link
Copy Markdown
Contributor Author

I misunderstood you at first, feel free to review now

@pi0 pi0 changed the title feat: add support for package.json5 and package.yaml formats feat: add support for package.json5 and package.yaml formats Aug 19, 2025
@pi0 pi0 changed the title feat: add support for package.json5 and package.yaml formats feat: support package.json5 and package.yaml Aug 19, 2025

@pi0 pi0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice impl, thanks ❤️

@pi0 pi0 merged commit 8aecac1 into unjs:main Aug 19, 2025
5 checks passed
@outslept outslept deleted the feat/package-json5-yaml-support branch August 19, 2025 16:23
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.

support package.json5 + package.yaml for pnpm

2 participants