mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 06:21:37 +00:00
* fix(scripts): complete worktree lint toolchain * fix(scripts): prepare complete lint pipeline
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
// Runs the complete lint pipeline after preparing a linked-worktree toolchain.
|
|
import { spawnSync } from "node:child_process";
|
|
import { createRequire } from "node:module";
|
|
import path from "node:path";
|
|
import { pathToFileURL } from "node:url";
|
|
import {
|
|
ensureRepoToolNodeModulesLink,
|
|
resolveRepoToolBinPath,
|
|
} from "./lib/local-heavy-check-runtime.mjs";
|
|
|
|
function run(command, args, options) {
|
|
const result = spawnSync(command, args, options);
|
|
if (result.error) {
|
|
throw result.error;
|
|
}
|
|
return result.status ?? 1;
|
|
}
|
|
|
|
const oxlintPath = resolveRepoToolBinPath("oxlint");
|
|
const tsxPath = resolveRepoToolBinPath("tsx");
|
|
ensureRepoToolNodeModulesLink(oxlintPath);
|
|
const tsxImportSpecifier = pathToFileURL(createRequire(tsxPath).resolve("tsx")).href;
|
|
|
|
// Invoke the pre-step directly: running pnpm through a linked node_modules can
|
|
// reconcile the owning checkout's dependency tree instead of merely running it.
|
|
const uiI18nStatus = run(
|
|
process.execPath,
|
|
["--import", tsxImportSpecifier, path.resolve("scripts", "control-ui-i18n-verify.ts"), "verify"],
|
|
{ env: process.env, stdio: "inherit" },
|
|
);
|
|
if (uiI18nStatus !== 0) {
|
|
process.exitCode = uiI18nStatus;
|
|
} else {
|
|
process.exitCode = run(
|
|
process.execPath,
|
|
[path.resolve("scripts", "run-oxlint-shards.mjs"), ...process.argv.slice(2)],
|
|
{ env: process.env, stdio: "inherit" },
|
|
);
|
|
}
|