create-waku 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/template/01_template/gitignore +7 -0
- package/template/01_template/package.json +6 -6
- package/template/02_demo/package.json +6 -6
- package/template/02_demo/private/pokemon.json +2586 -0
- package/template/02_demo/src/components/footer.tsx +1 -1
- package/template/02_demo/src/components/header.tsx +9 -1
- package/template/02_demo/src/components/reload.tsx +16 -0
- package/template/02_demo/src/lib/pokemon.ts +5 -2586
- package/template/02_demo/src/templates/home-page.tsx +37 -23
- package/template/02_demo/src/templates/pokemon-page.tsx +46 -44
- package/template/02_demo/src/templates/root-layout.tsx +1 -1
- package/template/03_minimal/package.json +6 -6
- package/template/03_minimal/public/404.html +1 -0
- package/template/04_promise/package.json +6 -6
- package/template/04_promise/src/components/Counter.tsx +3 -0
- package/template/04_promise/src/components/Hello.tsx +7 -0
- package/template/05_actions/package.json +6 -6
- package/template/06_nesting/package.json +6 -6
- package/template/07_router/package.json +6 -6
- package/template/07_router/src/components/Counter.tsx +3 -1
- package/template/07_router/src/components/HomeLayout.tsx +2 -0
- package/template/07_router/src/entries.tsx +8 -1
- package/template/07_router/src/styles.css +3 -0
- package/template/08_cookies/package.json +7 -7
- package/template/08_cookies/src/entries.tsx +1 -1
- package/template/09_cssmodules/package.json +6 -6
- package/template/{10_dynamicroute → 10_fs-router}/package.json +6 -6
- package/template/11_form/package.json +6 -6
- package/template/12_css/package.json +7 -7
- package/template/13_path-alias/package.json +7 -7
- package/template/13_path-alias/src/components/App.tsx +4 -1
- package/template/13_path-alias/src/components/Counter.tsx +5 -1
- package/template/13_path-alias/src/components/MyFragment.tsx +5 -0
- package/template/14_react-tweet/package.json +25 -0
- package/template/14_react-tweet/postcss.config.js +7 -0
- package/template/14_react-tweet/public/images/favicon.png +0 -0
- package/template/14_react-tweet/src/components/error-boundary.tsx +28 -0
- package/template/14_react-tweet/src/components/footer.tsx +18 -0
- package/template/14_react-tweet/src/components/header.tsx +7 -0
- package/template/14_react-tweet/src/entries.tsx +18 -0
- package/template/14_react-tweet/src/main.tsx +19 -0
- package/template/14_react-tweet/src/styles.css +4 -0
- package/template/14_react-tweet/src/templates/home-page.tsx +22 -0
- package/template/14_react-tweet/src/templates/root-layout.tsx +33 -0
- package/template/14_react-tweet/tailwind.config.js +4 -0
- package/template/14_react-tweet/tsconfig.json +17 -0
- package/template/14_react-tweet/vite.config.ts +15 -0
- package/template/10_dynamicroute/vite.config.ts +0 -20
- /package/template/08_cookies/{db → private}/items.json +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/components/Counter.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/components/ErrorBoundary.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/entries.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/main.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/bar/page.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/foo/page.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/layout.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/nested/[name]/page.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/src/routes/page.tsx +0 -0
- /package/template/{10_dynamicroute → 10_fs-router}/tsconfig.json +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const Footer = () => {
|
|
2
|
+
return (
|
|
3
|
+
<footer className="fixed bottom-0 left-0 p-6">
|
|
4
|
+
<div>
|
|
5
|
+
visit{' '}
|
|
6
|
+
<a
|
|
7
|
+
href="https://waku.gg/"
|
|
8
|
+
target="_blank"
|
|
9
|
+
rel="noreferrer"
|
|
10
|
+
className="mt-4 inline-block underline"
|
|
11
|
+
>
|
|
12
|
+
waku.gg
|
|
13
|
+
</a>{' '}
|
|
14
|
+
to learn more
|
|
15
|
+
</div>
|
|
16
|
+
</footer>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createPages } from 'waku';
|
|
2
|
+
|
|
3
|
+
import { RootLayout } from './templates/root-layout.js';
|
|
4
|
+
import { HomePage } from './templates/home-page.js';
|
|
5
|
+
|
|
6
|
+
export default createPages(async ({ createPage, createLayout }) => {
|
|
7
|
+
createLayout({
|
|
8
|
+
render: 'static',
|
|
9
|
+
path: '/',
|
|
10
|
+
component: RootLayout,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
createPage({
|
|
14
|
+
render: 'static',
|
|
15
|
+
path: '/',
|
|
16
|
+
component: HomePage,
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
3
|
+
import { Router } from 'waku/router/client';
|
|
4
|
+
|
|
5
|
+
import { ErrorBoundary } from './components/error-boundary.js';
|
|
6
|
+
|
|
7
|
+
const rootElement = (
|
|
8
|
+
<StrictMode>
|
|
9
|
+
<ErrorBoundary fallback={(error) => <h1>{String(error)}</h1>}>
|
|
10
|
+
<Router />
|
|
11
|
+
</ErrorBoundary>
|
|
12
|
+
</StrictMode>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
if (import.meta.env.WAKU_HYDRATE) {
|
|
16
|
+
hydrateRoot(document.body, rootElement);
|
|
17
|
+
} else {
|
|
18
|
+
createRoot(document.body).render(rootElement);
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Tweet } from 'react-tweet';
|
|
2
|
+
|
|
3
|
+
export const HomePage = async () => {
|
|
4
|
+
const data = await getData();
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<title>{data.title}</title>
|
|
9
|
+
<h1 className="text-4xl font-bold tracking-tight">{data.headline}</h1>
|
|
10
|
+
<Tweet id="1735308967880823082" />
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getData = async () => {
|
|
16
|
+
const data = {
|
|
17
|
+
title: 'Waku',
|
|
18
|
+
headline: 'Waku',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import '../styles.css';
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Header } from '../components/header.js';
|
|
6
|
+
import { Footer } from '../components/footer.js';
|
|
7
|
+
|
|
8
|
+
type RootLayoutProps = { children: ReactNode };
|
|
9
|
+
|
|
10
|
+
export const RootLayout = async ({ children }: RootLayoutProps) => {
|
|
11
|
+
const data = await getData();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div id="__waku" className="font-['Nunito']">
|
|
15
|
+
<meta property="description" content={data.description} />
|
|
16
|
+
<link rel="icon" type="image/png" href={data.icon} />
|
|
17
|
+
<Header />
|
|
18
|
+
<main className="flex min-h-svh items-center justify-center *:min-h-64 *:min-w-64">
|
|
19
|
+
{children}
|
|
20
|
+
</main>
|
|
21
|
+
<Footer />
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getData = async () => {
|
|
27
|
+
const data = {
|
|
28
|
+
description: 'An internet website!',
|
|
29
|
+
icon: '/images/favicon.png',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"target": "esnext",
|
|
5
|
+
"downlevelIteration": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"module": "nodenext",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"noUncheckedIndexedAccess": true,
|
|
10
|
+
"exactOptionalPropertyTypes": true,
|
|
11
|
+
"types": ["react/experimental"],
|
|
12
|
+
"jsx": "react-jsx",
|
|
13
|
+
"paths": {
|
|
14
|
+
"~/*": ["./src/*"]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @type {import('vite').UserConfig} */
|
|
2
|
+
export default ({ mode }: { mode: string }) => ({
|
|
3
|
+
...(mode === 'development' && {
|
|
4
|
+
optimizeDeps: {
|
|
5
|
+
include: [
|
|
6
|
+
'react-dom/client',
|
|
7
|
+
'react-tweet > use-sync-external-store/shim/index.js',
|
|
8
|
+
'react-tweet > date-fns/format/index.js',
|
|
9
|
+
],
|
|
10
|
+
},
|
|
11
|
+
ssr: {
|
|
12
|
+
noExternal: ['react-tweet'],
|
|
13
|
+
},
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { glob } from 'glob';
|
|
4
|
-
|
|
5
|
-
const rootDir = path.join(path.dirname(fileURLToPath(import.meta.url)), 'src');
|
|
6
|
-
const routeFiles = glob.sync('routes/**/*.{tsx,js}', { cwd: rootDir });
|
|
7
|
-
|
|
8
|
-
/** @type {import('vite').UserConfig} */
|
|
9
|
-
export default {
|
|
10
|
-
build: {
|
|
11
|
-
rollupOptions: {
|
|
12
|
-
input: Object.fromEntries(
|
|
13
|
-
routeFiles.map((fname) => [
|
|
14
|
-
fname.replace(/\.\w+$/, ''),
|
|
15
|
-
path.join(rootDir, fname),
|
|
16
|
-
]),
|
|
17
|
-
),
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|