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
4 changes: 2 additions & 2 deletions .claude/skills/bump-vite-task/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Update the vite-task git dependency in `Cargo.toml` to the latest commit on the

### 5. Run tests

- Run `cargo test -p vite_command -p vite_error -p vite_install -p vite_js_runtime -p vite_migration -p vite_shared -p vite_static_config -p vite-plus-cli -p vite_global_cli` to run the vite-plus crate tests.
- Note: Some tests require network access (e.g., `vite_install::package_manager` tests, `vite_global_cli::commands::env` tests). These may fail in sandboxed environments. Verify they also fail on the main branch before dismissing them.
- Run `cargo test -p vite_command -p vite_error -p vite_pm_cli -p vite_js_runtime -p vite_migration -p vite_shared -p vite_static_config -p vite-plus-cli -p vite_global_cli` to run the vite-plus crate tests.
- Note: Some tests require network access (e.g., `vite_pm_cli::package_manager` tests, `vite_global_cli::commands::env` tests). These may fail in sandboxed environments. Verify they also fail on the main branch before dismissing them.
- Note: `cargo test -p vite_task` will NOT work because vite_task is a git dependency, not a workspace member.
- The PTY snapshot suite (`crates/vite_cli_snapshots`) is excluded from `just test`; it is covered in step 6.

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,16 @@ jobs:

# `cargo-nextest` is invoked directly so the job never depends on the
# runner's Rust toolchain.
# Cross-compiled archives may also contain host-built proc-macro tests;
# filter them out before Windows tries to list their ELF binaries.
# --test-threads=1: nextest runs each test in its own process, so
# serial_test's in-process locks no longer serialize tests that contend
# on cross-process shared state (fixed temp paths, e.g.
# `vp-test-custom-home` in vite_shared::home tests). The whole suite is
# only ~1 minute of test time, so full serialization is cheap
# insurance; revisit if it becomes the bottleneck.
- name: Run tests
run: cargo-nextest nextest run --archive-file windows-tests.tar.zst --workspace-remap . --test-threads 1
run: cargo-nextest nextest run -E 'platform(target)' --archive-file windows-tests.tar.zst --workspace-remap . --test-threads 1
env:
RUST_MIN_STACK: '8388608'
# Keep Windows env parity with the `test` recipe in justfile.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-standalone-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 'packages/cli/install.sh'
- 'packages/cli/install.ps1'
- 'crates/vite_installer/**'
- 'crates/vite_pm_cli/**'
- 'crates/vite_setup/**'
- '.github/workflows/test-standalone-install.yml'

Expand Down
7 changes: 3 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ vite-plus/
├── crates/vite_command/ # Shared command execution helpers
├── crates/vite_error/ # Shared error types
├── crates/vite_global_cli/ # Standalone global vp binary and top-level command routing
├── crates/vite_install/ # Package-manager detection/install behavior
├── crates/vite_installer/ # Installer binary support
├── crates/vite_js_runtime/ # Managed Node.js runtime support
├── crates/vite_migration/ # Rust migration helpers
├── crates/vite_pm_cli/ # Package-manager command surface
├── crates/vite_pm_cli/ # Package-manager detection, download, command resolution, and dispatch
├── crates/vite_setup/ # Setup helpers
├── crates/vite_shared/ # Shared Rust env config, tracing, output, utilities
├── crates/vite_static_config/ # Static extraction of vite.config.* data
Expand All @@ -54,7 +53,7 @@ vite-plus/
- **JS-backed CLI behavior**: start at `packages/cli/src/bin.ts` and nearby `packages/cli/src/**` files.
- **Local CLI / NAPI-backed behavior**: start at `packages/cli/binding/src/lib.rs` and `packages/cli/binding/src/cli/mod.rs`.
- **Global `vp` routing, aliases, and runtime bootstrap**: start at `crates/vite_global_cli/src/main.rs` and `crates/vite_global_cli/src/cli.rs`.
- **Package-manager commands**: start at `crates/vite_pm_cli/` and `crates/vite_install/`.
- **Package-manager behavior**: start at `crates/vite_pm_cli/`.
- **Managed Node runtime / shims**: start at `crates/vite_js_runtime/`.
- **Static `vite.config.ts` extraction**: start at `crates/vite_static_config/README.md` and `packages/cli/src/resolve-vite-config.ts`.
- **Migration behavior**: `docs/guide/migrate-rules.md`.
Expand Down Expand Up @@ -193,7 +192,7 @@ Use the validation matrix above as the source of truth. For behavior-bearing cha
- Use `vp help` and `vp <command> --help` to inspect command surfaces.
- For command routing bugs, compare the global path (`crates/vite_global_cli/`) with the local/NAPI path (`packages/cli/src/bin.ts`, `packages/cli/binding/`).
- For config-loading bugs, compare the static extractor (`crates/vite_static_config/`) with the JS resolver fallback (`packages/cli/src/resolve-vite-config.ts`).
- For package-manager behavior, inspect `crates/vite_pm_cli/`, `crates/vite_install/`, and related snap tests.
- For package-manager behavior, inspect `crates/vite_pm_cli/` and related snap tests.
- For `vp check`, lint, format, or type-check behavior, validate end-to-end because bundled-tool routing can hide silent config drift.

## AI Assistant Tips
Expand Down
69 changes: 32 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"css-module-lexer",
"html5gum",
"prettyplease",
"proc-macro2",

Check warning on line 11 in Cargo.toml

View workflow job for this annotation

GitHub Actions / Lint

shear/redundant_ignore

redundant ignore `proc-macro2` (remove from ignored list)
"quote",

Check warning on line 12 in Cargo.toml

View workflow job for this annotation

GitHub Actions / Lint

shear/redundant_ignore

redundant ignore `quote` (remove from ignored list)
"rolldown_filter_analyzer",
"rolldown_plugin_vite_asset",
"rolldown_plugin_vite_asset_import_meta_url",
Expand All @@ -18,7 +18,7 @@
"rolldown_plugin_vite_html",
"rolldown_plugin_vite_html_inline_proxy",
"string_cache",
"syn",

Check warning on line 21 in Cargo.toml

View workflow job for this annotation

GitHub Actions / Lint

shear/redundant_ignore

redundant ignore `syn` (remove from ignored list)
]

[workspace.package]
Expand Down Expand Up @@ -299,9 +299,9 @@
vite_command = { path = "crates/vite_command" }
vite_error = { path = "crates/vite_error" }
vite_js_runtime = { path = "crates/vite_js_runtime" }
vite_install = { path = "crates/vite_install" }
vite_migration = { path = "crates/vite_migration" }
vite_pm_cli = { path = "crates/vite_pm_cli" }
vite_pm_cli_macros = { path = "crates/vite_pm_cli_macros" }
vite_setup = { path = "crates/vite_setup" }
vite_shared = { path = "crates/vite_shared" }
vite_static_config = { path = "crates/vite_static_config" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ Bun rejects unsupported JSON output
**Exit code:** 1

```
error: Invalid argument: `--json` is not supported by Bun `version`.
* Invalid argument: `--json` is not supported by Bun `version`.
Invalid argument: `--json` is not supported by Bun `version`.
```

## `vpt print-file package.json`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Yarn Berry rejects unsupported JSON output
**Exit code:** 1

```
error: Invalid argument: `--json` is not supported by Yarn 2+ `version`.
* Invalid argument: `--json` is not supported by Yarn 2+ `version`.
Invalid argument: `--json` is not supported by Yarn 2+ `version`.
```

## `vpt print-file package.json`
Expand Down
1 change: 0 additions & 1 deletion crates/vite_global_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ crossterm = { workspace = true }
indexmap = { workspace = true }
indicatif = { workspace = true }
vite_error = { workspace = true }
vite_install = { workspace = true }
vite_js_runtime = { workspace = true }
vite_pm_cli = { workspace = true }
vite_path = { workspace = true }
Expand Down
86 changes: 33 additions & 53 deletions crates/vite_global_cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use dialoguer::{Confirm, theme::ColorfulTheme};
use owo_colors::OwoColorize;
use tokio::runtime::Runtime;
use vite_path::AbsolutePathBuf;
use vite_pm_cli::PackageManagerCommand;
use vite_pm_cli::{ManagedGlobalCommand, PackageManagerCommand};
use vite_shared::output;

use crate::{
Expand Down Expand Up @@ -552,80 +552,60 @@ fn run_tasks_completions(current: &OsStr) -> Vec<clap_complete::CompletionCandid

/// Handle a parsed package-manager command.
///
/// `Install`/`Add`/`Update`/`Remove` invoked with `-g`/`--global` are routed
/// through the vite-plus-managed Node.js install store (`commands::global`).
/// Everything else is forwarded to `vite_pm_cli::dispatch`, which executes
/// the underlying package manager (pnpm/npm/yarn/bun).
/// Commands projected by [`PackageManagerCommand::managed_global_command`] are
/// routed through the vite-plus-managed Node.js install store
/// (`commands::global`). Everything else is forwarded to
/// `vite_pm_cli::dispatch`, which executes the underlying package manager
/// (pnpm/npm/yarn/bun).
async fn run_package_manager_command(
cwd: AbsolutePathBuf,
command: PackageManagerCommand,
) -> Result<ExitStatus, Error> {
match command {
PackageManagerCommand::Install {
global: true,
packages: Some(pkgs),
node,
force,
concurrency,
..
} if !pkgs.is_empty() => managed_install(&pkgs, node.as_deref(), force, concurrency).await,

PackageManagerCommand::Add {
global: true, ref packages, ref node, concurrency, ..
} => managed_install(packages, node.as_deref(), false, concurrency).await,

PackageManagerCommand::Remove { global: true, ref packages, dry_run, .. } => {
managed_uninstall(packages, dry_run).await
match command.managed_global_command() {
Some(ManagedGlobalCommand::Install { packages, node, force, concurrency }) => {
return managed_install(packages, node, force, concurrency).await;
}

PackageManagerCommand::Update {
global: true,
ref packages,
Some(ManagedGlobalCommand::Remove { packages, dry_run }) => {
return managed_uninstall(packages, dry_run).await;
}
Some(ManagedGlobalCommand::Update {
packages,
concurrency,
reinstall_node_mismatch,
ignore_node_mismatch,
..
} => {
}) => {
if reinstall_node_mismatch && ignore_node_mismatch {
output::error(
"--reinstall-node-mismatch and --ignore-node-mismatch cannot be used together",
);
return Ok(exit_status(1));
}
managed_update(packages, concurrency, reinstall_node_mismatch, ignore_node_mismatch)
.await
return managed_update(
packages,
concurrency,
reinstall_node_mismatch,
ignore_node_mismatch,
)
.await;
}

PackageManagerCommand::Outdated {
global: true,
ref packages,
long,
format,
concurrency,
..
} => {
global::outdated::execute(
Some(ManagedGlobalCommand::Outdated { packages, long, format, concurrency }) => {
return global::outdated::execute(
packages,
long,
format,
concurrency.unwrap_or(DEFAULT_GLOBAL_VIEW_CONCURRENCY),
)
.await
.await;
}

// `pm list -g` lists vite-plus-managed globals, not the underlying PM's.
PackageManagerCommand::Pm(vite_pm_cli::cli::PmCommands::List {
global: true,
json,
ref pattern,
..
}) => global::packages::execute(json, pattern.as_deref()).await,

cmd => {
commands::prepend_js_runtime_to_path_env(&cwd).await?;
Ok(vite_pm_cli::dispatch(&cwd, cmd).await?)
Some(ManagedGlobalCommand::List { json, pattern }) => {
return global::packages::execute(json, pattern).await;
}
None => {}
}

commands::prepend_js_runtime_to_path_env(&cwd).await?;
Ok(vite_pm_cli::dispatch(&cwd, command).await?)
}

async fn managed_install(
Expand Down Expand Up @@ -880,8 +860,8 @@ pub async fn run_command_with_options(
// global install, falling through to `vite_pm_cli::dispatch` for
// every project-scoped PM operation.
Commands::PackageManager(pm_command) => {
if let PackageManagerCommand::Install { silent, .. } = &pm_command {
print_runtime_header(render_options.show_header && !*silent);
if let Some(silent) = pm_command.install_silent() {
print_runtime_header(render_options.show_header && !silent);
}
run_package_manager_command(cwd, pm_command).await
}
Expand Down
4 changes: 2 additions & 2 deletions crates/vite_global_cli/src/commands/env/current.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use std::process::ExitStatus;

use owo_colors::OwoColorize;
use serde::Serialize;
use vite_install::package_manager::{
use vite_path::AbsolutePathBuf;
use vite_pm_cli::{
PackageManagerResolution, package_manager_bin_path, package_manager_install_dir,
resolve_package_manager_from_package_json,
};
use vite_path::AbsolutePathBuf;

use super::config::resolve_version;
use crate::{error::Error, help};
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_global_cli/src/commands/env/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ async fn collect_dev_engines_findings(
// too, the unsupported one is skipped by design (an info note); otherwise it
// is the only declaration and warrants a warning.
if let Some(field) = package_manager_field {
let is_supported = |name: &str| vite_install::PackageManagerType::from_name(name).is_some();
let is_supported = |name: &str| vite_pm_cli::PackageManagerType::from_name(name).is_some();
let has_supported = field.entries().iter().any(|e| is_supported(&e.name));
for entry in field.entries().iter().filter(|e| !is_supported(&e.name)) {
let skipped = if has_supported { " and will be skipped" } else { "" };
Expand Down
Loading
Loading