feat(starter): always initialize _app.tsx (#1380)
This commit is contained in:
@@ -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,13 +432,13 @@ if (!useTwind) {
|
|||||||
join(resolvedDirectory, "static", "styles.css"),
|
join(resolvedDirectory, "static", "styles.css"),
|
||||||
NO_TWIND_STYLES,
|
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 =
|
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">
|
||||||
<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"/>
|
<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"/>
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user