Skip to content
Draft
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
2 changes: 1 addition & 1 deletion crates/vite_global_cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ pub async fn run_command_with_options(
return Ok(ExitStatus::default());
}
print_runtime_header(render_options.show_header);
commands::run_or_delegate::execute(cwd, &args).await
commands::delegate::execute(cwd, "run", &args).await
}

Commands::Exec { args } => {
Expand Down
1 change: 0 additions & 1 deletion crates/vite_global_cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ pub mod upgrade;

// Category C: Local CLI Delegation
pub mod delegate;
pub mod run_or_delegate;

// Re-export command structs for convenient access
pub use add::AddCommand;
Expand Down
23 changes: 0 additions & 23 deletions crates/vite_global_cli/src/commands/run_or_delegate.rs

This file was deleted.

7 changes: 3 additions & 4 deletions crates/vite_global_cli/src/commands/vpr.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//! `vpr` command implementation.
//!
//! Standalone shorthand for `vp run`. Executes tasks via the same
//! run-or-delegate logic: delegates to local vite-plus CLI when
//! vite-plus is a dependency, otherwise falls back to `<pm> run`.
//! Standalone shorthand for `vp run`. Delegates to the local or global
//! vite-plus CLI to execute tasks.

use vite_path::AbsolutePath;
use vite_shared::output;
Expand All @@ -16,7 +15,7 @@ pub async fn execute_vpr(args: &[String], cwd: &AbsolutePath) -> i32 {
}

let cwd_buf = cwd.to_absolute_path_buf();
match super::run_or_delegate::execute(cwd_buf, args).await {
match super::delegate::execute(cwd_buf, "run", args).await {
Ok(status) => status.code().unwrap_or(1),
Err(e) => {
output::error(&e.to_string());
Expand Down
1 change: 0 additions & 1 deletion crates/vite_install/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub mod prune;
pub mod publish;
pub mod rebuild;
pub mod remove;
pub mod run;
pub mod search;
pub mod token;
pub mod unlink;
Expand Down
117 changes: 0 additions & 117 deletions crates/vite_install/src/commands/run.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
> vp run hello # should fall back to pnpm run when no vite-plus dependency
> vp run hello # should execute via global vite-plus task runner
VITE+ - The Unified Toolchain for the Web


> command-run-without-vite-plus@<semver> hello <cwd>
> echo hello from script

$ echo hello from script ⊘ cache disabled
hello from script

> vp run greet --arg1 value1 # should pass through args to pnpm run
VITE+ - The Unified Toolchain for the Web


> command-run-without-vite-plus@<semver> greet <cwd>
> echo greet --arg1 value1
> vp run greet --arg1 value1 # should pass through args
VITE+ - The Unified Toolchain for the Web

$ echo greet --arg1 value1 ⊘ cache disabled
greet --arg1 value1

[1]> vp run nonexistent # should show pnpm missing script error
VITE+ - The Unified Toolchain for the Web

 ERR_PNPM_NO_SCRIPT  Missing script: nonexistent
[1]> vp run nonexistent # should show task not found error
VITE+ - The Unified Toolchain for the Web

Command "nonexistent" not found.
Task "nonexistent" not found.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"ignoredPlatforms": ["win32"],
"commands": [
"vp run hello # should fall back to pnpm run when no vite-plus dependency",
"vp run greet --arg1 value1 # should pass through args to pnpm run",
"vp run nonexistent # should show pnpm missing script error"
"vp run hello # should execute via global vite-plus task runner",
"vp run greet --arg1 value1 # should pass through args",
"vp run nonexistent # should show task not found error"
]
}
18 changes: 6 additions & 12 deletions packages/cli/snap-tests-global/command-vpr/snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,15 @@ Filter Patterns:
Documentation: https://viteplus.dev/guide/run


> vpr hello # should fall back to pnpm run when no vite-plus dependency

> command-vpr@<semver> hello <cwd>
> echo hello from script

> vpr hello # should execute via global vite-plus task runner
$ echo hello from script ⊘ cache disabled
hello from script

> vpr greet --arg1 value1 # should pass through args to pnpm run

> command-vpr@<semver> greet <cwd>
> echo greet --arg1 value1

> vpr greet --arg1 value1 # should pass through args
$ echo greet --arg1 value1 ⊘ cache disabled
greet --arg1 value1

[1]> vpr nonexistent # should show pnpm missing script error
 ERR_PNPM_NO_SCRIPT  Missing script: nonexistent

Command "nonexistent" not found.
[1]> vpr nonexistent # should show task not found error
Task "nonexistent" not found.
6 changes: 3 additions & 3 deletions packages/cli/snap-tests-global/command-vpr/steps.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commands": [
"vpr -h # should show vp run help",
"vpr hello # should fall back to pnpm run when no vite-plus dependency",
"vpr greet --arg1 value1 # should pass through args to pnpm run",
"vpr nonexistent # should show pnpm missing script error"
"vpr hello # should execute via global vite-plus task runner",
"vpr greet --arg1 value1 # should pass through args",
"vpr nonexistent # should show task not found error"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ VITE+ - The Unified Toolchain for the Web
> vp run check-node # Should also use 22.12.0
VITE+ - The Unified Toolchain for the Web


> delegate-respects-default-node-version@<semver> check-node <cwd>
> node -e "console.log(process.version)"

$ node -e "console.log(process.version)" ⊘ cache disabled
v<semver>


> vp exec node -e "console.log(process.version)" # Should also use 22.12.0
VITE+ - The Unified Toolchain for the Web

Expand Down
Loading
Loading