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
+17 -7
View File
@@ -401,8 +401,18 @@ html {
}
`;
const NO_TWIND_APP_WRAPPER = `
import { AppProps } from "$fresh/server.ts";
const APP_WRAPPER = useTwind
? `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";
export default function App({ Component }: AppProps) {
@@ -422,13 +432,13 @@ if (!useTwind) {
join(resolvedDirectory, "static", "styles.css"),
NO_TWIND_STYLES,
);
await Deno.writeTextFile(
join(resolvedDirectory, "routes", "_app.tsx"),
NO_TWIND_APP_WRAPPER,
);
}
await Deno.writeTextFile(
join(resolvedDirectory, "routes", "_app.tsx"),
APP_WRAPPER,
);
const STATIC_LOGO =
`<svg width="40" height="40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M34.092 8.845C38.929 20.652 34.092 27 30 30.5c1 3.5-2.986 4.222-4.5 2.5-4.457 1.537-13.512 1.487-20-5C2 24.5 4.73 16.714 14 11.5c8-4.5 16-7 20.092-2.655Z" fill="#FFDB1E"/>
+2
View File
@@ -53,6 +53,7 @@ Deno.test({
`/main.ts`,
`/routes/greet/[name].tsx`,
`/routes/api/joke.ts`,
`/routes/_app.tsx`,
`/routes/index.tsx`,
`/static/logo.svg`,
];
@@ -138,6 +139,7 @@ Deno.test({
"/main.ts",
"/routes/greet/[name].tsx",
"/routes/api/joke.ts",
"/routes/_app.tsx",
"/routes/index.tsx",
"/static/logo.svg",
"/.vscode/settings.json",