forked from denoland/fresh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genAllManifest.ts
42 lines (36 loc) · 1.22 KB
/
genAllManifest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { walk } from "./src/dev/deps.ts";
import { manifest } from "./src/dev/mod.ts";
import type { FreshConfig } from "./src/server/mod.ts";
const skippedFixtures: string[] = [
"fixture_invalid_handlers",
"fixture_update_check",
];
async function runGenerateInFixtures() {
for await (const entry of walk(Deno.cwd(), { maxDepth: 10 })) {
if (entry.isDirectory && entry.name.startsWith("fixture")) {
if (skippedFixtures.includes(entry.name)) {
console.log(`Skipping ${entry.path}\n`);
continue;
}
console.log(`Processing ${entry.path}`);
try {
const configPath = `${entry.path}/fresh.config.ts`;
let config: FreshConfig;
try {
config = (await import(configPath)).default;
} catch {
console.warn(
`No fresh.config.ts found or error in reading it at ${configPath}, using empty config.`,
);
config = {};
}
await manifest(entry.path, config.router?.ignoreFilePattern);
console.log(`Manifest generated successfully in ${entry.path}\n`);
} catch (error) {
console.error(`Failed to process ${entry.path}:`, error);
console.log();
}
}
}
}
runGenerateInFixtures();