fix(scripts): normalize npm pack json output to support npm v12+ - #253
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughUpdated 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/prepare/index.mjs (1)
17-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd regression coverage for both
npm pack --jsonshapes.The normalization handles the legacy array and the npm v12 object form. The provided cohort includes no test for either branch. Add focused coverage with mocked
execFileSyncoutput for both shapes, and verify the resulting archive path before extraction. npm’s official changelog records this output-format change, so keep both fixtures to prevent parser regressions. (github.com)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9e0d4f4a-0ac4-43c8-abf3-5552ebe7dc1b
📒 Files selected for processing (1)
scripts/prepare/index.mjs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
webpack/webpack(auto-detected)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Summary
This PR normalizes npm pack json output. In newer versions of
npmv12+, the output structure of thenpm pack --jsoncommand changed from an array of objects to a flat object. This broke our JSON parser which strictly expected an array via destructuring. So this PR lets us support both ways.Summary by CodeRabbit