feat(starter): always initialize _app.tsx (#1380)

This commit is contained in:
Reed von Redwitz
2023-07-01 12:59:10 +02:00
committed by GitHub
parent f69a11c722
commit 70e9c556c3
2 changed files with 19 additions and 7 deletions
+14 -4
View File
@@ -401,8 +401,18 @@ html {
} }
`; `;
const NO_TWIND_APP_WRAPPER = ` const APP_WRAPPER = useTwind
import { AppProps } from "$fresh/server.ts"; ? `import { AppProps } from "$fresh/server.ts";
export default function App({ Component }: AppProps) {
return (
<>
<Component />
</>
);
}
`
: `import { AppProps } from "$fresh/server.ts";
import { Head } from "$fresh/runtime.ts"; import { Head } from "$fresh/runtime.ts";
export default function App({ Component }: AppProps) { export default function App({ Component }: AppProps) {
@@ -422,12 +432,12 @@ if (!useTwind) {
join(resolvedDirectory, "static", "styles.css"), join(resolvedDirectory, "static", "styles.css"),
NO_TWIND_STYLES, NO_TWIND_STYLES,
); );
}
await Deno.writeTextFile( await Deno.writeTextFile(
join(resolvedDirectory, "routes", "_app.tsx"), join(resolvedDirectory, "routes", "_app.tsx"),
NO_TWIND_APP_WRAPPER, APP_WRAPPER,
); );
}
const STATIC_LOGO = const STATIC_LOGO =
`<svg width="40" height="40" fill="none" xmlns="http://www.w3.org/2000/svg"> `<svg width="40" height="40" fill="none" xmlns="http://www.w3.org/2000/svg">
+2
View File
@@ -53,6 +53,7 @@ Deno.test({
`/main.ts`, `/main.ts`,
`/routes/greet/[name].tsx`, `/routes/greet/[name].tsx`,
`/routes/api/joke.ts`, `/routes/api/joke.ts`,
`/routes/_app.tsx`,
`/routes/index.tsx`, `/routes/index.tsx`,
`/static/logo.svg`, `/static/logo.svg`,
]; ];
@@ -138,6 +139,7 @@ Deno.test({
"/main.ts", "/main.ts",
"/routes/greet/[name].tsx", "/routes/greet/[name].tsx",
"/routes/api/joke.ts", "/routes/api/joke.ts",
"/routes/_app.tsx",
"/routes/index.tsx", "/routes/index.tsx",
"/static/logo.svg", "/static/logo.svg",
"/.vscode/settings.json", "/.vscode/settings.json",