diff --git a/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/package.json b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/package.json new file mode 100644 index 0000000000..d2767f0eb9 --- /dev/null +++ b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-add-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/packages/app/package.json b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/packages/app/package.json new file mode 100644 index 0000000000..fd1f8f6386 --- /dev/null +++ b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/packages/app/package.json @@ -0,0 +1,3 @@ +{ + "name": "app" +} diff --git a/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/packages/utils/package.json b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/packages/utils/package.json new file mode 100644 index 0000000000..d063b255a7 --- /dev/null +++ b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/packages/utils/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true +} diff --git a/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/pnpm-workspace.yaml b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/pnpm-workspace.yaml new file mode 100644 index 0000000000..924b55f42e --- /dev/null +++ b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/snap.txt b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/snap.txt new file mode 100644 index 0000000000..e8350386fd --- /dev/null +++ b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/snap.txt @@ -0,0 +1,215 @@ +> vp add testnpm2 -D -w && cat package.json # should add package to workspace root +Progress: resolved , reused , downloaded , added , done + +devDependencies: ++ testnpm2 ^1.0.1 + +Packages: + ++ +Done in ms using pnpm v +{ + "name": "command-add-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "testnpm2": "^1.0.1" + } +} + +> vp add @vite-plus-test/utils --workspace && cat package.json # should add @vite-plus-test/utils to workspace root +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ @vite-plus-test/utils workspace:* + +Already up to date +Done in ms using pnpm v +{ + "name": "command-add-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "testnpm2": "^1.0.1" + }, + "dependencies": { + "@vite-plus-test/utils": "workspace:*" + } +} + +> vp add testnpm2 test-vite-plus-install@1.0.0 --filter app && cat package.json packages/app/package.json packages/utils/package.json # should add packages to packages/app +Progress: resolved , reused , downloaded , added , done +. | +1 + +Done in ms using pnpm v +{ + "name": "command-add-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "testnpm2": "^1.0.1" + }, + "dependencies": { + "@vite-plus-test/utils": "workspace:*" + } +} +{ + "name": "app", + "dependencies": { + "test-vite-plus-install": "1.0.0", + "testnpm2": "^1.0.1" + } +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true +} + +> vp add @vite-plus-test/utils --workspace --filter app && cat package.json packages/app/package.json packages/utils/package.json # should add @vite-plus-test/utils to packages/app +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "command-add-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "testnpm2": "^1.0.1" + }, + "dependencies": { + "@vite-plus-test/utils": "workspace:*" + } +} +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "1.0.0", + "testnpm2": "^1.0.1" + } +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true +} + +> vp add -E testnpm2 test-vite-plus-install --filter "*" && cat package.json packages/app/package.json packages/utils/package.json # should add testnpm2 test-vite-plus-install to all packages except workspace root +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "command-add-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "testnpm2": "^1.0.1" + }, + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "1.0.0" + } +} +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "1.0.0", + "testnpm2": "^1.0.1" + } +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true, + "dependencies": { + "test-vite-plus-install": "1.0.0", + "testnpm2": "^1.0.1" + } +} + +> vp install test-vite-plus-package@1.0.0 --filter "*" --workspace-root --save-catalog && cat package.json packages/app/package.json packages/utils/package.json pnpm-workspace.yaml # should install packages alias for add command +. | +1 + +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "command-add-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "testnpm2": "^1.0.1" + }, + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "1.0.0", + "test-vite-plus-package": "catalog:" + } +} +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "1.0.0", + "test-vite-plus-package": "catalog:", + "testnpm2": "^1.0.1" + } +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true, + "dependencies": { + "test-vite-plus-install": "1.0.0", + "test-vite-plus-package": "catalog:", + "testnpm2": "^1.0.1" + } +} +packages: + - packages/* +catalog: + test-vite-plus-package: + +> vp add --filter app test-vite-plus-package-optional --save-catalog-name v1 && cat packages/app/package.json pnpm-workspace.yaml # should add with save-catalog-name +Progress: resolved , reused , downloaded , added , done +. | +1 + +Done in ms using pnpm v +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "1.0.0", + "test-vite-plus-package": "catalog:", + "test-vite-plus-package-optional": "catalog:v1", + "testnpm2": "^1.0.1" + } +} +packages: + - packages/* +catalog: + test-vite-plus-package: +catalogs: + v1: + test-vite-plus-package-optional: ^1.0.0 + +> vp add --filter=./packages/utils test-vite-plus-package-optional -O --save-catalog-name v2 && cat packages/utils/package.json pnpm-workspace.yaml # should add other with save-catalog-name +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true, + "dependencies": { + "test-vite-plus-install": "1.0.0", + "test-vite-plus-package": "catalog:", + "testnpm2": "^1.0.1" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "catalog:v2" + } +} +packages: + - packages/* +catalog: + test-vite-plus-package: +catalogs: + v1: + test-vite-plus-package-optional: ^1.0.0 + v2: + test-vite-plus-package-optional: ^1.0.0 diff --git a/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/steps.json b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/steps.json new file mode 100644 index 0000000000..3400981d3e --- /dev/null +++ b/packages/cli/snap-tests-global/command-add-pnpm11-with-workspace/steps.json @@ -0,0 +1,13 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp add testnpm2 -D -w && cat package.json # should add package to workspace root", + "vp add @vite-plus-test/utils --workspace && cat package.json # should add @vite-plus-test/utils to workspace root", + "vp add testnpm2 test-vite-plus-install@1.0.0 --filter app && cat package.json packages/app/package.json packages/utils/package.json # should add packages to packages/app", + "vp add @vite-plus-test/utils --workspace --filter app && cat package.json packages/app/package.json packages/utils/package.json # should add @vite-plus-test/utils to packages/app", + "vp add -E testnpm2 test-vite-plus-install --filter \"*\" && cat package.json packages/app/package.json packages/utils/package.json # should add testnpm2 test-vite-plus-install to all packages except workspace root", + "vp install test-vite-plus-package@1.0.0 --filter \"*\" --workspace-root --save-catalog && cat package.json packages/app/package.json packages/utils/package.json pnpm-workspace.yaml # should install packages alias for add command", + "vp add --filter app test-vite-plus-package-optional --save-catalog-name v1 && cat packages/app/package.json pnpm-workspace.yaml # should add with save-catalog-name", + "vp add --filter=./packages/utils test-vite-plus-package-optional -O --save-catalog-name v2 && cat packages/utils/package.json pnpm-workspace.yaml # should add other with save-catalog-name" + ] +} diff --git a/packages/cli/snap-tests-global/command-add-pnpm11/package.json b/packages/cli/snap-tests-global/command-add-pnpm11/package.json new file mode 100644 index 0000000000..9373cf5a38 --- /dev/null +++ b/packages/cli/snap-tests-global/command-add-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-add-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-add-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-add-pnpm11/snap.txt new file mode 100644 index 0000000000..41fc9379cd --- /dev/null +++ b/packages/cli/snap-tests-global/command-add-pnpm11/snap.txt @@ -0,0 +1,150 @@ +> vp add --help # should show help +Usage: vp add [OPTIONS] ... [-- ...] + +Add packages to dependencies + +Arguments: + ... Packages to add + [PASS_THROUGH_ARGS]... Additional arguments to pass through to the package manager + +Options: + -P, --save-prod Save to `dependencies` (default) + -D, --save-dev Save to `devDependencies` + --save-peer Save to `peerDependencies` and `devDependencies` + -O, --save-optional Save to `optionalDependencies` + -E, --save-exact Save exact version rather than semver range + --save-catalog-name Save the new dependency to the specified catalog name + --save-catalog Save the new dependency to the default catalog + --allow-build A list of package names allowed to run postinstall + --filter Filter packages in monorepo (can be used multiple times) + -w, --workspace-root Add to workspace root + --workspace Only add if package exists in workspace (pnpm-specific) + -g, --global Install globally + --node Node.js version to use for global installation (only with -g) + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +[2]> vp add # should error because no packages specified +error: the following required arguments were not provided: + ... + +Usage: vp add ... [-- ...] + +For more information, try '--help'. + +> vp add testnpm2 -D -- --loglevel=verbose --verbose && cat package.json # should add package as dev dependencies +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +devDependencies: ++ testnpm2 + +Done in ms using pnpm v +{ + "name": "command-add-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "testnpm2": "^1.0.1" + } +} + +> vp add testnpm2 test-vite-plus-install --allow-build=test-vite-plus-install && cat package.json # should add packages to dependencies +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ test-vite-plus-install + +Done in ms using pnpm v +{ + "name": "command-add-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "testnpm2": "^1.0.1" + }, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + } +} + +> vp install test-vite-plus-package@1.0.0 --save-peer && cat package.json # should install package alias for add +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +peerDependencies: ++ test-vite-plus-package + +devDependencies: ++ test-vite-plus-package + +Done in ms using pnpm v +{ + "name": "command-add-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "test-vite-plus-package": "1.0.0", + "testnpm2": "^1.0.1" + }, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "peerDependencies": { + "test-vite-plus-package": "1.0.0" + } +} + +> vp add test-vite-plus-package-optional -O && cat package.json # should add package as optional dependencies +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +optionalDependencies: ++ test-vite-plus-package-optional + +Done in ms using pnpm v +{ + "name": "command-add-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "test-vite-plus-package": "1.0.0", + "testnpm2": "^1.0.1" + }, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "peerDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} + +> vp add test-vite-plus-package-optional -- --loglevel=warn && cat package.json # support pass through arguments +{ + "name": "command-add-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "test-vite-plus-package": "1.0.0", + "testnpm2": "^1.0.1" + }, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "peerDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} diff --git a/packages/cli/snap-tests-global/command-add-pnpm11/steps.json b/packages/cli/snap-tests-global/command-add-pnpm11/steps.json new file mode 100644 index 0000000000..2c0868694e --- /dev/null +++ b/packages/cli/snap-tests-global/command-add-pnpm11/steps.json @@ -0,0 +1,12 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp add --help # should show help", + "vp add # should error because no packages specified", + "vp add testnpm2 -D -- --loglevel=verbose --verbose && cat package.json # should add package as dev dependencies", + "vp add testnpm2 test-vite-plus-install --allow-build=test-vite-plus-install && cat package.json # should add packages to dependencies", + "vp install test-vite-plus-package@1.0.0 --save-peer && cat package.json # should install package alias for add", + "vp add test-vite-plus-package-optional -O && cat package.json # should add package as optional dependencies", + "vp add test-vite-plus-package-optional -- --loglevel=warn && cat package.json # support pass through arguments" + ] +} diff --git a/packages/cli/snap-tests-global/command-cache-pnpm11/package.json b/packages/cli/snap-tests-global/command-cache-pnpm11/package.json new file mode 100644 index 0000000000..f101e9becd --- /dev/null +++ b/packages/cli/snap-tests-global/command-cache-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-cache-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt new file mode 100644 index 0000000000..046e134dbe --- /dev/null +++ b/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt @@ -0,0 +1,17 @@ +> vp pm cache --help # should show help +Usage: vp pm cache [-- ...] + +Manage package cache + +Arguments: + Subcommand: dir, path, clean + [PASS_THROUGH_ARGS]... Additional arguments + +Options: + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp pm cache dir > /dev/null # should show cache directory (uses pnpm store path) +> vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path) \ No newline at end of file diff --git a/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json b/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json new file mode 100644 index 0000000000..23198b09c4 --- /dev/null +++ b/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json @@ -0,0 +1,7 @@ +{ + "commands": [ + "vp pm cache --help # should show help", + "vp pm cache dir > /dev/null # should show cache directory (uses pnpm store path)", + "vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path)" + ] +} diff --git a/packages/cli/snap-tests-global/command-config-pnpm11/package.json b/packages/cli/snap-tests-global/command-config-pnpm11/package.json new file mode 100644 index 0000000000..1ea057b55f --- /dev/null +++ b/packages/cli/snap-tests-global/command-config-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-config-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-config-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-config-pnpm11/snap.txt new file mode 100644 index 0000000000..5f867fb5b5 --- /dev/null +++ b/packages/cli/snap-tests-global/command-config-pnpm11/snap.txt @@ -0,0 +1,23 @@ +> vp pm config --help # should show help +Usage: vp pm config + +Manage package manager configuration + +Commands: + list List all configuration + get Get configuration value + set Set configuration value + delete Delete configuration key + +Options: + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp pm config list --location project > /dev/null # should list all project configuration +> vp pm config set vitePlusPmConfigTestKey test-value --location project # should set config value in project scope +> vp pm config get vitePlusPmConfigTestKey --location project # should get config value from project scope +test-value + +> vp pm config delete vitePlusPmConfigTestKey --location project # should delete config key from project scope \ No newline at end of file diff --git a/packages/cli/snap-tests-global/command-config-pnpm11/steps.json b/packages/cli/snap-tests-global/command-config-pnpm11/steps.json new file mode 100644 index 0000000000..a18d3b2962 --- /dev/null +++ b/packages/cli/snap-tests-global/command-config-pnpm11/steps.json @@ -0,0 +1,9 @@ +{ + "commands": [ + "vp pm config --help # should show help", + "vp pm config list --location project > /dev/null # should list all project configuration", + "vp pm config set vitePlusPmConfigTestKey test-value --location project # should set config value in project scope", + "vp pm config get vitePlusPmConfigTestKey --location project # should get config value from project scope", + "vp pm config delete vitePlusPmConfigTestKey --location project # should delete config key from project scope" + ] +} diff --git a/packages/cli/snap-tests-global/command-dedupe-pnpm11/package.json b/packages/cli/snap-tests-global/command-dedupe-pnpm11/package.json new file mode 100644 index 0000000000..33a1c50d94 --- /dev/null +++ b/packages/cli/snap-tests-global/command-dedupe-pnpm11/package.json @@ -0,0 +1,14 @@ +{ + "name": "command-dedupe-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-dedupe-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-dedupe-pnpm11/snap.txt new file mode 100644 index 0000000000..405b61bdca --- /dev/null +++ b/packages/cli/snap-tests-global/command-dedupe-pnpm11/snap.txt @@ -0,0 +1,127 @@ +> vp dedupe --help # should show help +Usage: vp dedupe [OPTIONS] [-- ...] + +Deduplicate dependencies + +Arguments: + [PASS_THROUGH_ARGS]... Additional arguments to pass through to the package manager + +Options: + --check Check if deduplication would make changes + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp dedupe && cat package.json # should dedupe dependencies +Already up to date +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ testnpm2 + +optionalDependencies: ++ test-vite-plus-package-optional + +devDependencies: ++ test-vite-plus-package + +{ + "name": "command-dedupe-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} + +> vp dedupe --check && cat package.json # should check if deduplication would make changes +Progress: resolved , reused , downloaded , added , done + +{ + "name": "command-dedupe-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} + +> vp dedupe -- --loglevel=warn && cat package.json # support pass through arguments +{ + "name": "command-dedupe-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} + +[1]> json-edit package.json '_.dependencies = {}' && cat package.json && vp dedupe --check # should check fails because no dependencies +{ + "name": "command-dedupe-pnpm11", + "version": "1.0.0", + "dependencies": {}, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} +Progress: resolved , reused , downloaded , added , done + + ERR_PNPM_DEDUPE_CHECK_ISSUES  Dedupe --check found changes to the lockfile + +Importers +. +└── - testnpm2 + + +Packages +- testnpm2@ + +Run pnpm dedupe to apply the changes above. + + +> vp dedupe && cat package.json && vp dedupe --check # should dedupe fix the change by removing the dependencies +Packages: -1 +- +Progress: resolved , reused , downloaded , added , done + +dependencies: +- testnpm2 + +{ + "name": "command-dedupe-pnpm11", + "version": "1.0.0", + "dependencies": {}, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} +Progress: resolved , reused , downloaded , added , done + diff --git a/packages/cli/snap-tests-global/command-dedupe-pnpm11/steps.json b/packages/cli/snap-tests-global/command-dedupe-pnpm11/steps.json new file mode 100644 index 0000000000..6b161dfdc9 --- /dev/null +++ b/packages/cli/snap-tests-global/command-dedupe-pnpm11/steps.json @@ -0,0 +1,10 @@ +{ + "commands": [ + "vp dedupe --help # should show help", + "vp dedupe && cat package.json # should dedupe dependencies", + "vp dedupe --check && cat package.json # should check if deduplication would make changes", + "vp dedupe -- --loglevel=warn && cat package.json # support pass through arguments", + "json-edit package.json '_.dependencies = {}' && cat package.json && vp dedupe --check # should check fails because no dependencies", + "vp dedupe && cat package.json && vp dedupe --check # should dedupe fix the change by removing the dependencies" + ] +} diff --git a/packages/cli/snap-tests-global/command-dlx-pnpm11/package.json b/packages/cli/snap-tests-global/command-dlx-pnpm11/package.json new file mode 100644 index 0000000000..fc00f8d8f9 --- /dev/null +++ b/packages/cli/snap-tests-global/command-dlx-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-dlx-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-dlx-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-dlx-pnpm11/snap.txt new file mode 100644 index 0000000000..b2f433e776 --- /dev/null +++ b/packages/cli/snap-tests-global/command-dlx-pnpm11/snap.txt @@ -0,0 +1,36 @@ +> vp dlx --help # should show help message +Usage: vp dlx [OPTIONS] ... + +Execute a package binary without installing it + +Arguments: + ... Package to execute and arguments + +Options: + -p, --package Package(s) to install before running + -c, --shell-mode Execute within a shell environment + -s, --silent Suppress all output except the executed command's output + -h, --help Print help + +Documentation: https://viteplus.dev/guide/vpx + + +> vp dlx -s cowsay hello # should run cowsay with pnpm dlx + _______ +< hello > + ------- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || + +> vp dlx -s cowsay@1.6.0 hello # should run specific version + _______ +< hello > + ------- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || diff --git a/packages/cli/snap-tests-global/command-dlx-pnpm11/steps.json b/packages/cli/snap-tests-global/command-dlx-pnpm11/steps.json new file mode 100644 index 0000000000..8e2a8b772b --- /dev/null +++ b/packages/cli/snap-tests-global/command-dlx-pnpm11/steps.json @@ -0,0 +1,7 @@ +{ + "commands": [ + "vp dlx --help # should show help message", + "vp dlx -s cowsay hello # should run cowsay with pnpm dlx", + "vp dlx -s cowsay@1.6.0 hello # should run specific version" + ] +} diff --git a/packages/cli/snap-tests-global/command-link-pnpm11/package.json b/packages/cli/snap-tests-global/command-link-pnpm11/package.json new file mode 100644 index 0000000000..a50cf39adb --- /dev/null +++ b/packages/cli/snap-tests-global/command-link-pnpm11/package.json @@ -0,0 +1,8 @@ +{ + "name": "command-link-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "*" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-link-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-link-pnpm11/snap.txt new file mode 100644 index 0000000000..cbcdaba910 --- /dev/null +++ b/packages/cli/snap-tests-global/command-link-pnpm11/snap.txt @@ -0,0 +1,127 @@ +> vp link -h # should show help message +Usage: vp link [PACKAGE|DIR] [ARGS]... + +Link packages for local development + +Arguments: + [PACKAGE|DIR] Package name or directory to link + [ARGS]... Arguments to pass to package manager + +Options: + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp install # install initial dependencies +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ testnpm2 + +Done in ms using pnpm v + +> mkdir -p ../test-lib-pnpm && echo '{"name": "testnpm2", "version": "1.0.0"}' > ../test-lib-pnpm/package.json # create test library +> vp link ../test-lib-pnpm && cat package.json pnpm-lock.yaml # should link local directory +Packages: -1 +- + +dependencies: +- testnpm2 ++ testnpm2 <- ../test-lib-pnpm + +{ + "name": "command-link-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "*" + }, + "packageManager": "pnpm@ +} +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +overrides: + testnpm2: link:../test-lib-pnpm + +importers: + + .: + dependencies: + testnpm2: + specifier: link:../test-lib-pnpm + version: link:../test-lib-pnpm + +> vp ln ../test-lib-pnpm && cat package.json pnpm-lock.yaml # should work with ln alias +Lockfile is up to date, resolution step is skipped + +{ + "name": "command-link-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "*" + }, + "packageManager": "pnpm@ +} +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +overrides: + testnpm2: link:../test-lib-pnpm + +importers: + + .: + dependencies: + testnpm2: + specifier: link:../test-lib-pnpm + version: link:../test-lib-pnpm + +> vp unlink ../test-lib-pnpm -- --no-frozen-lockfile && vp unlink testnpm2 -- --no-frozen-lockfile && cat package.json pnpm-lock.yaml # should unlink the package (pnpm v11 requires --no-frozen-lockfile under CI=true to avoid ERR_PNPM_LOCKFILE_CONFIG_MISMATCH) +Already up to date +testnpm2 is linked to /node_modules from /../test-lib-pnpm +Already up to date +Progress: resolved , reused , downloaded , added , done + +dependencies: +- testnpm2 ++ testnpm2 + +{ + "name": "command-link-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "*" + }, + "packageManager": "pnpm@ +} +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + testnpm2: + specifier: '*' + version: + +packages: + + testnpm2@: + resolution: {integrity: sha512- + +snapshots: + + testnpm2@: {} diff --git a/packages/cli/snap-tests-global/command-link-pnpm11/steps.json b/packages/cli/snap-tests-global/command-link-pnpm11/steps.json new file mode 100644 index 0000000000..3bbd61d599 --- /dev/null +++ b/packages/cli/snap-tests-global/command-link-pnpm11/steps.json @@ -0,0 +1,11 @@ +{ + "ignoredPlatforms": ["win32", "linux"], + "commands": [ + "vp link -h # should show help message", + "vp install # install initial dependencies", + "mkdir -p ../test-lib-pnpm && echo '{\"name\": \"testnpm2\", \"version\": \"1.0.0\"}' > ../test-lib-pnpm/package.json # create test library", + "vp link ../test-lib-pnpm && cat package.json pnpm-lock.yaml # should link local directory", + "vp ln ../test-lib-pnpm && cat package.json pnpm-lock.yaml # should work with ln alias", + "vp unlink ../test-lib-pnpm -- --no-frozen-lockfile && vp unlink testnpm2 -- --no-frozen-lockfile && cat package.json pnpm-lock.yaml # should unlink the package (pnpm v11 requires --no-frozen-lockfile under CI=true to avoid ERR_PNPM_LOCKFILE_CONFIG_MISMATCH)" + ] +} diff --git a/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/package.json b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/package.json new file mode 100644 index 0000000000..1188546dc0 --- /dev/null +++ b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-list-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/packages/app/package.json b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/packages/app/package.json new file mode 100644 index 0000000000..8431ea2929 --- /dev/null +++ b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/packages/app/package.json @@ -0,0 +1,10 @@ +{ + "name": "app", + "version": "1.0.0", + "dependencies": { + "@vite-plus-test/utils": "workspace:*" + }, + "peerDependencies": { + "test-vite-plus-package-optional": "1.0.0" + } +} diff --git a/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/packages/utils/package.json b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/packages/utils/package.json new file mode 100644 index 0000000000..8e54c93d99 --- /dev/null +++ b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/packages/utils/package.json @@ -0,0 +1,8 @@ +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true, + "dependencies": { + "testnpm2": "*" + } +} diff --git a/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/pnpm-workspace.yaml b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/pnpm-workspace.yaml new file mode 100644 index 0000000000..924b55f42e --- /dev/null +++ b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/snap.txt b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/snap.txt new file mode 100644 index 0000000000..2c77d1cea8 --- /dev/null +++ b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/snap.txt @@ -0,0 +1,167 @@ +> vp install # should install packages first +Scope: all workspace projects +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +Done in ms using pnpm v + +> vp pm list # should list current workspace root dependencies +Legend: production dependency, optional only, dev only + +app@ /packages/app +│ +│ dependencies: +├── @vite-plus-test/utils@link:../utils +└── test-vite-plus-package-optional@ + +@vite-plus-test/utils@ /packages/utils (PRIVATE) +│ +│ dependencies: +└── testnpm2@ + +3 packages in 3 projects + +> vp pm list --recursive # should list all packages in workspace recursively +Legend: production dependency, optional only, dev only + +app@ /packages/app +│ +│ dependencies: +├── @vite-plus-test/utils@link:../utils +└── test-vite-plus-package-optional@ + +@vite-plus-test/utils@ /packages/utils (PRIVATE) +│ +│ dependencies: +└── testnpm2@ + +3 packages in 3 projects + +> vp pm list --filter app # should list specific workspace package (uses --filter app list) +Legend: production dependency, optional only, dev only + +app@ /packages/app +│ +│ dependencies: +├── @vite-plus-test/utils@link:../utils +└── test-vite-plus-package-optional@ + +2 packages + +> vp pm list --filter app --filter @vite-plus-test/utils # should list multiple workspace packages +Legend: production dependency, optional only, dev only + +app@ /packages/app +│ +│ dependencies: +├── @vite-plus-test/utils@link:../utils +└── test-vite-plus-package-optional@ + +@vite-plus-test/utils@ /packages/utils (PRIVATE) +│ +│ dependencies: +└── testnpm2@ + +3 packages in 2 projects + +> vp pm list --recursive --json # should list all workspace packages in JSON format +[ + { + "name": "command-list-pnpm11-with-workspace", + "version": "1.0.0", + "path": "", + "private": false + }, + { + "name": "app", + "version": "1.0.0", + "path": "/packages/app", + "private": false, + "dependencies": { + "@vite-plus-test/utils": { + "from": "@vite-plus-test/utils", + "version": "link:../utils", + "path": "/packages/utils" + }, + "test-vite-plus-package-optional": { + "from": "test-vite-plus-package-optional", + "version": "1.0.0", + "resolved": "https://registry./test-vite-plus-package-optional/-/test-vite-plus-package-optional-1.0.0.tgz", + "path": "/node_modules/.pnpm/test-vite-plus-package-optional@/node_modules/test-vite-plus-package-optional" + } + } + }, + { + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "path": "/packages/utils", + "private": true, + "dependencies": { + "testnpm2": { + "from": "testnpm2", + "version": "1.0.1", + "resolved": "https://registry./testnpm2/-/testnpm2-1.0.1.tgz", + "path": "/node_modules/.pnpm/testnpm2@/node_modules/testnpm2" + } + } + } +] + +> vp pm list --recursive --depth 0 # should list workspace packages with depth limit +Legend: production dependency, optional only, dev only + +app@ /packages/app +│ +│ dependencies: +├── @vite-plus-test/utils@link:../utils +└── test-vite-plus-package-optional@ + +@vite-plus-test/utils@ /packages/utils (PRIVATE) +│ +│ dependencies: +└── testnpm2@ + +3 packages in 3 projects + +> vp pm list --recursive --only-projects # should list only workspace projects (pnpm-specific) +Legend: production dependency, optional only, dev only + +app@ /packages/app +│ +│ dependencies: +└── @vite-plus-test/utils@link:../utils + +1 package in 3 projects + +> vp pm list --recursive --exclude-peers # should exclude peer dependencies in workspace +Legend: production dependency, optional only, dev only + +app@ /packages/app +│ +│ dependencies: +├── @vite-plus-test/utils@link:../utils +└── test-vite-plus-package-optional@ + +@vite-plus-test/utils@ /packages/utils (PRIVATE) +│ +│ dependencies: +└── testnpm2@ + +3 packages in 3 projects + +> vp pm list --recursive --prod # should list production dependencies in workspace +Legend: production dependency, optional only, dev only + +app@ /packages/app +│ +│ dependencies: +├── @vite-plus-test/utils@link:../utils +└── test-vite-plus-package-optional@ + +@vite-plus-test/utils@ /packages/utils (PRIVATE) +│ +│ dependencies: +└── testnpm2@ + +3 packages in 3 projects diff --git a/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/steps.json b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/steps.json new file mode 100644 index 0000000000..01e66e8a54 --- /dev/null +++ b/packages/cli/snap-tests-global/command-list-pnpm11-with-workspace/steps.json @@ -0,0 +1,15 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp install # should install packages first", + "vp pm list # should list current workspace root dependencies", + "vp pm list --recursive # should list all packages in workspace recursively", + "vp pm list --filter app # should list specific workspace package (uses --filter app list)", + "vp pm list --filter app --filter @vite-plus-test/utils # should list multiple workspace packages", + "vp pm list --recursive --json # should list all workspace packages in JSON format", + "vp pm list --recursive --depth 0 # should list workspace packages with depth limit", + "vp pm list --recursive --only-projects # should list only workspace projects (pnpm-specific)", + "vp pm list --recursive --exclude-peers # should exclude peer dependencies in workspace", + "vp pm list --recursive --prod # should list production dependencies in workspace" + ] +} diff --git a/packages/cli/snap-tests-global/command-list-pnpm11/package.json b/packages/cli/snap-tests-global/command-list-pnpm11/package.json new file mode 100644 index 0000000000..c16d86a7f3 --- /dev/null +++ b/packages/cli/snap-tests-global/command-list-pnpm11/package.json @@ -0,0 +1,14 @@ +{ + "name": "command-list-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "peerDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-list-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-list-pnpm11/snap.txt new file mode 100644 index 0000000000..062b06aa68 --- /dev/null +++ b/packages/cli/snap-tests-global/command-list-pnpm11/snap.txt @@ -0,0 +1,217 @@ +> vp install # should install packages first +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ test-vite-plus-package-optional ++ testnpm2 + +devDependencies: ++ test-vite-plus-package + +Done in ms using pnpm v + +> vp pm list --help # should show help +Usage: vp pm list [OPTIONS] [PATTERN] [-- ...] + +List installed packages + +Arguments: + [PATTERN] Package pattern to filter + [PASS_THROUGH_ARGS]... Additional arguments + +Options: + --depth Maximum depth of dependency tree + --json Output in JSON format + --long Show extended information + --parseable Parseable output format + -P, --prod Only production dependencies + -D, --dev Only dev dependencies + --no-optional Exclude optional dependencies + --exclude-peers Exclude peer dependencies + --only-projects Show only project packages + --find-by Use a finder function + -r, --recursive List across all workspaces + --filter Filter packages in monorepo + -g, --global List global packages + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp pm list # should list installed packages +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ dependencies: +├── test-vite-plus-package-optional@ +├── testnpm2@ +│ +│ devDependencies: +└── test-vite-plus-package@ + +3 packages + +> vp pm list testnpm2 # should list specific package +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ dependencies: +└── testnpm2@ + +1 package + +> vp pm list --depth 0 # should list packages with depth limit +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ dependencies: +├── test-vite-plus-package-optional@ +├── testnpm2@ +│ +│ devDependencies: +└── test-vite-plus-package@ + +3 packages + +> vp pm list --json # should list packages in JSON format +[ + { + "name": "command-list-pnpm11", + "version": "1.0.0", + "path": "", + "private": false, + "dependencies": { + "test-vite-plus-package-optional": { + "from": "test-vite-plus-package-optional", + "version": "1.0.0", + "resolved": "https://registry./test-vite-plus-package-optional/-/test-vite-plus-package-optional-1.0.0.tgz", + "path": "/node_modules/.pnpm/test-vite-plus-package-optional@/node_modules/test-vite-plus-package-optional" + }, + "testnpm2": { + "from": "testnpm2", + "version": "1.0.1", + "resolved": "https://registry./testnpm2/-/testnpm2-1.0.1.tgz", + "path": "/node_modules/.pnpm/testnpm2@/node_modules/testnpm2" + } + }, + "devDependencies": { + "test-vite-plus-package": { + "from": "test-vite-plus-package", + "version": "1.0.0", + "resolved": "https://registry./test-vite-plus-package/-/test-vite-plus-package-1.0.0.tgz", + "path": "/node_modules/.pnpm/test-vite-plus-package@/node_modules/test-vite-plus-package" + } + } + } +] + +> vp pm list --long # should list packages with extended info +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ dependencies: +├── test-vite-plus-package-optional@ +│ just for snap-test +│ /node_modules/.pnpm/test-vite-plus-package-optional@/node_modules/test-vite-plus-package-optional +├── testnpm2@ +│ /node_modules/.pnpm/testnpm2@/node_modules/testnpm2 +│ +│ devDependencies: +└── test-vite-plus-package@ + just for snap-test + /node_modules/.pnpm/test-vite-plus-package@/node_modules/test-vite-plus-package + +3 packages + +> vp pm list --parseable # should list packages in parseable format + +/node_modules/.pnpm/test-vite-plus-package@/node_modules/test-vite-plus-package +/node_modules/.pnpm/test-vite-plus-package-optional@/node_modules/test-vite-plus-package-optional +/node_modules/.pnpm/testnpm2@/node_modules/testnpm2 + +> vp pm list --prod # should list production dependencies only +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ dependencies: +├── test-vite-plus-package-optional@ +└── testnpm2@ + +2 packages + +> vp pm list --dev # should list development dependencies only +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ devDependencies: +└── test-vite-plus-package@ + +1 package + +> vp pm list --no-optional # should exclude optional dependencies +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ dependencies: +├── test-vite-plus-package-optional@ +├── testnpm2@ +│ +│ devDependencies: +└── test-vite-plus-package@ + +3 packages + +> vp pm list --exclude-peers # should exclude peer dependencies +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ dependencies: +├── test-vite-plus-package-optional@ +├── testnpm2@ +│ +│ devDependencies: +└── test-vite-plus-package@ + +3 packages + +> vp pm list --only-projects # should list only workspace projects (pnpm-specific) +[1]> vp pm list --find-by customFinder # should use custom finder (pnpm-specific) + ERR_PNPM_FINDER_NOT_FOUND  No finder with name customFinder is found + +> vp pm list --recursive # should list packages recursively in workspace +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ dependencies: +├── test-vite-plus-package-optional@ +├── testnpm2@ +│ +│ devDependencies: +└── test-vite-plus-package@ + +3 packages + +> vp pm list -- --loglevel=warn # should support pass through arguments +Legend: production dependency, optional only, dev only + +command-list-pnpm11@ +│ +│ dependencies: +├── test-vite-plus-package-optional@ +├── testnpm2@ +│ +│ devDependencies: +└── test-vite-plus-package@ + +3 packages diff --git a/packages/cli/snap-tests-global/command-list-pnpm11/steps.json b/packages/cli/snap-tests-global/command-list-pnpm11/steps.json new file mode 100644 index 0000000000..5bde08798f --- /dev/null +++ b/packages/cli/snap-tests-global/command-list-pnpm11/steps.json @@ -0,0 +1,21 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp install # should install packages first", + "vp pm list --help # should show help", + "vp pm list # should list installed packages", + "vp pm list testnpm2 # should list specific package", + "vp pm list --depth 0 # should list packages with depth limit", + "vp pm list --json # should list packages in JSON format", + "vp pm list --long # should list packages with extended info", + "vp pm list --parseable # should list packages in parseable format", + "vp pm list --prod # should list production dependencies only", + "vp pm list --dev # should list development dependencies only", + "vp pm list --no-optional # should exclude optional dependencies", + "vp pm list --exclude-peers # should exclude peer dependencies", + "vp pm list --only-projects # should list only workspace projects (pnpm-specific)", + "vp pm list --find-by customFinder # should use custom finder (pnpm-specific)", + "vp pm list --recursive # should list packages recursively in workspace", + "vp pm list -- --loglevel=warn # should support pass through arguments" + ] +} diff --git a/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/package.json b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/package.json new file mode 100644 index 0000000000..66b8b9a3f8 --- /dev/null +++ b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/package.json @@ -0,0 +1,8 @@ +{ + "name": "command-outdated-pnpm11-with-workspace", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.0" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/packages/app/package.json b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/packages/app/package.json new file mode 100644 index 0000000000..9cab9ad683 --- /dev/null +++ b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/packages/app/package.json @@ -0,0 +1,14 @@ +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "1.0.0", + "testnpm2": "1.0.0" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-other-optional": "1.0.0" + } +} diff --git a/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/packages/utils/package.json b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/packages/utils/package.json new file mode 100644 index 0000000000..1825862795 --- /dev/null +++ b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/packages/utils/package.json @@ -0,0 +1,7 @@ +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.0" + } +} diff --git a/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/pnpm-workspace.yaml b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/pnpm-workspace.yaml new file mode 100644 index 0000000000..924b55f42e --- /dev/null +++ b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/snap.txt b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/snap.txt new file mode 100644 index 0000000000..390ea9ee7f --- /dev/null +++ b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/snap.txt @@ -0,0 +1,74 @@ +> 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 + +[1]> vp outdated testnpm2 -w # should outdated in workspace root +┌──────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────┼─────────┼────────┤ +│ testnpm2 │ │ +└──────────┴─────────┴────────┘ + +[1]> vp outdated testnpm2 --filter app # should outdated in specific package +┌──────────┬─────────┬────────┬────────────┐ +│ Package │ Current │ Latest │ Dependents │ +├──────────┼─────────┼────────┼────────────┤ +│ testnpm2 │ │ app │ +└──────────┴─────────┴────────┴────────────┘ + +> vp outdated -D --filter app # should outdated dev dependencies in app +[1]> vp outdated --filter "*" --format json # should outdated in all packages +{ + "testnpm2": { + "current": "1.0.0", + "latest": "1.0.1", + "wanted": "1.0.0", + "isDeprecated": false, + "dependencyType": "dependencies", + "dependentPackages": [ + { + "name": "command-outdated-pnpm11-with-workspace", + "location": "" + }, + { + "name": "app", + "location": "/packages/app" + }, + { + "name": "@vite-plus-test/utils", + "location": "/packages/utils" + } + ] + }, + "test-vite-plus-other-optional": { + "current": "1.0.0", + "latest": "1.1.0", + "wanted": "1.0.0", + "isDeprecated": false, + "dependencyType": "optionalDependencies", + "dependentPackages": [ + { + "name": "app", + "location": "/packages/app" + } + ] + } +} + +[1]> vp outdated -r # should outdated recursively +┌──────────────────────────────────────────┬─────────┬────────┬────────────────────────────────┐ +│ Package │ Current │ Latest │ Dependents │ +├──────────────────────────────────────────┼─────────┼────────┼────────────────────────────────┤ +│ testnpm2 │ │ @vite-plus-test/utils, app, │ +│ │ │ │ command-outdated-pnpm11-with- │ +│ │ │ │ workspace │ +├──────────────────────────────────────────┼─────────┼────────┼────────────────────────────────┤ +│ test-vite-plus-other-optional (optional) │ │ app │ +└──────────────────────────────────────────┴─────────┴────────┴────────────────────────────────┘ diff --git a/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/steps.json b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/steps.json new file mode 100644 index 0000000000..49be7120e4 --- /dev/null +++ b/packages/cli/snap-tests-global/command-outdated-pnpm11-with-workspace/steps.json @@ -0,0 +1,11 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp install", + "vp outdated testnpm2 -w # should outdated in workspace root", + "vp outdated testnpm2 --filter app # should outdated in specific package", + "vp outdated -D --filter app # should outdated dev dependencies in app", + "vp outdated --filter \"*\" --format json # should outdated in all packages", + "vp outdated -r # should outdated recursively" + ] +} diff --git a/packages/cli/snap-tests-global/command-outdated-pnpm11/package.json b/packages/cli/snap-tests-global/command-outdated-pnpm11/package.json new file mode 100644 index 0000000000..9fd03b679c --- /dev/null +++ b/packages/cli/snap-tests-global/command-outdated-pnpm11/package.json @@ -0,0 +1,14 @@ +{ + "name": "command-outdated-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.0" + }, + "devDependencies": { + "test-vite-plus-top-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-other-optional": "1.0.0" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-outdated-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-outdated-pnpm11/snap.txt new file mode 100644 index 0000000000..d1701b9216 --- /dev/null +++ b/packages/cli/snap-tests-global/command-outdated-pnpm11/snap.txt @@ -0,0 +1,176 @@ +> vp outdated --help # should show help +Usage: vp outdated [OPTIONS] [PACKAGES]... [-- ...] + +Check for outdated packages + +Arguments: + [PACKAGES]... Package name(s) to check + [PASS_THROUGH_ARGS]... Additional arguments to pass through to the package manager + +Options: + --long Show extended information + --format Output format: table (default), list, or json + -r, --recursive Check recursively across all workspaces + --filter Filter packages in monorepo + -w, --workspace-root Include workspace root + -P, --prod Only production and optional dependencies + -D, --dev Only dev dependencies + --no-optional Exclude optional dependencies + --compatible Only show compatible versions + --sort-by Sort results by field + -g, --global Check globally installed packages + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp install # should install packages first +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ testnpm2 (1.0.1 is available) + +optionalDependencies: ++ test-vite-plus-other-optional (1.1.0 is available) + +devDependencies: ++ test-vite-plus-top-package (1.1.0 is available) + +Done in ms using pnpm v + +[1]> vp outdated testnpm2 # should outdated package +┌──────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────┼─────────┼────────┤ +│ testnpm2 │ │ +└──────────┴─────────┴────────┘ + +[1]> vp outdated test-vite* # should outdated with one glob pattern +┌──────────────────────────────────────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-other-optional (optional) │ │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-top-package (dev) │ │ +└──────────────────────────────────────────┴─────────┴────────┘ + +[1]> vp outdated test-vite* '*npm*' # should outdated with multiple glob patterns +┌──────────────────────────────────────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ testnpm2 │ │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-other-optional (optional) │ │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-top-package (dev) │ │ +└──────────────────────────────────────────┴─────────┴────────┘ + +[1]> vp outdated --format json # should support json output +{ + "testnpm2": { + "current": "1.0.0", + "latest": "1.0.1", + "wanted": "1.0.0", + "isDeprecated": false, + "dependencyType": "dependencies" + }, + "test-vite-plus-other-optional": { + "current": "1.0.0", + "latest": "1.1.0", + "wanted": "1.0.0", + "isDeprecated": false, + "dependencyType": "optionalDependencies" + }, + "test-vite-plus-top-package": { + "current": "1.0.0", + "latest": "1.1.0", + "wanted": "1.0.0", + "isDeprecated": false, + "dependencyType": "devDependencies" + } +} + +[1]> vp outdated --format list # should support list output +testnpm2 + => + +test-vite-plus-other-optional (optional) + => + +test-vite-plus-top-package (dev) + => + +[1]> vp outdated --format table # should support table output +┌──────────────────────────────────────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ testnpm2 │ │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-other-optional (optional) │ │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-top-package (dev) │ │ +└──────────────────────────────────────────┴─────────┴────────┘ + +[1]> vp outdated testnpm2 --long --format list # should support --long +testnpm2 + => + +[1]> vp outdated -r # should support recursive output +┌──────────────────────────────────────────┬─────────┬────────┬─────────────────────────┐ +│ Package │ Current │ Latest │ Dependents │ +├──────────────────────────────────────────┼─────────┼────────┼─────────────────────────┤ +│ testnpm2 │ │ command-outdated-pnpm11 │ +├──────────────────────────────────────────┼─────────┼────────┼─────────────────────────┤ +│ test-vite-plus-other-optional (optional) │ │ command-outdated-pnpm11 │ +├──────────────────────────────────────────┼─────────┼────────┼─────────────────────────┤ +│ test-vite-plus-top-package (dev) │ │ command-outdated-pnpm11 │ +└──────────────────────────────────────────┴─────────┴────────┴─────────────────────────┘ + +[1]> vp outdated -P # should support prod output +┌──────────────────────────────────────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ testnpm2 │ │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-other-optional (optional) │ │ +└──────────────────────────────────────────┴─────────┴────────┘ + +[1]> vp outdated -D # should support dev output +┌──────────────────────────────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-top-package (dev) │ │ +└──────────────────────────────────┴─────────┴────────┘ + +[1]> vp outdated --no-optional # should support no-optional output +┌──────────────────────────────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────────────────────────────┼─────────┼────────┤ +│ testnpm2 │ │ +├──────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-top-package (dev) │ │ +└──────────────────────────────────┴─────────┴────────┘ + +> vp outdated --compatible # should compatible output nothing +[1]> json-edit package.json '_.optionalDependencies["test-vite-plus-other-optional"] = "^1.0.0"' && vp outdated --compatible # should support compatible output with optional dependencies +┌──────────────────────────────────────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-other-optional (optional) │ │ +└──────────────────────────────────────────┴─────────┴────────┘ + +[1]> vp outdated --sort-by name # should support sort-by output +┌──────────────────────────────────────────┬─────────┬────────┐ +│ Package │ Current │ Latest │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-other-optional (optional) │ │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ test-vite-plus-top-package (dev) │ │ +├──────────────────────────────────────────┼─────────┼────────┤ +│ testnpm2 │ │ +└──────────────────────────────────────────┴─────────┴────────┘ + +> vp outdated testnpm2 -g --format json # should support global output +{} diff --git a/packages/cli/snap-tests-global/command-outdated-pnpm11/steps.json b/packages/cli/snap-tests-global/command-outdated-pnpm11/steps.json new file mode 100644 index 0000000000..b1e9e87cf3 --- /dev/null +++ b/packages/cli/snap-tests-global/command-outdated-pnpm11/steps.json @@ -0,0 +1,22 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp outdated --help # should show help", + "vp install # should install packages first", + "vp outdated testnpm2 # should outdated package", + "vp outdated test-vite* # should outdated with one glob pattern", + "vp outdated test-vite* '*npm*' # should outdated with multiple glob patterns", + "vp outdated --format json # should support json output", + "vp outdated --format list # should support list output", + "vp outdated --format table # should support table output", + "vp outdated testnpm2 --long --format list # should support --long", + "vp outdated -r # should support recursive output", + "vp outdated -P # should support prod output", + "vp outdated -D # should support dev output", + "vp outdated --no-optional # should support no-optional output", + "vp outdated --compatible # should compatible output nothing", + "json-edit package.json '_.optionalDependencies[\"test-vite-plus-other-optional\"] = \"^1.0.0\"' && vp outdated --compatible # should support compatible output with optional dependencies", + "vp outdated --sort-by name # should support sort-by output", + "vp outdated testnpm2 -g --format json # should support global output" + ] +} diff --git a/packages/cli/snap-tests-global/command-owner-pnpm11/package.json b/packages/cli/snap-tests-global/command-owner-pnpm11/package.json new file mode 100644 index 0000000000..e03f6ed045 --- /dev/null +++ b/packages/cli/snap-tests-global/command-owner-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-owner-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-owner-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-owner-pnpm11/snap.txt new file mode 100644 index 0000000000..e0bd865d75 --- /dev/null +++ b/packages/cli/snap-tests-global/command-owner-pnpm11/snap.txt @@ -0,0 +1,18 @@ +> vp pm owner --help # should show help +Usage: vp pm owner + +Manage package owners + +Commands: + list List package owners [aliases: ls] + add Add package owner + rm Remove package owner + +Options: + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp pm owner list testnpm2 # should list package owners (uses npm owner) +fengmk2 diff --git a/packages/cli/snap-tests-global/command-owner-pnpm11/steps.json b/packages/cli/snap-tests-global/command-owner-pnpm11/steps.json new file mode 100644 index 0000000000..e5e626f011 --- /dev/null +++ b/packages/cli/snap-tests-global/command-owner-pnpm11/steps.json @@ -0,0 +1,6 @@ +{ + "commands": [ + "vp pm owner --help # should show help", + "vp pm owner list testnpm2 # should list package owners (uses npm owner)" + ] +} diff --git a/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/package.json b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/package.json new file mode 100644 index 0000000000..730f51782e --- /dev/null +++ b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-pack-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/packages/app/package.json b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/packages/app/package.json new file mode 100644 index 0000000000..33b9c5952a --- /dev/null +++ b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/packages/app/package.json @@ -0,0 +1,4 @@ +{ + "name": "app", + "version": "1.0.0" +} diff --git a/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/packages/utils/package.json b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/packages/utils/package.json new file mode 100644 index 0000000000..d063b255a7 --- /dev/null +++ b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/packages/utils/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true +} diff --git a/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/pnpm-workspace.yaml b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/pnpm-workspace.yaml new file mode 100644 index 0000000000..924b55f42e --- /dev/null +++ b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/snap.txt b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/snap.txt new file mode 100644 index 0000000000..b0f7613142 --- /dev/null +++ b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/snap.txt @@ -0,0 +1,194 @@ +> vp pm pack && rm -rf *.tgz # should pack current workspace root +package: command-pack-pnpm11-with-workspace@ +Tarball Contents +output.log +package.json +packages/app/package.json +packages/utils/package.json +pnpm-workspace.yaml +snap.txt +steps.json +Tarball Details +command-pack-pnpm11-with-workspace-1.0.0.tgz + +> vp pm pack --recursive --json > out.json && tool json-sort out.json '_.name' && cat out.json && rm -rf *.tgz # should pack all packages in workspace +[ + { + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "filename": "/vite-plus-test-utils-1.0.0.tgz", + "files": [ + { + "path": "package.json" + } + ] + }, + { + "name": "app", + "version": "1.0.0", + "filename": "/app-1.0.0.tgz", + "files": [ + { + "path": "package.json" + } + ] + }, + { + "name": "command-pack-pnpm11-with-workspace", + "version": "1.0.0", + "filename": "command-pack-pnpm11-with-workspace-1.0.0.tgz", + "files": [ + { + "path": "command-pack-pnpm11-with-workspace-1.0.0.tgz" + }, + { + "path": "out.json" + }, + { + "path": "output.log" + }, + { + "path": "package.json" + }, + { + "path": "packages/app/package.json" + }, + { + "path": "packages/utils/package.json" + }, + { + "path": "pnpm-workspace.yaml" + }, + { + "path": "snap.txt" + }, + { + "path": "steps.json" + } + ] + } +] + +> vp pm pack --filter app && rm -rf *.tgz # should pack specific package (uses --filter app pack) +package: app@ +Tarball Contents +package.json +Tarball Details +/app-1.0.0.tgz + +> vp pm pack --filter app --filter @vite-plus-test/utils --json > out.json && tool json-sort out.json '_.name' && cat out.json && rm -rf *.tgz # should pack multiple packages +[ + { + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "filename": "/vite-plus-test-utils-1.0.0.tgz", + "files": [ + { + "path": "package.json" + } + ] + }, + { + "name": "app", + "version": "1.0.0", + "filename": "/app-1.0.0.tgz", + "files": [ + { + "path": "package.json" + } + ] + } +] + +> vp pm pack --out ./dist/package.tgz && rm -rf ./dist # should pack with output file +package: command-pack-pnpm11-with-workspace@ +Tarball Contents +app-1.0.0.tgz +command-pack-pnpm11-with-workspace-1.0.0.tgz +out.json +output.log +package.json +packages/app/package.json +packages/utils/package.json +pnpm-workspace.yaml +snap.txt +steps.json +vite-plus-test-utils-1.0.0.tgz +Tarball Details +/dist/package.tgz + +> vp pm pack --pack-destination ./dist && rm -rf ./dist # should pack with destination +package: command-pack-pnpm11-with-workspace@ +Tarball Contents +app-1.0.0.tgz +command-pack-pnpm11-with-workspace-1.0.0.tgz +out.json +output.log +package.json +packages/app/package.json +packages/utils/package.json +pnpm-workspace.yaml +snap.txt +steps.json +vite-plus-test-utils-1.0.0.tgz +Tarball Details +/dist/command-pack-pnpm11-with-workspace-1.0.0.tgz + +> vp pm pack --pack-gzip-level 9 && rm -rf *.tgz # should pack with gzip compression level +package: command-pack-pnpm11-with-workspace@ +Tarball Contents +app-1.0.0.tgz +command-pack-pnpm11-with-workspace-1.0.0.tgz +out.json +output.log +package.json +packages/app/package.json +packages/utils/package.json +pnpm-workspace.yaml +snap.txt +steps.json +vite-plus-test-utils-1.0.0.tgz +Tarball Details +command-pack-pnpm11-with-workspace-1.0.0.tgz + +> vp pm pack --json --out 'foo-%s-%v.tgz' && rm -rf *.tgz # should pack with json output +{ + "name": "command-pack-pnpm11-with-workspace", + "version": "1.0.0", + "filename": "foo-command-pack-pnpm11-with-workspace-1.0.0.tgz", + "files": [ + { + "path": "app-1.0.0.tgz" + }, + { + "path": "command-pack-pnpm11-with-workspace-1.0.0.tgz" + }, + { + "path": "out.json" + }, + { + "path": "output.log" + }, + { + "path": "package.json" + }, + { + "path": "packages/app/package.json" + }, + { + "path": "packages/utils/package.json" + }, + { + "path": "pnpm-workspace.yaml" + }, + { + "path": "snap.txt" + }, + { + "path": "steps.json" + }, + { + "path": "vite-plus-test-utils-1.0.0.tgz" + } + ] +} diff --git a/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/steps.json b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/steps.json new file mode 100644 index 0000000000..7c6dc4b414 --- /dev/null +++ b/packages/cli/snap-tests-global/command-pack-pnpm11-with-workspace/steps.json @@ -0,0 +1,13 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp pm pack && rm -rf *.tgz # should pack current workspace root", + "vp pm pack --recursive --json > out.json && tool json-sort out.json '_.name' && cat out.json && rm -rf *.tgz # should pack all packages in workspace", + "vp pm pack --filter app && rm -rf *.tgz # should pack specific package (uses --filter app pack)", + "vp pm pack --filter app --filter @vite-plus-test/utils --json > out.json && tool json-sort out.json '_.name' && cat out.json && rm -rf *.tgz # should pack multiple packages", + "vp pm pack --out ./dist/package.tgz && rm -rf ./dist # should pack with output file", + "vp pm pack --pack-destination ./dist && rm -rf ./dist # should pack with destination", + "vp pm pack --pack-gzip-level 9 && rm -rf *.tgz # should pack with gzip compression level", + "vp pm pack --json --out 'foo-%s-%v.tgz' && rm -rf *.tgz # should pack with json output" + ] +} diff --git a/packages/cli/snap-tests-global/command-pack-pnpm11/package.json b/packages/cli/snap-tests-global/command-pack-pnpm11/package.json new file mode 100644 index 0000000000..80c2cc172b --- /dev/null +++ b/packages/cli/snap-tests-global/command-pack-pnpm11/package.json @@ -0,0 +1,11 @@ +{ + "name": "command-pack-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-pack-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-pack-pnpm11/snap.txt new file mode 100644 index 0000000000..17665115ff --- /dev/null +++ b/packages/cli/snap-tests-global/command-pack-pnpm11/snap.txt @@ -0,0 +1,110 @@ +> vp pm pack --help # should show help +Usage: vp pm pack [OPTIONS] [-- ...] + +Create a tarball of the package + +Arguments: + [PASS_THROUGH_ARGS]... Additional arguments + +Options: + -r, --recursive Pack all workspace packages + --filter Filter packages to pack + --out Output path for the tarball + --pack-destination Directory where the tarball will be saved + --pack-gzip-level Gzip compression level (0-9) + --json Output in JSON format + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp pm pack && rm -rf *.tgz # should pack current package +package: command-pack-pnpm11@ +Tarball Contents +output.log +package.json +snap.txt +steps.json +Tarball Details +command-pack-pnpm11-1.0.0.tgz + +> vp pm pack --out ./dist/package.tgz && rm -rf ./dist # should pack with output file +package: command-pack-pnpm11@ +Tarball Contents +command-pack-pnpm11-1.0.0.tgz +output.log +package.json +snap.txt +steps.json +Tarball Details +/dist/package.tgz + +> vp pm pack --pack-destination ./dist && rm -rf ./dist # should pack with destination +package: command-pack-pnpm11@ +Tarball Contents +command-pack-pnpm11-1.0.0.tgz +output.log +package.json +snap.txt +steps.json +Tarball Details +/dist/command-pack-pnpm11-1.0.0.tgz + +> vp pm pack --json --pack-gzip-level 9 && rm -rf *.tgz # should pack with gzip compression level +{ + "name": "command-pack-pnpm11", + "version": "1.0.0", + "filename": "command-pack-pnpm11-1.0.0.tgz", + "files": [ + { + "path": "command-pack-pnpm11-1.0.0.tgz" + }, + { + "path": "output.log" + }, + { + "path": "package.json" + }, + { + "path": "snap.txt" + }, + { + "path": "steps.json" + } + ] +} + +> vp pm pack --json && rm -rf *.tgz # should pack with json output +{ + "name": "command-pack-pnpm11", + "version": "1.0.0", + "filename": "command-pack-pnpm11-1.0.0.tgz", + "files": [ + { + "path": "command-pack-pnpm11-1.0.0.tgz" + }, + { + "path": "output.log" + }, + { + "path": "package.json" + }, + { + "path": "snap.txt" + }, + { + "path": "steps.json" + } + ] +} + +> vp pm pack -- --loglevel=warn && rm -rf *.tgz # should support pass through arguments +package: command-pack-pnpm11@ +Tarball Contents +command-pack-pnpm11-1.0.0.tgz +output.log +package.json +snap.txt +steps.json +Tarball Details +command-pack-pnpm11-1.0.0.tgz diff --git a/packages/cli/snap-tests-global/command-pack-pnpm11/steps.json b/packages/cli/snap-tests-global/command-pack-pnpm11/steps.json new file mode 100644 index 0000000000..40db7dd3ea --- /dev/null +++ b/packages/cli/snap-tests-global/command-pack-pnpm11/steps.json @@ -0,0 +1,12 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp pm pack --help # should show help", + "vp pm pack && rm -rf *.tgz # should pack current package", + "vp pm pack --out ./dist/package.tgz && rm -rf ./dist # should pack with output file", + "vp pm pack --pack-destination ./dist && rm -rf ./dist # should pack with destination", + "vp pm pack --json --pack-gzip-level 9 && rm -rf *.tgz # should pack with gzip compression level", + "vp pm pack --json && rm -rf *.tgz # should pack with json output", + "vp pm pack -- --loglevel=warn && rm -rf *.tgz # should support pass through arguments" + ] +} diff --git a/packages/cli/snap-tests-global/command-prune-pnpm11/package.json b/packages/cli/snap-tests-global/command-prune-pnpm11/package.json new file mode 100644 index 0000000000..cf7a9e6b27 --- /dev/null +++ b/packages/cli/snap-tests-global/command-prune-pnpm11/package.json @@ -0,0 +1,14 @@ +{ + "name": "command-prune-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-prune-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-prune-pnpm11/snap.txt new file mode 100644 index 0000000000..77f0e7352d --- /dev/null +++ b/packages/cli/snap-tests-global/command-prune-pnpm11/snap.txt @@ -0,0 +1,139 @@ +> vp install # should install packages first +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ testnpm2 + +optionalDependencies: ++ test-vite-plus-package-optional + +devDependencies: ++ test-vite-plus-package + +Done in ms using pnpm v + +> vp pm prune --help # should show help +Usage: vp pm prune [OPTIONS] [-- ...] + +Remove unnecessary packages + +Arguments: + [PASS_THROUGH_ARGS]... Additional arguments + +Options: + --prod Remove devDependencies + --no-optional Remove optional dependencies + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp pm prune && cat package.json # should prune extraneous dependencies +Already up to date +{ + "name": "command-prune-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} + +> vp pm prune --prod && cat package.json # should prune dev dependencies +Lockfile is up to date, resolution step is skipped +Packages: -1 +- + +devDependencies: +- test-vite-plus-package + +{ + "name": "command-prune-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} + +> vp pm prune --no-optional && cat package.json # should prune optional dependencies +Lockfile is up to date, resolution step is skipped +Packages: -1 +- +Progress: resolved , reused , downloaded , added , done + +optionalDependencies: +- test-vite-plus-package-optional + +devDependencies: ++ test-vite-plus-package + +{ + "name": "command-prune-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} + +> vp pm prune --prod --no-optional && cat package.json # should prune both dev and optional dependencies +Lockfile is up to date, resolution step is skipped +Packages: -1 +- + +optionalDependencies: skipped + +devDependencies: +- test-vite-plus-package + +{ + "name": "command-prune-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} + +> vp pm prune -- --loglevel=warn && cat package.json # should support pass through arguments +{ + "name": "command-prune-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@ +} diff --git a/packages/cli/snap-tests-global/command-prune-pnpm11/steps.json b/packages/cli/snap-tests-global/command-prune-pnpm11/steps.json new file mode 100644 index 0000000000..41cb0e3e88 --- /dev/null +++ b/packages/cli/snap-tests-global/command-prune-pnpm11/steps.json @@ -0,0 +1,12 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp install # should install packages first", + "vp pm prune --help # should show help", + "vp pm prune && cat package.json # should prune extraneous dependencies", + "vp pm prune --prod && cat package.json # should prune dev dependencies", + "vp pm prune --no-optional && cat package.json # should prune optional dependencies", + "vp pm prune --prod --no-optional && cat package.json # should prune both dev and optional dependencies", + "vp pm prune -- --loglevel=warn && cat package.json # should support pass through arguments" + ] +} diff --git a/packages/cli/snap-tests-global/command-publish-pnpm11/package.json b/packages/cli/snap-tests-global/command-publish-pnpm11/package.json new file mode 100644 index 0000000000..b5db8bab1d --- /dev/null +++ b/packages/cli/snap-tests-global/command-publish-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-publish-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-publish-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-publish-pnpm11/snap.txt new file mode 100644 index 0000000000..1838047bf3 --- /dev/null +++ b/packages/cli/snap-tests-global/command-publish-pnpm11/snap.txt @@ -0,0 +1,27 @@ +> vp pm publish --help # should show help +Usage: vp pm publish [OPTIONS] [TARBALL|FOLDER] [-- ...] + +Publish package to registry + +Arguments: + [TARBALL|FOLDER] Tarball or folder to publish + [PASS_THROUGH_ARGS]... Additional arguments + +Options: + --dry-run Preview without publishing + --tag Publish tag + --access Access level (public/restricted) + --otp One-time password for authentication + --no-git-checks Skip git checks + --publish-branch Set the branch name to publish from + --report-summary Save publish summary + --force Force publish + --json Output in JSON format + -r, --recursive Publish all workspace packages + --filter Filter packages in monorepo + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp pm publish --dry-run -- --loglevel error # should preview publish without actually publishing (uses pnpm publish --dry-run) \ No newline at end of file diff --git a/packages/cli/snap-tests-global/command-publish-pnpm11/steps.json b/packages/cli/snap-tests-global/command-publish-pnpm11/steps.json new file mode 100644 index 0000000000..35a46e6d86 --- /dev/null +++ b/packages/cli/snap-tests-global/command-publish-pnpm11/steps.json @@ -0,0 +1,6 @@ +{ + "commands": [ + "vp pm publish --help # should show help", + "vp pm publish --dry-run -- --loglevel error # should preview publish without actually publishing (uses pnpm publish --dry-run)" + ] +} diff --git a/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/package.json b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/package.json new file mode 100644 index 0000000000..11db39dbc4 --- /dev/null +++ b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-remove-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/packages/app/package.json b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/packages/app/package.json new file mode 100644 index 0000000000..fd1f8f6386 --- /dev/null +++ b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/packages/app/package.json @@ -0,0 +1,3 @@ +{ + "name": "app" +} diff --git a/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/packages/utils/package.json b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/packages/utils/package.json new file mode 100644 index 0000000000..d063b255a7 --- /dev/null +++ b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/packages/utils/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true +} diff --git a/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/pnpm-workspace.yaml b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/pnpm-workspace.yaml new file mode 100644 index 0000000000..924b55f42e --- /dev/null +++ b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/snap.txt b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/snap.txt new file mode 100644 index 0000000000..e0da903a24 --- /dev/null +++ b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/snap.txt @@ -0,0 +1,156 @@ +> vp add testnpm2 -D -w --filter=* && vp add test-vite-plus-install -w --filter=* && vp add test-vite-plus-package-optional -O --filter=* && cat package.json packages/app/package.json packages/utils/package.json # prepare packages +. | +1 + +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +. | +1 + +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +. | +1 + +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "command-remove-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "devDependencies": { + "testnpm2": "^1.0.1" + }, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} +{ + "name": "app", + "devDependencies": { + "testnpm2": "^1.0.1" + }, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true, + "devDependencies": { + "testnpm2": "^1.0.1" + }, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} + +> vp remove testnpm2 -r && cat package.json packages/app/package.json packages/utils/package.json # should remove package from all workspaces and root +Scope: all workspace projects +. | -1 - +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "command-remove-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "dependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} +{ + "name": "app", + "dependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} + +> vp remove -O test-vite-plus-package-optional -r && cat package.json packages/app/package.json packages/utils/package.json # should remove optional package from all workspaces +Scope: all workspace projects +. | -1 - +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "command-remove-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "dependencies": { + "test-vite-plus-install": "^1.0.0" + } +} +{ + "name": "app", + "dependencies": { + "test-vite-plus-install": "^1.0.0" + } +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + } +} + +> vp remove test-vite-plus-install --filter=app && cat package.json packages/app/package.json packages/utils/package.json # should remove package by filter=app +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "command-remove-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ + "dependencies": { + "test-vite-plus-install": "^1.0.0" + } +} +{ + "name": "app" +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true, + "dependencies": { + "test-vite-plus-install": "^1.0.0" + } +} + +> vp remove test-vite-plus-install --filter=* && cat package.json packages/app/package.json packages/utils/package.json # should remove package by filter=* +Scope: all workspace projects +. | -1 - +Done in ms using pnpm v +{ + "name": "command-remove-pnpm11-with-workspace", + "version": "1.0.0", + "packageManager": "pnpm@ +} +{ + "name": "app" +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "private": true +} diff --git a/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/steps.json b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/steps.json new file mode 100644 index 0000000000..27265fa59b --- /dev/null +++ b/packages/cli/snap-tests-global/command-remove-pnpm11-with-workspace/steps.json @@ -0,0 +1,10 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp add testnpm2 -D -w --filter=* && vp add test-vite-plus-install -w --filter=* && vp add test-vite-plus-package-optional -O --filter=* && cat package.json packages/app/package.json packages/utils/package.json # prepare packages", + "vp remove testnpm2 -r && cat package.json packages/app/package.json packages/utils/package.json # should remove package from all workspaces and root", + "vp remove -O test-vite-plus-package-optional -r && cat package.json packages/app/package.json packages/utils/package.json # should remove optional package from all workspaces", + "vp remove test-vite-plus-install --filter=app && cat package.json packages/app/package.json packages/utils/package.json # should remove package by filter=app", + "vp remove test-vite-plus-install --filter=* && cat package.json packages/app/package.json packages/utils/package.json # should remove package by filter=*" + ] +} diff --git a/packages/cli/snap-tests-global/command-remove-pnpm11/package.json b/packages/cli/snap-tests-global/command-remove-pnpm11/package.json new file mode 100644 index 0000000000..1356e9827c --- /dev/null +++ b/packages/cli/snap-tests-global/command-remove-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-remove-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-remove-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-remove-pnpm11/snap.txt new file mode 100644 index 0000000000..df893dfdb0 --- /dev/null +++ b/packages/cli/snap-tests-global/command-remove-pnpm11/snap.txt @@ -0,0 +1,109 @@ +> vp remove --help # should show help +Usage: vp remove [OPTIONS] ... [-- ...] + +Remove packages from dependencies + +Arguments: + ... Packages to remove + [PASS_THROUGH_ARGS]... Additional arguments to pass through to the package manager + +Options: + -D, --save-dev Only remove from `devDependencies` (pnpm-specific) + -O, --save-optional Only remove from `optionalDependencies` (pnpm-specific) + -P, --save-prod Only remove from `dependencies` (pnpm-specific) + --filter Filter packages in monorepo (can be used multiple times) + -w, --workspace-root Remove from workspace root + -r, --recursive Remove recursively from all workspace packages + -g, --global Remove global packages + --dry-run Preview what would be removed without actually removing (only with -g) + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +[2]> vp remove # should error because no packages specified +error: the following required arguments were not provided: + ... + +Usage: vp remove ... [-- ...] + +For more information, try '--help'. + +[1]> vp remove testnpm2 -D && cat package.json # should error when remove not exists package from dev dependencies + ERR_PNPM_CANNOT_REMOVE_MISSING_DEPS  Cannot remove 'testnpm2': project has no 'devDependencies' + +> vp add testnpm2 && vp add -D test-vite-plus-install && vp add -O test-vite-plus-package-optional && cat package.json # should add packages to dependencies +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ testnpm2 + +Done in ms using pnpm v +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +devDependencies: ++ test-vite-plus-install + +Done in ms using pnpm v +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +optionalDependencies: ++ test-vite-plus-package-optional + +Done in ms using pnpm v +{ + "name": "command-remove-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "dependencies": { + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-install": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} + +> vp remove testnpm2 test-vite-plus-install && cat package.json # should remove packages from dependencies +Packages: -2 +-- +Progress: resolved , reused , downloaded , added , done + +dependencies: +- testnpm2 + +devDependencies: +- test-vite-plus-install + +Done in ms using pnpm v +{ + "name": "command-remove-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0" + } +} + +> vp remove -O test-vite-plus-package-optional -- --loglevel=warn && cat package.json # support remove package from optional dependencies and pass through arguments +{ + "name": "command-remove-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ +} + +[1]> vp remove -g --dry-run testnpm2 && cat package.json # support remove global package with dry-run +Failed to uninstall testnpm2: Configuration error: Package testnpm2 is not installed + +[2]> vp rm --stream foo && should show tips to use pass through arguments when options are not supported +error: Unexpected argument '--stream' + +Use `-- --stream` to pass the argument as a value diff --git a/packages/cli/snap-tests-global/command-remove-pnpm11/steps.json b/packages/cli/snap-tests-global/command-remove-pnpm11/steps.json new file mode 100644 index 0000000000..7a98a5e6b4 --- /dev/null +++ b/packages/cli/snap-tests-global/command-remove-pnpm11/steps.json @@ -0,0 +1,13 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp remove --help # should show help", + "vp remove # should error because no packages specified", + "vp remove testnpm2 -D && cat package.json # should error when remove not exists package from dev dependencies", + "vp add testnpm2 && vp add -D test-vite-plus-install && vp add -O test-vite-plus-package-optional && cat package.json # should add packages to dependencies", + "vp remove testnpm2 test-vite-plus-install && cat package.json # should remove packages from dependencies", + "vp remove -O test-vite-plus-package-optional -- --loglevel=warn && cat package.json # support remove package from optional dependencies and pass through arguments", + "vp remove -g --dry-run testnpm2 && cat package.json # support remove global package with dry-run", + "vp rm --stream foo && should show tips to use pass through arguments when options are not supported" + ] +} diff --git a/packages/cli/snap-tests-global/command-unlink-pnpm11/package.json b/packages/cli/snap-tests-global/command-unlink-pnpm11/package.json new file mode 100644 index 0000000000..fb77bc16a2 --- /dev/null +++ b/packages/cli/snap-tests-global/command-unlink-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-unlink-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-unlink-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-unlink-pnpm11/snap.txt new file mode 100644 index 0000000000..dcb7643aa7 --- /dev/null +++ b/packages/cli/snap-tests-global/command-unlink-pnpm11/snap.txt @@ -0,0 +1,57 @@ +> vp unlink -h # should show help message +Usage: vp unlink [OPTIONS] [PACKAGE|DIR] [ARGS]... + +Unlink packages + +Arguments: + [PACKAGE|DIR] Package name to unlink + [ARGS]... Arguments to pass to package manager + +Options: + -r, --recursive Unlink in every workspace package + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> 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 + +dependencies: ++ unlink-test-lib <- ../unlink-test-lib + +{ + "name": "command-unlink-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "dependencies": { + "unlink-test-lib": "link:../unlink-test-lib" + } +} + +> vp unlink unlink-test-lib -- --no-frozen-lockfile && cat package.json # should unlink the package (pnpm v11 requires --no-frozen-lockfile under CI=true) +Already up to date + +{ + "name": "command-unlink-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "dependencies": { + "unlink-test-lib": "link:../unlink-test-lib" + } +} + +> vp link ../unlink-test-lib # link again + + +> vp unlink -- --no-frozen-lockfile && cat package.json # should unlink all packages +Already up to date + +{ + "name": "command-unlink-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@ + "dependencies": { + "unlink-test-lib": "link:../unlink-test-lib" + } +} diff --git a/packages/cli/snap-tests-global/command-unlink-pnpm11/steps.json b/packages/cli/snap-tests-global/command-unlink-pnpm11/steps.json new file mode 100644 index 0000000000..bd9523e2a7 --- /dev/null +++ b/packages/cli/snap-tests-global/command-unlink-pnpm11/steps.json @@ -0,0 +1,11 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp unlink -h # should show help message", + "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", + "vp unlink unlink-test-lib -- --no-frozen-lockfile && cat package.json # should unlink the package (pnpm v11 requires --no-frozen-lockfile under CI=true)", + "vp link ../unlink-test-lib # link again", + "vp unlink -- --no-frozen-lockfile && cat package.json # should unlink all packages" + ] +} diff --git a/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/package.json b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/package.json new file mode 100644 index 0000000000..a71f2c0a34 --- /dev/null +++ b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/package.json @@ -0,0 +1,8 @@ +{ + "name": "command-update-pnpm11-with-workspace", + "version": "1.0.0", + "dependencies": { + "testnpm2": "*" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/packages/app/package.json b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/packages/app/package.json new file mode 100644 index 0000000000..579391133d --- /dev/null +++ b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/packages/app/package.json @@ -0,0 +1,11 @@ +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "*", + "testnpm2": "*" + }, + "devDependencies": { + "test-vite-plus-package": "*" + } +} diff --git a/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/packages/utils/package.json b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/packages/utils/package.json new file mode 100644 index 0000000000..fbce9dda5d --- /dev/null +++ b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/packages/utils/package.json @@ -0,0 +1,7 @@ +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "dependencies": { + "testnpm2": "*" + } +} diff --git a/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/pnpm-workspace.yaml b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/pnpm-workspace.yaml new file mode 100644 index 0000000000..924b55f42e --- /dev/null +++ b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/snap.txt b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/snap.txt new file mode 100644 index 0000000000..62fff2f9cd --- /dev/null +++ b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/snap.txt @@ -0,0 +1,107 @@ +> vp update testnpm2 --latest -w && cat package.json # should update in workspace root +Progress: resolved , reused , downloaded , added , done + +Packages: + ++ +Done in ms using pnpm v +{ + "name": "command-update-pnpm11-with-workspace", + "version": "1.0.0", + "dependencies": { + "testnpm2": "^1.0.1" + }, + "packageManager": "pnpm@ +} + +> vp update testnpm2 --latest --filter app && cat packages/app/package.json # should update in specific package +Progress: resolved , reused , downloaded , added , done +. | +2 + +Done in ms using pnpm v +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "*", + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "*" + } +} + +> vp up -D --filter app && cat packages/app/package.json # should update dev dependencies in app +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "*", + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "^1.0.0" + } +} + +> vp update --latest --filter "*" && cat packages/app/package.json packages/utils/package.json # should update in all packages +Scope: all workspace projects +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "^1.0.0", + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "^1.0.0" + } +} +{ + "name": "@vite-plus-test/utils", + "version": "1.0.0", + "dependencies": { + "testnpm2": "^1.0.1" + } +} + +> vp update -r --no-save && cat package.json packages/app/package.json # should update recursively without saving +Scope: all workspace projects +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "command-update-pnpm11-with-workspace", + "version": "1.0.0", + "dependencies": { + "testnpm2": "^1.0.1" + }, + "packageManager": "pnpm@ +} +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "^1.0.0", + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "^1.0.0" + } +} + +> vp update --workspace --filter app @vite-plus-test/utils && cat packages/app/package.json # should update workspace dependency +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "^1.0.0", + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "^1.0.0" + } +} diff --git a/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/steps.json b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/steps.json new file mode 100644 index 0000000000..3bcf5b33b8 --- /dev/null +++ b/packages/cli/snap-tests-global/command-update-pnpm11-with-workspace/steps.json @@ -0,0 +1,11 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp update testnpm2 --latest -w && cat package.json # should update in workspace root", + "vp update testnpm2 --latest --filter app && cat packages/app/package.json # should update in specific package", + "vp up -D --filter app && cat packages/app/package.json # should update dev dependencies in app", + "vp update --latest --filter \"*\" && cat packages/app/package.json packages/utils/package.json # should update in all packages", + "vp update -r --no-save && cat package.json packages/app/package.json # should update recursively without saving", + "vp update --workspace --filter app @vite-plus-test/utils && cat packages/app/package.json # should update workspace dependency" + ] +} diff --git a/packages/cli/snap-tests-global/command-update-pnpm11/package.json b/packages/cli/snap-tests-global/command-update-pnpm11/package.json new file mode 100644 index 0000000000..2f6495c393 --- /dev/null +++ b/packages/cli/snap-tests-global/command-update-pnpm11/package.json @@ -0,0 +1,14 @@ +{ + "name": "command-update-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "*" + }, + "devDependencies": { + "test-vite-plus-package": "*" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "*" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-update-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-update-pnpm11/snap.txt new file mode 100644 index 0000000000..78d7731cd3 --- /dev/null +++ b/packages/cli/snap-tests-global/command-update-pnpm11/snap.txt @@ -0,0 +1,173 @@ +> vp update --help # should show help +Usage: vp update [OPTIONS] [PACKAGES]... [-- ...] + +Update packages to their latest versions + +Arguments: + [PACKAGES]... Packages to update (optional - updates all if omitted) + [PASS_THROUGH_ARGS]... Additional arguments to pass through to the package manager + +Options: + -L, --latest Update to latest version (ignore semver range) + -g, --global Update global packages + -r, --recursive Update recursively in all workspace packages + --filter Filter packages in monorepo (can be used multiple times) + -w, --workspace-root Include workspace root + -D, --dev Update only devDependencies + -P, --prod Update only dependencies (production) + -i, --interactive Interactive mode + --no-optional Don't update optionalDependencies + --no-save Update lockfile only, don't modify package.json + --workspace Only update if package exists in workspace (pnpm-specific) + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp update testnpm2 && cat package.json # should update package within semver range +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ testnpm2 + +optionalDependencies: ++ test-vite-plus-package-optional + +devDependencies: ++ test-vite-plus-package + +Done in ms using pnpm v +{ + "name": "command-update-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "*" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "*" + }, + "packageManager": "pnpm@ +} + +> vp up testnpm2 --latest && cat package.json # should to absolute latest version +Already up to date +Progress: resolved , reused , downloaded , added , done + +Done in ms using pnpm v +{ + "name": "command-update-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "*" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "*" + }, + "packageManager": "pnpm@ +} + +> vp update -D && cat package.json # should update only dev dependencies +Already up to date +Progress: resolved , reused , downloaded , added , done + +dependencies: skipped + +optionalDependencies: skipped + +Done in ms using pnpm v +{ + "name": "command-update-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "*" + }, + "packageManager": "pnpm@ +} + +> vp update -P --no-save && cat package.json # should update only dependencies and optionalDependencies without saving +Already up to date +Progress: resolved , reused , downloaded , added , done + +devDependencies: skipped + +Done in ms using pnpm v +{ + "name": "command-update-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "^1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "*" + }, + "packageManager": "pnpm@ +} + +> vp rm testnpm2 # should remove package from dependencies for the next test +> vp add testnpm2@1.0.0 -O && vp update --no-optional --latest && cat package.json # should skip optional dependencies +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +optionalDependencies: ++ testnpm2 (1.0.1 is available) + +Done in ms using pnpm v +Packages: + -1 ++- +Progress: resolved , reused , downloaded , added , done + +optionalDependencies: +- testnpm2 ++ testnpm2 + +Done in ms using pnpm v +{ + "name": "command-update-pnpm11", + "version": "1.0.0", + "devDependencies": { + "test-vite-plus-package": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0", + "testnpm2": "1.0.1" + }, + "packageManager": "pnpm@ +} + +> vp update && vp update --recursive && cat package.json # should update all packages and change the package.json +Already up to date +Progress: resolved , reused , downloaded , added , done + +Done in ms using pnpm v +Progress: resolved , reused , downloaded , added , done +Done in ms using pnpm v +{ + "name": "command-update-pnpm11", + "version": "1.0.0", + "devDependencies": { + "test-vite-plus-package": "^1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "^1.0.0", + "testnpm2": "1.0.1" + }, + "packageManager": "pnpm@ +} diff --git a/packages/cli/snap-tests-global/command-update-pnpm11/steps.json b/packages/cli/snap-tests-global/command-update-pnpm11/steps.json new file mode 100644 index 0000000000..6e517683eb --- /dev/null +++ b/packages/cli/snap-tests-global/command-update-pnpm11/steps.json @@ -0,0 +1,16 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp update --help # should show help", + "vp update testnpm2 && cat package.json # should update package within semver range", + "vp up testnpm2 --latest && cat package.json # should to absolute latest version", + "vp update -D && cat package.json # should update only dev dependencies", + "vp update -P --no-save && cat package.json # should update only dependencies and optionalDependencies without saving", + { + "command": "vp rm testnpm2 # should remove package from dependencies for the next test", + "ignoreOutput": true + }, + "vp add testnpm2@1.0.0 -O && vp update --no-optional --latest && cat package.json # should skip optional dependencies", + "vp update && vp update --recursive && cat package.json # should update all packages and change the package.json" + ] +} diff --git a/packages/cli/snap-tests-global/command-view-pnpm11/package.json b/packages/cli/snap-tests-global/command-view-pnpm11/package.json new file mode 100644 index 0000000000..6ec3b9ea14 --- /dev/null +++ b/packages/cli/snap-tests-global/command-view-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-view-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-view-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-view-pnpm11/snap.txt new file mode 100644 index 0000000000..60c094e839 --- /dev/null +++ b/packages/cli/snap-tests-global/command-view-pnpm11/snap.txt @@ -0,0 +1,83 @@ +> vp pm view --help # should show help +Usage: vp pm view [OPTIONS] [FIELD] [-- ...] + +View package information from the registry + +Arguments: + Package name with optional version + [FIELD] Specific field to view + [PASS_THROUGH_ARGS]... Additional arguments + +Options: + --json Output in JSON format + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp pm view testnpm2 # should view lodash package information (uses npm view) + +testnpm2@ | ISC | deps: none | versions: 2 + +dist +.tarball: https://registry./testnpm2/-/testnpm2-1.0.1.tgz +.shasum: +.integrity: sha512- + +maintainers: +- fengmk2 + +dist-tags: +latest: +release-1: + +published over a year ago by fengmk2 + +> vp pm view testnpm2 version # should view lodash version field (uses npm view) +1.0.1 + +> vp pm view testnpm2@1.0.0 # should view specific version of lodash (uses npm view) + +testnpm2@ | ISC | deps: none | versions: 2 + +dist +.tarball: https://registry./testnpm2/-/testnpm2-1.0.0.tgz +.shasum: +.integrity: sha512- + +maintainers: +- fengmk2 + +dist-tags: +latest: +release-1: + +published over a year ago by fengmk2 + +> vp pm view testnpm2 dist.tarball # should view nested field (uses npm view) +https://registry./testnpm2/-/testnpm2-1.0.1.tgz + +> vp pm view testnpm2 dependencies # should view dependencies object (uses npm view) +> vp pm view testnpm2 dist.tarball --json # should view package.dist.tarball info in JSON format (uses npm view) +"https://registry./testnpm2/-/testnpm2-1.0.1.tgz" + +> vp pm view testnpm2 version --json # should view field in JSON format (uses npm view) +"1.0.1" + +> vp pm view testnpm2 -- --loglevel=warn # should support pass through arguments (uses npm view) + +testnpm2@ | ISC | deps: none | versions: 2 + +dist +.tarball: https://registry./testnpm2/-/testnpm2-1.0.1.tgz +.shasum: +.integrity: sha512- + +maintainers: +- fengmk2 + +dist-tags: +latest: +release-1: + +published over a year ago by fengmk2 diff --git a/packages/cli/snap-tests-global/command-view-pnpm11/steps.json b/packages/cli/snap-tests-global/command-view-pnpm11/steps.json new file mode 100644 index 0000000000..c89aea7830 --- /dev/null +++ b/packages/cli/snap-tests-global/command-view-pnpm11/steps.json @@ -0,0 +1,13 @@ +{ + "commands": [ + "vp pm view --help # should show help", + "vp pm view testnpm2 # should view lodash package information (uses npm view)", + "vp pm view testnpm2 version # should view lodash version field (uses npm view)", + "vp pm view testnpm2@1.0.0 # should view specific version of lodash (uses npm view)", + "vp pm view testnpm2 dist.tarball # should view nested field (uses npm view)", + "vp pm view testnpm2 dependencies # should view dependencies object (uses npm view)", + "vp pm view testnpm2 dist.tarball --json # should view package.dist.tarball info in JSON format (uses npm view)", + "vp pm view testnpm2 version --json # should view field in JSON format (uses npm view)", + "vp pm view testnpm2 -- --loglevel=warn # should support pass through arguments (uses npm view)" + ] +} diff --git a/packages/cli/snap-tests-global/command-vpx-pnpm11/package.json b/packages/cli/snap-tests-global/command-vpx-pnpm11/package.json new file mode 100644 index 0000000000..511b70de1a --- /dev/null +++ b/packages/cli/snap-tests-global/command-vpx-pnpm11/package.json @@ -0,0 +1,5 @@ +{ + "name": "command-vpx-pnpm11", + "version": "1.0.0", + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-vpx-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-vpx-pnpm11/snap.txt new file mode 100644 index 0000000000..908f9b8cf7 --- /dev/null +++ b/packages/cli/snap-tests-global/command-vpx-pnpm11/snap.txt @@ -0,0 +1,30 @@ +> vpx --help # should show vpx help message +Execute a command from a local or remote npm package + +Usage: vpx [OPTIONS] [args...] + +Arguments: + Package binary to execute + [args...] Arguments to pass to the command + +Options: + -p, --package Package(s) to install if not found locally + -c, --shell-mode Execute the command within a shell environment + -s, --silent Suppress all output except the command's output + -h, --help Print help + +Examples: + vpx eslint . # Run local eslint (or download) + vpx create-vue my-app # Download and run create-vue + vpx typescript@ tsc --version # Run specific version + vpx -p cowsay -c 'echo "hi" | cowsay' # Shell mode with package + +> vpx -s cowsay hello # should run cowsay via dlx fallback + _______ +< hello > + ------- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || diff --git a/packages/cli/snap-tests-global/command-vpx-pnpm11/steps.json b/packages/cli/snap-tests-global/command-vpx-pnpm11/steps.json new file mode 100644 index 0000000000..1947f55875 --- /dev/null +++ b/packages/cli/snap-tests-global/command-vpx-pnpm11/steps.json @@ -0,0 +1,6 @@ +{ + "commands": [ + "vpx --help # should show vpx help message", + "vpx -s cowsay hello # should run cowsay via dlx fallback" + ] +} diff --git a/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/package.json b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/package.json new file mode 100644 index 0000000000..053b9bbbc2 --- /dev/null +++ b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/package.json @@ -0,0 +1,8 @@ +{ + "name": "command-why-pnpm11-with-workspace", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.0" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/packages/app/package.json b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/packages/app/package.json new file mode 100644 index 0000000000..9cab9ad683 --- /dev/null +++ b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/packages/app/package.json @@ -0,0 +1,14 @@ +{ + "name": "app", + "dependencies": { + "@vite-plus-test/utils": "workspace:*", + "test-vite-plus-install": "1.0.0", + "testnpm2": "1.0.0" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-other-optional": "1.0.0" + } +} diff --git a/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/packages/utils/package.json b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/packages/utils/package.json new file mode 100644 index 0000000000..5089db43d3 --- /dev/null +++ b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/packages/utils/package.json @@ -0,0 +1,6 @@ +{ + "name": "@vite-plus-test/utils", + "dependencies": { + "testnpm2": "1.0.0" + } +} diff --git a/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/pnpm-workspace.yaml b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/pnpm-workspace.yaml new file mode 100644 index 0000000000..924b55f42e --- /dev/null +++ b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/snap.txt b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/snap.txt new file mode 100644 index 0000000000..b62827bccd --- /dev/null +++ b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/snap.txt @@ -0,0 +1,72 @@ +> 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 + +> vp why testnpm2 -w # should check why in workspace root +testnpm2@ +└── command-why-pnpm11-with-workspace@ (dependencies) + +Found 1 version of testnpm2 + +> vp why testnpm2 --filter app # should check why in specific package +testnpm2@ +├── @vite-plus-test/utils (dependencies) +└── app (dependencies) + +Found 1 version of testnpm2 + +> vp why test-vite-plus-package -D --filter app # should check why dev dependencies in app +test-vite-plus-package@ +└── app (devDependencies) + +Found 1 version of test-vite-plus-package + +> vp why testnpm2 --filter "*" # should check why in all packages +testnpm2@ +├── @vite-plus-test/utils (dependencies) +├── app (dependencies) +└── command-why-pnpm11-with-workspace@ (dependencies) + +Found 1 version of testnpm2 + +> vp why testnpm2 -r # should check why recursively +testnpm2@ +├── @vite-plus-test/utils (dependencies) +├── app (dependencies) +└── command-why-pnpm11-with-workspace@ (dependencies) + +Found 1 version of testnpm2 + +> vp why testnpm2 --filter app --json # should support json output with filter +[ + { + "name": "testnpm2", + "version": "1.0.0", + "path": "/node_modules/.pnpm/testnpm2@/node_modules/testnpm2", + "dependents": [ + { + "name": "@vite-plus-test/utils", + "version": "", + "depField": "dependencies" + }, + { + "name": "app", + "version": "", + "depField": "dependencies" + } + ] + } +] + +> vp why test-vite-plus-install --filter app --depth 1 # should support depth limiting with filter +test-vite-plus-install@ +└── app (dependencies) + +Found 1 version of test-vite-plus-install diff --git a/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/steps.json b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/steps.json new file mode 100644 index 0000000000..52da8c58de --- /dev/null +++ b/packages/cli/snap-tests-global/command-why-pnpm11-with-workspace/steps.json @@ -0,0 +1,13 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp install", + "vp why testnpm2 -w # should check why in workspace root", + "vp why testnpm2 --filter app # should check why in specific package", + "vp why test-vite-plus-package -D --filter app # should check why dev dependencies in app", + "vp why testnpm2 --filter \"*\" # should check why in all packages", + "vp why testnpm2 -r # should check why recursively", + "vp why testnpm2 --filter app --json # should support json output with filter", + "vp why test-vite-plus-install --filter app --depth 1 # should support depth limiting with filter" + ] +} diff --git a/packages/cli/snap-tests-global/command-why-pnpm11/package.json b/packages/cli/snap-tests-global/command-why-pnpm11/package.json new file mode 100644 index 0000000000..999985e71f --- /dev/null +++ b/packages/cli/snap-tests-global/command-why-pnpm11/package.json @@ -0,0 +1,14 @@ +{ + "name": "command-why-pnpm11", + "version": "1.0.0", + "dependencies": { + "testnpm2": "1.0.1" + }, + "devDependencies": { + "test-vite-plus-package": "1.0.0" + }, + "optionalDependencies": { + "test-vite-plus-package-optional": "1.0.0" + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/command-why-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-why-pnpm11/snap.txt new file mode 100644 index 0000000000..fb1b347885 --- /dev/null +++ b/packages/cli/snap-tests-global/command-why-pnpm11/snap.txt @@ -0,0 +1,125 @@ +> vp why --help # should show help +Usage: vp why [OPTIONS] ... [-- ...] + +Show why a package is installed + +Arguments: + ... Package(s) to check + [PASS_THROUGH_ARGS]... Additional arguments to pass through to the package manager + +Options: + --json Output in JSON format + --long Show extended information + --parseable Show parseable output + -r, --recursive Check recursively across all workspaces + --filter Filter packages in monorepo + -w, --workspace-root Check in workspace root + -P, --prod Only production dependencies + -D, --dev Only dev dependencies + --depth Limit tree depth + --no-optional Exclude optional dependencies + -g, --global Check globally installed packages + --exclude-peers Exclude peer dependencies + --find-by Use a finder function defined in .pnpmfile.cjs + -h, --help Print help + +Documentation: https://viteplus.dev/guide/install + + +> vp install # should install packages first +Packages: + ++ +Progress: resolved , reused , downloaded , added , done + +dependencies: ++ testnpm2 + +optionalDependencies: ++ test-vite-plus-package-optional + +devDependencies: ++ test-vite-plus-package + +Done in ms using pnpm v + +> vp why testnpm2 # should show why package is installed +testnpm2@ +└── command-why-pnpm11@ (dependencies) + +Found 1 version of testnpm2 + +> vp explain testnpm2 # should work with explain alias +testnpm2@ +└── command-why-pnpm11@ (dependencies) + +Found 1 version of testnpm2 + +> vp why test-vite-plus-package # should show why dev package is installed +test-vite-plus-package@ +└── command-why-pnpm11@ (devDependencies) + +Found 1 version of test-vite-plus-package + +> vp why testnpm2 test-vite-plus-package # should support multiple packages +test-vite-plus-package@ +└── command-why-pnpm11@ (devDependencies) + +testnpm2@ +└── command-why-pnpm11@ (dependencies) + +Found 1 version of test-vite-plus-package +Found 1 version of testnpm2 + +> vp why testnpm2 --json # should support json output +[ + { + "name": "testnpm2", + "version": "1.0.1", + "path": "/node_modules/.pnpm/testnpm2@/node_modules/testnpm2", + "dependents": [ + { + "name": "command-why-pnpm11", + "version": "1.0.0", + "depField": "dependencies" + } + ] + } +] + +> vp why testnpm2 --long # should support long output +testnpm2@ +│ /node_modules/.pnpm/testnpm2@/node_modules/testnpm2 +└── command-why-pnpm11@ (dependencies) + +Found 1 version of testnpm2 + +> vp why testnpm2 --parseable # should support parseable output +command-why-pnpm11@ > testnpm2@ + +> vp why testnpm2 -P # should support prod dependencies only +testnpm2@ +└── command-why-pnpm11@ (dependencies) + +Found 1 version of testnpm2 + +> vp why test-vite-plus-package -D # should support dev dependencies only +test-vite-plus-package@ +└── command-why-pnpm11@ (devDependencies) + +Found 1 version of test-vite-plus-package + +> vp why testnpm2 --depth 1 # should support depth limiting +testnpm2@ +└── command-why-pnpm11@ (dependencies) + +Found 1 version of testnpm2 + +> vp why test-vite-plus-package-optional --no-optional # should exclude optional dependencies +[1]> vp why testnpm2 --find-by customFinder # should support find-by option (pnpm-specific) + ERR_PNPM_FINDER_NOT_FOUND  No finder with name customFinder is found + +> vp why testnpm2 -- --reporter=silent # should support pass through arguments +testnpm2@ +└── command-why-pnpm11@ (dependencies) + +Found 1 version of testnpm2 diff --git a/packages/cli/snap-tests-global/command-why-pnpm11/steps.json b/packages/cli/snap-tests-global/command-why-pnpm11/steps.json new file mode 100644 index 0000000000..e7b38a4206 --- /dev/null +++ b/packages/cli/snap-tests-global/command-why-pnpm11/steps.json @@ -0,0 +1,20 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vp why --help # should show help", + "vp install # should install packages first", + "vp why testnpm2 # should show why package is installed", + "vp explain testnpm2 # should work with explain alias", + "vp why test-vite-plus-package # should show why dev package is installed", + "vp why testnpm2 test-vite-plus-package # should support multiple packages", + "vp why testnpm2 --json # should support json output", + "vp why testnpm2 --long # should support long output", + "vp why testnpm2 --parseable # should support parseable output", + "vp why testnpm2 -P # should support prod dependencies only", + "vp why test-vite-plus-package -D # should support dev dependencies only", + "vp why testnpm2 --depth 1 # should support depth limiting", + "vp why test-vite-plus-package-optional --no-optional # should exclude optional dependencies", + "vp why testnpm2 --find-by customFinder # should support find-by option (pnpm-specific)", + "vp why testnpm2 -- --reporter=silent # should support pass through arguments" + ] +} diff --git a/packages/cli/snap-tests-global/dev-engines-runtime-pnpm11/package.json b/packages/cli/snap-tests-global/dev-engines-runtime-pnpm11/package.json new file mode 100644 index 0000000000..a474ddf6ec --- /dev/null +++ b/packages/cli/snap-tests-global/dev-engines-runtime-pnpm11/package.json @@ -0,0 +1,11 @@ +{ + "name": "dev-engines-runtime-pnpm11", + "version": "1.0.0", + "devEngines": { + "runtime": { + "name": "node", + "version": "22.22.2" + } + }, + "packageManager": "pnpm@11.0.0-rc.5" +} diff --git a/packages/cli/snap-tests-global/dev-engines-runtime-pnpm11/snap.txt b/packages/cli/snap-tests-global/dev-engines-runtime-pnpm11/snap.txt new file mode 100644 index 0000000000..0ecf520f73 --- /dev/null +++ b/packages/cli/snap-tests-global/dev-engines-runtime-pnpm11/snap.txt @@ -0,0 +1,2 @@ +> vp dlx -s print-current-version # should print Node.js version 22.22.2 from devEngines.runtime +v22.22.2 diff --git a/packages/cli/snap-tests-global/dev-engines-runtime-pnpm11/steps.json b/packages/cli/snap-tests-global/dev-engines-runtime-pnpm11/steps.json new file mode 100644 index 0000000000..fe35235871 --- /dev/null +++ b/packages/cli/snap-tests-global/dev-engines-runtime-pnpm11/steps.json @@ -0,0 +1,5 @@ +{ + "commands": [ + "vp dlx -s print-current-version # should print Node.js version 22.22.2 from devEngines.runtime" + ] +} diff --git a/rfcs/add-remove-package-commands.md b/rfcs/add-remove-package-commands.md index 9b2ee4d13d..31ab75528a 100644 --- a/rfcs/add-remove-package-commands.md +++ b/rfcs/add-remove-package-commands.md @@ -866,6 +866,7 @@ $ vp add - pnpm@9.x [WIP] - pnpm@10.x +- pnpm@11.x [WIP] - yarn@1.x [WIP] - yarn@4.x - npm@10.x diff --git a/rfcs/dedupe-package-command.md b/rfcs/dedupe-package-command.md index a466a59663..948c2a43d7 100644 --- a/rfcs/dedupe-package-command.md +++ b/rfcs/dedupe-package-command.md @@ -559,6 +559,7 @@ vp dedupe:run - pnpm@9.x (WIP) - pnpm@10.x +- pnpm@11.x (WIP) - yarn@4.x (yarn@2+) - npm@10.x - npm@11.x (WIP) diff --git a/rfcs/install-command.md b/rfcs/install-command.md index e3b1e1b227..8c5a384dcd 100644 --- a/rfcs/install-command.md +++ b/rfcs/install-command.md @@ -800,6 +800,7 @@ VITE_PM=pnpm vp install - pnpm@9.x - pnpm@10.x +- pnpm@11.x [WIP] - yarn@1.x - yarn@4.x - npm@10.x diff --git a/rfcs/link-unlink-package-commands.md b/rfcs/link-unlink-package-commands.md index 39fa0aea44..160554ea57 100644 --- a/rfcs/link-unlink-package-commands.md +++ b/rfcs/link-unlink-package-commands.md @@ -753,6 +753,7 @@ $ vp link - pnpm@9.x - pnpm@10.x +- pnpm@11.x [WIP] (pass `-- --no-frozen-lockfile` to `vp unlink` under CI=true; see snap-tests `command-unlink-pnpm11`) - yarn@1.x - yarn@4.x - npm@10.x diff --git a/rfcs/outdated-package-command.md b/rfcs/outdated-package-command.md index d1ea80b7a0..936477d2ea 100644 --- a/rfcs/outdated-package-command.md +++ b/rfcs/outdated-package-command.md @@ -1005,6 +1005,7 @@ vp outdated --update - pnpm@9.x - pnpm@10.x +- pnpm@11.x [WIP] - yarn@1.x - yarn@4.x - npm@10.x diff --git a/rfcs/update-package-command.md b/rfcs/update-package-command.md index 55e40b025d..a543b37ad4 100644 --- a/rfcs/update-package-command.md +++ b/rfcs/update-package-command.md @@ -646,6 +646,7 @@ vp update react --range # Updates within semver range - pnpm@9.x [WIP] - pnpm@10.x +- pnpm@11.x [WIP] - yarn@1.x [WIP] - yarn@4.x - npm@10.x diff --git a/rfcs/why-package-command.md b/rfcs/why-package-command.md index 95e0a80bd8..588d59dd94 100644 --- a/rfcs/why-package-command.md +++ b/rfcs/why-package-command.md @@ -986,6 +986,7 @@ vp why react --json # On yarn - pnpm@9.x - pnpm@10.x +- pnpm@11.x [WIP] - yarn@1.x - yarn@4.x - npm@10.x