Skip to content

refactor(global): install command without cache#344

Merged
fengmk2 merged 1 commit intomainfrom
12-15-refactor_global_install_command_without_cache
Dec 24, 2025
Merged

refactor(global): install command without cache#344
fengmk2 merged 1 commit intomainfrom
12-15-refactor_global_install_command_without_cache

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Dec 15, 2025

TL;DR

Add a comprehensive vite install command that adapts to the detected package manager (pnpm/yarn/npm) with support for common flags and workspace operations.

What changed?

  • Implemented a new InstallCommandOptions struct to handle various install options (prod, dev, frozen-lockfile, etc.)
  • Added package manager-specific command translation logic for pnpm, yarn (classic and berry), and npm
  • Updated the CLI interface to support all common install flags with proper descriptions
  • Removed the task-based implementation in favor of direct package manager execution
  • Added comprehensive unit tests for all supported package managers and options
  • Included detailed RFC documentation explaining the design decisions and implementation

The implementation translates a unified command interface into the appropriate package manager-specific commands:

  • Maps --frozen-lockfile to npm ci for npm
  • Handles yarn v1 vs v2+ differences (e.g., --immutable vs --frozen-lockfile)
  • Supports workspace filtering with the --filter flag
  • Provides pass-through arguments for maximum flexibility

How to test?

Run the install command with various options:

# Basic install
vite install

# Production install (no devDependencies)
vite install --prod

# Frozen lockfile (CI mode)
vite install --frozen-lockfile

# Workspace operations
vite install --filter app

# With multiple options
vite install --prod --frozen-lockfile --ignore-scripts

Verify that the command correctly translates to the appropriate package manager command based on the detected package manager in the project.

Why make this change?

This change provides a unified interface for installing dependencies across different package managers, eliminating the need to remember different syntaxes for pnpm, yarn, and npm. It simplifies workflows in monorepos and ensures consistent behavior regardless of the underlying package manager.

The implementation follows the same patterns as other package management commands while providing an intuitive interface that works across all supported package managers, making it easier for developers to work with different projects without having to learn package manager-specific commands.


Note

Introduces a unified, package-manager–aware install flow and removes the previous task-graph/caching approach.

  • Adds InstallCommandOptions and PackageManager::resolve/run_install_command to translate flags for pnpm/yarn (v1 & v2+)/npm, including npm ci for frozen lockfile, Yarn Berry modes, --filter, workspace root, and pass-through args
  • Redesigns CLI install subcommand: rich flags, optional package args (acts as add), updated help; removes auto-install/task caching paths and simplifies Cache; makes commands::install public
  • Drops task-graph dependencies (petgraph, vite_task) from global CLI; adjusts Cargo manifests; minor bench deps moved to dev-dependencies
  • Adds comprehensive unit tests and snapshot updates across PMs; includes detailed RFC (rfcs/install-command.md) documenting design and mappings

Written by Cursor Bugbot for commit 10d5bc5. This will update automatically on new commits. Configure here.

@fengmk2 fengmk2 marked this pull request as ready for review December 15, 2025 12:38
@fengmk2 fengmk2 self-assigned this Dec 15, 2025
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from 620042c to 920cb33 Compare December 15, 2025 13:47
@fengmk2 fengmk2 marked this pull request as draft December 15, 2025 13:48
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch 2 times, most recently from 7516e4d to dee5413 Compare December 16, 2025 01:25
@fengmk2 fengmk2 marked this pull request as ready for review December 16, 2025 02:08
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from dee5413 to 953d4d8 Compare December 16, 2025 06:15
@fengmk2 fengmk2 force-pushed the 12-11-refactor_cli_remove_packages_commands_from_local_cli branch 3 times, most recently from dfd9310 to c8d3b03 Compare December 17, 2025 06:17
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch 2 times, most recently from ac619b7 to cbf3d21 Compare December 17, 2025 06:44
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from cbf3d21 to 23a45e8 Compare December 17, 2025 07:52
@fengmk2 fengmk2 force-pushed the 12-11-refactor_cli_remove_packages_commands_from_local_cli branch from c8d3b03 to 17d6984 Compare December 17, 2025 07:52
@fengmk2 fengmk2 changed the base branch from 12-11-refactor_cli_remove_packages_commands_from_local_cli to graphite-base/344 December 19, 2025 00:34
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from 23a45e8 to bc4d4c2 Compare December 19, 2025 00:47
@graphite-app graphite-app Bot changed the base branch from graphite-base/344 to main December 19, 2025 00:47
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from bc4d4c2 to 9afc36d Compare December 19, 2025 00:48
Copilot AI review requested due to automatic review settings December 22, 2025 15:02
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from 9afc36d to 461ef24 Compare December 22, 2025 15:02
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from ee45142 to f5c1988 Compare December 23, 2025 08:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/global/binding/src/cli.rs
Comment thread crates/vite_install/src/commands/install.rs
Comment thread crates/vite_install/src/commands/install.rs
Comment thread crates/vite_install/src/commands/install.rs
Comment thread packages/global/snap-tests/command-install-bug-31/snap.txt
Comment thread packages/global/binding/src/cli.rs
Comment thread crates/vite_install/src/commands/install.rs
Comment thread crates/vite_install/src/commands/install.rs Outdated
Comment thread rfcs/install-command.md
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from f5c1988 to 6716f71 Compare December 23, 2025 11:53
Copilot AI review requested due to automatic review settings December 24, 2025 03:30
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from 6716f71 to 5acfe9e Compare December 24, 2025 03:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/vite_install/src/commands/install.rs
Comment thread crates/vite_install/src/commands/install.rs
Comment thread crates/vite_install/src/commands/install.rs
Comment thread crates/vite_install/src/commands/install.rs
@fengmk2 fengmk2 changed the base branch from main to graphite-base/344 December 24, 2025 04:38
@fengmk2 fengmk2 changed the base branch from graphite-base/344 to main December 24, 2025 04:38
@fengmk2 fengmk2 changed the base branch from main to graphite-base/344 December 24, 2025 04:38
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from 5acfe9e to abd0919 Compare December 24, 2025 04:38
@fengmk2 fengmk2 changed the base branch from graphite-base/344 to 12-24-test_fix_unstable_snap-test December 24, 2025 04:38
@fengmk2 fengmk2 changed the base branch from 12-24-test_fix_unstable_snap-test to graphite-base/344 December 24, 2025 05:38
@Brooooooklyn Brooooooklyn changed the base branch from graphite-base/344 to main December 24, 2025 05:38
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cursor review

@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from abd0919 to 10d5bc5 Compare December 24, 2025 05:40
@Brooooooklyn
Copy link
Copy Markdown
Member

cursor review

Comment thread crates/vite_install/src/commands/install.rs Outdated
Copilot AI review requested due to automatic review settings December 24, 2025 06:10
@fengmk2 fengmk2 force-pushed the 12-15-refactor_global_install_command_without_cache branch from 10d5bc5 to ecb915f Compare December 24, 2025 06:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/vite_install/src/commands/install.rs
Comment thread crates/vite_install/src/commands/install.rs
Comment thread crates/vite_install/src/commands/install.rs
Comment thread rfcs/install-command.md
@fengmk2 fengmk2 merged commit b1220c8 into main Dec 24, 2025
28 of 30 checks passed
Copy link
Copy Markdown
Member Author

fengmk2 commented Dec 24, 2025

Merge activity

@fengmk2 fengmk2 deleted the 12-15-refactor_global_install_command_without_cache branch December 24, 2025 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants