()
| 13 | } |
| 14 | |
| 15 | function 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 | |
| 43 | function readReadmeCommandKeys(): Set<string> { |
| 44 | const text = readFileSync(README_PATH, "utf8"); |
no test coverage detected