Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/test-standalone-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
vp --version
vp --help
# test new command
vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello && vp run build

- name: Set PATH
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
vp --version

# FIXME: qemu: uncaught target signal 11 (Segmentation fault) - core dumped
# vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
# vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
# cd hello && vp run build
"

Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
vp --help
# $env:VITE_LOG = "trace"
# test new command
vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello && vp run build

- name: Verify bin setup on powershell
Expand Down Expand Up @@ -261,7 +261,7 @@ jobs:
dir "%USERPROFILE%\.vite-plus\bin"

REM test new command
vp new create-vite --no-interactive --no-agent -- hello-cmd --no-interactive -t vanilla
vp create vite --no-interactive --no-agent -- hello-cmd --no-interactive -t vanilla
cd hello-cmd && vp run build

- name: Verify bin setup on cmd
Expand Down Expand Up @@ -300,7 +300,7 @@ jobs:
vp --version
vp --help
# test new command
vp new create-vite --no-interactive --no-agent -- hello-bash --no-interactive -t vanilla
vp create vite --no-interactive --no-agent -- hello-bash --no-interactive -t vanilla
cd hello-bash && vp run build

- name: Verify bin setup on bash
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ Vite+ automatically detects and wraps the underlying package manager such as pnp

### Scaffolding your first Vite+ project

Use `vp new` to create a new project:
Use `vp create` to create a new project:

```bash
vp new
vp create
```

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

### Migrating an existing project

Expand Down
16 changes: 8 additions & 8 deletions crates/vite_global_cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ pub enum Commands {
// =========================================================================
/// Create a new project from a template (delegates to JS)
#[command(disable_help_flag = true)]
New {
Create {
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
Expand Down Expand Up @@ -1524,7 +1524,7 @@ pub async fn run_command(cwd: AbsolutePathBuf, args: Args) -> Result<ExitStatus,
Commands::Pm(pm_command) => commands::pm::execute_pm_subcommand(cwd, pm_command).await,

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

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

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

let after_help = format!(
"{bold_underline}Vite+ Commands:{reset}
"{bold_underline}Core Commands:{reset}
{bold}create{reset} Create a new project from a template
{bold}dev{reset} Run the development server
{bold}build{reset} Build for production
{bold}lint{reset} Lint code
{bold}test{reset} Run tests
{bold}lint{reset} Lint code
{bold}fmt{reset} Format code
{bold}lib{reset} Build library
{bold}migrate{reset} Migrate an existing project to Vite+
{bold}cache{reset} Manage the task cache
{bold}new{reset} Generate a new project
{bold}run{reset} Run tasks
{bold}preview{reset} Preview production build
{bold}env{reset} Manage Node.js versions
{bold}migrate{reset} Migrate an existing project to Vite+
{bold}cache{reset} Manage the task cache

{bold_underline}Package Manager Commands:{reset}
{bold}install, i{reset} Install all dependencies, or add packages if package names are provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ use vite_path::AbsolutePathBuf;

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

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

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

#[cfg(test)]
mod tests {
#[test]
fn test_new_command_module_exists() {
fn test_create_command_module_exists() {
// Basic test to ensure the module compiles
assert!(true);
}
Expand Down
4 changes: 2 additions & 2 deletions crates/vite_global_cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! - `pm`: Forward commands to the package manager
//!
//! Category B - JS Script Commands:
//! - `new`: Project scaffolding
//! - `create`: Project scaffolding
//! - `migrate`: Migration command
//! - `version`: Version display
//!
Expand Down Expand Up @@ -132,8 +132,8 @@ pub mod update;
pub mod why;

// Category B: JS Script Commands
pub mod create;
pub mod migrate;
pub mod new;
pub mod version;

// Category D: Environment Management
Expand Down
2 changes: 1 addition & 1 deletion docs/vite/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ vp env help # Show all commands
Create a Vite+ project:

```bash
vp new
vp create
```

Follow the prompts to select your preferred framework and configuration.
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ Vite+ automatically detects and wraps the underlying package manager such as pnp

### Scaffolding your first Vite+ project

Use `vp new` to create a new project:
Use `vp create` to create a new project:

```bash
vp new
vp create
```

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

### Migrating an existing project

Expand Down
6 changes: 3 additions & 3 deletions packages/global/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ Vite+ automatically detects and wraps the underlying package manager such as pnp

### Scaffolding your first Vite+ project

Use `vp new` to create a new project:
Use `vp create` to create a new project:

```bash
vp new
vp create
```

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

### Migrating an existing project

Expand Down
2 changes: 1 addition & 1 deletion packages/global/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ exec "`$VITE_PLUS_HOME/current/bin/vp.exe" "`$@"
Write-Host " The Unified Toolchain for the Web."
Write-Host ""
Write-Host " ${BOLD}Get started:${NC}"
Write-Host " ${BRIGHT_BLUE}vp new${NC} Create a new project"
Write-Host " ${BRIGHT_BLUE}vp create${NC} Create a new project"
Write-Host " ${BRIGHT_BLUE}vp env${NC} Manage Node.js versions"
Write-Host " ${BRIGHT_BLUE}vp install${NC} Install dependencies"
Write-Host " ${BRIGHT_BLUE}vp dev${NC} Start dev server"
Expand Down
2 changes: 1 addition & 1 deletion packages/global/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ main() {
echo " The Unified Toolchain for the Web."
echo ""
echo -e " ${BOLD}Get started:${NC}"
echo -e " ${BRIGHT_BLUE}vp new${NC} Create a new project"
echo -e " ${BRIGHT_BLUE}vp create${NC} Create a new project"
echo -e " ${BRIGHT_BLUE}vp env${NC} Manage Node.js versions"
echo -e " ${BRIGHT_BLUE}vp install${NC} Install dependencies"
echo -e " ${BRIGHT_BLUE}vp dev${NC} Start dev server"
Expand Down
6 changes: 3 additions & 3 deletions packages/global/snap-tests-todo/new-create-tsdown/steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
},
"commands": [
{
"command": "vp new vite:library || vite new vite:library # create vite library with default values (retry if failed)",
"command": "vp create vite:library || vite create vite:library # create vite library with default values (retry if failed)",
"ignoreOutput": true
},
"ls vite-plus-library/package.json # check package.json",
{
"command": "vp new vite:library --directory my-vue -- --template vue # create vite library with custom template",
"command": "vp create vite:library --directory my-vue -- --template vue # create vite library with custom template",
"ignoreOutput": true
},
"ls my-vue/package.json # check package.json",
{
"command": "vp new vite:library --no-interactive --directory @my-scope/my-library-with-scope # create vite library with scope name",
"command": "vp create vite:library --no-interactive --directory @my-scope/my-library-with-scope # create vite library with scope name",
"ignoreOutput": true
},
"ls my-library-with-scope/package.json # check package.json"
Expand Down
12 changes: 6 additions & 6 deletions packages/global/snap-tests/cli-helper-message/snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ Vite+/<semver>

Usage: vp [COMMAND]

Vite+ Commands:
Core Commands:
create Create a new project from a template
dev Run the development server
build Build for production
lint Lint code
test Run tests
lint Lint code
fmt Format code
lib Build library
migrate Migrate an existing project to Vite+<repeat>
cache Manage the task cache
new Generate a new project
run Run tasks
preview Preview production build
env Manage Node.js versions
migrate Migrate an existing project to Vite+<repeat>
cache Manage the task cache

Package Manager Commands:
install, i Install all dependencies, or add packages if package names are provided
Expand Down
71 changes: 37 additions & 34 deletions packages/global/snap-tests/new-check/snap.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
> vp new --help # show help
> vp create --help # show help
VITE+(⚡︎) - The Unified Toolchain for the Web

USAGE: vp new [TEMPLATE] [OPTIONS] [-- TEMPLATE_OPTIONS]
USAGE: vp create [TEMPLATE] [OPTIONS] [-- TEMPLATE_OPTIONS]

Use any builtin, local or remote template with Vite+.

ARGUMENTS:
TEMPLATE Template name. Run `vp new --list` to see available templates.
TEMPLATE Template name. Run `vp create --list` to see available templates.
- Default: vite:monorepo, vite:application, vite:library, vite:generator
- Remote: create-vite, @tanstack/create-start, create-next-app,
- Remote: vite, @tanstack/start, create-next-app,
create-nuxt, github:user/repo, https://github.com/user/template-repo, etc.
- Local: @company/generator-*, ./tools/create-ui-component

Expand All @@ -24,26 +24,29 @@ TEMPLATE OPTIONS:

EXAMPLES:
# Interactive mode
vp new
vp create

# Use existing templates
vp new create-vite
vp new create-next-app
vp new @tanstack/create-start
vp new create-vite -- --template react-ts
# Use existing templates (shorthand expands to create-* packages)
vp create vite
vp create @tanstack/start
vp create vite -- --template react-ts

# Full package names also work
vp create create-vite
vp create create-next-app

# Create Vite+ monorepo, application, library, or generator scaffolds
vp new vite:monorepo
vp new vite:application
vp new vite:library
vp new vite:generator
vp create vite:monorepo
vp create vite:application
vp create vite:library
vp create vite:generator

# Use templates from GitHub (via degit)
vp new github:user/repo
vp new https://github.com/user/template-repo
vp create github:user/repo
vp create https://github.com/user/template-repo


> vp new --list # list templates
> vp create --list # list templates
VITE+(⚡︎) - The Unified Toolchain for the Web

VITE+ BUILT-IN TEMPLATES:
Expand All @@ -52,32 +55,32 @@ VITE+ BUILT-IN TEMPLATES:
vite:library Create a new library
vite:generator Scaffold a new code generator

POPULAR TEMPLATES:
create-vite Official Vite templates
create-typescript-app TypeScript application
@tanstack/create-start TanStack applications
create-next-app Next.js application
create-nuxt Nuxt application
create-react-router React Router application
create-vue Vue application
POPULAR TEMPLATES (SHORTHAND):
vite Official Vite templates (create-vite)
@tanstack/start TanStack applications (@tanstack/create-start)
next-app Next.js application (create-next-app)
nuxt Nuxt application (create-nuxt)
react-router React Router application (create-react-router)
vue Vue application (create-vue)

EXAMPLES:
vp new # interactive mode
vp new <template> # use any template
vp new <template> -- <options> # pass options to the template
vp create # interactive mode
vp create vite # shorthand for create-vite
vp create @tanstack/start # shorthand for @tanstack/create-start
vp create <template> -- <options> # pass options to the template

✨ Tip: You can use any npm template or git repo with vp new!
✨ Tip: You can use any npm template or git repo with vp create!


[1]> vp new --no-interactive # run in non-interactive mode without template name will show error
[1]> vp create --no-interactive # run in non-interactive mode without template name will show error

A template name is required when running in non-interactive mode

Usage: vp new [TEMPLATE] [OPTIONS] [-- TEMPLATE_OPTIONS]
Usage: vp create [TEMPLATE] [OPTIONS] [-- TEMPLATE_OPTIONS]

Example:
Example:
# Create a new application in non-interactive mode with a custom target directory
vp new vite:application --no-interactive --directory=apps/my-app
vp create vite:application --no-interactive --directory=apps/my-app

Use `vp new --list` to list all available templates, or run `vp new --help` for more information.
Use `vp create --list` to list all available templates, or run `vp create --help` for more information.

6 changes: 3 additions & 3 deletions packages/global/snap-tests/new-check/steps.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"commands": [
"vp new --help # show help",
"vp new --list # list templates",
"vp new --no-interactive # run in non-interactive mode without template name will show error"
"vp create --help # show help",
"vp create --list # list templates",
"vp create --no-interactive # run in non-interactive mode without template name will show error"
]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
> vp new vite:application --no-interactive --directory @my-scope/my-vite-app -- --template vanilla-ts # create vite app with vanilla-ts template with scope name
> vp create vite:application --no-interactive --directory @my-scope/my-vite-app -- --template vanilla-ts # create vite app with vanilla-ts template with scope name
> ls my-vite-app/package.json # check package.json
my-vite-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
},
"commands": [
{
"command": "vp new vite:application --no-interactive --directory @my-scope/my-vite-app -- --template vanilla-ts # create vite app with vanilla-ts template with scope name",
"command": "vp create vite:application --no-interactive --directory @my-scope/my-vite-app -- --template vanilla-ts # create vite app with vanilla-ts template with scope name",
"ignoreOutput": true
},
"ls my-vite-app/package.json # check package.json"
Expand Down
Loading
Loading