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
+2 -1
View File
@@ -8,7 +8,8 @@
"check:types": "deno check **/*.ts && deno check **/*.tsx",
"ok": "deno fmt --check && deno lint && deno task check:types && deno task test",
"install-puppeteer": "PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts && PUPPETEER_PRODUCT=firefox deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts",
"test:www": "deno test -A tests/www/"
"test:www": "deno test -A tests/www/",
"manifests": "deno run -A genAllManifest.ts"
},
"exclude": [
"**/_fresh/*",
+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();
+6 -1
View File
@@ -1,6 +1,6 @@
import { gte, join, relative, semverParse, walk, WalkEntry } from "./deps.ts";
export { generate, type Manifest } from "./manifest.ts";
import type { Manifest } from "./manifest.ts";
import { generate, type Manifest } from "./manifest.ts";
import { error } from "./error.ts";
const MIN_DENO_VERSION = "1.31.0";
const TEST_FILE_PATTERN = /[._]test\.(?:[tj]sx?|[mc][tj]s)$/;
@@ -92,3 +92,8 @@ export async function collect(
return { routes, islands };
}
export async function manifest(path: string, ignoreFilePattern?: RegExp) {
const manifest = await collect(path, ignoreFilePattern);
await generate(path, manifest);
}
+1 -1
View File
@@ -6,7 +6,7 @@ import * as $_app from "./routes/_app.tsx";
import * as $_layout from "./routes/_layout.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+3 -3
View File
@@ -14,8 +14,8 @@ import * as $error_boundary from "./routes/error_boundary.tsx";
import * as $html from "./routes/html.tsx";
import * as $index from "./routes/index.tsx";
import * as $islands from "./routes/islands.tsx";
import * as $$Counter from "./islands/Counter.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $Counter from "./islands/Counter.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
@@ -33,7 +33,7 @@ const manifest = {
"./routes/islands.tsx": $islands,
},
islands: {
"./islands/Counter.tsx": $$Counter,
"./islands/Counter.tsx": $Counter,
},
baseUrl: import.meta.url,
} satisfies Manifest;
@@ -0,0 +1,13 @@
// DO NOT EDIT. This file is generated by Fresh.
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {},
islands: {},
baseUrl: import.meta.url,
} satisfies Manifest;
export default manifest;
@@ -0,0 +1,13 @@
// DO NOT EDIT. This file is generated by Fresh.
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {},
islands: {},
baseUrl: import.meta.url,
} satisfies Manifest;
export default manifest;
+1 -1
View File
@@ -4,7 +4,7 @@
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+13
View File
@@ -0,0 +1,13 @@
// DO NOT EDIT. This file is generated by Fresh.
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {},
islands: {},
baseUrl: import.meta.url,
} satisfies Manifest;
export default manifest;
+1 -1
View File
@@ -5,7 +5,7 @@
import * as $_500 from "./routes/_500.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -6,7 +6,7 @@ import * as $_app from "./routes/_app.tsx";
import * as $_layout from "./routes/_layout.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -5,7 +5,7 @@
import * as $_500 from "./routes/_500.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -5,7 +5,7 @@
import * as $codeframe from "./routes/codeframe.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -5,7 +5,7 @@
import * as $codeframe from "./routes/codeframe.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -5,7 +5,7 @@
import * as $_all_ from "./routes/[...all].ts";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -7,7 +7,7 @@ import * as $head from "./routes/head.tsx";
import * as $index from "./routes/index.tsx";
import * as $title from "./routes/title.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -4,7 +4,7 @@
import * as $_group_index from "./routes/(group)/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+3 -3
View File
@@ -5,8 +5,8 @@
import * as $index from "./routes/index.tsx";
import * as $island from "./routes/island.tsx";
import * as $no_island from "./routes/no_island.tsx";
import * as $$Counter from "./islands/Counter.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $Counter from "./islands/Counter.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
@@ -15,7 +15,7 @@ const manifest = {
"./routes/no_island.tsx": $no_island,
},
islands: {
"./islands/Counter.tsx": $$Counter,
"./islands/Counter.tsx": $Counter,
},
baseUrl: import.meta.url,
} satisfies Manifest;
+25 -25
View File
@@ -20,19 +20,19 @@ import * as $island_nested_props from "./routes/island_nested_props.tsx";
import * as $island_order from "./routes/island_order.tsx";
import * as $island_siblings from "./routes/island_siblings.tsx";
import * as $island_valid_children from "./routes/island_valid_children.tsx";
import * as $$BooleanButton from "./islands/BooleanButton.tsx";
import * as $$Counter from "./islands/Counter.tsx";
import * as $$Dropdown from "./islands/Dropdown.tsx";
import * as $$FragmentIsland from "./islands/FragmentIsland.tsx";
import * as $$Island from "./islands/Island.tsx";
import * as $$IslandCenter from "./islands/IslandCenter.tsx";
import * as $$IslandConditional from "./islands/IslandConditional.tsx";
import * as $$IslandFn from "./islands/IslandFn.tsx";
import * as $$IslandInsideIsland from "./islands/IslandInsideIsland.tsx";
import * as $$IslandWithProps from "./islands/IslandWithProps.tsx";
import * as $$PassThrough from "./islands/PassThrough.tsx";
import * as $$ReadyMarker from "./islands/ReadyMarker.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $BooleanButton from "./islands/BooleanButton.tsx";
import * as $Counter from "./islands/Counter.tsx";
import * as $Dropdown from "./islands/Dropdown.tsx";
import * as $FragmentIsland from "./islands/FragmentIsland.tsx";
import * as $Island from "./islands/Island.tsx";
import * as $IslandCenter from "./islands/IslandCenter.tsx";
import * as $IslandConditional from "./islands/IslandConditional.tsx";
import * as $IslandFn from "./islands/IslandFn.tsx";
import * as $IslandInsideIsland from "./islands/IslandInsideIsland.tsx";
import * as $IslandWithProps from "./islands/IslandWithProps.tsx";
import * as $PassThrough from "./islands/PassThrough.tsx";
import * as $ReadyMarker from "./islands/ReadyMarker.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
@@ -57,18 +57,18 @@ const manifest = {
"./routes/island_valid_children.tsx": $island_valid_children,
},
islands: {
"./islands/BooleanButton.tsx": $$BooleanButton,
"./islands/Counter.tsx": $$Counter,
"./islands/Dropdown.tsx": $$Dropdown,
"./islands/FragmentIsland.tsx": $$FragmentIsland,
"./islands/Island.tsx": $$Island,
"./islands/IslandCenter.tsx": $$IslandCenter,
"./islands/IslandConditional.tsx": $$IslandConditional,
"./islands/IslandFn.tsx": $$IslandFn,
"./islands/IslandInsideIsland.tsx": $$IslandInsideIsland,
"./islands/IslandWithProps.tsx": $$IslandWithProps,
"./islands/PassThrough.tsx": $$PassThrough,
"./islands/ReadyMarker.tsx": $$ReadyMarker,
"./islands/BooleanButton.tsx": $BooleanButton,
"./islands/Counter.tsx": $Counter,
"./islands/Dropdown.tsx": $Dropdown,
"./islands/FragmentIsland.tsx": $FragmentIsland,
"./islands/Island.tsx": $Island,
"./islands/IslandCenter.tsx": $IslandCenter,
"./islands/IslandConditional.tsx": $IslandConditional,
"./islands/IslandFn.tsx": $IslandFn,
"./islands/IslandInsideIsland.tsx": $IslandInsideIsland,
"./islands/IslandWithProps.tsx": $IslandWithProps,
"./islands/PassThrough.tsx": $PassThrough,
"./islands/ReadyMarker.tsx": $ReadyMarker,
},
baseUrl: import.meta.url,
} satisfies Manifest;
@@ -1,5 +1,7 @@
import { useSignal } from "@preact/signals";
export const thisShouldNotCauseProblems = 42;
export function Multiple1() {
const sig = useSignal(0);
return (
+3 -3
View File
@@ -3,15 +3,15 @@
// This file is automatically updated during development when running `dev.ts`.
import * as $index from "./routes/index.tsx";
import * as $$Island from "./islands/Island.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $Island from "./islands/Island.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
"./routes/index.tsx": $index,
},
islands: {
"./islands/Island.tsx": $$Island,
"./islands/Island.tsx": $Island,
},
baseUrl: import.meta.url,
} satisfies Manifest;
+3 -3
View File
@@ -4,8 +4,8 @@
import * as $head from "./routes/head.tsx";
import * as $index from "./routes/index.tsx";
import * as $$Island from "./islands/Island.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $Island from "./islands/Island.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
@@ -13,7 +13,7 @@ const manifest = {
"./routes/index.tsx": $index,
},
islands: {
"./islands/Island.tsx": $$Island,
"./islands/Island.tsx": $Island,
},
baseUrl: import.meta.url,
} satisfies Manifest;
+3 -3
View File
@@ -34,8 +34,8 @@ import * as $override_no_layout from "./routes/override/no_layout.tsx";
import * as $override_no_layout_no_app from "./routes/override/no_layout_no_app.tsx";
import * as $skip_sub_layout from "./routes/skip/sub/_layout.tsx";
import * as $skip_sub_index from "./routes/skip/sub/index.tsx";
import * as $$dynamic_tenant_islands_Counter from "./routes/dynamic/[tenant]/(_islands)/Counter.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $dynamic_tenant_islands_Counter from "./routes/dynamic/[tenant]/(_islands)/Counter.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
@@ -75,7 +75,7 @@ const manifest = {
},
islands: {
"./routes/dynamic/[tenant]/(_islands)/Counter.tsx":
$$dynamic_tenant_islands_Counter,
$dynamic_tenant_islands_Counter,
},
baseUrl: import.meta.url,
} satisfies Manifest;
+1 -1
View File
@@ -6,7 +6,7 @@ import * as $_app from "./routes/_app.tsx";
import * as $_layout from "./routes/_layout.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+3 -3
View File
@@ -3,15 +3,15 @@
// This file is automatically updated during development when running `dev.ts`.
import * as $index from "./routes/index.tsx";
import * as $$Test from "./islands/Test.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $Test from "./islands/Test.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
"./routes/index.tsx": $index,
},
islands: {
"./islands/Test.tsx": $$Test,
"./islands/Test.tsx": $Test,
},
baseUrl: import.meta.url,
} satisfies Manifest;
+3 -3
View File
@@ -6,8 +6,8 @@ import * as $lots_of_middleware_index from "./routes/lots-of-middleware/index.ts
import * as $static from "./routes/static.tsx";
import * as $test from "./routes/test.tsx";
import * as $with_island from "./routes/with-island.tsx";
import * as $$Island from "./islands/Island.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $Island from "./islands/Island.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
@@ -17,7 +17,7 @@ const manifest = {
"./routes/with-island.tsx": $with_island,
},
islands: {
"./islands/Island.tsx": $$Island,
"./islands/Island.tsx": $Island,
},
baseUrl: import.meta.url,
} satisfies Manifest;
+3 -3
View File
@@ -3,15 +3,15 @@
// This file is automatically updated during development when running `dev.ts`.
import * as $index from "./routes/index.tsx";
import * as $$Island from "./islands/Island.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $Island from "./islands/Island.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
"./routes/index.tsx": $index,
},
islands: {
"./islands/Island.tsx": $$Island,
"./islands/Island.tsx": $Island,
},
baseUrl: import.meta.url,
} satisfies Manifest;
+3 -3
View File
@@ -2,13 +2,13 @@
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.
import * as $0 from "./routes/index.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
"./routes/index.tsx": $0,
"./routes/index.tsx": $index,
},
islands: {},
baseUrl: import.meta.url,
+1 -1
View File
@@ -5,7 +5,7 @@
import * as $_middleware from "./routes/_middleware.ts";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
@@ -4,7 +4,7 @@
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -8,7 +8,7 @@ import * as $header_instance from "./routes/header_instance.tsx";
import * as $header_obj from "./routes/header_obj.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -4,7 +4,7 @@
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -5,7 +5,7 @@
import * as $about from "./routes/about.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
@@ -4,7 +4,7 @@
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -5,7 +5,7 @@
import * as $_app from "./routes/_app.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -5,7 +5,7 @@
import * as $_app from "./routes/_app.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+1 -1
View File
@@ -6,7 +6,7 @@ import * as $_app from "./routes/_app.tsx";
import * as $app_class from "./routes/app_class.tsx";
import * as $index from "./routes/index.tsx";
import { Manifest } from "$fresh/server.ts";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
+5 -5
View File
@@ -10,9 +10,9 @@ import * as $island_twind_index from "./routes/island_twind/index.tsx";
import * as $static from "./routes/static.tsx";
import * as $unused from "./routes/unused.tsx";
import * as $unused_tw from "./routes/unused_tw.tsx";
import * as $$CheckDuplication from "./islands/CheckDuplication.tsx";
import * as $$InsertCssrules from "./islands/InsertCssrules.tsx";
import { Manifest } from "$fresh/server.ts";
import * as $CheckDuplication from "./islands/CheckDuplication.tsx";
import * as $InsertCssrules from "./islands/InsertCssrules.tsx";
import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
@@ -26,8 +26,8 @@ const manifest = {
"./routes/unused_tw.tsx": $unused_tw,
},
islands: {
"./islands/CheckDuplication.tsx": $$CheckDuplication,
"./islands/InsertCssrules.tsx": $$InsertCssrules,
"./islands/CheckDuplication.tsx": $CheckDuplication,
"./islands/InsertCssrules.tsx": $InsertCssrules,
},
baseUrl: import.meta.url,
} satisfies Manifest;