fix(create-app): detect the running package manager via getUserAgent - #2720
Open
SouichiroTsujimoto wants to merge 1 commit into
Open
fix(create-app): detect the running package manager via getUserAgent#2720SouichiroTsujimoto wants to merge 1 commit into
SouichiroTsujimoto wants to merge 1 commit into
Conversation
detect() returns an object and was used as a command name, so create-slidev printed [object Object] and crashed on install. Restore getUserAgent() with an npm fallback, matching the reviewed version of slidevjs#2703. Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Summary
create-slidevcurrently stringifies the package manager as[object Object], then crashes withERR_INVALID_ARG_TYPEif you choose to install immediately.This restores
getUserAgent()(the package manager that is runningcreate-slidev) instead ofdetect()(lockfile lookup up the directory tree). If nothing is detected, it still falls back to npm, which is the #2703 fix fornull installwhen the script is run with plain Node.Background
On current
create-slidev(v52.19.1), scaffolding succeeds but the follow-up install crashes:The prompt shows
[object Object]. Answering yes spawns that object as the command. Answering no prints[object Object] install/[object Object] run dev. The template is already written, so a manualbun installstill works.#2703 was meant to fix the case where running
create-slidevdirectly with Node detects no package manager, so the later-install hints becamenull install/null run dev. The author, following review, used:antfu suggested that same line. A later
chore: updateon the PR swapped it todetect()and then used the return value as a command name. There is no note that detection should switch to lockfiles.That produced:
using [object Object]?in the prompttinyexectries to spawn an objectcreate-slidevThe intent recorded in #2516 was to detect the package manager running
create-slidev.Change
packages/create-app/index.mjsonly:Test plan
Verified locally:
bun run create-slidev(orbun create slidev) showsusing bun?and does not throw if you answer yespnpm create slidev/npm init slidevshow pnpm / npm respectivelynode packages/create-app/index.mjswith no user agent showsusing npm?(fix(create-app): default manual setup to npm #2703 fallback)[object Object]