Repository navigation
fix(init): ask every new-project question before writing the starter - #860
Merged
Merged
Conversation
The deployment question came after init had written the starter, so cancelling there left a partial starter that the next run treated as an existing project. Init now asks it right after the starter question and saves the answer where it did before. The line that says what init will do (detected framework, empty project or existing project) now comes before the first question instead of after the Git prompt. Existing projects keep their question order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 the order of
void initwhen it creates a new project: init now asks every question before it writes the starter, and says what it is going to do before the first question.This follows #853. More PRs will follow to shorten the rest of the
void initoutput in the style ofvp create.Changes
Ask where to deploy before writing the starter
Init asked "Where should this project deploy?" after it had written the starter. Cancelling at that question left a partial starter behind (
package.json,pages/,void.config.tsand more), and the nextvoid inittreated the folder as an existing project instead of offering the starter again. Init now asks right after the starter question, so cancelling at any question leaves no starter files. The answer is still saved after the files are written, followed by the Cloudflare or Void platform setup as before. Existing projects keep their question order.Say what init will do before the first question
"Empty project detected. Creating a Pages starter." and "Existing project detected. Configuring Void..." appeared after the Git question. They now come before it, so they introduce the questions that follow. The existing-project line also drops its trailing "...", like the empty-project line in #853. In a framework project, "Detected framework" now appears there alone; it used to be followed by the existing-project line.
Before / after
New project, answering every question. Blank lines are omitted, and the starter's file lines and the
vp installoutput are shortened.void init --no-git, then Ctrl+C at the deployment question. Before, the folder kept 13 entries; now it stays empty.An existing Vite app:
Design decisions
askDeploymentPlatform()only asks.runInitCommand()saves the answer at the point wherepromptDeploymentPlatform()used to.--deploywas missing is gone: the question itself now comes before any file is written and fails with the same message. Its existing test passes unchanged..gitis allowed in an empty project, so detecting the project beforegit initgives the same result.--tsconfigand--githubruns print no new line.Detected <name> frameworkstill appears there, as before.Checked
init.test.ts: four new tests check that the folder is still empty when the deployment question appears, that cancelling it leaves the folder empty, and that the line comes before the Git question for an empty folder and an existing app. They fail without the source changes. The existing tests pass unchanged.vp run check,vp lintandvp fmt --checkvp test run): 820 files passed, 1 skippedmainand from this branch, for the three flows above.🤖 Generated with Claude Code