MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / readPackageScriptKeys

Function readPackageScriptKeys

apps/api/scripts/check-scripts-docs.ts:15–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13}
14
15function readPackageScriptKeys(): string[] {
16 const parsed: unknown = JSON.parse(readFileSync(PACKAGE_JSON_PATH, "utf8"));
17
18 if (typeof parsed !== "object" || parsed === null || !("scripts" in parsed)) {
19 return [];
20 }
21
22 const scripts = parsed.scripts;
23
24 if (typeof scripts !== "object" || scripts === null) {
25 return [];
26 }
27
28 return Object.entries(scripts)
29 .filter(([key, value]) => {
30 if (SKIP_SCRIPT_KEYS.has(key)) {
31 return false;
32 }
33
34 return typeof value !== "string" ? false : referencesScriptsDir(value);
35 })
36 .map(([key]) => key);
37}
38
39function readReadmeCommandKeys(): Set<string> {
40 const text = readFileSync(README_PATH, "utf8");
41 const keys = new Set<string>();
42
43 for (const match of text.matchAll(/\|\s*`bun run\s+([^`]+)`\s*\|/gu)) {
44 const key = match[1]?.trim();

Callers 1

mainFunction · 0.70

Calls 2

referencesScriptsDirFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected