@norskvideo/ctl-dev-kit 0.2.44 → 0.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/path-existence.ts +8 -1
- package/package.json +1 -1
package/docs/path-existence.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// walk and nothing is ignored.
|
|
14
14
|
import { readdirSync, readFileSync, realpathSync } from "node:fs";
|
|
15
15
|
import { basename, dirname, join, posix } from "node:path";
|
|
16
|
+
import { BEGIN_MARKER, END_MARKER } from "./splice-generated.ts";
|
|
16
17
|
|
|
17
18
|
export interface PathFinding {
|
|
18
19
|
file: string;
|
|
@@ -39,6 +40,9 @@ export const PATH_ALLOW = "<!-- path-allow -->";
|
|
|
39
40
|
// conventions, not claims about this repo's tree.
|
|
40
41
|
const CORE_BEGIN = "<!-- BEGIN ctl-shared-conventions v1 -->";
|
|
41
42
|
const CORE_END = "<!-- END ctl-shared-conventions v1 -->";
|
|
43
|
+
// A spliced generated block (splice-generated.ts) is a tool's output, gated
|
|
44
|
+
// against that tool; its paths name the tool's world (an export bundle's
|
|
45
|
+
// `template/workflow.yml`), not this repo's tree.
|
|
42
46
|
|
|
43
47
|
// The five prefixes the review names (its `@norskvideo/` widened to every
|
|
44
48
|
// scoped npm name), plus the classes they imply: any absolute path (container
|
|
@@ -207,6 +211,7 @@ export function checkPathExistence(
|
|
|
207
211
|
const lines = readFileSync(join(repoRoot, file), "utf8").split("\n");
|
|
208
212
|
let inFence = false;
|
|
209
213
|
let inCore = false;
|
|
214
|
+
let inGenerated = false;
|
|
210
215
|
lines.forEach((line, index) => {
|
|
211
216
|
if (/^\s*(```|~~~)/.test(line)) {
|
|
212
217
|
inFence = !inFence;
|
|
@@ -214,7 +219,9 @@ export function checkPathExistence(
|
|
|
214
219
|
}
|
|
215
220
|
if (line.includes(CORE_BEGIN)) inCore = true;
|
|
216
221
|
if (line.includes(CORE_END)) inCore = false;
|
|
217
|
-
if (
|
|
222
|
+
if (line.startsWith(BEGIN_MARKER)) inGenerated = true;
|
|
223
|
+
if (line.trim() === END_MARKER) inGenerated = false;
|
|
224
|
+
if (inFence || inCore || inGenerated || line.includes(PATH_ALLOW)) return;
|
|
218
225
|
for (const token of extractPathTokens(line)) {
|
|
219
226
|
if (isSkipped(token, skipPrefixes)) continue;
|
|
220
227
|
if (!token.includes("/")) {
|