mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 20:35:39 -06:00
chore(release): satisfy parallel runner lint
This commit is contained in:
@@ -1323,7 +1323,7 @@ function updateOrCheckPackage(packageDir, check, changedPaths = []) {
|
||||
}
|
||||
|
||||
export async function runBoundedTasks(items, jobs, runTask) {
|
||||
const results = new Array(items.length);
|
||||
const results = Array.from({ length: items.length });
|
||||
let nextIndex = 0;
|
||||
const workers = Array.from({ length: Math.min(jobs, items.length) }, async () => {
|
||||
while (nextIndex < items.length) {
|
||||
@@ -1427,15 +1427,20 @@ if (!isMainThread && workerData?.kind === SHRINKWRAP_WORKER_KIND) {
|
||||
workerData.check,
|
||||
workerData.changedPaths,
|
||||
);
|
||||
// oxlint-disable-next-line unicorn/require-post-message-target-origin -- Node MessagePort has no targetOrigin parameter.
|
||||
parentPort?.postMessage({ output });
|
||||
} catch (error) {
|
||||
// oxlint-disable-next-line unicorn/require-post-message-target-origin -- Node MessagePort has no targetOrigin parameter.
|
||||
parentPort?.postMessage({ error: error instanceof Error ? error.message : String(error) });
|
||||
}
|
||||
} else if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
main().catch((error) => {
|
||||
console.error(error instanceof Error ? error.message : String(error));
|
||||
process.exitCode = 1;
|
||||
});
|
||||
main().catch(handleMainError);
|
||||
}
|
||||
|
||||
/** @param {unknown} error */
|
||||
function handleMainError(error) {
|
||||
console.error(error instanceof Error ? error.message : String(error));
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
@@ -126,17 +126,17 @@ if (shouldCheckMacosVersions) {
|
||||
console.log("[release-preflight] macOS app version metadata OK");
|
||||
}
|
||||
}
|
||||
const { failed } = await runTaskGraph({
|
||||
const { failed: checkFailures } = await runTaskGraph({
|
||||
commandKey: "check",
|
||||
jobs: parsedArgs.jobs,
|
||||
tasks: selectedTasks,
|
||||
});
|
||||
if (macosVersionErrors.length !== 0 || failed.length !== 0) {
|
||||
if (macosVersionErrors.length !== 0 || checkFailures.length !== 0) {
|
||||
console.error("\nrelease preflight found drift:");
|
||||
for (const error of macosVersionErrors) {
|
||||
console.error(`- macOS app version metadata: ${error}`);
|
||||
}
|
||||
printCommandFailures(failed);
|
||||
printCommandFailures(checkFailures);
|
||||
console.error(
|
||||
"\nCorrect manual version metadata first. Run `pnpm release:prep` for intentional generated version/config/API changes, then commit the resulting files.",
|
||||
);
|
||||
@@ -220,7 +220,8 @@ async function runTaskGraph({ commandKey, jobs, tasks }) {
|
||||
const runnableTasks = tasks
|
||||
.filter((task) => task[commandKey])
|
||||
.map((task) => ({
|
||||
...task,
|
||||
id: task.id,
|
||||
name: task.name,
|
||||
args: task[commandKey],
|
||||
after: commandKey === "fix" ? (task.fixAfter ?? []) : [],
|
||||
}));
|
||||
@@ -228,7 +229,7 @@ async function runTaskGraph({ commandKey, jobs, tasks }) {
|
||||
const pending = new Map(runnableTasks.map((task) => [task.id, task]));
|
||||
const completed = new Set();
|
||||
const failedIds = new Set();
|
||||
const failed = [];
|
||||
const taskFailures = [];
|
||||
const skipped = [];
|
||||
|
||||
while (pending.size > 0) {
|
||||
@@ -267,13 +268,13 @@ async function runTaskGraph({ commandKey, jobs, tasks }) {
|
||||
completed.add(task.id);
|
||||
} else {
|
||||
failedIds.add(task.id);
|
||||
failed.push({ ...task, status });
|
||||
taskFailures.push({ ...task, status });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { failed, skipped };
|
||||
return { failed: taskFailures, skipped };
|
||||
}
|
||||
|
||||
async function runCommand(command) {
|
||||
@@ -407,5 +408,5 @@ function taskMatchesScopes(task, scopes) {
|
||||
}
|
||||
|
||||
function formatScopes(scopes) {
|
||||
return [...scopes].toSorted().join(",");
|
||||
return [...scopes].toSorted((left, right) => left.localeCompare(right)).join(",");
|
||||
}
|
||||
|
||||
@@ -97,7 +97,9 @@ describe("generate-npm-shrinkwrap", () => {
|
||||
const results = await runBoundedTasks(["slow", "fast", "last"], 2, async (value) => {
|
||||
active += 1;
|
||||
maxActive = Math.max(maxActive, active);
|
||||
await new Promise((resolve) => setTimeout(resolve, value === "slow" ? 30 : 5));
|
||||
await new Promise<void>((resolve) => {
|
||||
setTimeout(resolve, value === "slow" ? 30 : 5);
|
||||
});
|
||||
active -= 1;
|
||||
return value;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user