Skip to content

Commit a29ac83

Browse files
authored
refactor(cli): rename vp new to vp create with shorthand expansion (#570)
Rename the `new` command to `create` to align with `npm create` / `pnpm create` conventions. Add shorthand expansion so `vp create vite` resolves to `create-vite` and `vp create @tanstack/start` resolves to `@tanstack/create-start`. - Rename Rust enum variant `New` → `Create` and module `new.rs` → `create.rs` - Update JS routing to handle `create` command - Add `expandCreateShorthand()` with unit tests - Rename help section "Vite+ Commands" → "Core Commands", reorder entries - Update all docs, snap tests, CI workflows, and install scripts
1 parent b5ba31f commit a29ac83

37 files changed

Lines changed: 266 additions & 128 deletions

File tree

.github/workflows/test-standalone-install.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
vp --version
6868
vp --help
6969
# test new command
70-
vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
70+
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
7171
cd hello && vp run build
7272
7373
- name: Set PATH
@@ -173,7 +173,7 @@ jobs:
173173
vp --version
174174
175175
# FIXME: qemu: uncaught target signal 11 (Segmentation fault) - core dumped
176-
# vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
176+
# vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
177177
# cd hello && vp run build
178178
"
179179
@@ -218,7 +218,7 @@ jobs:
218218
vp --help
219219
# $env:VITE_LOG = "trace"
220220
# test new command
221-
vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
221+
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
222222
cd hello && vp run build
223223
224224
- name: Verify bin setup on powershell
@@ -261,7 +261,7 @@ jobs:
261261
dir "%USERPROFILE%\.vite-plus\bin"
262262
263263
REM test new command
264-
vp new create-vite --no-interactive --no-agent -- hello-cmd --no-interactive -t vanilla
264+
vp create vite --no-interactive --no-agent -- hello-cmd --no-interactive -t vanilla
265265
cd hello-cmd && vp run build
266266
267267
- name: Verify bin setup on cmd
@@ -300,7 +300,7 @@ jobs:
300300
vp --version
301301
vp --help
302302
# test new command
303-
vp new create-vite --no-interactive --no-agent -- hello-bash --no-interactive -t vanilla
303+
vp create vite --no-interactive --no-agent -- hello-bash --no-interactive -t vanilla
304304
cd hello-bash && vp run build
305305
306306
- name: Verify bin setup on bash

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ Vite+ automatically detects and wraps the underlying package manager such as pnp
6868

6969
### Scaffolding your first Vite+ project
7070

71-
Use `vp new` to create a new project:
71+
Use `vp create` to create a new project:
7272

7373
```bash
74-
vp new
74+
vp create
7575
```
7676

77-
You can run `vp new` inside of a project to add new apps or libraries to your project.
77+
You can run `vp create` inside of a project to add new apps or libraries to your project.
7878

7979
### Migrating an existing project
8080

crates/vite_global_cli/src/cli.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ pub enum Commands {
515515
// =========================================================================
516516
/// Create a new project from a template (delegates to JS)
517517
#[command(disable_help_flag = true)]
518-
New {
518+
Create {
519519
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
520520
args: Vec<String>,
521521
},
@@ -1524,7 +1524,7 @@ pub async fn run_command(cwd: AbsolutePathBuf, args: Args) -> Result<ExitStatus,
15241524
Commands::Pm(pm_command) => commands::pm::execute_pm_subcommand(cwd, pm_command).await,
15251525

15261526
// Category B: JS Script Commands
1527-
Commands::New { args } => commands::new::execute(cwd, &args).await,
1527+
Commands::Create { args } => commands::create::execute(cwd, &args).await,
15281528

15291529
Commands::Migrate { args } => commands::migrate::execute(cwd, &args).await,
15301530

@@ -1590,18 +1590,18 @@ fn apply_custom_help(cmd: clap::Command) -> clap::Command {
15901590
let version = env!("CARGO_PKG_VERSION");
15911591

15921592
let after_help = format!(
1593-
"{bold_underline}Vite+ Commands:{reset}
1593+
"{bold_underline}Core Commands:{reset}
1594+
{bold}create{reset} Create a new project from a template
15941595
{bold}dev{reset} Run the development server
15951596
{bold}build{reset} Build for production
1596-
{bold}lint{reset} Lint code
15971597
{bold}test{reset} Run tests
1598+
{bold}lint{reset} Lint code
15981599
{bold}fmt{reset} Format code
1599-
{bold}lib{reset} Build library
1600-
{bold}migrate{reset} Migrate an existing project to Vite+
1601-
{bold}cache{reset} Manage the task cache
1602-
{bold}new{reset} Generate a new project
16031600
{bold}run{reset} Run tasks
1601+
{bold}preview{reset} Preview production build
16041602
{bold}env{reset} Manage Node.js versions
1603+
{bold}migrate{reset} Migrate an existing project to Vite+
1604+
{bold}cache{reset} Manage the task cache
16051605
16061606
{bold_underline}Package Manager Commands:{reset}
16071607
{bold}install, i{reset} Install all dependencies, or add packages if package names are provided

crates/vite_global_cli/src/commands/new.rs renamed to crates/vite_global_cli/src/commands/create.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ use vite_path::AbsolutePathBuf;
66

77
use crate::{error::Error, js_executor::JsExecutor};
88

9-
/// Execute the `new` command by delegating to the bundled JavaScript implementation.
9+
/// Execute the `create` command by delegating to the bundled JavaScript implementation.
1010
pub async fn execute(cwd: AbsolutePathBuf, args: &[String]) -> Result<ExitStatus, Error> {
1111
let mut executor = JsExecutor::new(None);
1212

13-
// Execute the bundled JS script with the "new" command
13+
// Execute the bundled JS script with the "create" command
1414
// The JS script handles all argument parsing, template discovery, and execution
15-
executor.execute_cli_script("index.js", "new", args, &cwd).await
15+
executor.execute_cli_script("index.js", "create", args, &cwd).await
1616
}
1717

1818
#[cfg(test)]
1919
mod tests {
2020
#[test]
21-
fn test_new_command_module_exists() {
21+
fn test_create_command_module_exists() {
2222
// Basic test to ensure the module compiles
2323
assert!(true);
2424
}

crates/vite_global_cli/src/commands/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! - `pm`: Forward commands to the package manager
1717
//!
1818
//! Category B - JS Script Commands:
19-
//! - `new`: Project scaffolding
19+
//! - `create`: Project scaffolding
2020
//! - `migrate`: Migration command
2121
//! - `version`: Version display
2222
//!
@@ -132,8 +132,8 @@ pub mod update;
132132
pub mod why;
133133

134134
// Category B: JS Script Commands
135+
pub mod create;
135136
pub mod migrate;
136-
pub mod new;
137137
pub mod version;
138138

139139
// Category D: Environment Management

docs/vite/guide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ vp env help # Show all commands
4949
Create a Vite+ project:
5050

5151
```bash
52-
vp new
52+
vp create
5353
```
5454

5555
Follow the prompts to select your preferred framework and configuration.

packages/cli/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ Vite+ automatically detects and wraps the underlying package manager such as pnp
6666

6767
### Scaffolding your first Vite+ project
6868

69-
Use `vp new` to create a new project:
69+
Use `vp create` to create a new project:
7070

7171
```bash
72-
vp new
72+
vp create
7373
```
7474

75-
You can run `vp new` inside of a project to add new apps or libraries to your project.
75+
You can run `vp create` inside of a project to add new apps or libraries to your project.
7676

7777
### Migrating an existing project
7878

packages/global/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ Vite+ automatically detects and wraps the underlying package manager such as pnp
6464

6565
### Scaffolding your first Vite+ project
6666

67-
Use `vp new` to create a new project:
67+
Use `vp create` to create a new project:
6868

6969
```bash
70-
vp new
70+
vp create
7171
```
7272

73-
You can run `vp new` inside of a project to add new apps or libraries to your project.
73+
You can run `vp create` inside of a project to add new apps or libraries to your project.
7474

7575
### Migrating an existing project
7676

packages/global/install.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ exec "`$VITE_PLUS_HOME/current/bin/vp.exe" "`$@"
474474
Write-Host " The Unified Toolchain for the Web."
475475
Write-Host ""
476476
Write-Host " ${BOLD}Get started:${NC}"
477-
Write-Host " ${BRIGHT_BLUE}vp new${NC} Create a new project"
477+
Write-Host " ${BRIGHT_BLUE}vp create${NC} Create a new project"
478478
Write-Host " ${BRIGHT_BLUE}vp env${NC} Manage Node.js versions"
479479
Write-Host " ${BRIGHT_BLUE}vp install${NC} Install dependencies"
480480
Write-Host " ${BRIGHT_BLUE}vp dev${NC} Start dev server"

packages/global/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ main() {
673673
echo " The Unified Toolchain for the Web."
674674
echo ""
675675
echo -e " ${BOLD}Get started:${NC}"
676-
echo -e " ${BRIGHT_BLUE}vp new${NC} Create a new project"
676+
echo -e " ${BRIGHT_BLUE}vp create${NC} Create a new project"
677677
echo -e " ${BRIGHT_BLUE}vp env${NC} Manage Node.js versions"
678678
echo -e " ${BRIGHT_BLUE}vp install${NC} Install dependencies"
679679
echo -e " ${BRIGHT_BLUE}vp dev${NC} Start dev server"

0 commit comments

Comments
 (0)