From 0ad87650f8533a03ef4b783c5a222e1e1c27b137 Mon Sep 17 00:00:00 2001 From: Liang Date: Thu, 6 Aug 2026 21:18:40 +0800 Subject: [PATCH 1/6] feat(cli): warn when project-local CLI is missing --- .../assert-silent-fallback.mjs | 15 +++++ .../missing_local_cli_warning/package.json | 4 ++ .../missing_local_cli_warning/snapshots.toml | 12 ++++ .../snapshots/missing_local_cli_warning.md | 42 ++++++++++++++ .../missing_local_cli_warning/src/index.js | 1 + crates/vp_global_cli/src/commands/migrate.rs | 2 +- crates/vp_global_cli/src/commands/mod.rs | 55 +++++++++++++------ crates/vp_global_cli/src/js_executor.rs | 23 +++++++- 8 files changed, 133 insertions(+), 21 deletions(-) create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/assert-silent-fallback.mjs create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/package.json create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots.toml create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots/missing_local_cli_warning.md create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/src/index.js diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/assert-silent-fallback.mjs b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/assert-silent-fallback.mjs new file mode 100644 index 0000000000..2b4e532c28 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/assert-silent-fallback.mjs @@ -0,0 +1,15 @@ +import { spawnSync } from 'node:child_process' + +const result = spawnSync('vp', ['lint', '--help'], { encoding: 'utf8' }) +const output = `${result.stdout}${result.stderr}` + +if (result.error) + throw result.error + +if (result.status !== 0 || !output.includes('Usage: vp lint')) + throw new Error(`Global CLI did not run successfully:\n${output}`) + +if (output.includes('No project-local vite-plus installation was found')) + throw new Error(`Unexpected missing local CLI warning:\n${output}`) + +console.log('Global fallback remained silent.') diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/package.json new file mode 100644 index 0000000000..d616721d28 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/package.json @@ -0,0 +1,4 @@ +{ + "name": "missing-local-cli-warning", + "version": "1.0.0" +} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots.toml b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots.toml new file mode 100644 index 0000000000..8a861543b3 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots.toml @@ -0,0 +1,12 @@ +[[case]] +name = "missing_local_cli_warning" +vp = "global" +skip-platforms = ["windows"] +steps = [ + { argv = ["vpt", "write-file", "node_modules/vite-plus/package.json", '{"name":"vite-plus","version":"0.0.0"}'], snapshot = false }, + { argv = ["vp", "lint", "src/index.js"], comment = "a project that does not declare vite-plus gets migration guidance" }, + { argv = ["vpt", "json-edit", "package.json", "devDependencies.vite-plus", "0.0.0"], snapshot = false }, + { argv = ["vp", "lint", "src/index.js"], comment = "a project that declares vite-plus but has no local CLI gets installation guidance" }, + { argv = ["vpt", "rm", "package.json"], snapshot = false }, + { argv = ["node", "assert-silent-fallback.mjs"], comment = "outside a project, global fallback remains silent" }, +] diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots/missing_local_cli_warning.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots/missing_local_cli_warning.md new file mode 100644 index 0000000000..4b3eed2df4 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots/missing_local_cli_warning.md @@ -0,0 +1,42 @@ +# missing_local_cli_warning + +## `vpt write-file node_modules/vite-plus/package.json '{"name":"vite-plus","version":"0.0.0"}'` + + +## `vp lint src/index.js` + +a project that does not declare vite-plus gets migration guidance + +``` +VITE+ - The Unified Toolchain for the Web + +warn: This project does not use vite-plus. Learn how to migrate: https://viteplus.dev/guide/migrate +Found 0 warnings and 0 errors. +Finished in on 1 file with rules using threads. +``` + +## `vpt json-edit package.json devDependencies.vite-plus 0.0.0` + + +## `vp lint src/index.js` + +a project that declares vite-plus but has no local CLI gets installation guidance + +``` +VITE+ - The Unified Toolchain for the Web + +warn: No project-local vite-plus installation was found. Run `vp install` to install dependencies. +Found 0 warnings and 0 errors. +Finished in on 1 file with rules using threads. +``` + +## `vpt rm package.json` + + +## `node assert-silent-fallback.mjs` + +outside a project, global fallback remains silent + +``` +Global fallback remained silent. +``` diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/src/index.js b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/src/index.js new file mode 100644 index 0000000000..eab39ce89c --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/src/index.js @@ -0,0 +1 @@ +export const answer = 42 diff --git a/crates/vp_global_cli/src/commands/migrate.rs b/crates/vp_global_cli/src/commands/migrate.rs index 8affa4c055..4ccc3c7862 100644 --- a/crates/vp_global_cli/src/commands/migrate.rs +++ b/crates/vp_global_cli/src/commands/migrate.rs @@ -12,7 +12,7 @@ use crate::{error::Error, js_executor::JsExecutor}; /// global CLI when the project's local `vite-plus` is older than this global /// `vp` (the upgrade scenario). Otherwise it keeps local-first semantics. pub async fn execute(cwd: AbsolutePathBuf, args: &[String]) -> Result { - let mut executor = JsExecutor::new(None); + let mut executor = JsExecutor::new(None).without_missing_local_cli_warning(); let mut full_args = vec!["migrate".to_string()]; full_args.extend(args.iter().cloned()); executor.delegate_migrate(&cwd, &full_args).await diff --git a/crates/vp_global_cli/src/commands/mod.rs b/crates/vp_global_cli/src/commands/mod.rs index 47b97046a1..603fffb23c 100644 --- a/crates/vp_global_cli/src/commands/mod.rs +++ b/crates/vp_global_cli/src/commands/mod.rs @@ -18,8 +18,8 @@ use std::{collections::HashMap, io::BufReader}; -use vp_shared::{PrependOptions, prepend_to_path_env}; -use vt_path::AbsolutePath; +use vp_shared::{PrependOptions, output, prepend_to_path_env}; +use vt_path::{AbsolutePath, AbsolutePathBuf}; use crate::{error::Error, js_executor::JsExecutor}; @@ -32,33 +32,52 @@ struct DepCheckPackageJson { dev_dependencies: HashMap, } -/// Check if vite-plus is listed in the nearest package.json's -/// dependencies or devDependencies. -/// -/// Returns `true` if vite-plus is found, `false` if not found -/// or if no package.json exists. -pub fn has_vite_plus_dependency(cwd: &AbsolutePath) -> bool { +fn find_nearest_package_json(cwd: &AbsolutePath) -> Option { let mut current = cwd; loop { let package_json_path = current.join("package.json"); if package_json_path.as_path().exists() { - if let Ok(file) = std::fs::File::open(&package_json_path) { - if let Ok(pkg) = - serde_json::from_reader::<_, DepCheckPackageJson>(BufReader::new(file)) - { - return pkg.dependencies.contains_key("vite-plus") - || pkg.dev_dependencies.contains_key("vite-plus"); - } - } - return false; // Found package.json but couldn't parse deps → treat as no dependency + return Some(package_json_path); } match current.parent() { Some(parent) if parent != current => current = parent, - _ => return false, // Reached filesystem root + _ => return None, } } } +/// Check if vite-plus is listed in the nearest package.json's +/// dependencies or devDependencies. +/// +/// Returns `true` if vite-plus is found, `false` if not found +/// or if no package.json exists. +pub fn has_vite_plus_dependency(cwd: &AbsolutePath) -> bool { + if let Some(package_json_path) = find_nearest_package_json(cwd) + && let Ok(file) = std::fs::File::open(&package_json_path) + && let Ok(pkg) = serde_json::from_reader::<_, DepCheckPackageJson>(BufReader::new(file)) + { + return pkg.dependencies.contains_key("vite-plus") + || pkg.dev_dependencies.contains_key("vite-plus"); + } + false +} + +pub(crate) fn warn_missing_local_cli_if_project(cwd: &AbsolutePath) { + if find_nearest_package_json(cwd).is_none() { + return; + } + + if has_vite_plus_dependency(cwd) { + output::warn( + "No project-local vite-plus installation was found. Run `vp install` to install dependencies.", + ); + } else { + output::warn( + "This project does not use vite-plus. Learn how to migrate: https://viteplus.dev/guide/migrate", + ); + } +} + /// Ensure the JS runtime is downloaded and prepend its bin directory to PATH. /// This should be called before executing any package manager command. /// diff --git a/crates/vp_global_cli/src/js_executor.rs b/crates/vp_global_cli/src/js_executor.rs index 66c263ec49..053110cab9 100644 --- a/crates/vp_global_cli/src/js_executor.rs +++ b/crates/vp_global_cli/src/js_executor.rs @@ -11,7 +11,10 @@ use vp_shared::{PrependOptions, PrependResult, env_vars, format_path_with_prepen use vt_path::{AbsolutePath, AbsolutePathBuf}; use crate::{ - commands::env::config::{self, ShimMode}, + commands::{ + self, + env::config::{self, ShimMode}, + }, error::Error, shim, }; @@ -30,6 +33,8 @@ pub struct JsExecutor { scripts_dir: Option, /// Subcommand as the user wrote it, forwarded to the CLI this one runs raw_subcommand: Option, + /// Whether a project-local CLI miss should emit a warning before global fallback + warn_on_missing_local_cli: bool, } impl JsExecutor { @@ -40,7 +45,13 @@ impl JsExecutor { /// If not provided, will be auto-detected from the binary location. #[must_use] pub const fn new(scripts_dir: Option) -> Self { - Self { cli_runtime: None, project_runtime: None, scripts_dir, raw_subcommand: None } + Self { + cli_runtime: None, + project_runtime: None, + scripts_dir, + raw_subcommand: None, + warn_on_missing_local_cli: true, + } } /// Forward the subcommand as the user wrote it to the CLI this one runs. @@ -52,6 +63,11 @@ impl JsExecutor { self } + pub(crate) fn without_missing_local_cli_warning(mut self) -> Self { + self.warn_on_missing_local_cli = false; + self + } + /// Get the JS scripts directory. /// /// Resolution order: @@ -339,6 +355,9 @@ impl JsExecutor { let entry_point = match Self::resolve_local_vite_plus(project_path) { Some(path) => path, None => { + if self.warn_on_missing_local_cli { + commands::warn_missing_local_cli_if_project(project_path); + } // Fall back to the global installation's bin.js let scripts_dir = self.get_scripts_dir()?; scripts_dir.join("bin.js") From 5440075ca39cce65754da47e8fbb904512f3bd2b Mon Sep 17 00:00:00 2001 From: Liang Date: Thu, 6 Aug 2026 21:18:46 +0800 Subject: [PATCH 2/6] docs(rfc): document global CLI fallback --- rfcs/exec-command.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rfcs/exec-command.md b/rfcs/exec-command.md index 3a9162ea37..5e5b00e550 100644 --- a/rfcs/exec-command.md +++ b/rfcs/exec-command.md @@ -179,7 +179,7 @@ Based on pnpm exec behavior (reference: `exec/plugin-commands-script-runners/src ### Key Differences from vpx - `vp exec` prepends only `./node_modules/.bin` from the current directory — it does **not** walk up parent directories. Use `vpx` if you want monorepo root binaries. -- `vp exec` never falls back to global vp packages or remote download — commands resolve through `node_modules/.bin` + system PATH only. +- After the Vite+ CLI is selected, `vp exec` never falls back to globally installed executable packages or remote downloads — commands resolve through `node_modules/.bin` + system PATH only. ## Implementation Architecture @@ -206,7 +206,7 @@ Route in `execute_command()`: Commands::Exec { args } => commands::delegate::execute(cwd, "exec", &args).await, ``` -The global CLI always delegates `exec` to the local CLI — there is no fallback path or direct execution in the global CLI. This follows the same unconditional delegation pattern as other Category C commands. +The global CLI always delegates `exec` to the JavaScript CLI. Delegation resolves the project's local `vite-plus` first, then falls back to the globally installed `vite-plus` when no local CLI is available. When this fallback occurs inside a project, `vp` recommends migration if `vite-plus` is not declared as a dependency, or recommends installing dependencies if it is declared but unavailable. The Rust global CLI has no direct `exec` implementation. ### Local CLI @@ -256,16 +256,16 @@ The following existing code is reused: ## Design Decisions -### 1. Unconditional Delegation (No Global CLI Fallback) +### 1. Local-First Delegation with Global CLI Fallback -**Decision**: The global CLI always delegates `exec` to the local CLI. There is no fallback path for projects without vite-plus as a dependency. +**Decision**: The global CLI delegates `exec` to the project-local `vite-plus` when available. Otherwise, it provides migration or installation guidance inside projects and continues with the globally installed `vite-plus` CLI. **Rationale**: - Simplifies the global CLI — no need for a direct-execution codepath - Consistent with how all Category C commands are dispatched -- The local CLI has all the workspace awareness needed for `--recursive`, `--filter`, etc. -- Projects using `vp exec` are expected to have vite-plus installed +- The delegated CLI has all the workspace awareness needed for `--recursive`, `--filter`, etc. +- The warning directs projects to migrate or install their declared dependencies without making the global fallback unusable ### 2. No Directory Walk-Up (Unlike vpx) @@ -278,14 +278,14 @@ The following existing code is reused: - Walking up would blur the boundary between package-level and workspace-level binaries - Use `vpx` if you want walk-up behavior -### 3. Workspace Features Only via Local CLI +### 3. Workspace Features Use the Delegated CLI -**Decision**: `--recursive`, `--workspace-root`, `--filter`, `--parallel`, `--reverse`, `--resume-from`, and `--report-summary` only work when vite-plus is a local dependency (local CLI handles them). +**Decision**: `--recursive`, `--workspace-root`, `--filter`, `--parallel`, `--reverse`, `--resume-from`, and `--report-summary` are handled by the resolved `vite-plus` CLI, whether project-local or the global fallback. **Rationale**: - These features require workspace awareness from vite-task infrastructure -- The global CLI fallback is for simple, single-directory exec +- The project-local and globally installed CLIs use the same workspace-aware implementation - This is consistent with how `vp run` handles workspace features ### 4. Same Env Var Convention From eeb4a77158eff10110394ddd0ddcbe33ecc28672 Mon Sep 17 00:00:00 2001 From: Liang Date: Thu, 6 Aug 2026 21:42:41 +0800 Subject: [PATCH 3/6] fix(cli): refine missing-local fallback warnings --- .../node_modules/vite-plus/package.json | 4 ++++ .../global_cli_missing_local/package.json | 10 ++++++++++ .../packages/app/package.json | 7 +++++++ .../global_cli_missing_local/snapshots.toml | 15 +++++++++++++++ .../dynamic_task_completion_stays_silent.md | 9 +++++++++ .../workspace_root_dependency_prompts_install.md | 13 +++++++++++++ crates/vp_global_cli/src/commands/delegate.rs | 2 +- crates/vp_global_cli/src/commands/mod.rs | 7 ++++++- 8 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/node_modules/vite-plus/package.json create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/package.json create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/packages/app/package.json create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots.toml create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/dynamic_task_completion_stays_silent.md create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/node_modules/vite-plus/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/node_modules/vite-plus/package.json new file mode 100644 index 0000000000..8df4daec7e --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/node_modules/vite-plus/package.json @@ -0,0 +1,4 @@ +{ + "name": "vite-plus", + "version": "0.0.0" +} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/package.json new file mode 100644 index 0000000000..ac5cea4912 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/package.json @@ -0,0 +1,10 @@ +{ + "name": "global-cli-missing-local", + "private": true, + "workspaces": [ + "packages/*" + ], + "devDependencies": { + "vite-plus": "^0.1.0" + } +} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/packages/app/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/packages/app/package.json new file mode 100644 index 0000000000..ae86febb99 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/packages/app/package.json @@ -0,0 +1,7 @@ +{ + "name": "app", + "private": true, + "scripts": { + "build": "vpt print build" + } +} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots.toml b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots.toml new file mode 100644 index 0000000000..4a85f5e464 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots.toml @@ -0,0 +1,15 @@ +[[case]] +name = "workspace_root_dependency_prompts_install" +vp = "global" +cwd = "packages/app" +steps = [ + { argv = ["vp", "run", "build"], comment = "a workspace-root vite-plus declaration should recommend installing dependencies" }, +] + +[[case]] +name = "dynamic_task_completion_stays_silent" +vp = "global" +cwd = "packages/app" +steps = [ + { argv = ["vp", "--", "vp", "run", ""], envs = [["VP_COMPLETE", "bash"], ["_CLAP_COMPLETE_INDEX", "2"]], comment = "dynamic task completion should not print missing-local guidance" }, +] diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/dynamic_task_completion_stays_silent.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/dynamic_task_completion_stays_silent.md new file mode 100644 index 0000000000..d29c5733a1 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/dynamic_task_completion_stays_silent.md @@ -0,0 +1,9 @@ +# dynamic_task_completion_stays_silent + +## `VP_COMPLETE=bash _CLAP_COMPLETE_INDEX=2 vp -- vp run ` + +dynamic task completion should not print missing-local guidance + +``` +build +``` diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md new file mode 100644 index 0000000000..58e624a31e --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md @@ -0,0 +1,13 @@ +# workspace_root_dependency_prompts_install + +## `vp run build` + +a workspace-root vite-plus declaration should recommend installing dependencies + +``` +VITE+ - The Unified Toolchain for the Web + +warn: No project-local vite-plus installation was found. Run `vp install` to install dependencies. +~/packages/app$ vpt print build ⊘ cache disabled +build +``` diff --git a/crates/vp_global_cli/src/commands/delegate.rs b/crates/vp_global_cli/src/commands/delegate.rs index 553a2e8893..879f47b0a6 100644 --- a/crates/vp_global_cli/src/commands/delegate.rs +++ b/crates/vp_global_cli/src/commands/delegate.rs @@ -28,7 +28,7 @@ pub async fn execute_output( command: &str, args: &[String], ) -> Result { - let mut executor = JsExecutor::new(None); + let mut executor = JsExecutor::new(None).without_missing_local_cli_warning(); let mut full_args = vec![command.to_string()]; full_args.extend(args.iter().cloned()); executor.delegate_to_local_cli_output(&cwd, &full_args).await diff --git a/crates/vp_global_cli/src/commands/mod.rs b/crates/vp_global_cli/src/commands/mod.rs index 603fffb23c..11014111e3 100644 --- a/crates/vp_global_cli/src/commands/mod.rs +++ b/crates/vp_global_cli/src/commands/mod.rs @@ -67,7 +67,12 @@ pub(crate) fn warn_missing_local_cli_if_project(cwd: &AbsolutePath) { return; } - if has_vite_plus_dependency(cwd) { + let has_declared_vite_plus = has_vite_plus_dependency(cwd) + || vt_workspace::find_workspace_root(cwd).is_ok_and(|(workspace_root, _)| { + has_vite_plus_dependency(workspace_root.path.as_ref()) + }); + + if has_declared_vite_plus { output::warn( "No project-local vite-plus installation was found. Run `vp install` to install dependencies.", ); From da7e3cee996a6ad9ef0c918722afa19ab8bec407 Mon Sep 17 00:00:00 2001 From: Liang Date: Thu, 6 Aug 2026 22:17:42 +0800 Subject: [PATCH 4/6] fix(cli): correct missing-local install guidance --- ...rkspace_root_dependency_prompts_install.md | 2 +- .../caller/package.json | 4 ++++ .../optional/package.json | 7 +++++++ .../optional/src/index.js | 1 + .../missing_local_cli_guidance/snapshots.toml | 19 +++++++++++++++++++ .../chdir_install_guidance_names_target.md | 16 ++++++++++++++++ .../optional_dependency_prompts_install.md | 16 ++++++++++++++++ .../target/package.json | 7 +++++++ .../target/src/index.js | 1 + .../snapshots/missing_local_cli_warning.md | 2 +- crates/vp_global_cli/src/commands/mod.rs | 14 +++++++++----- 11 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/caller/package.json create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/package.json create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/src/index.js create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots.toml create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/chdir_install_guidance_names_target.md create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/optional_dependency_prompts_install.md create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/package.json create mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/src/index.js diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md index 58e624a31e..3cf92428bd 100644 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md @@ -7,7 +7,7 @@ a workspace-root vite-plus declaration should recommend installing dependencies ``` VITE+ - The Unified Toolchain for the Web -warn: No project-local vite-plus installation was found. Run `vp install` to install dependencies. +warn: No project-local vite-plus installation was found. Run `vp install` in `/packages/app` to install dependencies. ~/packages/app$ vpt print build ⊘ cache disabled build ``` diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/caller/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/caller/package.json new file mode 100644 index 0000000000..d3bc4872e6 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/caller/package.json @@ -0,0 +1,4 @@ +{ + "name": "chdir-caller", + "private": true +} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/package.json new file mode 100644 index 0000000000..67211fd7de --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/package.json @@ -0,0 +1,7 @@ +{ + "name": "optional-vite-plus", + "private": true, + "optionalDependencies": { + "vite-plus": "^0.1.0" + } +} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/src/index.js b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/src/index.js new file mode 100644 index 0000000000..eab39ce89c --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/src/index.js @@ -0,0 +1 @@ +export const answer = 42 diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots.toml b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots.toml new file mode 100644 index 0000000000..809181d34b --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots.toml @@ -0,0 +1,19 @@ +[[case]] +name = "optional_dependency_prompts_install" +vp = "global" +cwd = "optional" +skip-platforms = ["windows"] +steps = [ + { argv = ["vpt", "write-file", "node_modules/vite-plus/package.json", '{"name":"vite-plus","version":"0.0.0"}'], snapshot = false }, + { argv = ["vp", "lint", "src/index.js"], comment = "an optional vite-plus declaration should recommend installing dependencies" }, +] + +[[case]] +name = "chdir_install_guidance_names_target" +vp = "global" +cwd = "caller" +skip-platforms = ["windows"] +steps = [ + { argv = ["vpt", "write-file", "../target/node_modules/vite-plus/package.json", '{"name":"vite-plus","version":"0.0.0"}'], snapshot = false }, + { argv = ["vp", "-C", "../target", "lint", "src/index.js"], comment = "install guidance should name the project selected by -C" }, +] diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/chdir_install_guidance_names_target.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/chdir_install_guidance_names_target.md new file mode 100644 index 0000000000..a02f723e53 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/chdir_install_guidance_names_target.md @@ -0,0 +1,16 @@ +# chdir_install_guidance_names_target + +## `vpt write-file ../target/node_modules/vite-plus/package.json '{"name":"vite-plus","version":"0.0.0"}'` + + +## `vp -C ../target lint src/index.js` + +install guidance should name the project selected by -C + +``` +VITE+ - The Unified Toolchain for the Web + +warn: No project-local vite-plus installation was found. Run `vp install` in `/target` to install dependencies. +Found 0 warnings and 0 errors. +Finished in on 1 file with rules using threads. +``` diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/optional_dependency_prompts_install.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/optional_dependency_prompts_install.md new file mode 100644 index 0000000000..c6534e98e6 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/optional_dependency_prompts_install.md @@ -0,0 +1,16 @@ +# optional_dependency_prompts_install + +## `vpt write-file node_modules/vite-plus/package.json '{"name":"vite-plus","version":"0.0.0"}'` + + +## `vp lint src/index.js` + +an optional vite-plus declaration should recommend installing dependencies + +``` +VITE+ - The Unified Toolchain for the Web + +warn: No project-local vite-plus installation was found. Run `vp install` in `/optional` to install dependencies. +Found 0 warnings and 0 errors. +Finished in on 1 file with rules using threads. +``` diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/package.json new file mode 100644 index 0000000000..8a6c9369c8 --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/package.json @@ -0,0 +1,7 @@ +{ + "name": "chdir-target", + "private": true, + "devDependencies": { + "vite-plus": "^0.1.0" + } +} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/src/index.js b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/src/index.js new file mode 100644 index 0000000000..eab39ce89c --- /dev/null +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/src/index.js @@ -0,0 +1 @@ +export const answer = 42 diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots/missing_local_cli_warning.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots/missing_local_cli_warning.md index 4b3eed2df4..1dff992a4b 100644 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots/missing_local_cli_warning.md +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_warning/snapshots/missing_local_cli_warning.md @@ -25,7 +25,7 @@ a project that declares vite-plus but has no local CLI gets installation guidanc ``` VITE+ - The Unified Toolchain for the Web -warn: No project-local vite-plus installation was found. Run `vp install` to install dependencies. +warn: No project-local vite-plus installation was found. Run `vp install` in `` to install dependencies. Found 0 warnings and 0 errors. Finished in on 1 file with rules using threads. ``` diff --git a/crates/vp_global_cli/src/commands/mod.rs b/crates/vp_global_cli/src/commands/mod.rs index 11014111e3..4d3339000a 100644 --- a/crates/vp_global_cli/src/commands/mod.rs +++ b/crates/vp_global_cli/src/commands/mod.rs @@ -30,6 +30,8 @@ struct DepCheckPackageJson { dependencies: HashMap, #[serde(default)] dev_dependencies: HashMap, + #[serde(default)] + optional_dependencies: HashMap, } fn find_nearest_package_json(cwd: &AbsolutePath) -> Option { @@ -47,7 +49,7 @@ fn find_nearest_package_json(cwd: &AbsolutePath) -> Option { } /// Check if vite-plus is listed in the nearest package.json's -/// dependencies or devDependencies. +/// dependencies, devDependencies, or optionalDependencies. /// /// Returns `true` if vite-plus is found, `false` if not found /// or if no package.json exists. @@ -57,7 +59,8 @@ pub fn has_vite_plus_dependency(cwd: &AbsolutePath) -> bool { && let Ok(pkg) = serde_json::from_reader::<_, DepCheckPackageJson>(BufReader::new(file)) { return pkg.dependencies.contains_key("vite-plus") - || pkg.dev_dependencies.contains_key("vite-plus"); + || pkg.dev_dependencies.contains_key("vite-plus") + || pkg.optional_dependencies.contains_key("vite-plus"); } false } @@ -73,9 +76,10 @@ pub(crate) fn warn_missing_local_cli_if_project(cwd: &AbsolutePath) { }); if has_declared_vite_plus { - output::warn( - "No project-local vite-plus installation was found. Run `vp install` to install dependencies.", - ); + output::warn(&format!( + "No project-local vite-plus installation was found. Run `vp install` in `{}` to install dependencies.", + cwd.as_path().display() + )); } else { output::warn( "This project does not use vite-plus. Learn how to migrate: https://viteplus.dev/guide/migrate", From a56010a7720b78b330faee566ef047a68da29f2e Mon Sep 17 00:00:00 2001 From: Liang Date: Thu, 6 Aug 2026 22:41:27 +0800 Subject: [PATCH 5/6] fix(cli): detect ancestor vite-plus declarations --- crates/vp_global_cli/src/commands/mod.rs | 49 +++++++++++++++++------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/crates/vp_global_cli/src/commands/mod.rs b/crates/vp_global_cli/src/commands/mod.rs index 4d3339000a..a7bf308f88 100644 --- a/crates/vp_global_cli/src/commands/mod.rs +++ b/crates/vp_global_cli/src/commands/mod.rs @@ -48,14 +48,8 @@ fn find_nearest_package_json(cwd: &AbsolutePath) -> Option { } } -/// Check if vite-plus is listed in the nearest package.json's -/// dependencies, devDependencies, or optionalDependencies. -/// -/// Returns `true` if vite-plus is found, `false` if not found -/// or if no package.json exists. -pub fn has_vite_plus_dependency(cwd: &AbsolutePath) -> bool { - if let Some(package_json_path) = find_nearest_package_json(cwd) - && let Ok(file) = std::fs::File::open(&package_json_path) +fn package_json_has_vite_plus_dependency(package_json_path: &AbsolutePath) -> bool { + if let Ok(file) = std::fs::File::open(package_json_path) && let Ok(pkg) = serde_json::from_reader::<_, DepCheckPackageJson>(BufReader::new(file)) { return pkg.dependencies.contains_key("vite-plus") @@ -65,20 +59,47 @@ pub fn has_vite_plus_dependency(cwd: &AbsolutePath) -> bool { false } +fn find_vite_plus_dependency(cwd: &AbsolutePath) -> Option { + let mut current = cwd; + loop { + if package_json_has_vite_plus_dependency(¤t.join("package.json")) { + return Some(current.to_absolute_path_buf()); + } + match current.parent() { + Some(parent) if parent != current => current = parent, + _ => return None, + } + } +} + +/// Check if vite-plus is listed in the nearest package.json's +/// dependencies, devDependencies, or optionalDependencies. +/// +/// Returns `true` if vite-plus is found, `false` if not found +/// or if no package.json exists. +pub fn has_vite_plus_dependency(cwd: &AbsolutePath) -> bool { + find_nearest_package_json(cwd) + .is_some_and(|package_json_path| package_json_has_vite_plus_dependency(&package_json_path)) +} + pub(crate) fn warn_missing_local_cli_if_project(cwd: &AbsolutePath) { if find_nearest_package_json(cwd).is_none() { return; } - let has_declared_vite_plus = has_vite_plus_dependency(cwd) - || vt_workspace::find_workspace_root(cwd).is_ok_and(|(workspace_root, _)| { - has_vite_plus_dependency(workspace_root.path.as_ref()) - }); + let install_dir = if has_vite_plus_dependency(cwd) + || vt_workspace::find_workspace_root(cwd) + .is_ok_and(|(workspace_root, _)| has_vite_plus_dependency(workspace_root.path.as_ref())) + { + Some(cwd.to_absolute_path_buf()) + } else { + find_vite_plus_dependency(cwd) + }; - if has_declared_vite_plus { + if let Some(install_dir) = install_dir { output::warn(&format!( "No project-local vite-plus installation was found. Run `vp install` in `{}` to install dependencies.", - cwd.as_path().display() + install_dir.as_path().display() )); } else { output::warn( From a33485bc4b91d84f10602b36ec40e243afa543b6 Mon Sep 17 00:00:00 2001 From: Liang Date: Thu, 6 Aug 2026 22:45:57 +0800 Subject: [PATCH 6/6] wip --- .../node_modules/vite-plus/package.json | 4 ---- .../global_cli_missing_local/package.json | 10 ---------- .../packages/app/package.json | 7 ------- .../global_cli_missing_local/snapshots.toml | 15 --------------- .../dynamic_task_completion_stays_silent.md | 9 --------- ...rkspace_root_dependency_prompts_install.md | 13 ------------- .../caller/package.json | 4 ---- .../optional/package.json | 7 ------- .../optional/src/index.js | 1 - .../missing_local_cli_guidance/snapshots.toml | 19 ------------------- .../chdir_install_guidance_names_target.md | 16 ---------------- .../optional_dependency_prompts_install.md | 16 ---------------- .../target/package.json | 7 ------- .../target/src/index.js | 1 - 14 files changed, 129 deletions(-) delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/node_modules/vite-plus/package.json delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/package.json delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/packages/app/package.json delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots.toml delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/dynamic_task_completion_stays_silent.md delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/caller/package.json delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/package.json delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/src/index.js delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots.toml delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/chdir_install_guidance_names_target.md delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/optional_dependency_prompts_install.md delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/package.json delete mode 100644 crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/src/index.js diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/node_modules/vite-plus/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/node_modules/vite-plus/package.json deleted file mode 100644 index 8df4daec7e..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/node_modules/vite-plus/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "vite-plus", - "version": "0.0.0" -} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/package.json deleted file mode 100644 index ac5cea4912..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "global-cli-missing-local", - "private": true, - "workspaces": [ - "packages/*" - ], - "devDependencies": { - "vite-plus": "^0.1.0" - } -} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/packages/app/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/packages/app/package.json deleted file mode 100644 index ae86febb99..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/packages/app/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "app", - "private": true, - "scripts": { - "build": "vpt print build" - } -} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots.toml b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots.toml deleted file mode 100644 index 4a85f5e464..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots.toml +++ /dev/null @@ -1,15 +0,0 @@ -[[case]] -name = "workspace_root_dependency_prompts_install" -vp = "global" -cwd = "packages/app" -steps = [ - { argv = ["vp", "run", "build"], comment = "a workspace-root vite-plus declaration should recommend installing dependencies" }, -] - -[[case]] -name = "dynamic_task_completion_stays_silent" -vp = "global" -cwd = "packages/app" -steps = [ - { argv = ["vp", "--", "vp", "run", ""], envs = [["VP_COMPLETE", "bash"], ["_CLAP_COMPLETE_INDEX", "2"]], comment = "dynamic task completion should not print missing-local guidance" }, -] diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/dynamic_task_completion_stays_silent.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/dynamic_task_completion_stays_silent.md deleted file mode 100644 index d29c5733a1..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/dynamic_task_completion_stays_silent.md +++ /dev/null @@ -1,9 +0,0 @@ -# dynamic_task_completion_stays_silent - -## `VP_COMPLETE=bash _CLAP_COMPLETE_INDEX=2 vp -- vp run ` - -dynamic task completion should not print missing-local guidance - -``` -build -``` diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md deleted file mode 100644 index 3cf92428bd..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/global_cli_missing_local/snapshots/workspace_root_dependency_prompts_install.md +++ /dev/null @@ -1,13 +0,0 @@ -# workspace_root_dependency_prompts_install - -## `vp run build` - -a workspace-root vite-plus declaration should recommend installing dependencies - -``` -VITE+ - The Unified Toolchain for the Web - -warn: No project-local vite-plus installation was found. Run `vp install` in `/packages/app` to install dependencies. -~/packages/app$ vpt print build ⊘ cache disabled -build -``` diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/caller/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/caller/package.json deleted file mode 100644 index d3bc4872e6..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/caller/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "chdir-caller", - "private": true -} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/package.json deleted file mode 100644 index 67211fd7de..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "optional-vite-plus", - "private": true, - "optionalDependencies": { - "vite-plus": "^0.1.0" - } -} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/src/index.js b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/src/index.js deleted file mode 100644 index eab39ce89c..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/optional/src/index.js +++ /dev/null @@ -1 +0,0 @@ -export const answer = 42 diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots.toml b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots.toml deleted file mode 100644 index 809181d34b..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots.toml +++ /dev/null @@ -1,19 +0,0 @@ -[[case]] -name = "optional_dependency_prompts_install" -vp = "global" -cwd = "optional" -skip-platforms = ["windows"] -steps = [ - { argv = ["vpt", "write-file", "node_modules/vite-plus/package.json", '{"name":"vite-plus","version":"0.0.0"}'], snapshot = false }, - { argv = ["vp", "lint", "src/index.js"], comment = "an optional vite-plus declaration should recommend installing dependencies" }, -] - -[[case]] -name = "chdir_install_guidance_names_target" -vp = "global" -cwd = "caller" -skip-platforms = ["windows"] -steps = [ - { argv = ["vpt", "write-file", "../target/node_modules/vite-plus/package.json", '{"name":"vite-plus","version":"0.0.0"}'], snapshot = false }, - { argv = ["vp", "-C", "../target", "lint", "src/index.js"], comment = "install guidance should name the project selected by -C" }, -] diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/chdir_install_guidance_names_target.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/chdir_install_guidance_names_target.md deleted file mode 100644 index a02f723e53..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/chdir_install_guidance_names_target.md +++ /dev/null @@ -1,16 +0,0 @@ -# chdir_install_guidance_names_target - -## `vpt write-file ../target/node_modules/vite-plus/package.json '{"name":"vite-plus","version":"0.0.0"}'` - - -## `vp -C ../target lint src/index.js` - -install guidance should name the project selected by -C - -``` -VITE+ - The Unified Toolchain for the Web - -warn: No project-local vite-plus installation was found. Run `vp install` in `/target` to install dependencies. -Found 0 warnings and 0 errors. -Finished in on 1 file with rules using threads. -``` diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/optional_dependency_prompts_install.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/optional_dependency_prompts_install.md deleted file mode 100644 index c6534e98e6..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/snapshots/optional_dependency_prompts_install.md +++ /dev/null @@ -1,16 +0,0 @@ -# optional_dependency_prompts_install - -## `vpt write-file node_modules/vite-plus/package.json '{"name":"vite-plus","version":"0.0.0"}'` - - -## `vp lint src/index.js` - -an optional vite-plus declaration should recommend installing dependencies - -``` -VITE+ - The Unified Toolchain for the Web - -warn: No project-local vite-plus installation was found. Run `vp install` in `/optional` to install dependencies. -Found 0 warnings and 0 errors. -Finished in on 1 file with rules using threads. -``` diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/package.json deleted file mode 100644 index 8a6c9369c8..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "chdir-target", - "private": true, - "devDependencies": { - "vite-plus": "^0.1.0" - } -} diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/src/index.js b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/src/index.js deleted file mode 100644 index eab39ce89c..0000000000 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/missing_local_cli_guidance/target/src/index.js +++ /dev/null @@ -1 +0,0 @@ -export const answer = 42