@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
|
@@ -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.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 "../../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,30 @@
|
|
|
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
|
+
"index.ts",
|
|
25
|
+
"src",
|
|
26
|
+
"app",
|
|
27
|
+
"tests",
|
|
28
|
+
"entry.ts"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -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
|
+
"unattended": "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 {
|
|
19
|
+
import { RENDERINGS, 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,10 +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
51
|
|
|
52
|
-
Shorthands from earlier releases: ${Object.entries(LEGACY_TEMPLATES).map(([name, t]) => `${name} = app --render ${t.render}${t.server ? " --server" : ""}`).join("; ")}.
|
|
53
52
|
|
|
54
53
|
For the esdev + ES-Runtime workflow, use \`esdev create\`.`;
|
|
55
54
|
|
|
@@ -89,24 +88,14 @@ export function parseArgs(args) {
|
|
|
89
88
|
}
|
|
90
89
|
if (options.template !== undefined) {
|
|
91
90
|
const [, base, lang] = options.template.match(/^(.*?)(?:-(ts|js))?$/);
|
|
92
|
-
if (!TEMPLATES[base]
|
|
91
|
+
if (!TEMPLATES[base]) {
|
|
93
92
|
throw new Error(`Unknown template "${options.template}". Choose one of: ${TEMPLATE_NAMES.join(", ")} (optionally with -ts or -js).`);
|
|
94
93
|
}
|
|
95
94
|
if (lang) {
|
|
96
95
|
if (options.language && options.language !== lang) throw new Error(`--template ${options.template} conflicts with --language ${options.language}`);
|
|
97
96
|
options.language = lang;
|
|
98
97
|
}
|
|
99
|
-
|
|
100
|
-
if (legacy) {
|
|
101
|
-
// 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 (legacy.server && options.server === false) throw new Error(`--template ${base} conflicts with --no-server`);
|
|
104
|
-
options.template = legacy.template;
|
|
105
|
-
options.render = legacy.render;
|
|
106
|
-
options.server ??= legacy.server;
|
|
107
|
-
} else {
|
|
108
|
-
options.template = base;
|
|
109
|
-
}
|
|
98
|
+
options.template = base;
|
|
110
99
|
}
|
|
111
100
|
if (options.render !== undefined && !RENDERINGS[options.render]) {
|
|
112
101
|
throw new Error(`Unknown rendering "${options.render}". Choose one of: ${Object.keys(RENDERINGS).join(", ")}.`);
|
|
@@ -117,7 +106,7 @@ export function parseArgs(args) {
|
|
|
117
106
|
if (options.language !== undefined && !LANGUAGES[options.language]) {
|
|
118
107
|
throw new Error(`Unknown language "${options.language}". Choose ts or js.`);
|
|
119
108
|
}
|
|
120
|
-
if (options.render
|
|
109
|
+
if (SERVER_RENDERINGS.has(options.render) && options.server === false) throw new Error(`--render ${options.render} always has a server; drop --no-server`);
|
|
121
110
|
if (options.template && options.template !== "app") {
|
|
122
111
|
if (options.render !== undefined) throw new Error(`--render applies to the app template, not ${options.template}`);
|
|
123
112
|
if (options.server !== undefined) throw new Error(`--server applies to the app template, not ${options.template}`);
|
|
@@ -162,7 +151,7 @@ async function emptyDir(dir) {
|
|
|
162
151
|
* (default), `"remove"` its files first, or `"ignore"` and write beside them.
|
|
163
152
|
*/
|
|
164
153
|
export async function create({
|
|
165
|
-
directory = DEFAULT_DIRECTORY, template = "app", render = "
|
|
154
|
+
directory = DEFAULT_DIRECTORY, template = "app", render = "client", server = false, blog = false, styling = "css", language = "ts",
|
|
166
155
|
packageName, existing = "error", cwd: base = cwd(),
|
|
167
156
|
} = {}) {
|
|
168
157
|
const target = resolve(base, directory);
|
|
@@ -279,9 +268,11 @@ export async function main(args = argv.slice(2)) {
|
|
|
279
268
|
|
|
280
269
|
const template = options.template ?? (interactive ? await choose("Select a template:", TEMPLATES) : "app");
|
|
281
270
|
const isApp = template === "app";
|
|
282
|
-
const render = isApp
|
|
271
|
+
const render = isApp
|
|
272
|
+
? (options.render ?? (interactive ? await choose("How should pages render by default? (any folder can change it later with its own _config.js)", RENDERINGS) : "client"))
|
|
273
|
+
: undefined;
|
|
283
274
|
// Server-rendered pages need a server; the other renderings may add one.
|
|
284
|
-
const server = isApp && (render
|
|
275
|
+
const server = isApp && (SERVER_RENDERINGS.has(render) || (options.server ?? (interactive
|
|
285
276
|
? await ask(prompts.confirm({ message: `Add a server? (${SERVER_HINT})`, initialValue: false }))
|
|
286
277
|
: false)));
|
|
287
278
|
// 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.7.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.38.0",
|
|
32
|
+
"@opentf/afw-form": "1.34.0",
|
|
33
|
+
"@opentf/afw-test": "1.35.0",
|
|
34
|
+
"@opentf/vite-plugin-afw": "0.8.0",
|
|
30
35
|
"@tailwindcss/vite": "4.3.3",
|
|
31
36
|
"happy-dom": "21.0.4",
|
|
32
37
|
"tailwindcss": "4.3.3",
|