fix(plugin): require runtime build package targets

This commit is contained in:
Vincent Koc
2026-06-06 22:29:12 +02:00
parent bd7f65d445
commit 3f3b757e50
3 changed files with 43 additions and 8 deletions

View File

@@ -11,16 +11,20 @@ import {
resolvePluginNpmRuntimeBuildPlan,
} from "./lib/plugin-npm-runtime-build.mjs";
function parseArgs(argv) {
function readPackageArgValue(argv, index) {
const value = argv[index + 1];
if (value === undefined || value === "" || value.startsWith("--")) {
throw new Error("missing value for --package");
}
return value;
}
export function parseArgs(argv) {
const packageDirs = [];
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index];
if (arg === "--package") {
const packageDir = argv[index + 1];
if (!packageDir) {
throw new Error("missing value for --package");
}
packageDirs.push(packageDir);
packageDirs.push(readPackageArgValue(argv, index));
index += 1;
continue;
}

View File

@@ -294,11 +294,16 @@ export async function buildPluginNpmRuntime(params) {
};
}
function parseArgs(argv) {
function readPackageDirArg(argv) {
const packageDir = argv[0];
if (!packageDir) {
if (!packageDir || packageDir.startsWith("--")) {
throw new Error("usage: node scripts/lib/plugin-npm-runtime-build.mjs <package-dir>");
}
return packageDir;
}
export function parseArgs(argv) {
const packageDir = readPackageDirArg(argv);
return { packageDir };
}