mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-11 18:08:03 +00:00
* refactor(scripts): migrate JavaScript tools to TypeScript * fix(ci): keep changed-scope preflight zero-install * fix(ci): preserve zero-install script owners * fix(ci): complete script migration follow-through * fix(release): keep stable closeout zero-install * fix(scripts): preserve standalone execution boundaries * fix(scripts): repair standalone loader boundaries * fix(scripts): normalize gateway observation ids * fix(scripts): keep Docker packager standalone * test(scripts): preserve rebase cleanup helpers * test(sessions): use tracked temp directory
60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
// Runs the complete lint pipeline after preparing a linked-worktree toolchain.
|
|
import { spawnSync, type SpawnSyncOptions } 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.mts";
|
|
|
|
function run(command: string, args: string[], options: SpawnSyncOptions) {
|
|
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 {
|
|
const oxlintStatus = run(
|
|
process.execPath,
|
|
[
|
|
"--import",
|
|
tsxImportSpecifier,
|
|
path.resolve("scripts", "run-oxlint-shards.mts"),
|
|
...process.argv.slice(2),
|
|
],
|
|
{ env: process.env, stdio: "inherit" },
|
|
);
|
|
if (oxlintStatus !== 0) {
|
|
process.exitCode = oxlintStatus;
|
|
} else {
|
|
// Control UI CSS hygiene: plain stylesheets plus css`` templates in Lit
|
|
// components. oxlint cannot see inside tagged CSS templates.
|
|
process.exitCode = run(
|
|
resolveRepoToolBinPath("stylelint"),
|
|
[
|
|
"--config",
|
|
path.resolve("config", "stylelint.config.mjs"),
|
|
"ui/src/**/*.css",
|
|
"ui/src/**/*.ts",
|
|
],
|
|
{ env: process.env, stdio: "inherit" },
|
|
);
|
|
}
|
|
}
|