mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:40:44 +00:00
refactor: trim tooling helper exports
This commit is contained in:
@@ -8,11 +8,11 @@ export function formatBytesAsMb(valueBytes) {
|
||||
: `${(valueBytes / 1024 / 1024).toFixed(1)}MB`;
|
||||
}
|
||||
|
||||
export function formatSignedMs(value, digits = 1) {
|
||||
function formatSignedMs(value, digits = 1) {
|
||||
return `${value > 0 ? "+" : ""}${formatMs(value, digits)}`;
|
||||
}
|
||||
|
||||
export function formatSignedBytesAsMb(valueBytes) {
|
||||
function formatSignedBytesAsMb(valueBytes) {
|
||||
return valueBytes === null || valueBytes === undefined
|
||||
? "n/a"
|
||||
: `${valueBytes > 0 ? "+" : ""}${formatBytesAsMb(valueBytes)}`;
|
||||
@@ -46,7 +46,7 @@ export function resolveTestArea(file) {
|
||||
return parts[0] || normalized;
|
||||
}
|
||||
|
||||
export function resolveTestFolder(file, depth = 2) {
|
||||
function resolveTestFolder(file, depth = 2) {
|
||||
const normalized = normalizeTrackedRepoPath(file);
|
||||
const dir = path.posix.dirname(normalized);
|
||||
if (dir === ".") {
|
||||
|
||||
@@ -23,7 +23,7 @@ const REQUIRED_BOOTSTRAP_WORKSPACE_FILES = [
|
||||
"BOOTSTRAP.md",
|
||||
];
|
||||
|
||||
export const WORKSPACE_BOOTSTRAP_SMOKE_TIMEOUT_MS = 15_000;
|
||||
const WORKSPACE_BOOTSTRAP_SMOKE_TIMEOUT_MS = 15_000;
|
||||
const SAFE_UNIX_SMOKE_PATH = "/usr/bin:/bin";
|
||||
|
||||
export function createWorkspaceBootstrapSmokeEnv(env, homeDir, overrides = {}) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
import { spawn } from "node:child_process";
|
||||
|
||||
export const BOUNDARY_CHECKS = [
|
||||
const BOUNDARY_CHECKS = [
|
||||
["plugin-extension-boundary", "pnpm", ["run", "lint:plugins:no-extension-imports"]],
|
||||
["lint:tmp:no-random-messaging", "pnpm", ["run", "lint:tmp:no-random-messaging"]],
|
||||
["lint:tmp:channel-agnostic-boundaries", "pnpm", ["run", "lint:tmp:channel-agnostic-boundaries"]],
|
||||
|
||||
@@ -3,7 +3,7 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
export const normalizeRepoPath = (value) => value.split(path.sep).join("/");
|
||||
const normalizeRepoPath = (value) => value.split(path.sep).join("/");
|
||||
const repoRoot = path.resolve(process.cwd());
|
||||
|
||||
export function normalizeTrackedRepoPath(value) {
|
||||
@@ -29,10 +29,6 @@ export function tryReadJsonFile(filePath, fallback) {
|
||||
}
|
||||
}
|
||||
|
||||
export function writeJsonFile(filePath, value) {
|
||||
fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
||||
}
|
||||
|
||||
export function runVitestJsonReport({
|
||||
config,
|
||||
reportPath = "",
|
||||
|
||||
@@ -4,7 +4,7 @@ export function resolvePathEnvKey(env) {
|
||||
return Object.keys(env).find((key) => key.toLowerCase() === "path") ?? "PATH";
|
||||
}
|
||||
|
||||
export function escapeForCmdExe(arg) {
|
||||
function escapeForCmdExe(arg) {
|
||||
if (WINDOWS_UNSAFE_CMD_CHARS_RE.test(arg)) {
|
||||
throw new Error(`unsafe Windows cmd.exe argument detected: ${JSON.stringify(arg)}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user