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 if (typeof value !== "string") {
35 return false;
36 }
37
38 return referencesScriptsDir(value);
39 })
40 .map(([key]) => key);
41}
42
43function readReadmeCommandKeys(): Set<string> {
44 const text = readFileSync(README_PATH, "utf8");

Callers 1

mainFunction · 0.70

Calls 2

referencesScriptsDirFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected