feat: skip package manager prompt when nothing needs installing - #1195
Open
jycouet wants to merge 3 commits into
Open
feat: skip package manager prompt when nothing needs installing#1195jycouet wants to merge 3 commits into
jycouet wants to merge 3 commits into
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/sv/c/57085d36e0863c0b5711cc05237e2355f1285307Open in |
🦋 Changeset detectedLatest commit: 57085d3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
jycouet
force-pushed
the
feat/install-when-needed
branch
from
July 25, 2026 17:07
e072bab to
a883eb7
Compare
Contributor
|
Darn, I was working on the issue too, but yours look better. |
Comment on lines
+693
to
+697
| let packageManager: AgentName | null | undefined = null; | ||
| if (options.install !== false && installNeeded) { | ||
| packageManager = | ||
| options.install === true ? await packageManagerPrompt(options.cwd) : options.install; | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| let packageManager: AgentName | null | undefined = null; | |
| if (options.install !== false && installNeeded) { | |
| packageManager = | |
| options.install === true ? await packageManagerPrompt(options.cwd) : options.install; | |
| } | |
| let packageManager: AgentName | null | undefined = null; | |
| if (options.install === true) { | |
| // prompt user when `package.json` has changed | |
| if (installNeeded) { | |
| packageManager = await packageManagerPrompt(options.cwd); | |
| } | |
| } else if (options.install === false) { | |
| // user choose not to install | |
| } else { | |
| packageManager = options.install; | |
| } |
Comment on lines
+760
to
+761
| // still format when the install was skipped only because no new dependency was added | ||
| if (packageManager || (!installNeeded && options.install !== false)) { |
Contributor
There was a problem hiding this comment.
really hard to understand this condition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1088
sv addnow only asks which package manager to use when an add-on actually adds or widens a dependency inpackage.json(e.g.sv add mcp=ide:claude-code+setup:remoteneeds nothing installed). Files are still formatted when the install is skipped for that reason.Adds
isRangeWithinto@sveltejs/sv-utils, so an existing stricter range (^9.2.0vs a requested^9.0.0) is kept and doesn't trigger an install.