fix: strip -y flag from npm init before PM conversion#7693
fix: strip -y flag from npm init before PM conversion#7693AmanVarshney01 wants to merge 2 commits intomainfrom
Conversation
npm-to-yarn converts `npm init -y` to `pnpm init -y` and `bun init -y`, but neither pnpm nor bun support the -y flag for init (they're always non-interactive). Strip -y before conversion so all package managers get a clean `init` command.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThree application configuration files are updated to normalize the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
apps/eclipse/source.config.ts (1)
49-61: Optional: Extract shared utility across apps.All three configs (docs, blog, eclipse) now contain nearly identical
packageManagerslogic with the-ynormalization. If you find yourself updating this pattern again, consider extracting a shared utility (e.g., in a common package or shared config file) that all three apps import. This would make future fixes a single-point change.Not blocking—just something to consider for long-term maintainability.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/eclipse/source.config.ts` around lines 49 - 61, The three configs duplicate the packageManagers logic (the array using convert and the npm init -y normalization); extract this into a shared utility (e.g., export a function like getNormalizedPackageManagers or normalizePackageManagers that returns the array) and replace the inline packageManagers in each config (docs, blog, eclipse) with a call/import of that utility; ensure the utility preserves the bun special-case transformation (the replace(/^bun x /, 'bunx --bun ')) and keeps references to convert so behaviour remains identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/blog/source.config.ts`:
- Around line 70-75: The current command normalizer uses cmd.replace(/^npm init
-y$/, "npm init") inside the command lambdas (refer to the command properties
that call convert and the convert(...) call), which only matches single-line
exact strings and will miss multi-line code blocks; update the logic to split
the incoming cmd on '\n', run the replacement on each line (or reuse/implement a
convertLine helper like in docs), then rejoin with '\n' before passing to
convert so multi-line commands such as "npm init -y\nnpm install ..." are
normalized correctly.
In `@apps/eclipse/source.config.ts`:
- Around line 50-55: The command arrow functions currently use an anchored regex
replace (cmd.replace(/^npm init -y$/, 'npm init')) which fails if cmd contains
newlines; update these entries (the anonymous command functions that call
convert and the const converted for 'bun') to use the existing convertLine
helper (or equivalent line-by-line processing) instead of the anchored regex so
each line is normalised before calling convert (apply the change to the 'npm',
'pnpm', 'yarn' and 'bun' command handlers and ensure convertLine is
imported/available).
---
Nitpick comments:
In `@apps/eclipse/source.config.ts`:
- Around line 49-61: The three configs duplicate the packageManagers logic (the
array using convert and the npm init -y normalization); extract this into a
shared utility (e.g., export a function like getNormalizedPackageManagers or
normalizePackageManagers that returns the array) and replace the inline
packageManagers in each config (docs, blog, eclipse) with a call/import of that
utility; ensure the utility preserves the bun special-case transformation (the
replace(/^bun x /, 'bunx --bun ')) and keeps references to convert so behaviour
remains identical.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5916d395-b3d0-4baf-b6e1-a9f59e805bca
📒 Files selected for processing (3)
apps/blog/source.config.tsapps/docs/source.config.tsapps/eclipse/source.config.ts
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Summary
npm-to-yarnconvertsnpm init -ytopnpm init -yandbun init -y, but neitherpnpmnorbunsupport the-yflag forinit(they're always non-interactive)-yfromnpm init -ybefore passing toconvert()in all threesource.config.tsfiles (docs, blog, eclipse)initcommandSummary by CodeRabbit
npm init -ytonpm initacross npm, pnpm, yarn, and bun, ensuring more predictable behavior when converting between different package managers.