chore: create manifest generation task (#2088)

This commit is contained in:
Reed von Redwitz
2023-11-30 17:07:00 +01:00
committed by GitHub
parent 9e11c5c56b
commit a0483bc357
38 changed files with 168 additions and 79 deletions
+42
View File
@@ -0,0 +1,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();