File size: 698 Bytes
489b6e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { existsSync, readFileSync } from "node:fs";
import { join } from "node:path";

const sourceFiles = ["app/HipcampApp.tsx", "app/globals.css"];
const pattern = /["'(](\/camps\/[^"'()]+)["')]/g;
const missing = new Set();
const seen = new Set();

for (const file of sourceFiles) {
  const source = readFileSync(file, "utf8");
  for (const match of source.matchAll(pattern)) {
    seen.add(match[1]);
    if (!existsSync(join("public", match[1]))) missing.add(match[1]);
  }
}

if (missing.size) {
  console.error("Missing public assets:");
  for (const asset of missing) console.error(`- ${asset}`);
  process.exit(1);
}

console.log(`checked ${seen.size} local camping assets, all present`);