### Basic Install Example Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/install-command.md Demonstrates a standard installation using the 'vp install' command, showing package manager detection and installation progress. ```bash $ vp install Detected package manager: pnpm@10.15.0 Running: pnpm install Lockfile is up to date, resolution step is skipped Packages: +150 +++++++++++++++++++++++++++++++++++ Progress: resolved 150, reused 150, downloaded 0, added 150, done Done in 1.2s ``` -------------------------------- ### Vite+ Project Setup and Commands Source: https://github.com/voidzero-dev/vite-plus/blob/main/docs/guide/index.md Use these commands to create a new project, install dependencies, start the development server, check code quality, run tests, and build for production. ```bash vp create # Create a new project vp install # Install dependencies vp dev # Start the dev server vp check # Format, lint, type-check vp test # Run JavaScript tests vp build # Build for production ``` -------------------------------- ### Initial Setup for Vite-Plus Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/env-command.md Run this command to set up shims and get instructions for configuring your PATH. ```bash # Initial setup - creates shims and shows PATH configuration instructions vp env setup ``` -------------------------------- ### Initial Vite+ Setup (macOS/Linux) Source: https://github.com/voidzero-dev/vite-plus/blob/main/CONTRIBUTING.md Installs project dependencies using the 'just init' command. ```shell just init ``` -------------------------------- ### CI Install Example Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/install-command.md Shows how to perform a clean install in a CI environment using the '--frozen-lockfile' flag, which maps to 'npm ci' for npm. ```bash $ vp install --frozen-lockfile Detected package manager: npm@11.0.0 Running: npm ci added 150 packages in 2.3s Done in 2.3s ``` -------------------------------- ### Workspace Install Example Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/install-command.md Demonstrates installing packages within a specific workspace using the '--filter' flag, useful for monorepo management. ```bash $ vp install --filter app Detected package manager: pnpm@10.15.0 Running: pnpm --filter app install Scope: 1 of 5 workspace projects Packages: +50 ++++++++++++++ Progress: resolved 50, reused 50, downloaded 0, added 50, done Done in 0.5s ``` -------------------------------- ### Production Install Example Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/install-command.md Illustrates installing only production dependencies using the '--prod' flag, which is passed directly to the underlying package manager. ```bash $ vp install --prod Detected package manager: pnpm@10.15.0 Running: pnpm install --prod Packages: +80 ++++++++++++++++++++ Progress: resolved 80, reused 80, downloaded 0, added 80, done Done in 0.8s ``` -------------------------------- ### Download and Execute a Package Command Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-vpx-pnpm11/snap.txt This example demonstrates downloading and running the 'create-vue' command from an npm package. vpx handles the installation if the package is not already present. ```bash vpx create-vue my-app ``` -------------------------------- ### Install Initial Dependencies Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/command-link-pnpm10/snap.txt Run `vp install` to install the project's initial dependencies. This command shows the progress of dependency resolution and installation. ```bash vp install ``` -------------------------------- ### Explain Package Installation with JSON Output Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-why-npm10/snap.txt Use 'vp why --json' to get detailed dependency information in JSON format. This is useful for programmatic analysis. ```bash vp why testnpm2 --json # should support json output ``` -------------------------------- ### Local Development Install Flow Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/merge-global-and-local-cli.md Command for local development setup, copying the `vp` binary and symlinking `node_modules` for development. ```bash pnpm bootstrap-cli ``` -------------------------------- ### Install Dependencies with Specific Options Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/install-command.md Demonstrates various installation options including preferring offline caching, ignoring scripts, and installing only devDependencies. ```bash vp install --prefer-offline vp install --ignore-scripts vp install --dev ``` -------------------------------- ### Install Packages with 'pnpm install' Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/command-why-pnpm10/snap.txt Demonstrates the output of 'pnpm install' command, showing package resolution, download, and installation progress. ```bash vp install # should install packages first Packages: + + Progress: resolved , reused , downloaded , added , done dependencies: + testnpm2 optionalDependencies: + test-vite-plus-package-optional developmentDependencies: + test-vite-plus-package Done in ms using pnpm v ``` -------------------------------- ### Install Packages with 'vp install' Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-outdated-bun/snap.txt Installs project dependencies using the 'vp install' command, which internally uses 'bun install'. Shows the packages being installed and the total installation time. ```bash vp install # should install packages first bun install v () + test-vite-plus-top-package@ + test-vite-plus-other-optional@ + testnpm2@ 4 packages installed [ms] ``` -------------------------------- ### Verify vp Installation Source: https://github.com/voidzero-dev/vite-plus/blob/main/docs/guide/index.md After installation, run this command to verify that vp is installed correctly and to view its help information. ```bash vp help ``` -------------------------------- ### Adding Packages - Basic Examples Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/add-remove-package-commands.md Illustrates basic usage of the 'vp add' command for adding production, development, and multiple dependencies. ```bash vp add react - Add production dependency vp add -D typescript - Add dev dependency vp add react react-dom - Add multiple packages ``` -------------------------------- ### Install Commit Hooks Source: https://github.com/voidzero-dev/vite-plus/blob/main/docs/guide/commit-hooks.md Installs Git hooks and sets up the hook directory. Can be configured with custom hook directories or to skip agent setup. ```bash vp config vp config --hooks-dir .vite-hooks vp config --no-hooks vp config --no-agent ``` -------------------------------- ### Navigate and run the application Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/create-next-command-monorepo-application/snap.txt Standard workflow commands to enter the project directory and start the development server. ```bash cd apps/vite-plus-application && vp run ``` -------------------------------- ### Analyze and Report Dependencies Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/install-command.md Use the `--analyze` flag to get a detailed report of installed packages, their sizes, and the total installation time. ```bash $ vp install --analyze Installing dependencies... Added packages: react@18.3.1 (85KB) react-dom@18.3.1 (120KB) Total: 150 packages, 12.3MB Done in 2.3s ``` -------------------------------- ### Show Install Command Help Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/cli-helper-message/snap.txt Displays detailed help information for the 'vp install' command, including its options and arguments for managing project dependencies. ```bash vp install -h # show install help message ``` -------------------------------- ### Vite-Plus Global Package Configuration Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/env-command.md Example JSON configuration file for a globally installed package, detailing its name, version, platform, binaries, manager, and installation timestamp. ```json { "name": "typescript", "version": "5.7.0", "platform": { "node": "20.18.0", "npm": "10.8.0" }, "bins": ["tsc", "tsserver"], "manager": "npm", "installedAt": "2024-01-15T10:30:00Z" } ``` -------------------------------- ### Build Library with vp pack Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/command-pack/snap.txt This example demonstrates building a library using 'vp pack'. It specifies the entry point 'src/index.ts' and shows the output indicating the build process, file sizes, and completion time. ```bash vp pack src/index.ts ``` -------------------------------- ### Install a Snap Package Providing a Binary Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/env-install-binary-conflict/snap.txt Installs a Snap package named 'env-binary-conflict-pkg-a' which provides the 'env-binary-conflict-cli' binary. Verifies the installation and checks the binary configuration. ```bash vp install -g ./env-binary-conflict-pkg-a # Install pkg-a which provides env-binary-conflict-cli binary info: Installing 1 global package with Node.js ✓ Installed env-binary-conflict-pkg-a Bins: env-binary-conflict-cli ``` ```bash cat $VP_HOME/bins/env-binary-conflict-cli.json # Bin config should point to pkg-a { "name": "env-binary-conflict-cli", "package": "env-binary-conflict-pkg-a", "version": "1.0.0", "nodeVersion": "22.22.0", "source": "vp" } ``` -------------------------------- ### Get npm Global Prefix Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/npm-global-install-already-linked/snap.txt Retrieves the configured global installation prefix for npm packages. ```bash npm config get prefix ``` -------------------------------- ### Force Hooks Setup during Creation/Migration Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/config-and-staged-commands.md Use the `--hooks` flag with `vp create` or `vp migrate` to force the setup of pre-commit hooks without a prompt. Conversely, `--no-hooks` skips setup. ```bash vp create --hooks # Force hooks setup vp create --no-hooks # Skip hooks setup vp migrate --hooks # Force hooks setup vp migrate --no-hooks # Skip hooks setup ``` -------------------------------- ### Silent Installation in CI Environments Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/windows-installer.md Example of running the installer in CI environments where it automatically detects and skips interactive prompts. Also shows explicit silent mode and customization via flags. ```bash # CI environments are automatically non-interactive vp-setup.exe # Explicit silent mode (outside CI) vp-setup.exe -y # Customize vp-setup.exe --version 0.3.0 --no-node-manager --registry https://registry.npmmirror.com ``` -------------------------------- ### Vite-Plus Install Command Help Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/install-command.md Displays the help information for the `vp install` command, outlining available options and their usage. ```bash $ vp install --help ``` -------------------------------- ### Shell Mode Execution with Package Installation Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-vpx-pnpm10/snap.txt Execute a command within a shell environment, specifying a package to install if it's not found locally. This example runs 'echo "hi" | cowsay'. ```bash vpx -p cowsay -c 'echo "hi" | cowsay' ``` -------------------------------- ### Start development server Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/templates/monorepo/README.md Launches the development server for the project. ```bash vp run dev ``` -------------------------------- ### Unsupported lint-staged.config.mjs Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/migration-lintstagedrc-not-support/snap.txt Example of an unsupported lint-staged.config.mjs file format that will cause the migration to skip git hook setup. ```javascript export default { '*.js': ['oxlint', 'oxfmt'], }; ``` -------------------------------- ### Get Parseable Output with 'pnpm why --parseable' Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/command-why-pnpm10/snap.txt Outputs installation information in a parseable format, useful for scripting. ```bash vp why testnpm2 --parseable # should support parseable output /node_modules/.pnpm/testnpm2@/node_modules/testnpm2 ``` -------------------------------- ### Explain Dev Package Installation Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-why-npm10/snap.txt Use 'vp why ' for development packages to see their installation source and version. ```bash vp why test-vite-plus-package # should show why dev package is installed ``` -------------------------------- ### Scaffold New Projects with Various Frameworks Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/dlx-command.md Demonstrates creating new projects using different frontend frameworks via the vp dlx command. This simplifies project setup by leveraging remote scaffolding tools. ```bash # Create new projects with various frameworks vp dlx create-vue my-vue-app vp dlx create-react-app my-react-app vp dlx create-next-app my-next-app vp dlx create-svelte my-svelte-app vp dlx @angular/cli ng new my-angular-app ``` -------------------------------- ### `vite outdated` Global Package Check Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/outdated-package-command.md Example of using the `-g` option to check for outdated globally installed packages. ```bash # Global packages vite outdated -g # Check globally installed packages ``` -------------------------------- ### Unsupported .lintstagedrc (JSON-like) Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/migration-lintstagedrc-not-support/snap.txt Example of an unsupported .lintstagedrc file format that will cause the migration to skip git hook setup. ```yaml '*.js': - oxlint - oxfmt ``` -------------------------------- ### Setup Environment with External VP Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-env-setup-external-vp/snap.txt Configures the project's environment using the external VP binary, ensuring shims are correctly set up. ```bash VP_HOME="$(pwd)/home" ./external/vp env setup ``` -------------------------------- ### Setup Vite+ in GitHub Actions Source: https://github.com/voidzero-dev/vite-plus/blob/main/docs/guide/ci.md Use this action to install Vite+, set up the Node.js version and package manager, and enable dependency caching. ```yaml - uses: voidzero-dev/setup-vp@v1 with: node-version: '24' cache: true - run: vp install - run: vp check - run: vp test - run: vp build ``` -------------------------------- ### Explain Package Installation Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-why-npm10/snap.txt Use 'vp why ' or 'vp explain ' to understand why a package is installed and its version details. ```bash vp why testnpm2 # should show why package is installed (uses npm explain) ``` ```bash vp explain testnpm2 # should work with explain alias ``` -------------------------------- ### Snap Test Directory Structure Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/env-command.md Example directory structure for snap tests, including package.json, steps.json, and snap.txt files for environment setup and doctor commands. ```text env-setup/ ├── package.json ├── steps.json # [{"command": "vp env setup"}] └── snap.txt env-doctor/ ├── package.json ├── .node-version # "20.18.0" ├── steps.json # [{"command": "vp env doctor"}] └── snap.txt ``` -------------------------------- ### Filter Packages by Name Source: https://github.com/voidzero-dev/vite-plus/blob/main/docs/guide/run.md Use the `--filter` flag with a package name to select specific packages for task execution. This example targets packages starting with `@my/`. ```bash # By name vp run --filter @my/app build # By glob vp run --filter "@my/*" build # By directory vp run --filter ./packages/app build # Include dependencies vp run --filter "@my/app..." build # Include dependents vp run --filter "...@my/core" build # Exclude packages vp run --filter "@my/*" --filter "!@my/utils" build ``` -------------------------------- ### Global CLI Installation Comparison Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/global-cli-rust-binary.md Compares the installation process before and after the Rust binary implementation. The 'after' scenario demonstrates immediate command execution without Node.js pre-installation. ```bash # Before (requires Node.js) npm install -g vite-plus-cli vp create my-app # After (no Node.js required) curl -fsSL https://vite.plus | bash # or brew install vite-plus # or download binary directly vp create my-app # Works immediately ``` -------------------------------- ### Basic Execution Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/dlx-command.md Standard usage example for creating a project using vp dlx. ```bash $ vp dlx create-vue my-app Detected package manager: pnpm@10.15.0 Running: pnpm dlx create-vue my-app Vue.js - The Progressive JavaScript Framework ✔ Project name: my-app ✔ Add TypeScript? Yes ... ``` -------------------------------- ### Version Resolution API Request Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/upgrade-command.md This example shows the GET request format used to query the npm registry for version information, including the version number and platform-specific package details. ```http GET {registry}/vite-plus-cli/{version_or_tag} ``` -------------------------------- ### Adding Packages - Workspace Examples Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/add-remove-package-commands.md Shows how to use 'vp add' with workspace-specific options to target packages within a monorepo. ```bash vp add react --filter app - Add to specific package vp add react --filter "app*" - Add to multiple packages (pnpm) vp add @myorg/utils --workspace --filter web - Add workspace dependency vp add lodash -w - Add to workspace root ``` -------------------------------- ### Basic Installation Source: https://github.com/voidzero-dev/vite-plus/blob/main/docs/guide/install.md Run this command to install project dependencies using the detected package manager. ```bash vp install ``` -------------------------------- ### Enable Corepack with Custom Install Directory Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/shim-corepack-enable-install-directory/snap.txt This example demonstrates enabling corepack with an explicit `--install-directory` flag, showing that it respects the specified path and restores the npm shim managed by Vite+. ```bash VP_HOME="$(pwd)/home" PATH="$(pwd)/home/bin:$PATH" corepack enable --install-directory /tmp/custom-dir # Explicit --install-directory is respected, clobbered npm shim is restored corepack enable --install-directory /tmp/custom-dir ``` -------------------------------- ### Create and Link a Test Library Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/command-unlink-pnpm10/snap.txt This snippet demonstrates creating a new local library and linking it to the current project using `vp link`. It then shows the `package.json` to confirm the link. ```bash mkdir -p ../unlink-test-lib && echo '{"name": "unlink-test-lib", "version": "1.0.0"}' > ../unlink-test-lib/package.json vp link ../unlink-test-lib && cat package.json ``` -------------------------------- ### Set Up Git Hooks in package.json Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/config-and-staged-commands.md Automate hook setup by adding `vp config` to the `prepare` script in `package.json`. This ensures hooks are configured on installation or update. Custom hook directories can be specified. ```json // New project { "scripts": { "prepare": "vp config" } } ``` ```json // Migrated from husky with custom dir — dir is preserved { "scripts": { "prepare": "vp config --hooks-dir .config/husky" } } ``` ```json { "scripts": { "prepare": "vp config && npm run build" } } ``` -------------------------------- ### VS Code: Recommended Extensions Source: https://github.com/voidzero-dev/vite-plus/blob/main/docs/guide/ide-integration.md Install the Vite Plus Extension Pack for VS Code to get Oxc and Vitest integration. This is typically handled automatically by `vp create` or `vp migrate`. ```json { "recommendations": ["VoidZero.vite-plus-extension-pack"] } ``` -------------------------------- ### Navigate and Run Library Project Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/create-next-command-library/snap.txt After creating the library, navigate into the project directory and use `vp run` to execute tasks. This command is suggested after the project scaffolding is complete. ```bash cd vite-plus-library && vp run ``` -------------------------------- ### Basic 'vp why' Usage Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/why-package-command.md Demonstrates the fundamental usage of the 'vp why' and 'vp explain' commands with single package names. ```bash # Basic usage vp why react vp explain lodash ``` -------------------------------- ### Phase 2: Migration Execution Feedback Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/migration-command.md Example output during Phase 2 of the migration, showing progress and confirmation messages as tasks are executed. This includes package manager installation, linting/formatting migrations, and configuration updates. ```bash pnpm@latest installing... pnpm@ installed Migrating ESLint config to Oxlint... ESLint config migrated to .oxlintrc.json Replacing ESLint comments with Oxlint equivalents... ESLint comments replaced ✔ Removed eslint.config.mjs ✔ Created vite.config.ts in vite.config.ts ✔ Merged .oxlintrc.json into vite.config.ts ✔ Merged staged config into vite.config.ts Wrote agent instructions to AGENTS.md ✔ Migration completed! ``` -------------------------------- ### Create and Run a TypeScript File Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/plain-terminal-ui-nested/snap.txt Demonstrates creating a simple TypeScript file and then running it using 'vp run hello', showing linting results and cache status. ```bash > echo 'console.log(123)' > a.ts > vp run hello # report cache status from the inner runner $ vp lint ./src Found 0 warnings and 0 errors. Finished in ms on 1 file with rules using threads. $ vp lint Found 0 warnings and 0 errors. Finished in ms on 3 files with rules using threads. --- vp run: 0/2 cache hit (0%). root-package#hello (and 1 more) not cached because they modified their inputs. (Run `vp run --last-details` for full details) ``` -------------------------------- ### Interactive Package Addition Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/add-remove-package-commands.md Use the `--interactive` flag to select packages and their installation type (prod, dev, peer) through a guided prompt. This is useful when you need to manually choose from a list of similar packages or versions. ```bash $ vp add --interactive ? Select for package > tsdown ❯ tsdown v0.15.7 - git+https://github.com/rolldown/tsdown.git tsdown-config-silverwind v1.4.0 - git+https://github.com/silverwind/tsdown-config-silverwind.git @storm-software/tsdown v0.45.0 - git+https://github.com/storm-software/storm-ops.git create-tsdown v0.15.7 - git+https://github.com/rolldown/tsdown.git shadcn-auv v0.0.1 - git+https://github.com/ohojs/shadcn-auv.git ts-build-wizard v1.0.3 - git+https://github.com/Alireza-Tabatabaeian/react-app-registry.git vite-plugin-shadcn-registry v0.0.6 - git+https://github.com/myshkouski/vite-plugin-shadcn-registry.git @qds.dev/tools v0.3.3 - https://www.npmjs.com/package/@qds.dev/tools feishu-bot-notify v0.1.3 - git+https://github.com/duowb/feishu-bot-notify.git @memo28.pro/bundler v0.0.2 - https://www.npmjs.com/package/@memo28.pro/bundler tsdown-jsr-exports-lint v0.1.4 - git+https://github.com/kazupon/tsdown-jsr-exports-lint.git @miloas/tsdown v0.13.0 - git+https://github.com/rolldown/tsdown.git @socket-synced-state/server v0.0.9 - https://www.npmjs.com/package/@socket-synced-state/server @gamedev-sensei/tsdown-config v2.0.1 - git+ssh://git@github.com/gamedev-sensei/package-extras.git ↓ 0xpresc-test v0.1.0 - https://www.npmjs.com/package/0xpresc-test ? install tsdown as › - Use arrow-keys. Return to submit. ❯ prod dev peer ``` -------------------------------- ### When to Use `vpx` vs. `vp dlx` Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/vpx-command.md Provides guidance on choosing between `vpx` and `vp dlx` based on whether you want to prioritize local installations or always fetch the latest from the registry. ```markdown # **`vpx eslint .`** — "Run eslint, preferring my local version" # **`vp dlx create-vue my-app`** — "Download and run create-vue from the registry" # **`vpx create-vue my-app`** — Same as `vp dlx` in practice, since `create-vue` is never installed locally ``` -------------------------------- ### Get Project-Scoped Configuration Value Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-config-yarn4/snap.txt Retrieves a configuration value from the project scope using Yarn 4. Note: This example shows the command usage; actual execution might result in an error if the key does not exist. ```bash vp pm config get vite-plus-pm-config-test-key --location project ``` ```bash yarn config get [--why] [--json] [--no-redacted] ``` -------------------------------- ### Accessing site data with useData in VitePress Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/command-doc/api-examples.md The useData() API allows developers to retrieve site, theme, page, and frontmatter data. It is designed for use within Vue components or script setup blocks in VitePress files. ```markdown ## Results ### Theme Data
{{ theme }}
### Page Data
{{ page }}
### Page Frontmatter
{{ frontmatter }}
``` ```javascript ``` -------------------------------- ### Display Help Message for 'vp create' Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-create-help/snap.txt Shows the detailed help message for the 'vp create' command, including usage, arguments, options, and template examples. ```bash vp create --help ``` -------------------------------- ### Help Output for `vp pm approve-builds` Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-pm-approve-builds-bun/snap.txt Displays the help information for the `vp pm approve-builds` command, including its usage, arguments, and options. Note the caveat regarding the `--all` flag. ```bash vp pm approve-builds --help ``` -------------------------------- ### Test Installer Build and Installation in CI Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/windows-installer.md CI job to build the installer from source, install it silently using PowerShell, and verify the installation across multiple shells. ```yaml test-vp-setup-exe: name: Test vp-setup.exe (pwsh) runs-on: windows-latest steps: - uses: actions/checkout@v4 - uses: oxc-project/setup-rust@v1 - name: Build vp-setup.exe run: cargo build --release -p vite_installer - name: Install via vp-setup.exe (silent) shell: pwsh run: ./target/release/vp-setup.exe env: VP_VERSION: alpha - name: Verify installation (pwsh/cmd/bash) # verifies from all three shells after a single install ``` -------------------------------- ### Run Universal Create-* Template Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/code-generator.md Execute any standard `create-*` package from the npm ecosystem. This requires no additional setup and leverages the vast existing template landscape. ```bash vp create create-vite ``` ```bash vp create create-next-app ``` ```bash vp create create-nuxt ``` -------------------------------- ### Local Vite-Plus Resolution using oxc_resolver in Rust Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/merge-global-and-local-cli.md This Rust function uses 'oxc_resolver' to locate the 'vite-plus/package.json' file starting from a given project path. If found and the 'dist/bin.js' exists within its directory, it returns the path to the local 'bin.js'; otherwise, it returns None, indicating a fallback to the global installation is necessary. ```rust // Uses oxc_resolver to resolve vite-plus/package.json from the project directory // If found and dist/bin.js exists, runs the local installation // Otherwise falls back to the global installation's dist/bin.js fn resolve_local_vite_plus(project_path: &AbsolutePath) -> Option { let resolver = Resolver::new(ResolveOptions { condition_names: vec!["import".into(), "node".into()], ..ResolveOptions::default() }); let resolved = resolver.resolve(project_path, "vite-plus/package.json").ok()?; let pkg_dir = resolved.path().parent()?; let bin_js = pkg_dir.join("dist").join("bin.js"); if bin_js.exists() { AbsolutePathBuf::new(bin_js) } else { None } } ``` -------------------------------- ### Prepare External VP and Project Home Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-env-setup-external-vp/snap.txt Creates necessary directories for an isolated external VP installation and the project's home directory. ```bash mkdir -p external home ``` -------------------------------- ### Build Executable with Vite-Plus Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-pack-exe/snap.txt Use the `vp pack` command with the `--exe` option to create an executable from your entry point. The `exe` option is experimental. ```bash vp pack src/index.ts --exe 2>&1 ``` -------------------------------- ### Install Packages with Alias Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-add-yarn4-with-workspace/snap.txt Use `vp install` with the `-O` flag to install optional packages by alias. This command filters installations to apply to all packages within the workspace. ```bash vp install -O test-vite-plus-package-optional --filter "*" && cat package.json packages/app/package.json packages/admin/package.json packages/utils/package.json # should install packages alias for add command ``` -------------------------------- ### Removing Packages - Basic Examples Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/add-remove-package-commands.md Demonstrates the fundamental usage of the 'vp remove' command for uninstalling single or multiple packages. ```bash vp remove lodash - Remove package vp rm axios underscore - Remove multiple packages ``` -------------------------------- ### Explain Multiple Package Installations Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-why-npm10/snap.txt Provide multiple package names to 'vp why' to analyze the dependencies of several packages simultaneously. ```bash vp why testnpm2 test-vite-plus-package # should support multiple packages ``` -------------------------------- ### Install dependencies after cloning monorepo Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/add-remove-package-commands.md Run `vp install` to install all dependencies for the monorepo after cloning. ```bash # Clone new monorepo git clone vp install ``` -------------------------------- ### Running Package Manager Commands with Managed Runtime Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/global-cli-rust-binary.md Illustrates how the CLI automatically handles Node.js and package manager provisioning for commands like `vp install`. This ensures package managers can run even if Node.js is not pre-installed on the system. ```bash # User runs install command (no Node.js pre-installed on system) vp install lodash # CLI automatically: # 1. Checks if managed Node.js is cached # 2. Downloads Node.js 22.22.0 if not present # 3. Detects workspace package manager (pnpm/npm/yarn) # 4. Downloads package manager if needed # 5. Executes: node /path/to/pnpm install lodash ``` -------------------------------- ### Install Packages with Vite Plus Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-list-pnpm10-with-workspace/snap.txt Installs packages for the project. Ensure packages are installed first. ```bash vp install # should install packages first ``` -------------------------------- ### Installing Global Packages with Vite-Plus Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/env-command.md Shows how to install global packages using the 'vp install -g' command, with options to specify the Node.js version or install multiple packages simultaneously. ```bash # Install a global package (uses Node.js version from current directory) vp install -g typescript # Install with a specific Node.js version vp install -g --node 22 typescript vp install -g --node 20.18.0 typescript vp install -g --node lts typescript # Install multiple packages vp install -g typescript eslint prettier ``` -------------------------------- ### vp pack CLI Help Output Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/pack-command.md Displays all available options and commands for the `vp pack` CLI. Use this to understand the full range of customization for bundling. ```bash $ vp pack -h vp pack Usage: $ vp pack [...files] Commands: [...files] Bundle files Options: --config-loader Config loader to use: auto, native, unrun (default: auto) --no-config Disable config file -f, --format Bundle format: esm, cjs, iife, umd (default: esm) --clean Clean output directory, --no-clean to disable --deps.never-bundle Mark dependencies as external --minify Minify output --devtools Enable devtools integration --debug [feat] Show debug logs --target Bundle target, e.g "es2015", "esnext" -l, --logLevel Set log level: info, warn, error, silent --fail-on-warn Fail on warnings (default: true) --no-write Disable writing files to disk, incompatible with watch mode -d, --out-dir Output directory (default: dist) --treeshake Tree-shake bundle (default: true) --sourcemap Generate source map (default: false) --shims Enable cjs and esm shims (default: false) --platform Target platform (default: node) --dts Generate dts files --publint Enable publint (default: false) --attw Enable Are the types wrong integration (default: false) --unused Enable unused dependencies check (default: false) -w, --watch [path] Watch mode --ignore-watch Ignore custom paths in watch mode --from-vite [vitest] Reuse config from Vite or Vitest --report Size report (default: true) --env.* Define compile-time env variables --env-file Load environment variables from a file --env-prefix Prefix for env variables to inject into the bundle --on-success Command to run on success --copy Copy files to output dir --public-dir Alias for --copy, deprecated --tsconfig Set tsconfig path --unbundle Unbundle mode -W, --workspace [dir] Enable workspace mode -F, --filter Filter configs (cwd or name) --exports Generate export-related metadata for package.json (experimental) --exe Bundle as executable using Node.js SEA (experimental) -h, --help Display this message ``` -------------------------------- ### Unified Install Command for Vite+ Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/install-command.md Use `vp install` or its alias `vp i` to install project dependencies. This command automatically detects the package manager and applies the correct installation logic. ```bash vp install vp i ``` -------------------------------- ### Migration from Package Manager Commands Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/add-remove-package-commands.md Demonstrates the transition from using individual package manager commands (pnpm, yarn, npm, bun) to the unified 'vp add' command. ```bash # Old way (package manager specific) pnpm add react yarn add react npm install react bun add react # New way (works with any package manager) vp add react ``` -------------------------------- ### Install Options Structure Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/install-command.md Defines the structure for install options, encompassing various flags for package installation. ```rust pub struct InstallOptions { pub prod: bool, pub dev: bool, pub no_optional: bool, pub frozen_lockfile: bool, pub lockfile_only: bool, pub prefer_offline: bool, pub offline: bool, pub force: bool, pub ignore_scripts: bool, pub no_lockfile: bool, pub fix_lockfile: bool, pub shamefully_hoist: bool, pub resolution_only: bool, pub filters: Vec, pub workspace_root: bool, pub extra_args: Vec, } ``` -------------------------------- ### Create Project with Pre-commit Hooks Setup Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-create-help/snap.txt Sets up pre-commit hooks for the project. This is the default behavior in non-interactive mode. ```bash vp create vite --hooks ``` -------------------------------- ### Install Packages with Bun Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-list-bun/snap.txt Installs project dependencies using Bun. Ensure packages are installed first. ```bash vp install # should install packages first bun install v () + test-vite-plus-package@ + test-vite-plus-package-optional@ + testnpm2@ 3 packages installed [ms] ``` -------------------------------- ### Initialize Git and Set Hooks Path Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/migration-hooks-skip-on-existing-hookspath/snap.txt This snippet shows the initial Git commands to set up a repository and configure a custom hooks path. ```bash git init git config core.hooksPath .custom-hooks ``` -------------------------------- ### Error: Global install rejected Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/command-pm-global-rejected/snap.txt Attempting to install a global package using `vp install -g` results in an error. Global package operations are restricted to the globally installed `vp` CLI. ```bash vp install -g testnpm2 # rejected: managed install error: Global package operations (`-g`/`--global`) are only supported by the globally-installed `vp` CLI. See https://viteplus.dev/guide/ to install it, then run the same command via the global `vp` binary. ``` -------------------------------- ### Build Library from Root Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/command-pack-monorepo/snap.txt Builds the 'hello' library from the project root. Verify the output in the 'dist' directory. ```bash vp run hello#build # should build the library from root ls packages/hello/dist # should have the library index.cjs ``` -------------------------------- ### Inspect Installed Dependencies Source: https://github.com/voidzero-dev/vite-plus/blob/main/docs/guide/install.md Provides information about installed packages, including lists, reasons for installation, and registry metadata. ```bash vp list vp why react vp info react ``` -------------------------------- ### Lockfile Only Installation Source: https://github.com/voidzero-dev/vite-plus/blob/main/docs/guide/install.md Installs dependencies strictly from the lockfile without checking for newer versions. This is the most reproducible install method. ```bash vp install --lockfile-only ``` -------------------------------- ### Create and Link Test Library Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-unlink-pnpm11/snap.txt This sequence first creates a new directory and a minimal package.json for a test library, then links it using `vp link` and displays the updated package.json to confirm the link. ```bash mkdir -p ../unlink-test-lib && echo '{"name": "unlink-test-lib", "version": "1.0.0"}' > ../unlink-test-lib/package.json # create test library vp link ../unlink-test-lib && cat package.json # link the library first ``` -------------------------------- ### Build and Install Vite+ from Source Source: https://github.com/voidzero-dev/vite-plus/blob/main/AGENTS.md Commands for building a release version and bootstrapping the CLI. Use `pnpm bootstrap-cli` to validate the global CLI installation. ```bash just build # Release build for Vite+ pnpm bootstrap-cli # Build packages, compile vp/NAPI, and install the global CLI vp --version ``` -------------------------------- ### Create a Test Library Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests/command-link-pnpm10/snap.txt Create a new local library directory and a basic `package.json` file for testing the linking functionality. ```bash mkdir -p ../test-lib-pnpm && echo '{"name": "testnpm2", "version": "1.0.0"}' > ../test-lib-pnpm/package.json ``` -------------------------------- ### Install Packages with Vite-Plus Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-why-pnpm10-with-workspace/snap.txt Installs packages across all workspace projects or specified packages. Shows installation progress and summary. ```bash vp install Scope: all workspace projects Packages: + + Progress: resolved , reused , downloaded , added , done dependencies: + testnpm2 (1.0.1 is available) Done in ms using pnpm v ``` -------------------------------- ### Install Packages with vp install Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-list-yarn1/snap.txt Installs project dependencies. This command should be run before other `vp pm` commands if no lockfile is present. ```bash vp install # should install packages first yarn install v info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. Done in ms. ``` -------------------------------- ### Initialize Project and Configure Vite Plus Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-config-no-agent-writes/snap.txt Initializes a new Git repository and runs the Vite Plus configuration command. This sets up the project for Vite Plus. ```bash git init vp config ``` -------------------------------- ### Install Dependencies and Ignore Scripts Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/create-framework-shim-astro/snap.txt Navigate to the Astro project directory and install dependencies using `vp install`. The `--ignore-scripts` flag prevents script execution during installation, and `--no-frozen-lockfile` allows modifications to the lockfile. ```bash cd my-astro-app && vp install --ignore-scripts -- --no-frozen-lockfile # install dependencies ``` -------------------------------- ### Usage Examples Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/pack-command.md Common CLI usage patterns for bundling, watching, and workspace operations. ```bash # Bundle with defaults (ESM, node platform) vp pack src/index.ts # Multiple formats vp pack src/index.ts --format esm --format cjs # With declaration files vp pack src/index.ts --dts # Watch mode with success hook vp pack src/index.ts --watch --on-success 'node dist/index.mjs' # Workspace mode vp pack --workspace --filter my-lib # Bundle as executable (experimental, Node.js >= 25.7.0) vp pack src/cli.ts --exe ``` -------------------------------- ### Update Command Syntax and Examples Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/update-package-command.md Provides detailed examples of the `vp update` command, including updating specific packages, all packages, and using various options. ```bash vp update react react-dom ``` ```bash vp update react --latest vp up react -L ``` ```bash vp update ``` ```bash vp update --latest ``` ```bash vp update -D ``` ```bash vp update -P ``` ```bash vp update --filter app ``` ```bash vp update react --latest --filter "app*" ``` ```bash vp update -r ``` ```bash vp update -g typescript ``` ```bash vp update --interactive vp up -i ``` ```bash vp update --no-optional ``` ```bash vp update --no-save ``` ```bash vp update react --latest --no-save ``` -------------------------------- ### Install package alias for add command Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-add-npm10-with-workspace/snap.txt The 'vp install' command functions as an alias for 'vp add' when installing packages. Use '--filter "*" --workspace-root' to install to all workspaces including the root. ```bash vp install test-vite-plus-package@1.0.0 --filter "*" --workspace-root -- --no-audit && cat package.json packages/app/package.json packages/utils/package.json # should install packages alias for add command ``` -------------------------------- ### Verify Global Package Installation Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/npm-global-install-already-linked/snap.txt Checks if the globally installed package's executable is callable after installation via Vite Plus. ```bash npm-global-linked-cli # Should be callable via the link ``` -------------------------------- ### Utilize Development Utilities with vp dlx Source: https://github.com/voidzero-dev/vite-plus/blob/main/rfcs/dlx-command.md Demonstrates using vp dlx to run development utilities for setting up a quick HTTP server, mocking APIs with JSON Server, analyzing bundles, and visualizing dependencies. ```bash # Quick HTTP server vp dlx serve dist/ # JSON server for mocking vp dlx json-server db.json # Bundle analyzer vp dlx source-map-explorer dist/*.js # Dependency visualization vp dlx madge --image deps.svg src/ ``` -------------------------------- ### Install a Global Package from Current Directory Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/command-env-install-global-local/snap.txt Installs a package globally from the current directory. Shows the package name and its binaries after installation. ```bash vp install -g . info: Installing 1 global package with Node.js ✓ Installed just-a-normal-package Bins: just-a-normal-package ``` -------------------------------- ### Display Copilot Setup Workflow File Source: https://github.com/voidzero-dev/vite-plus/blob/main/packages/cli/snap-tests-global/new-create-vite/snap.txt View the content of the generated Copilot setup workflow file (`copilot-setup-steps.yml`) for a Vite application created with the Copilot agent. ```bash cat copilot-app/.github/workflows/copilot-setup-steps.yml ```