refactor: dedupe tooling helpers

This commit is contained in:
Peter Steinberger
2026-04-23 18:06:49 +01:00
parent f98f93c29a
commit 2045c0977e
11 changed files with 244 additions and 347 deletions

View File

@@ -1,6 +1,7 @@
import { spawnSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import { readFlagValue } from "./lib/arg-utils.mjs";
import {
acquireLocalHeavyCheckLockSync,
applyLocalTsgoPolicy,
@@ -45,16 +46,3 @@ try {
} finally {
releaseLock();
}
function readFlagValue(args, name) {
for (let index = 0; index < args.length; index++) {
const arg = args[index];
if (arg === name) {
return args[index + 1];
}
if (arg.startsWith(`${name}=`)) {
return arg.slice(name.length + 1);
}
}
return undefined;
}