fix: Stream output during installation and don't skip installation of npm packages when no lockfile is detected #73
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.
Description 📖
This pull request addresses a minor UX issue mentioned in #72, where running
vite install
on a project without a JS lockfile will fail to install dependencies.As a result of this change, when no lockfile is present it will now default to
npm
(or the user's preferred package manager) and proceed to install the dependencies.Streamed Output 📜
Prior to this change, the output of running
npm install
oryarn install
was being captured—in cases where the installation takes a long time, it was reasonable for a user to think the command had hung.After this change, the output will be streamed line by line, which is a nicer experience.
Note ✏️
Although
ni
supports an interactive prompt when lockfile detection fails, piping the input correctly through stdin requires more logic than I'm willing to support for this very niche use case. Hence the decision to pass"\n"
and let it picknpm
instead.