@opentf/create-afw 0.5.0 → 0.6.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/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 +30 -0
- package/esdev/templates/app/_option/render/client+language/js/app/_config.js +6 -0
- package/esdev/templates/app/_option/render/client+language/ts/app/_config.ts +6 -0
- package/esdev/templates/app/_option/render/client+server/no/esdev.json +18 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/css+language/js/README.md +14 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/css+language/js/app/layout.jsx +13 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/css+language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/css+language/ts/README.md +15 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/css+language/ts/app/layout.tsx +13 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/css+language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/js/app/layout.jsx +13 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/ts/app/layout.tsx +13 -0
- package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/client+server/yes/esdev.json +28 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/js/README.md +16 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/ts/README.md +17 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/mixed+language/js/app/_config.js +6 -0
- package/esdev/templates/app/_option/render/mixed+language/js/app/about/_config.js +4 -0
- package/esdev/templates/app/_option/render/mixed+language/js/app/dashboard/_config.js +5 -0
- package/esdev/templates/app/_option/render/mixed+language/js/app/dashboard/loader.js +4 -0
- package/esdev/templates/app/_option/render/mixed+language/ts/app/_config.ts +6 -0
- package/esdev/templates/app/_option/render/mixed+language/ts/app/about/_config.ts +4 -0
- package/esdev/templates/app/_option/render/mixed+language/ts/app/dashboard/_config.ts +5 -0
- package/esdev/templates/app/_option/render/mixed+language/ts/app/dashboard/loader.ts +4 -0
- package/esdev/templates/app/_option/render/mixed+server/yes/esdev.json +28 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/js/app/layout.jsx +15 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/ts/app/layout.tsx +15 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/js/README.md +16 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/js/app/layout.jsx +15 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/ts/README.md +17 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/ts/app/layout.tsx +15 -0
- package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/mixed+styling/css+language/js/app/dashboard/page.jsx +13 -0
- package/esdev/templates/app/_option/render/mixed+styling/css+language/ts/app/dashboard/page.tsx +13 -0
- package/esdev/templates/app/_option/render/mixed+styling/tailwind+language/js/app/dashboard/page.jsx +13 -0
- package/esdev/templates/app/_option/render/mixed+styling/tailwind+language/ts/app/dashboard/page.tsx +13 -0
- package/esdev/templates/app/_option/render/server+language/js/app/_config.js +6 -0
- package/esdev/templates/app/_option/render/server+language/ts/app/_config.ts +6 -0
- package/esdev/templates/app/_option/render/server+server/yes/esdev.json +28 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/js/README.md +16 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/ts/README.md +17 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/static+language/js/app/_config.js +6 -0
- package/esdev/templates/app/_option/render/static+language/ts/app/_config.ts +6 -0
- package/esdev/templates/app/_option/render/static+server/no/esdev.json +32 -0
- package/esdev/templates/app/_option/render/static+server/no/ssg.js +131 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/css+language/js/README.md +14 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/css+language/js/app/layout.jsx +13 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/css+language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/css+language/ts/README.md +15 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/css+language/ts/app/layout.tsx +13 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/css+language/ts/package.json +22 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/js/app/layout.jsx +13 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/js/package.json +21 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/ts/app/layout.tsx +13 -0
- package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/ts/package.json +23 -0
- package/esdev/templates/app/_option/render/static+server/yes/esdev.json +28 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/js/README.md +15 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/js/package.json +19 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/ts/README.md +16 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/ts/package.json +21 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/js/README.md +16 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/js/app/layout.jsx +14 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/js/package.json +20 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/ts/README.md +17 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/ts/app/layout.tsx +14 -0
- package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/ts/package.json +22 -0
- package/esdev/templates/app/_option/server/yes/server.js +52 -0
- package/esdev/templates/app/_option/server/yes+language/js/app/_middleware.js +9 -0
- package/esdev/templates/app/_option/server/yes+language/js/app/api/hello/route.js +4 -0
- package/esdev/templates/app/_option/server/yes+language/js/app/todos/loader.js +7 -0
- package/esdev/templates/app/_option/server/yes+language/js/app/todos/todos.server.js +15 -0
- package/esdev/templates/app/_option/server/yes+language/js/tests/server/api.test.js +8 -0
- package/esdev/templates/app/_option/server/yes+language/ts/app/_middleware.ts +9 -0
- package/esdev/templates/app/_option/server/yes+language/ts/app/api/hello/route.ts +4 -0
- package/esdev/templates/app/_option/server/yes+language/ts/app/todos/loader.ts +7 -0
- package/esdev/templates/app/_option/server/yes+language/ts/app/todos/todos.server.ts +15 -0
- package/esdev/templates/app/_option/server/yes+language/ts/tests/server/api.test.ts +8 -0
- package/esdev/templates/app/_option/server/yes+styling/css+language/js/app/todos/page.jsx +29 -0
- package/esdev/templates/app/_option/server/yes+styling/css+language/ts/app/todos/page.tsx +29 -0
- package/esdev/templates/app/_option/server/yes+styling/tailwind+language/js/app/todos/page.jsx +29 -0
- package/esdev/templates/app/_option/server/yes+styling/tailwind+language/ts/app/todos/page.tsx +29 -0
- package/esdev/templates/app/_option/styling/css/app/global.css +16 -0
- package/esdev/templates/app/_option/styling/css+language/js/app/Counter.jsx +10 -0
- package/esdev/templates/app/_option/styling/css+language/js/app/page.jsx +13 -0
- package/esdev/templates/app/_option/styling/css+language/ts/app/Counter.tsx +10 -0
- package/esdev/templates/app/_option/styling/css+language/ts/app/page.tsx +13 -0
- package/esdev/templates/app/_option/styling/tailwind/app/global.css +7 -0
- package/esdev/templates/app/_option/styling/tailwind+language/js/app/Counter.jsx +10 -0
- package/esdev/templates/app/_option/styling/tailwind+language/js/app/page.jsx +13 -0
- package/esdev/templates/app/_option/styling/tailwind+language/ts/app/Counter.tsx +10 -0
- package/esdev/templates/app/_option/styling/tailwind+language/ts/app/page.tsx +13 -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/afw.config.js +13 -0
- package/esdev/templates/docs/_option/blog/no+language/js/README.md +14 -0
- package/esdev/templates/docs/_option/blog/no+language/js/app/page.jsx +15 -0
- package/esdev/templates/docs/_option/blog/no+language/js/tests/ui/Home.test.js +9 -0
- package/esdev/templates/docs/_option/blog/no+language/ts/README.md +15 -0
- package/esdev/templates/docs/_option/blog/no+language/ts/app/page.tsx +15 -0
- package/esdev/templates/docs/_option/blog/no+language/ts/tests/ui/Home.test.ts +9 -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/blog/yes+language/js/README.md +14 -0
- package/esdev/templates/docs/_option/blog/yes+language/js/app/blog/layout.jsx +7 -0
- package/esdev/templates/docs/_option/blog/yes+language/js/app/blog/page.jsx +13 -0
- package/esdev/templates/docs/_option/blog/yes+language/js/app/page.jsx +15 -0
- package/esdev/templates/docs/_option/blog/yes+language/js/tests/ui/Home.test.js +10 -0
- package/esdev/templates/docs/_option/blog/yes+language/ts/README.md +15 -0
- package/esdev/templates/docs/_option/blog/yes+language/ts/app/blog/layout.tsx +7 -0
- package/esdev/templates/docs/_option/blog/yes+language/ts/app/blog/page.tsx +13 -0
- package/esdev/templates/docs/_option/blog/yes+language/ts/app/page.tsx +15 -0
- package/esdev/templates/docs/_option/blog/yes+language/ts/tests/ui/Home.test.ts +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 +32 -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 +32 -0
- package/esdev/templates/library/_option/styling/css/app/global.css +16 -0
- package/esdev/templates/library/_option/styling/css+language/js/README.md +12 -0
- package/esdev/templates/library/_option/styling/css+language/js/app/page.jsx +10 -0
- package/esdev/templates/library/_option/styling/css+language/js/package.json +26 -0
- package/esdev/templates/library/_option/styling/css+language/js/src/Counter.jsx +10 -0
- package/esdev/templates/library/_option/styling/css+language/ts/README.md +13 -0
- package/esdev/templates/library/_option/styling/css+language/ts/app/page.tsx +10 -0
- package/esdev/templates/library/_option/styling/css+language/ts/package.json +28 -0
- package/esdev/templates/library/_option/styling/css+language/ts/src/Counter.tsx +10 -0
- package/esdev/templates/library/_option/styling/tailwind/app/global.css +7 -0
- package/esdev/templates/library/_option/styling/tailwind+language/js/README.md +13 -0
- package/esdev/templates/library/_option/styling/tailwind+language/js/app/page.jsx +10 -0
- package/esdev/templates/library/_option/styling/tailwind+language/js/package.json +27 -0
- package/esdev/templates/library/_option/styling/tailwind+language/js/src/Counter.jsx +10 -0
- package/esdev/templates/library/_option/styling/tailwind+language/ts/README.md +14 -0
- package/esdev/templates/library/_option/styling/tailwind+language/ts/app/page.tsx +10 -0
- package/esdev/templates/library/_option/styling/tailwind+language/ts/package.json +29 -0
- package/esdev/templates/library/_option/styling/tailwind+language/ts/src/Counter.tsx +10 -0
- package/esdev/templates/library/esdev.json +18 -0
- package/esdev/templates/library/template.json +44 -0
- package/index.js +13 -9
- package/package.json +14 -9
- package/templates.js +263 -74
- package/versions.json +4 -4
|
@@ -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 "../../index.js";
|
|
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}} preview</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 "../../index.ts";
|
|
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,32 @@
|
|
|
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
|
+
],
|
|
16
|
+
"customConditions": [
|
|
17
|
+
"esdev"
|
|
18
|
+
],
|
|
19
|
+
"strict": true,
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"isolatedModules": true,
|
|
22
|
+
"skipLibCheck": true,
|
|
23
|
+
"allowImportingTsExtensions": true
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"index.ts",
|
|
27
|
+
"src",
|
|
28
|
+
"app",
|
|
29
|
+
"tests",
|
|
30
|
+
"entry.ts"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
A component library for [AFW](https://afw.opentechf.org), published as JSX source.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Preview the components (`app/page.jsx`) |
|
|
8
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
9
|
+
| `{{pm}} publish` | Publish `index.js` and `src/` |
|
|
10
|
+
|
|
11
|
+
- Export each component from `index.js`.
|
|
12
|
+
- Apps install it next to `@opentf/afw` (a peer dependency); their AFW plugin compiles it, with Vite or esdev.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"index.js",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "esdev start",
|
|
15
|
+
"test": "esdev test --dom --setup=@opentf/afw-test/setup tests/ui"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@opentf/afw": "^{{registry:@opentf/afw}}"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@opentf/afw": "{{registry:@opentf/afw}}",
|
|
22
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
23
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
24
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
A component library for [AFW](https://afw.opentechf.org), published as JSX source.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Preview the components (`app/page.tsx`) |
|
|
8
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
9
|
+
| `{{pm}} run typecheck` | Check types |
|
|
10
|
+
| `{{pm}} publish` | Publish `index.ts` and `src/` |
|
|
11
|
+
|
|
12
|
+
- Export each component from `index.ts`.
|
|
13
|
+
- Apps install it next to `@opentf/afw` (a peer dependency); their AFW plugin compiles it, with Vite or esdev.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.ts"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"index.ts",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "esdev start",
|
|
15
|
+
"test": "esdev test --dom --setup=@opentf/afw-test/setup tests/ui",
|
|
16
|
+
"typecheck": "esdev typecheck"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@opentf/afw": "^{{registry:@opentf/afw}}"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@opentf/afw": "{{registry:@opentf/afw}}",
|
|
23
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
24
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
25
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
|
|
26
|
+
"typescript": "{{registry:typescript}}"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
A component library for [AFW](https://afw.opentechf.org), published as JSX source.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Preview the components (`app/page.jsx`) |
|
|
8
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
9
|
+
| `{{pm}} publish` | Publish `index.js` and `src/` |
|
|
10
|
+
|
|
11
|
+
- Export each component from `index.js`.
|
|
12
|
+
- Apps install it next to `@opentf/afw` (a peer dependency); their AFW plugin compiles it, with Vite or esdev.
|
|
13
|
+
- Components use Tailwind classes: apps that use Tailwind add `@source "../node_modules/{{name}}";` to their stylesheet so the classes are generated.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"index.js",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "esdev start",
|
|
15
|
+
"test": "esdev test --dom --setup=@opentf/afw-test/setup tests/ui"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@opentf/afw": "^{{registry:@opentf/afw}}"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@opentf/afw": "{{registry:@opentf/afw}}",
|
|
22
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
23
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
24
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
|
|
25
|
+
"tailwindcss": "{{registry:tailwindcss}}"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function Counter({ start = 0 }) {
|
|
2
|
+
let count = $state(start);
|
|
3
|
+
const doubled = $derived(count * 2);
|
|
4
|
+
|
|
5
|
+
return (
|
|
6
|
+
<p>
|
|
7
|
+
<button class="rounded-md bg-sky-600 px-3 py-1 text-white" onclick={() => count++}>Count: {count}</button> Doubled: {doubled}
|
|
8
|
+
</p>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
A component library for [AFW](https://afw.opentechf.org), published as JSX source.
|
|
4
|
+
|
|
5
|
+
| Command | What it does |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `{{pm}} run dev` | Preview the components (`app/page.tsx`) |
|
|
8
|
+
| `{{pm}} run test` | Run the tests with esdev |
|
|
9
|
+
| `{{pm}} run typecheck` | Check types |
|
|
10
|
+
| `{{pm}} publish` | Publish `index.ts` and `src/` |
|
|
11
|
+
|
|
12
|
+
- Export each component from `index.ts`.
|
|
13
|
+
- Apps install it next to `@opentf/afw` (a peer dependency); their AFW plugin compiles it, with Vite or esdev.
|
|
14
|
+
- Components use Tailwind classes: apps that use Tailwind add `@source "../node_modules/{{name}}";` to their stylesheet so the classes are generated.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.ts"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"index.ts",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "esdev start",
|
|
15
|
+
"test": "esdev test --dom --setup=@opentf/afw-test/setup tests/ui",
|
|
16
|
+
"typecheck": "esdev typecheck"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@opentf/afw": "^{{registry:@opentf/afw}}"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@opentf/afw": "{{registry:@opentf/afw}}",
|
|
23
|
+
"@opentf/afw-test": "{{registry:@opentf/afw-test}}",
|
|
24
|
+
"@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
|
|
25
|
+
"@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
|
|
26
|
+
"tailwindcss": "{{registry:tailwindcss}}",
|
|
27
|
+
"typescript": "{{registry:typescript}}"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function Counter({ start = 0 }: { start?: number }) {
|
|
2
|
+
let count = $state(start);
|
|
3
|
+
const doubled = $derived(count * 2);
|
|
4
|
+
|
|
5
|
+
return (
|
|
6
|
+
<p>
|
|
7
|
+
<button class="rounded-md bg-sky-600 px-3 py-1 text-white" onclick={() => count++}>Count: {count}</button> Doubled: {doubled}
|
|
8
|
+
</p>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"label": "Component Library",
|
|
3
|
+
"description": "A component library published as JSX source",
|
|
4
|
+
"group": "AFW",
|
|
5
|
+
"run": "test",
|
|
6
|
+
"options": [
|
|
7
|
+
{
|
|
8
|
+
"name": "styling",
|
|
9
|
+
"question": "Select a styling:",
|
|
10
|
+
"kind": "choice",
|
|
11
|
+
"default": "css",
|
|
12
|
+
"choices": [
|
|
13
|
+
{
|
|
14
|
+
"value": "css",
|
|
15
|
+
"label": "CSS",
|
|
16
|
+
"description": "CSS"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"value": "tailwind",
|
|
20
|
+
"label": "Tailwind CSS",
|
|
21
|
+
"description": "Tailwind CSS"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "language",
|
|
27
|
+
"question": "Select a language:",
|
|
28
|
+
"kind": "choice",
|
|
29
|
+
"default": "ts",
|
|
30
|
+
"choices": [
|
|
31
|
+
{
|
|
32
|
+
"value": "ts",
|
|
33
|
+
"label": "TypeScript",
|
|
34
|
+
"description": "TypeScript: .tsx sources and a tsconfig.json"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"value": "js",
|
|
38
|
+
"label": "JavaScript",
|
|
39
|
+
"description": "JavaScript: .jsx sources"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
package/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { styleText } from "node:util";
|
|
|
16
16
|
import * as prompts from "@clack/prompts";
|
|
17
17
|
import { slugify } from "@opentf/std";
|
|
18
18
|
|
|
19
|
-
import { LEGACY_TEMPLATES, RENDERINGS, STYLINGS, TEMPLATES, projectFiles } from "./templates.js";
|
|
19
|
+
import { LEGACY_TEMPLATES, RENDERINGS, RENDER_ALIASES, SERVER_RENDERINGS, STYLINGS, TEMPLATES, projectFiles } from "./templates.js";
|
|
20
20
|
import { afwVersions } from "./versions.js";
|
|
21
21
|
|
|
22
22
|
const DEFAULT_DIRECTORY = "afw-app";
|
|
@@ -31,9 +31,9 @@ Create an AFW project on Vite and Node. With no options, you are asked for each
|
|
|
31
31
|
|
|
32
32
|
Options:
|
|
33
33
|
-t, --template <name> ${TEMPLATE_NAMES.join(", ")} (add -ts or -js to pick the language)
|
|
34
|
-
-r, --render <mode> app: ${Object.keys(RENDERINGS).join(", ")}
|
|
34
|
+
-r, --render <mode> app: how pages render by default: ${Object.keys(RENDERINGS).join(", ")}
|
|
35
35
|
--server app: add ${SERVER_HINT}
|
|
36
|
-
--no-server app: no server (not with --render
|
|
36
|
+
--no-server app: no server (not with --render server or mixed, which always have one)
|
|
37
37
|
-s, --styling <name> app and library: ${Object.keys(STYLINGS).join(", ")} (--tailwind for short)
|
|
38
38
|
--blog docs: add a blog, with RSS and Atom feeds
|
|
39
39
|
--no-blog docs: no blog (the default)
|
|
@@ -46,8 +46,9 @@ Options:
|
|
|
46
46
|
Templates:
|
|
47
47
|
${TEMPLATE_NAMES.map((t) => ` ${t.padEnd(10)} ${TEMPLATES[t]}`).join("\n")}
|
|
48
48
|
|
|
49
|
-
Renderings (app):
|
|
49
|
+
Renderings (app), set in app/_config.js; any folder can change it with its own:
|
|
50
50
|
${Object.entries(RENDERINGS).map(([r, label]) => ` ${r.padEnd(10)} ${label}`).join("\n")}
|
|
51
|
+
(spa, ssr and ssg from earlier releases mean client, server and static.)
|
|
51
52
|
|
|
52
53
|
Shorthands from earlier releases: ${Object.entries(LEGACY_TEMPLATES).map(([name, t]) => `${name} = app --render ${t.render}${t.server ? " --server" : ""}`).join("; ")}.
|
|
53
54
|
|
|
@@ -99,7 +100,7 @@ export function parseArgs(args) {
|
|
|
99
100
|
const legacy = LEGACY_TEMPLATES[base];
|
|
100
101
|
if (legacy) {
|
|
101
102
|
// An earlier release's name: a shorthand for app with its rendering and server.
|
|
102
|
-
if (options.render !== undefined && options.render !== legacy.render) throw new Error(`--template ${base} conflicts with --render ${options.render}`);
|
|
103
|
+
if (options.render !== undefined && (RENDER_ALIASES[options.render] ?? options.render) !== legacy.render) throw new Error(`--template ${base} conflicts with --render ${options.render}`);
|
|
103
104
|
if (legacy.server && options.server === false) throw new Error(`--template ${base} conflicts with --no-server`);
|
|
104
105
|
options.template = legacy.template;
|
|
105
106
|
options.render = legacy.render;
|
|
@@ -108,6 +109,7 @@ export function parseArgs(args) {
|
|
|
108
109
|
options.template = base;
|
|
109
110
|
}
|
|
110
111
|
}
|
|
112
|
+
if (options.render !== undefined) options.render = RENDER_ALIASES[options.render] ?? options.render;
|
|
111
113
|
if (options.render !== undefined && !RENDERINGS[options.render]) {
|
|
112
114
|
throw new Error(`Unknown rendering "${options.render}". Choose one of: ${Object.keys(RENDERINGS).join(", ")}.`);
|
|
113
115
|
}
|
|
@@ -117,7 +119,7 @@ export function parseArgs(args) {
|
|
|
117
119
|
if (options.language !== undefined && !LANGUAGES[options.language]) {
|
|
118
120
|
throw new Error(`Unknown language "${options.language}". Choose ts or js.`);
|
|
119
121
|
}
|
|
120
|
-
if (options.render
|
|
122
|
+
if (SERVER_RENDERINGS.has(options.render) && options.server === false) throw new Error(`--render ${options.render} always has a server; drop --no-server`);
|
|
121
123
|
if (options.template && options.template !== "app") {
|
|
122
124
|
if (options.render !== undefined) throw new Error(`--render applies to the app template, not ${options.template}`);
|
|
123
125
|
if (options.server !== undefined) throw new Error(`--server applies to the app template, not ${options.template}`);
|
|
@@ -162,7 +164,7 @@ async function emptyDir(dir) {
|
|
|
162
164
|
* (default), `"remove"` its files first, or `"ignore"` and write beside them.
|
|
163
165
|
*/
|
|
164
166
|
export async function create({
|
|
165
|
-
directory = DEFAULT_DIRECTORY, template = "app", render = "
|
|
167
|
+
directory = DEFAULT_DIRECTORY, template = "app", render = "client", server = false, blog = false, styling = "css", language = "ts",
|
|
166
168
|
packageName, existing = "error", cwd: base = cwd(),
|
|
167
169
|
} = {}) {
|
|
168
170
|
const target = resolve(base, directory);
|
|
@@ -279,9 +281,11 @@ export async function main(args = argv.slice(2)) {
|
|
|
279
281
|
|
|
280
282
|
const template = options.template ?? (interactive ? await choose("Select a template:", TEMPLATES) : "app");
|
|
281
283
|
const isApp = template === "app";
|
|
282
|
-
const render = isApp
|
|
284
|
+
const render = isApp
|
|
285
|
+
? (options.render ?? (interactive ? await choose("How should pages render by default? (any folder can change it later with its own _config.js)", RENDERINGS) : "client"))
|
|
286
|
+
: undefined;
|
|
283
287
|
// Server-rendered pages need a server; the other renderings may add one.
|
|
284
|
-
const server = isApp && (render
|
|
288
|
+
const server = isApp && (SERVER_RENDERINGS.has(render) || (options.server ?? (interactive
|
|
285
289
|
? await ask(prompts.confirm({ message: `Add a server? (${SERVER_HINT})`, initialValue: false }))
|
|
286
290
|
: false)));
|
|
287
291
|
// A docs site has no blog unless asked for one.
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentf/create-afw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Create an AFW app on Vite and Node: npm create @opentf/afw.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-afw": "./index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "cp ../../LICENSE LICENSE && node scripts/write-versions.mjs"
|
|
10
|
+
"build": "cp ../../LICENSE LICENSE && node scripts/write-versions.mjs && node scripts/write-esdev-templates.mjs"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
".": "./index.js"
|
|
@@ -16,17 +16,22 @@
|
|
|
16
16
|
"index.js",
|
|
17
17
|
"templates.js",
|
|
18
18
|
"versions.js",
|
|
19
|
-
"versions.json"
|
|
19
|
+
"versions.json",
|
|
20
|
+
"esdev"
|
|
20
21
|
],
|
|
21
22
|
"engines": {
|
|
22
|
-
"node": ">=
|
|
23
|
+
"node": ">=24",
|
|
24
|
+
"esdev": ">=0.28.0"
|
|
25
|
+
},
|
|
26
|
+
"esdev": {
|
|
27
|
+
"templates": "esdev/templates"
|
|
23
28
|
},
|
|
24
29
|
"devDependencies": {
|
|
25
|
-
"@opentf/afw": "0.
|
|
26
|
-
"@opentf/afw-docs": "0.
|
|
27
|
-
"@opentf/afw-form": "1.
|
|
28
|
-
"@opentf/afw-test": "1.
|
|
29
|
-
"@opentf/vite-plugin-afw": "0.
|
|
30
|
+
"@opentf/afw": "0.39.0",
|
|
31
|
+
"@opentf/afw-docs": "0.37.0",
|
|
32
|
+
"@opentf/afw-form": "1.34.0",
|
|
33
|
+
"@opentf/afw-test": "1.34.0",
|
|
34
|
+
"@opentf/vite-plugin-afw": "0.7.0",
|
|
30
35
|
"@tailwindcss/vite": "4.3.3",
|
|
31
36
|
"happy-dom": "21.0.4",
|
|
32
37
|
"tailwindcss": "4.3.3",
|