mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:20:43 +00:00
fix(ci): prepare plugin sdk dts before lint
This commit is contained in:
@@ -6,32 +6,86 @@ import {
|
||||
shouldAcquireLocalHeavyCheckLockForOxlint,
|
||||
} from "./lib/local-heavy-check-runtime.mjs";
|
||||
|
||||
const { args: finalArgs, env } = applyLocalOxlintPolicy(process.argv.slice(2), process.env);
|
||||
|
||||
const oxlintPath = path.resolve("node_modules", ".bin", "oxlint");
|
||||
const releaseLock = shouldAcquireLocalHeavyCheckLockForOxlint(finalArgs, {
|
||||
cwd: process.cwd(),
|
||||
env,
|
||||
})
|
||||
? acquireLocalHeavyCheckLockSync({
|
||||
cwd: process.cwd(),
|
||||
env,
|
||||
toolName: "oxlint",
|
||||
})
|
||||
: () => {};
|
||||
const PREPARE_EXTENSION_BOUNDARY_ARGS = [
|
||||
path.resolve("scripts", "prepare-extension-package-boundary-artifacts.mjs"),
|
||||
];
|
||||
const OXLINT_PREPARE_SKIP_FLAGS = new Set([
|
||||
"--help",
|
||||
"-h",
|
||||
"--version",
|
||||
"-V",
|
||||
"--print-config",
|
||||
"--rules",
|
||||
"--init",
|
||||
"--lsp",
|
||||
]);
|
||||
export function shouldPrepareExtensionPackageBoundaryArtifacts(args) {
|
||||
return !args.some((arg) => OXLINT_PREPARE_SKIP_FLAGS.has(arg));
|
||||
}
|
||||
|
||||
try {
|
||||
const result = spawnSync(oxlintPath, finalArgs, {
|
||||
stdio: "inherit",
|
||||
function prepareExtensionPackageBoundaryArtifacts(env) {
|
||||
const releaseArtifactsLock = acquireLocalHeavyCheckLockSync({
|
||||
cwd: process.cwd(),
|
||||
env,
|
||||
shell: process.platform === "win32",
|
||||
toolName: "extension-package-boundary-artifacts",
|
||||
lockName: "extension-package-boundary-artifacts",
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
}
|
||||
try {
|
||||
const result = spawnSync(process.execPath, PREPARE_EXTENSION_BOUNDARY_ARGS, {
|
||||
stdio: "inherit",
|
||||
env,
|
||||
});
|
||||
|
||||
process.exitCode = result.status ?? 1;
|
||||
} finally {
|
||||
releaseLock();
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
if ((result.status ?? 1) !== 0) {
|
||||
throw new Error(
|
||||
`prepare-extension-package-boundary-artifacts failed with exit code ${result.status ?? 1}`,
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
releaseArtifactsLock();
|
||||
}
|
||||
}
|
||||
|
||||
export function main(argv = process.argv.slice(2), runtimeEnv = process.env) {
|
||||
const { args: finalArgs, env } = applyLocalOxlintPolicy(argv, runtimeEnv);
|
||||
const releaseLock = shouldAcquireLocalHeavyCheckLockForOxlint(finalArgs, {
|
||||
cwd: process.cwd(),
|
||||
env,
|
||||
})
|
||||
? acquireLocalHeavyCheckLockSync({
|
||||
cwd: process.cwd(),
|
||||
env,
|
||||
toolName: "oxlint",
|
||||
})
|
||||
: () => {};
|
||||
|
||||
try {
|
||||
if (shouldPrepareExtensionPackageBoundaryArtifacts(finalArgs)) {
|
||||
prepareExtensionPackageBoundaryArtifacts(env);
|
||||
}
|
||||
|
||||
const result = spawnSync(oxlintPath, finalArgs, {
|
||||
stdio: "inherit",
|
||||
env,
|
||||
shell: process.platform === "win32",
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
process.exitCode = result.status ?? 1;
|
||||
} finally {
|
||||
releaseLock();
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
main();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user