@norskvideo/ctl-dev-kit 0.2.51 → 0.2.52

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.
@@ -20,7 +20,7 @@
20
20
  // workspace-symlinked and installed from the published tarball.
21
21
 
22
22
  import { execFileSync } from "node:child_process";
23
- import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
23
+ import { existsSync, lstatSync, readdirSync, readFileSync, statSync } from "node:fs";
24
24
  import { join } from "node:path";
25
25
  import { parseManifestSeed } from "@norskvideo/ctl-sdk/manifest-seed";
26
26
  import { checkTheme } from "../docs-theme/sync.ts";
@@ -369,16 +369,21 @@ const CHECKS_LOGS = /\bproductTemplateLogsProblems\b/;
369
369
  const SKIP_DIRS = new Set(["node_modules", ".git", "dist", "build", "lib", "coverage", ".wireit"]);
370
370
 
371
371
  function sourceFiles(dir: string, out: string[] = []): string[] {
372
- let names: string[];
373
- try {
374
- names = readdirSync(dir);
375
- } catch {
376
- return out;
377
- }
378
- for (const name of names) {
372
+ // `dir` is the repo root or an entry just stat'd as a directory: one the walk
373
+ // cannot list is a real failure, never an empty directory
374
+ for (const name of readdirSync(dir)) {
379
375
  if (SKIP_DIRS.has(name)) continue;
380
376
  const path = join(dir, name);
381
- const st = statSync(path);
377
+ let st: ReturnType<typeof statSync>;
378
+ try {
379
+ st = statSync(path);
380
+ } catch (e) {
381
+ // Only a symlink whose target is absent is skipped: a docs site's link to
382
+ // a doc-guide capture not generated yet (a fresh checkout). Anything else
383
+ // that stops the walk reading an entry is a real failure.
384
+ if ((e as NodeJS.ErrnoException).code === "ENOENT" && lstatSync(path).isSymbolicLink()) continue;
385
+ throw e;
386
+ }
382
387
  if (st.isDirectory()) sourceFiles(path, out);
383
388
  else if (/\.(ts|tsx)$/.test(name)) out.push(path);
384
389
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-dev-kit",
3
- "version": "0.2.51",
3
+ "version": "0.2.52",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./create-product": "./create-product/create-product.ts",