refactor(scripts): remove dead helper exports · openclaw/openclaw@8607b40
vincentkoc
·
2026-06-18
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Shared argument parsing helpers for repository scripts. |
2 | | -/** Read a finite number from an environment variable, returning null when unset or invalid. */ |
3 | | -export function readEnvNumber(name, env = process.env) { |
4 | | -const raw = env[name]?.trim(); |
5 | | -if (!raw) { |
6 | | -return null; |
7 | | -} |
8 | | -const parsed = Number.parseFloat(raw); |
9 | | -return Number.isFinite(parsed) ? parsed : null; |
10 | | -} |
11 | | - |
12 | 2 | /** Read a flag value from `--flag value` or `--flag=value` arguments. */ |
13 | 3 | export function readFlagValue(args, name) { |
14 | 4 | for (let index = 0; index < args.length; index += 1) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Shared write/check/report helpers for generated repository files. |
2 | 2 | import path from "node:path"; |
3 | | -import { pathToFileURL } from "node:url"; |
4 | 3 | import { writeTextFileIfChanged } from "../runtime-postbuild-shared.mjs"; |
5 | 4 | import { readIfExists } from "./bundled-plugin-source-utils.mjs"; |
6 | 5 | |
@@ -24,25 +23,3 @@ export function writeGeneratedOutput(params) {
|
24 | 23 | outputPath, |
25 | 24 | }; |
26 | 25 | } |
27 | | - |
28 | | -/** Report generated-output CLI results when the current module is run directly. */ |
29 | | -export function reportGeneratedOutputCli(params) { |
30 | | -if (params.importMetaUrl !== pathToFileURL(process.argv[1] ?? "").href) { |
31 | | -return; |
32 | | -} |
33 | | - |
34 | | -const check = process.argv.includes("--check"); |
35 | | -const result = params.run({ check }); |
36 | | -if (!result.changed) { |
37 | | -return; |
38 | | -} |
39 | | - |
40 | | -const relativeOutputPath = path.relative(process.cwd(), result.outputPath); |
41 | | -if (check) { |
42 | | -console.error(`[${params.label}] stale generated output at ${relativeOutputPath}`); |
43 | | -process.exitCode = 1; |
44 | | -return; |
45 | | -} |
46 | | - |
47 | | -console.log(`[${params.label}] wrote ${relativeOutputPath}`); |
48 | | -} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -70,11 +70,3 @@ export const parsePassthroughArgs = (args = []) => {
|
70 | 70 | |
71 | 71 | return { fileFilters, optionArgs }; |
72 | 72 | }; |
73 | | - |
74 | | -export const countExplicitEntryFilters = (entryArgs) => { |
75 | | -const { fileFilters } = parsePassthroughArgs(entryArgs.slice(2)); |
76 | | -return fileFilters.length > 0 ? fileFilters.length : null; |
77 | | -}; |
78 | | - |
79 | | -export const getExplicitEntryFilters = (entryArgs) => |
80 | | -parsePassthroughArgs(entryArgs.slice(2)).fileFilters; |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。