@opentf/create-afw 0.5.0 → 0.7.0
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/README.md +5 -8
- package/esdev/templates/app/_gitignore +18 -0
- package/esdev/templates/app/_option/language/js/entry.js +4 -0
- package/esdev/templates/app/_option/language/js/index.html +13 -0
- package/esdev/templates/app/_option/language/js/jsconfig.json +6 -0
- package/esdev/templates/app/_option/language/js/tests/ui/Counter.test.js +10 -0
- package/esdev/templates/app/_option/language/ts/entry.ts +4 -0
- package/esdev/templates/app/_option/language/ts/index.html +13 -0
- package/esdev/templates/app/_option/language/ts/tests/ui/Counter.test.ts +10 -0
- package/esdev/templates/app/_option/language/ts/tsconfig.json +28 -0
- package/esdev/templates/app/_option/render/client/_option/language/js/app/_config.js +6 -0
- package/esdev/templates/app/_option/render/client/_option/language/ts/app/_config.ts +6 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/js/README.md +14 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/js/app/layout.jsx +13 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/ts/README.md +15 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/ts/app/layout.tsx +13 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/js/app/layout.jsx +13 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/ts/app/layout.tsx +13 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/esdev.json +18 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +16 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +17 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/client/_option/server/yes/esdev.json +28 -0
- package/esdev/templates/app/_option/render/mixed/_option/language/js/app/_config.js +6 -0
- package/esdev/templates/app/_option/render/mixed/_option/language/js/app/about/_config.js +4 -0
- package/esdev/templates/app/_option/render/mixed/_option/language/js/app/dashboard/_config.js +5 -0
- package/esdev/templates/app/_option/render/mixed/_option/language/js/app/dashboard/loader.js +4 -0
- package/esdev/templates/app/_option/render/mixed/_option/language/ts/app/_config.ts +6 -0
- package/esdev/templates/app/_option/render/mixed/_option/language/ts/app/about/_config.ts +4 -0
- package/esdev/templates/app/_option/render/mixed/_option/language/ts/app/dashboard/_config.ts +5 -0
- package/esdev/templates/app/_option/render/mixed/_option/language/ts/app/dashboard/loader.ts +4 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/js/app/layout.jsx +15 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/ts/app/layout.tsx +15 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +16 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/js/app/layout.jsx +15 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +17 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/layout.tsx +15 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/esdev.json +28 -0
- package/esdev/templates/app/_option/render/mixed/_option/styling/css/_option/language/js/app/dashboard/page.jsx +13 -0
- package/esdev/templates/app/_option/render/mixed/_option/styling/css/_option/language/ts/app/dashboard/page.tsx +13 -0
- package/esdev/templates/app/_option/render/mixed/_option/styling/tailwind/_option/language/js/app/dashboard/page.jsx +13 -0
- package/esdev/templates/app/_option/render/mixed/_option/styling/tailwind/_option/language/ts/app/dashboard/page.tsx +13 -0
- package/esdev/templates/app/_option/render/server/_option/language/js/app/_config.js +6 -0
- package/esdev/templates/app/_option/render/server/_option/language/ts/app/_config.ts +6 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +16 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +17 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/server/_option/server/yes/esdev.json +28 -0
- package/esdev/templates/app/_option/render/static/_option/language/js/app/_config.js +6 -0
- package/esdev/templates/app/_option/render/static/_option/language/ts/app/_config.ts +6 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/js/README.md +14 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/js/app/layout.jsx +13 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/ts/README.md +15 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/ts/app/layout.tsx +13 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/js/app/layout.jsx +13 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/js/package.json +21 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/ts/app/layout.tsx +13 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/ts/package.json +23 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/esdev.json +32 -0
- package/esdev/templates/app/_option/render/static/_option/server/no/ssg.js +131 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +16 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +17 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/static/_option/server/yes/esdev.json +28 -0
- package/esdev/templates/app/_option/server/yes/_option/language/js/app/_middleware.js +9 -0
- package/esdev/templates/app/_option/server/yes/_option/language/js/app/api/hello/route.js +4 -0
- package/esdev/templates/app/_option/server/yes/_option/language/js/app/todos/loader.js +7 -0
- package/esdev/templates/app/_option/server/yes/_option/language/js/app/todos/todos.server.js +15 -0
- package/esdev/templates/app/_option/server/yes/_option/language/js/tests/server/api.test.js +8 -0
- package/esdev/templates/app/_option/server/yes/_option/language/ts/app/_middleware.ts +9 -0
- package/esdev/templates/app/_option/server/yes/_option/language/ts/app/api/hello/route.ts +4 -0
- package/esdev/templates/app/_option/server/yes/_option/language/ts/app/todos/loader.ts +7 -0
- package/esdev/templates/app/_option/server/yes/_option/language/ts/app/todos/todos.server.ts +15 -0
- package/esdev/templates/app/_option/server/yes/_option/language/ts/tests/server/api.test.ts +8 -0
- package/esdev/templates/app/_option/server/yes/_option/styling/css/_option/language/js/app/todos/page.jsx +29 -0
- package/esdev/templates/app/_option/server/yes/_option/styling/css/_option/language/ts/app/todos/page.tsx +29 -0
- package/esdev/templates/app/_option/server/yes/_option/styling/tailwind/_option/language/js/app/todos/page.jsx +29 -0
- package/esdev/templates/app/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/todos/page.tsx +29 -0
- package/esdev/templates/app/_option/server/yes/server.js +53 -0
- package/esdev/templates/app/_option/styling/css/_option/language/js/app/Counter.jsx +10 -0
- package/esdev/templates/app/_option/styling/css/_option/language/js/app/page.jsx +13 -0
- package/esdev/templates/app/_option/styling/css/_option/language/ts/app/Counter.tsx +10 -0
- package/esdev/templates/app/_option/styling/css/_option/language/ts/app/page.tsx +13 -0
- package/esdev/templates/app/_option/styling/css/app/global.css +16 -0
- package/esdev/templates/app/_option/styling/tailwind/_option/language/js/app/Counter.jsx +10 -0
- package/esdev/templates/app/_option/styling/tailwind/_option/language/js/app/page.jsx +13 -0
- package/esdev/templates/app/_option/styling/tailwind/_option/language/ts/app/Counter.tsx +10 -0
- package/esdev/templates/app/_option/styling/tailwind/_option/language/ts/app/page.tsx +13 -0
- package/esdev/templates/app/_option/styling/tailwind/app/global.css +7 -0
- package/esdev/templates/app/app/about/page.md +7 -0
- package/esdev/templates/app/template.json +96 -0
- package/esdev/templates/catalog.json +15 -0
- package/esdev/templates/docs/_gitignore +18 -0
- package/esdev/templates/docs/_option/blog/no/_option/language/js/README.md +14 -0
- package/esdev/templates/docs/_option/blog/no/_option/language/js/app/page.jsx +15 -0
- package/esdev/templates/docs/_option/blog/no/_option/language/js/tests/ui/Home.test.js +9 -0
- package/esdev/templates/docs/_option/blog/no/_option/language/ts/README.md +15 -0
- package/esdev/templates/docs/_option/blog/no/_option/language/ts/app/page.tsx +15 -0
- package/esdev/templates/docs/_option/blog/no/_option/language/ts/tests/ui/Home.test.ts +9 -0
- package/esdev/templates/docs/_option/blog/no/afw.config.js +13 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/js/README.md +14 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/js/app/blog/layout.jsx +7 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/js/app/blog/page.jsx +13 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/js/app/page.jsx +15 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/js/tests/ui/Home.test.js +10 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/ts/README.md +15 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/ts/app/blog/layout.tsx +7 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/ts/app/blog/page.tsx +13 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/ts/app/page.tsx +15 -0
- package/esdev/templates/docs/_option/blog/yes/_option/language/ts/tests/ui/Home.test.ts +10 -0
- package/esdev/templates/docs/_option/blog/yes/afw.config.js +15 -0
- package/esdev/templates/docs/_option/blog/yes/app/blog/hello-world/page.mdx +10 -0
- package/esdev/templates/docs/_option/language/js/app/_config.js +4 -0
- package/esdev/templates/docs/_option/language/js/app/docs/layout.jsx +6 -0
- package/esdev/templates/docs/_option/language/js/app/layout.jsx +3 -0
- package/esdev/templates/docs/_option/language/js/entry.js +6 -0
- package/esdev/templates/docs/_option/language/js/index.html +12 -0
- package/esdev/templates/docs/_option/language/js/jsconfig.json +6 -0
- package/esdev/templates/docs/_option/language/js/package.json +21 -0
- package/esdev/templates/docs/_option/language/ts/app/_config.ts +4 -0
- package/esdev/templates/docs/_option/language/ts/app/docs/layout.tsx +6 -0
- package/esdev/templates/docs/_option/language/ts/app/layout.tsx +3 -0
- package/esdev/templates/docs/_option/language/ts/entry.ts +6 -0
- package/esdev/templates/docs/_option/language/ts/index.html +12 -0
- package/esdev/templates/docs/_option/language/ts/package.json +23 -0
- package/esdev/templates/docs/_option/language/ts/tsconfig.json +30 -0
- package/esdev/templates/docs/app/docs/_meta.js +5 -0
- package/esdev/templates/docs/app/docs/getting-started/page.mdx +11 -0
- package/esdev/templates/docs/app/docs/guides/writing-pages/page.mdx +20 -0
- package/esdev/templates/docs/app/docs/page.mdx +14 -0
- package/esdev/templates/docs/app/global.css +1 -0
- package/esdev/templates/docs/esdev.json +39 -0
- package/esdev/templates/docs/ssg.js +131 -0
- package/esdev/templates/docs/template.json +43 -0
- package/esdev/templates/library/_gitignore +18 -0
- package/esdev/templates/library/_option/language/js/entry.js +4 -0
- package/esdev/templates/library/_option/language/js/index.html +13 -0
- package/esdev/templates/library/_option/language/js/index.js +2 -0
- package/esdev/templates/library/_option/language/js/jsconfig.json +6 -0
- package/esdev/templates/library/_option/language/js/tests/ui/Counter.test.js +10 -0
- package/esdev/templates/library/_option/language/ts/entry.ts +4 -0
- package/esdev/templates/library/_option/language/ts/index.html +13 -0
- package/esdev/templates/library/_option/language/ts/index.ts +2 -0
- package/esdev/templates/library/_option/language/ts/tests/ui/Counter.test.ts +10 -0
- package/esdev/templates/library/_option/language/ts/tsconfig.json +30 -0
- package/esdev/templates/library/_option/styling/css/_option/language/js/README.md +12 -0
- package/esdev/templates/library/_option/styling/css/_option/language/js/app/page.jsx +10 -0
- package/esdev/templates/library/_option/styling/css/_option/language/js/package.json +26 -0
- package/esdev/templates/library/_option/styling/css/_option/language/js/src/Counter.jsx +10 -0
- package/esdev/templates/library/_option/styling/css/_option/language/ts/README.md +13 -0
- package/esdev/templates/library/_option/styling/css/_option/language/ts/app/page.tsx +10 -0
- package/esdev/templates/library/_option/styling/css/_option/language/ts/package.json +28 -0
- package/esdev/templates/library/_option/styling/css/_option/language/ts/src/Counter.tsx +10 -0
- package/esdev/templates/library/_option/styling/css/app/global.css +16 -0
- package/esdev/templates/library/_option/styling/tailwind/_option/language/js/README.md +13 -0
- package/esdev/templates/library/_option/styling/tailwind/_option/language/js/app/page.jsx +10 -0
- package/esdev/templates/library/_option/styling/tailwind/_option/language/js/package.json +27 -0
- package/esdev/templates/library/_option/styling/tailwind/_option/language/js/src/Counter.jsx +10 -0
- package/esdev/templates/library/_option/styling/tailwind/_option/language/ts/README.md +14 -0
- package/esdev/templates/library/_option/styling/tailwind/_option/language/ts/app/page.tsx +10 -0
- package/esdev/templates/library/_option/styling/tailwind/_option/language/ts/package.json +29 -0
- package/esdev/templates/library/_option/styling/tailwind/_option/language/ts/src/Counter.tsx +10 -0
- package/esdev/templates/library/_option/styling/tailwind/app/global.css +7 -0
- package/esdev/templates/library/esdev.json +18 -0
- package/esdev/templates/library/template.json +44 -0
- package/index.js +12 -21
- package/package.json +14 -9
- package/templates.js +257 -77
- package/versions.json +4 -4
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ dev server is shown. Nothing is started for you.
|
|
|
13
13
|
| Prompt | Asked for | Choices |
|
|
14
14
|
| --- | --- | --- |
|
|
15
15
|
| Template | every project | `app`, `docs`, `library` |
|
|
16
|
-
| Rendering | `app` | `
|
|
17
|
-
| Server | `app`,
|
|
16
|
+
| Rendering | `app` | `client` (in the browser), `server` (per request, hydrated), `static` (prerendered), `mixed` (server, with a static page and a client section); written to `app/_config.js` |
|
|
17
|
+
| Server | `app`, for `client` and `static` | API routes, middleware, loaders and server functions on Node: yes or no |
|
|
18
18
|
| Styling | `app`, `library` | CSS, or Tailwind CSS |
|
|
19
19
|
| Blog | `docs` | Posts with RSS and Atom feeds: yes or no (default) |
|
|
20
20
|
| Language | every project | TypeScript (default), JavaScript |
|
|
@@ -22,15 +22,15 @@ dev server is shown. Nothing is started for you.
|
|
|
22
22
|
Or pass the choices:
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
npm create @opentf/afw@latest my-app -- --template app --render
|
|
25
|
+
npm create @opentf/afw@latest my-app -- --template app --render static --server --tailwind
|
|
26
26
|
npm create @opentf/afw@latest my-docs -- --template docs-js --blog
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
| Option | Values |
|
|
30
30
|
| --- | --- |
|
|
31
31
|
| `-t`, `--template` | `app`, `docs`, `library`; add `-ts` or `-js` for the language (`app-js`) |
|
|
32
|
-
| `-r`, `--render` | `
|
|
33
|
-
| `--server`, `--no-server` | Add a Node server, or not (default) — `app` only; `
|
|
32
|
+
| `-r`, `--render` | `client` (default), `server`, `static`, `mixed` — `app` only |
|
|
33
|
+
| `--server`, `--no-server` | Add a Node server, or not (default) — `app` only; `server` and `mixed` always have one |
|
|
34
34
|
| `-s`, `--styling` | `css` (default) or `tailwind`; `--tailwind` for short — `app` and `library` |
|
|
35
35
|
| `--blog`, `--no-blog` | Add a blog, or not (default) — `docs` only |
|
|
36
36
|
| `-l`, `--language` | `ts` (default) or `js` |
|
|
@@ -44,9 +44,6 @@ npm create @opentf/afw@latest my-docs -- --template docs-js --blog
|
|
|
44
44
|
| `docs` | An [`@opentf/afw-docs`](https://afw.opentechf.org/packages/afw-docs) site: MDX docs, prerendered, with search, `sitemap.xml` and `llms.txt`; with `--blog`, a blog with RSS/Atom feeds |
|
|
45
45
|
| `library` | Components published as JSX source (`index.js` and `src/`), `@opentf/afw` as a peer dependency, a preview app and a test |
|
|
46
46
|
|
|
47
|
-
The names of earlier releases still work: `spa`, `fullstack` (`app --server`), `ssr`
|
|
48
|
-
and `ssg`.
|
|
49
|
-
|
|
50
47
|
- A non-empty target directory: choose to cancel, remove its files, or ignore them.
|
|
51
48
|
- A folder name that is not a valid package name: you are asked for one (`My App` → `my-app`).
|
|
52
49
|
- Apps and docs sites have `dev`, `build` and `test` (Vitest) scripts, and either `start`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>{{name}}</title>
|
|
7
|
+
<link rel="stylesheet" href="./app/global.css" />
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="./entry.js"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { expect, test } from "@opentf/afw-test/test";
|
|
2
|
+
import { render, userEvent } from "@opentf/afw-test";
|
|
3
|
+
import Counter from "../../app/Counter.jsx";
|
|
4
|
+
|
|
5
|
+
test("counts clicks", async () => {
|
|
6
|
+
const { getByRole, getByText } = render(Counter, { start: 1 });
|
|
7
|
+
await userEvent.setup().click(getByRole("button", { name: "Count: 1" }));
|
|
8
|
+
expect(getByRole("button").textContent).toBe("Count: 2");
|
|
9
|
+
expect(getByText(/Doubled: 4/)).toBeTruthy();
|
|
10
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>{{name}}</title>
|
|
7
|
+
<link rel="stylesheet" href="./app/global.css" />
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="./entry.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { expect, test } from "@opentf/afw-test/test";
|
|
2
|
+
import { render, userEvent } from "@opentf/afw-test";
|
|
3
|
+
import Counter from "../../app/Counter.tsx";
|
|
4
|
+
|
|
5
|
+
test("counts clicks", async () => {
|
|
6
|
+
const { getByRole, getByText } = render(Counter, { start: 1 });
|
|
7
|
+
await userEvent.setup().click(getByRole("button", { name: "Count: 1" }));
|
|
8
|
+
expect(getByRole("button").textContent).toBe("Count: 2");
|
|
9
|
+
expect(getByText(/Doubled: 4/)).toBeTruthy();
|
|
10
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ESNext",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
11
|
+
"jsx": "preserve",
|
|
12
|
+
"jsxImportSource": "@opentf/afw",
|
|
13
|
+
"types": [
|
|
14
|
+
"@opentf/esrun-types",
|
|
15
|
+
"@opentf/esdev-plugin-afw/client"
|
|
16
|
+
],
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noEmit": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"allowImportingTsExtensions": true
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"app",
|
|
25
|
+
"tests",
|
|
26
|
+
"entry.ts"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { defineRoute } from "@opentf/afw";
|
|
2
|
+
|
|
3
|
+
// How the pages in app/ render: "server" (per request), "static" (once, at build time) or
|
|
4
|
+
// "client" (in the browser). A folder's own _config.js sets it for that folder and
|
|
5
|
+
// the folders below it; the nearest one wins.
|
|
6
|
+
export default defineRoute({ render: "client" });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { defineRoute } from "@opentf/afw";
|
|
2
|
+
|
|
3
|
+
// How the pages in app/ render: "server" (per request), "static" (once, at build time) or
|
|
4
|
+
// "client" (in the browser). A folder's own _config.ts sets it for that folder and
|
|
5
|
+
// the folders below it; the nearest one wins.
|
|
6
|
+
export default defineRoute({ render: "client" });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered in the browser.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Start the dev server |
|
|
8
|
+
| `{{pm}} run build` | Build for production |
|
|
9
|
+
| `{{pm}} run preview` | Preview the production build |
|
|
10
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
|
+
|
|
12
|
+
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
13
|
+
- `app/_config.js` sets how pages render (`server`, `static` or `client`); a folder's own `_config.js` changes it for that folder.
|
|
14
|
+
- Component tests live in `tests/ui/`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "esdev start",
|
|
7
|
+
"build": "esdev build",
|
|
8
|
+
"preview": "esdev preview --spa",
|
|
9
|
+
"test": "esdev test --dom --setup=@opentf/afw-test/setup tests/ui"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@opentf/afw": "{{registry:@opentf/afw}}"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
16
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
17
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered in the browser.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Start the dev server |
|
|
8
|
+
| `{{pm}} run build` | Build for production |
|
|
9
|
+
| `{{pm}} run preview` | Preview the production build |
|
|
10
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
|
+
| `{{pm}} run typecheck` | Check types |
|
|
12
|
+
|
|
13
|
+
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
14
|
+
- `app/_config.ts` sets how pages render (`server`, `static` or `client`); a folder's own `_config.ts` changes it for that folder.
|
|
15
|
+
- Component tests live in `tests/ui/`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "esdev start",
|
|
7
|
+
"build": "esdev build",
|
|
8
|
+
"preview": "esdev preview --spa",
|
|
9
|
+
"test": "esdev test --dom --setup=@opentf/afw-test/setup tests/ui",
|
|
10
|
+
"typecheck": "esdev typecheck"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@opentf/afw": "{{registry:@opentf/afw}}"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
17
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
18
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
|
|
19
|
+
"typescript": "{{registry:typescript}}"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered in the browser.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Start the dev server |
|
|
8
|
+
| `{{pm}} run build` | Build for production |
|
|
9
|
+
| `{{pm}} run preview` | Preview the production build |
|
|
10
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
|
+
|
|
12
|
+
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
13
|
+
- `app/_config.js` sets how pages render (`server`, `static` or `client`); a folder's own `_config.js` changes it for that folder.
|
|
14
|
+
- Component tests live in `tests/ui/`.
|
|
15
|
+
- Styled with Tailwind CSS: utility classes go straight into `class`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Link } from "@opentf/afw";
|
|
2
|
+
|
|
3
|
+
export default function Layout({ children }) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<nav class="mb-8 flex gap-4 text-sky-700">
|
|
7
|
+
<Link href="/">Home</Link>
|
|
8
|
+
<Link href="/about">About</Link>
|
|
9
|
+
</nav>
|
|
10
|
+
<main>{children}</main>
|
|
11
|
+
</>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "esdev start",
|
|
7
|
+
"build": "esdev build",
|
|
8
|
+
"preview": "esdev preview --spa",
|
|
9
|
+
"test": "esdev test --dom --setup=@opentf/afw-test/setup tests/ui"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@opentf/afw": "{{registry:@opentf/afw}}"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
16
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
17
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
|
|
18
|
+
"tailwindcss": "{{registry:tailwindcss}}"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered in the browser.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Start the dev server |
|
|
8
|
+
| `{{pm}} run build` | Build for production |
|
|
9
|
+
| `{{pm}} run preview` | Preview the production build |
|
|
10
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
|
+
| `{{pm}} run typecheck` | Check types |
|
|
12
|
+
|
|
13
|
+
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
14
|
+
- `app/_config.ts` sets how pages render (`server`, `static` or `client`); a folder's own `_config.ts` changes it for that folder.
|
|
15
|
+
- Component tests live in `tests/ui/`.
|
|
16
|
+
- Styled with Tailwind CSS: utility classes go straight into `class`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Link } from "@opentf/afw";
|
|
2
|
+
|
|
3
|
+
export default function Layout({ children }: { children: unknown }) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<nav class="mb-8 flex gap-4 text-sky-700">
|
|
7
|
+
<Link href="/">Home</Link>
|
|
8
|
+
<Link href="/about">About</Link>
|
|
9
|
+
</nav>
|
|
10
|
+
<main>{children}</main>
|
|
11
|
+
</>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "esdev start",
|
|
7
|
+
"build": "esdev build",
|
|
8
|
+
"preview": "esdev preview --spa",
|
|
9
|
+
"test": "esdev test --dom --setup=@opentf/afw-test/setup tests/ui",
|
|
10
|
+
"typecheck": "esdev typecheck"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@opentf/afw": "{{registry:@opentf/afw}}"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
17
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
18
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
|
|
19
|
+
"tailwindcss": "{{registry:tailwindcss}}",
|
|
20
|
+
"typescript": "{{registry:typescript}}"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered in the browser, with a server on ES-Runtime.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Start the dev server |
|
|
8
|
+
| `{{pm}} run build` | Build for production |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
10
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
|
+
|
|
12
|
+
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
13
|
+
- `app/_config.js` sets how pages render (`server`, `static` or `client`); a folder's own `_config.js` changes it for that folder.
|
|
14
|
+
- Component tests live in `tests/ui/`, server tests (API routes, loaders) in `tests/server/`.
|
|
15
|
+
- On the server: API routes (`app/api/hello/route.js`), middleware (`app/_middleware.js`), a loader (`app/todos/loader.js`) and server functions (`app/todos/todos.server.js`), which components call like async functions.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Link } from "@opentf/afw";
|
|
2
|
+
|
|
3
|
+
export default function Layout({ children }) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<nav>
|
|
7
|
+
<Link href="/">Home</Link>
|
|
8
|
+
<Link href="/about">About</Link>
|
|
9
|
+
<Link href="/todos">Todos</Link>
|
|
10
|
+
</nav>
|
|
11
|
+
<main>{children}</main>
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "esdev start",
|
|
7
|
+
"build": "esdev build",
|
|
8
|
+
"start": "esrun --allow-read=dist --allow-listen=0.0.0.0:3000 --allow-env=PORT --allow-imports dist/server.js",
|
|
9
|
+
"test": "esdev test tests/server && esdev test --dom --setup=@opentf/afw-test/setup tests/ui"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@opentf/afw": "{{registry:@opentf/afw}}"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
16
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
17
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered in the browser, with a server on ES-Runtime.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Start the dev server |
|
|
8
|
+
| `{{pm}} run build` | Build for production |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
10
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
|
+
| `{{pm}} run typecheck` | Check types |
|
|
12
|
+
|
|
13
|
+
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
14
|
+
- `app/_config.ts` sets how pages render (`server`, `static` or `client`); a folder's own `_config.ts` changes it for that folder.
|
|
15
|
+
- Component tests live in `tests/ui/`, server tests (API routes, loaders) in `tests/server/`.
|
|
16
|
+
- On the server: API routes (`app/api/hello/route.ts`), middleware (`app/_middleware.ts`), a loader (`app/todos/loader.ts`) and server functions (`app/todos/todos.server.ts`), which components call like async functions.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Link } from "@opentf/afw";
|
|
2
|
+
|
|
3
|
+
export default function Layout({ children }: { children: unknown }) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<nav>
|
|
7
|
+
<Link href="/">Home</Link>
|
|
8
|
+
<Link href="/about">About</Link>
|
|
9
|
+
<Link href="/todos">Todos</Link>
|
|
10
|
+
</nav>
|
|
11
|
+
<main>{children}</main>
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "esdev start",
|
|
7
|
+
"build": "esdev build",
|
|
8
|
+
"start": "esrun --allow-read=dist --allow-listen=0.0.0.0:3000 --allow-env=PORT --allow-imports dist/server.js",
|
|
9
|
+
"test": "esdev test tests/server && esdev test --dom --setup=@opentf/afw-test/setup tests/ui",
|
|
10
|
+
"typecheck": "esdev typecheck"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@opentf/afw": "{{registry:@opentf/afw}}"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
17
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
18
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
|
|
19
|
+
"typescript": "{{registry:typescript}}"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered in the browser, with a server on ES-Runtime.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Start the dev server |
|
|
8
|
+
| `{{pm}} run build` | Build for production |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
10
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
|
+
|
|
12
|
+
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
13
|
+
- `app/_config.js` sets how pages render (`server`, `static` or `client`); a folder's own `_config.js` changes it for that folder.
|
|
14
|
+
- Component tests live in `tests/ui/`, server tests (API routes, loaders) in `tests/server/`.
|
|
15
|
+
- On the server: API routes (`app/api/hello/route.js`), middleware (`app/_middleware.js`), a loader (`app/todos/loader.js`) and server functions (`app/todos/todos.server.js`), which components call like async functions.
|
|
16
|
+
- Styled with Tailwind CSS: utility classes go straight into `class`.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Link } from "@opentf/afw";
|
|
2
|
+
|
|
3
|
+
export default function Layout({ children }) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<nav class="mb-8 flex gap-4 text-sky-700">
|
|
7
|
+
<Link href="/">Home</Link>
|
|
8
|
+
<Link href="/about">About</Link>
|
|
9
|
+
<Link href="/todos">Todos</Link>
|
|
10
|
+
</nav>
|
|
11
|
+
<main>{children}</main>
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "esdev start",
|
|
7
|
+
"build": "esdev build",
|
|
8
|
+
"start": "esrun --allow-read=dist --allow-listen=0.0.0.0:3000 --allow-env=PORT --allow-imports dist/server.js",
|
|
9
|
+
"test": "esdev test tests/server && esdev test --dom --setup=@opentf/afw-test/setup tests/ui"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@opentf/afw": "{{registry:@opentf/afw}}"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
16
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
17
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
|
|
18
|
+
"tailwindcss": "{{registry:tailwindcss}}"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered in the browser, with a server on ES-Runtime.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Start the dev server |
|
|
8
|
+
| `{{pm}} run build` | Build for production |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
10
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
|
+
| `{{pm}} run typecheck` | Check types |
|
|
12
|
+
|
|
13
|
+
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
14
|
+
- `app/_config.ts` sets how pages render (`server`, `static` or `client`); a folder's own `_config.ts` changes it for that folder.
|
|
15
|
+
- Component tests live in `tests/ui/`, server tests (API routes, loaders) in `tests/server/`.
|
|
16
|
+
- On the server: API routes (`app/api/hello/route.ts`), middleware (`app/_middleware.ts`), a loader (`app/todos/loader.ts`) and server functions (`app/todos/todos.server.ts`), which components call like async functions.
|
|
17
|
+
- Styled with Tailwind CSS: utility classes go straight into `class`.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Link } from "@opentf/afw";
|
|
2
|
+
|
|
3
|
+
export default function Layout({ children }: { children: unknown }) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<nav class="mb-8 flex gap-4 text-sky-700">
|
|
7
|
+
<Link href="/">Home</Link>
|
|
8
|
+
<Link href="/about">About</Link>
|
|
9
|
+
<Link href="/todos">Todos</Link>
|
|
10
|
+
</nav>
|
|
11
|
+
<main>{children}</main>
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "esdev start",
|
|
7
|
+
"build": "esdev build",
|
|
8
|
+
"start": "esrun --allow-read=dist --allow-listen=0.0.0.0:3000 --allow-env=PORT --allow-imports dist/server.js",
|
|
9
|
+
"test": "esdev test tests/server && esdev test --dom --setup=@opentf/afw-test/setup tests/ui",
|
|
10
|
+
"typecheck": "esdev typecheck"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@opentf/afw": "{{registry:@opentf/afw}}"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
17
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
18
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
|
|
19
|
+
"tailwindcss": "{{registry:tailwindcss}}",
|
|
20
|
+
"typescript": "{{registry:typescript}}"
|
|
21
|
+
}
|
|
22
|
+
}
|