fix(deps): replace type-fest w/ @package-json/types#434
Conversation
Type-fest types are imported in published declaration files, which causes TypeScript compilation errors for consumers who don't have skipLibCheck enabled. Moving type-fest to dependencies ensures the types are available to all consumers.
🦋 Changeset detectedLatest commit: f372fee The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughMoved Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to f76f905 in 39 seconds. Click for details.
- Reviewed
20lines of code in1files - Skipped
0files when reviewing. - Skipped posting
2draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. package.json:86
- Draft comment:
Ensure 'type-fest' is now in dependencies so its types are available to consumers compiling declaration files. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. package.json:161
- Draft comment:
Remove 'type-fest' from devDependencies since it's now provided as part of the production dependencies. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
Workflow ID: wflow_NjAokcgHQOVa9kmz
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
package.json(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
|
Also, since it's only |
Agreed. So why not use a smaller dependency? I myself prefer |
Replace type-fest with the smaller @package-json/types package since only the PackageJson type is used in published declaration files. This fixes TypeScript compilation errors for consumers who don't have skipLibCheck enabled while reducing bundle size. - Add @package-json/types to dependencies - Remove type-fest completely (no longer needed) - Update imports in src/rules/no-duplicates.ts, src/rules/no-extraneous-dependencies.ts, and src/utils/read-pkg-up.ts - Update changeset to reflect the replacement
|
Heads up, @SukkaW, I've switched to |
type-fest to dependenciestype-fest w/ @package-json/types
commit: |
|
Thanks, @SukkaW! Is there anything we could do to ship it? |
It seems that CI is finished. Let's merge it! |
|
@package-json/types is broken: https://github.com/jhipster/generator-jhipster/actions/runs/22978922040/job/66714103187?pr=32663 |
@package-json/types was added in un-ts#434 as a replacement for type-fest, after type-fest leaked into published .d.ts files from devDependencies. However the swap introduced a new transitive dependency (~148k weekly downloads, low activity) for what is effectively three type annotations touching only 8 package.json fields. This commit removes the dependency entirely and replaces it with a small inline PackageJson interface in src/utils/package-json.ts that covers exactly the fields this plugin accesses: - name, version (read-pkg-up, no-duplicates) - dependencies, devDependencies, optionalDependencies, peerDependencies, bundleDependencies, bundledDependencies (no-extraneous-dependencies) Benefits: - Zero runtime/type dependencies added to consumers - No more exposure to upstream type breakages (e.g. TS2411 strict errors in @package-json/types that affect consumers with strict: true) - The interface is trivial to maintain; package.json dep fields are stable Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PackageJsontypes are imported in published declaration files, which causes TypeScript compilation errors for consumers who don't haveskipLibCheckenabled.This PR replaces
type-festwith the smaller@package-json/typespackage, ensuring the types are available to all consumers while reducing bundle size.Changes
type-festwith@package-json/typesin dependencies@package-json/typestype-festdependency entirely (test imports are just strings, not actual code)