Repository navigation
feat(init): show a spinner instead of the output of a successful install - #877
Open
morinokami wants to merge 5 commits into
Open
morinokami wants to merge 5 commits into
morinokami wants to merge 5 commits into
Conversation
`void init` printed the installer's full output, about 40 lines for a new project. It now shows a spinner with the elapsed time while it installs dependencies and generates the first migration, and reports both in the closing summary. A failed install prints everything the installer wrote. - A step that fails or is interrupted prints how to finish by hand. The install is named as the user can type it, also without `vp` on PATH. - Init runs the installer in its own process group. When init exits during a step, it stops that group, waits until its processes have ended, kills what is still running after 5 seconds, and removes a half-written migration. Ctrl+C at the spinner keeps exit code 130. - The Git command for a new subfolder uses a relative path, as `vp create` does. - A new subfolder prints "Creating a Pages starter in ./<name>." instead of "Empty project detected." - A migrated config is a ✓ line in the summary, with "Commit …" as a → line. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
When init got a signal with piped output, as on a cancelled CI job, the step it stopped was printed as a yellow warning, above the warning for the unfinished setup. In a terminal the cancelled spinner leaves a red ■ line. The static spinner printed a cancelled step with `log.warn`. It now uses `log.error`, which draws the same red ■. Only init cancels a spinner, so the output of other commands does not change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…stall - `init-command.ts` read like the init command itself. It runs and stops subprocesses, so it is `init-subprocess.ts` now, and its result type is `SubprocessResult`. - `ProjectInstall.typed` is `manualCommand`: "typed" means "with types" elsewhere in this code. - `installProjectDependencies()` took the package manager only to build a default for its third argument, and ignored it when the caller passed one. It now takes the resolved install alone. - `runBehindSpinner()` returns how long the command ran, so the install does not time it again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
morinokami
force-pushed
the
feat/init-spinner
branch
from
November 18, 2026 10:25
4b87bd9 to
33b706e
Compare
Collaborator
Author
|
@cpojer Rebased and resolved the conflicts. Together with the earlier PRs, this should make |
This branch has not been deployed
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.
This PR changes what
void initshows while it installs dependencies and generates the first migration. Init printed the installer's full output, about 40 lines for a new project. It now shows a spinner with the elapsed time, and prints the output only when the install fails.This follows #853, #860 and #865. It is the last of these PRs for
void inititself; a PR forcreate-voidwill follow.Changes
A spinner instead of the installer's output
Init ran the install with inherited output. The package manager's progress, warnings and dependency list all went to the terminal, and so did the
postinstalloutput ofvoid prepare, whose "✓ Project codegen is ready." read like the end of the command.Init now runs the install behind a spinner that shows the elapsed time, as
vp createdoes, and removes the spinner when the install ends. The summary reports the result, such as "Installed dependencies in 2.4s". The duration has the formatvp createuses ("215ms", "2.4s", "12s").Generating the first migration works the same way and adds "Generated the initial database migration" to the summary. The spinner, the summary and the error now all call it the initial database migration. They used "initial Drizzle migration" and "starter database migration".
Without a terminal (CI, piped output), each of the two steps prints one line when it starts, like the progress of other commands.
Notices that a package manager prints after a successful install are no longer shown, such as pnpm's "Agent skills awaiting approval" and npm's warning about install scripts.
A failed install prints its output and how to finish
When the install fails, the spinner becomes a "Failed to install dependencies with vp" line. Everything the installer wrote to stdout and stderr follows, in the order it arrived. The error after it is the same as before.
Init also says how to finish by hand, such as "Run
vp install, thenvoid db generateto finish setup". Runningvoid initagain does not finish a new project whose install failed: init then finds an existing project and does not generate the starter's migration. When generating the migration fails, the line is "Runvoid db generateto finish setup".When neither the project nor
PATHhas avp, init installs throughnpx, and the line names that command: "Runnpx -p vite-plus@1.7.0 vp install, then …". A barevp installwould not run for that user.Ctrl+C during the install stops the installer
A spinner reads the keyboard, so the terminal no longer interrupts the installer on Ctrl+C. Init now runs the installer in its own process group and stops that group when init exits. On Windows it stops the installer's process tree. Stopping only the installer's own process is not enough: with
vp, a runningpostinstallscript kept running.Init waits until the stopped processes have ended, so that none of them changes the project after init has exited. It kills one that is still running after 5 seconds, such as a
postinstallscript that ignores SIGTERM. To see whether they have ended, init reads the process states (/procon Linux,pselsewhere).kill(-pgid, 0)cannot tell: an exited child counts until Node collects it, which Node cannot do inside anexitlistener.When init exits while drizzle-kit generates the migration, it also removes what drizzle-kit wrote. A journal entry left without its SQL file would make
void db generatereport no schema changes.The terminal's signals do not reach that group either, so while the installer runs, init exits on SIGINT and SIGTERM, which stops the installer the same way.
Init then prints the warning for a run that stopped early. The stopped step comes first, and the line about how to finish comes last. The exit code is 130, as before. The prompt library exits with 0 on Ctrl+C at a spinner, which
create-voidwould take for a finished setup.Without a terminal, such as on a cancelled CI job, the stopped step is a red
■line too. The static spinner printed a cancelled step as a yellow warning. Only init cancels a spinner, so the output of other commands does not change.The Git command uses a relative path
For a project in a new subfolder, the
Git (optional)command named the folder by its absolute path, twice. The line was long enough to wrap in most terminals, and a wrapped line cannot be copied as one command. The command now uses the path from the user's shell, asvp createdoes, and as thecdin the success line already did.Smaller changes
void.jsonor Wrangler config was a gray◇line above the first question. It is now a✓line in the summary, and "Commit void.config.ts and void.lock.json" is a→line. The→line namesvoid.lock.jsononly when the migration wrote it, which it does not for a project that had onlyvoid.json.vp installin a Vite+ project, notpnpm install.vp installis what init runs itself.Before / after
Blank lines are omitted, and the install output is shortened.
New project, answering every question:
The same run with its output piped:
An install that fails (a
vpthat prints two lines and exits with 1):Ctrl+C during the install. Before, the terminal interrupted init and the installer, and init printed nothing more:
A PostgreSQL starter in a new subfolder:
An existing app with
void.jsonandwrangler.jsonc:Testing
spawnandspawnSync. New cases cover the summary lines, a failed install and a failed migration, an exit during the install and during the migration, and the new wording.init-install.test.tsruns real subprocesses and checks that a successful installer's output stays off the terminal and that a failed one's is printed. It also exits init during an install and checks that the installer and the script it started have ended by then.init-subprocess.test.tsstops real process trees: one that ends on SIGTERM, and one with a child that ignores it. It also checks that a process that has exited, but that Node has not collected, does not count as running.vponPATH, and an interrupt duringvp install,npm install, drizzle-kit, and an installer whosepostinstallscript ignores SIGTERM (nothing was left running).psinstead of/proc: the two test files above, and the interrupt cases by hand.taskkill) is covered by the mocked unit test only.🤖 Generated with Claude Code