Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"build:docs": "vp run --filter @antdv-next/docs build",
"build:x": "vp run --filter @antdv-next/x build",
"build:token": "vp run --filter @antdv-next/x build:token",
"pack:packages": "vp pm pack -r --filter \"./packages/*\" --filter \"!./packages/docs\"",
"publish:packages": "vp pm publish -r --filter \"./packages/*\" --filter \"!./packages/docs\" --access public --no-git-checks",
"publish:x": "vp run --filter @antdv-next/x build && vp pm publish --filter @antdv-next/x --access public --no-git-checks",
"publish:x-markdown": "vp run --filter @antdv-next/x-markdown build && vp pm publish --filter @antdv-next/x-markdown --access public --no-git-checks",
"publish:x-sdk": "vp run --filter @antdv-next/x-sdk build && vp pm publish --filter @antdv-next/x-sdk --access public --no-git-checks",
"publish:x-skill": "vp run --filter @antdv-next/x-skill build && vp pm publish --filter @antdv-next/x-skill --access public --no-git-checks",
"publish:x-card": "vp run --filter @antdv-next/x-card build && vp pm publish --filter @antdv-next/x-card --access public --no-git-checks",
"pack:packages": "node scripts/run-pm.mjs pack -r --filter \"./packages/*\" --filter \"!./packages/docs\"",
"publish:packages": "node scripts/run-pm.mjs publish -r --filter \"./packages/*\" --filter \"!./packages/docs\" --access public --no-git-checks",
"publish:x": "vp run --filter @antdv-next/x build && node scripts/run-pm.mjs publish --filter @antdv-next/x --access public --no-git-checks",
"publish:x-markdown": "vp run --filter @antdv-next/x-markdown build && node scripts/run-pm.mjs publish --filter @antdv-next/x-markdown --access public --no-git-checks",
"publish:x-sdk": "vp run --filter @antdv-next/x-sdk build && node scripts/run-pm.mjs publish --filter @antdv-next/x-sdk --access public --no-git-checks",
"publish:x-skill": "vp run --filter @antdv-next/x-skill build && node scripts/run-pm.mjs publish --filter @antdv-next/x-skill --access public --no-git-checks",
"publish:x-card": "vp run --filter @antdv-next/x-card build && node scripts/run-pm.mjs publish --filter @antdv-next/x-card --access public --no-git-checks",
"bump:x": "vp exec bumpp packages/x/package.json --tag \"@antdv-next/x@\"",
"bump:x-markdown": "vp exec bumpp packages/x-markdown/package.json --tag \"@antdv-next/x-markdown@\"",
"bump:x-sdk": "vp exec bumpp packages/x-sdk/package.json --tag \"@antdv-next/x-sdk@\"",
Expand Down
34 changes: 34 additions & 0 deletions scripts/run-pm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Forward all arguments to `vp pm` (the Vite+ package-manager forwarder).
//
// Why this script exists:
// `vp pm` is only implemented by the full Vite+ CLI binary, not by the local
// `node_modules/.bin/vp` JS wrapper (which only covers core commands like
// dev/build/run/exec/install/...). When a package.json script is executed via
// `vp run <script>`, the task runner prepends `node_modules/.bin` to `PATH`, so
// any `vp pm ...` launched from that script resolves to the local JS wrapper
// and fails with:
//
// error: Command 'pm' not found
//
// `vp run` exposes the path to the full CLI binary through the `VP_CLI_BIN`
// environment variable, so we use that to invoke `vp pm` directly. We fall back
// to `vp` (resolved from PATH) when `VP_CLI_BIN` is not set — e.g. when this
// script is run outside of `vp run`, where `vp` already resolves to the full
// binary.
//
// Usage (from a package.json script):
// node scripts/run-pm.mjs publish --filter @scope/pkg --access public --no-git-checks
// node scripts/run-pm.mjs pack -r --filter "./packages/*" --filter "!./packages/docs"
import { spawnSync } from "node:child_process";

const bin = process.env.VP_CLI_BIN || "vp";
const result = spawnSync(bin, ["pm", ...process.argv.slice(2)], {
stdio: "inherit",
});

if (result.error) {
console.error(`[run-pm] failed to spawn '${bin}': ${result.error.message}`);
process.exit(1);
}

process.exit(result.status ?? 1);
Loading