@opentf/create-afw 0.4.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.
Files changed (212) hide show
  1. package/README.md +4 -2
  2. package/esdev/templates/app/_gitignore +18 -0
  3. package/esdev/templates/app/_option/language/js/entry.js +4 -0
  4. package/esdev/templates/app/_option/language/js/index.html +13 -0
  5. package/esdev/templates/app/_option/language/js/jsconfig.json +6 -0
  6. package/esdev/templates/app/_option/language/js/tests/ui/Counter.test.js +10 -0
  7. package/esdev/templates/app/_option/language/ts/entry.ts +4 -0
  8. package/esdev/templates/app/_option/language/ts/index.html +13 -0
  9. package/esdev/templates/app/_option/language/ts/tests/ui/Counter.test.ts +10 -0
  10. package/esdev/templates/app/_option/language/ts/tsconfig.json +30 -0
  11. package/esdev/templates/app/_option/render/client+language/js/app/_config.js +6 -0
  12. package/esdev/templates/app/_option/render/client+language/ts/app/_config.ts +6 -0
  13. package/esdev/templates/app/_option/render/client+server/no/esdev.json +18 -0
  14. package/esdev/templates/app/_option/render/client+server/no+styling/css+language/js/README.md +14 -0
  15. package/esdev/templates/app/_option/render/client+server/no+styling/css+language/js/app/layout.jsx +13 -0
  16. package/esdev/templates/app/_option/render/client+server/no+styling/css+language/js/package.json +19 -0
  17. package/esdev/templates/app/_option/render/client+server/no+styling/css+language/ts/README.md +15 -0
  18. package/esdev/templates/app/_option/render/client+server/no+styling/css+language/ts/app/layout.tsx +13 -0
  19. package/esdev/templates/app/_option/render/client+server/no+styling/css+language/ts/package.json +21 -0
  20. package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/js/README.md +15 -0
  21. package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/js/app/layout.jsx +13 -0
  22. package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/js/package.json +20 -0
  23. package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/ts/README.md +16 -0
  24. package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/ts/app/layout.tsx +13 -0
  25. package/esdev/templates/app/_option/render/client+server/no+styling/tailwind+language/ts/package.json +22 -0
  26. package/esdev/templates/app/_option/render/client+server/yes/esdev.json +28 -0
  27. package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/js/README.md +15 -0
  28. package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/js/app/layout.jsx +14 -0
  29. package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/js/package.json +19 -0
  30. package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/ts/README.md +16 -0
  31. package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/ts/app/layout.tsx +14 -0
  32. package/esdev/templates/app/_option/render/client+server/yes+styling/css+language/ts/package.json +21 -0
  33. package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/js/README.md +16 -0
  34. package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/js/app/layout.jsx +14 -0
  35. package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/js/package.json +20 -0
  36. package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/ts/README.md +17 -0
  37. package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/ts/app/layout.tsx +14 -0
  38. package/esdev/templates/app/_option/render/client+server/yes+styling/tailwind+language/ts/package.json +22 -0
  39. package/esdev/templates/app/_option/render/mixed+language/js/app/_config.js +6 -0
  40. package/esdev/templates/app/_option/render/mixed+language/js/app/about/_config.js +4 -0
  41. package/esdev/templates/app/_option/render/mixed+language/js/app/dashboard/_config.js +5 -0
  42. package/esdev/templates/app/_option/render/mixed+language/js/app/dashboard/loader.js +4 -0
  43. package/esdev/templates/app/_option/render/mixed+language/ts/app/_config.ts +6 -0
  44. package/esdev/templates/app/_option/render/mixed+language/ts/app/about/_config.ts +4 -0
  45. package/esdev/templates/app/_option/render/mixed+language/ts/app/dashboard/_config.ts +5 -0
  46. package/esdev/templates/app/_option/render/mixed+language/ts/app/dashboard/loader.ts +4 -0
  47. package/esdev/templates/app/_option/render/mixed+server/yes/esdev.json +28 -0
  48. package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/js/README.md +15 -0
  49. package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/js/app/layout.jsx +15 -0
  50. package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/js/package.json +19 -0
  51. package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/ts/README.md +16 -0
  52. package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/ts/app/layout.tsx +15 -0
  53. package/esdev/templates/app/_option/render/mixed+server/yes+styling/css+language/ts/package.json +21 -0
  54. package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/js/README.md +16 -0
  55. package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/js/app/layout.jsx +15 -0
  56. package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/js/package.json +20 -0
  57. package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/ts/README.md +17 -0
  58. package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/ts/app/layout.tsx +15 -0
  59. package/esdev/templates/app/_option/render/mixed+server/yes+styling/tailwind+language/ts/package.json +22 -0
  60. package/esdev/templates/app/_option/render/mixed+styling/css+language/js/app/dashboard/page.jsx +13 -0
  61. package/esdev/templates/app/_option/render/mixed+styling/css+language/ts/app/dashboard/page.tsx +13 -0
  62. package/esdev/templates/app/_option/render/mixed+styling/tailwind+language/js/app/dashboard/page.jsx +13 -0
  63. package/esdev/templates/app/_option/render/mixed+styling/tailwind+language/ts/app/dashboard/page.tsx +13 -0
  64. package/esdev/templates/app/_option/render/server+language/js/app/_config.js +6 -0
  65. package/esdev/templates/app/_option/render/server+language/ts/app/_config.ts +6 -0
  66. package/esdev/templates/app/_option/render/server+server/yes/esdev.json +28 -0
  67. package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/js/README.md +15 -0
  68. package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/js/app/layout.jsx +14 -0
  69. package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/js/package.json +19 -0
  70. package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/ts/README.md +16 -0
  71. package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/ts/app/layout.tsx +14 -0
  72. package/esdev/templates/app/_option/render/server+server/yes+styling/css+language/ts/package.json +21 -0
  73. package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/js/README.md +16 -0
  74. package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/js/app/layout.jsx +14 -0
  75. package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/js/package.json +20 -0
  76. package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/ts/README.md +17 -0
  77. package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/ts/app/layout.tsx +14 -0
  78. package/esdev/templates/app/_option/render/server+server/yes+styling/tailwind+language/ts/package.json +22 -0
  79. package/esdev/templates/app/_option/render/static+language/js/app/_config.js +6 -0
  80. package/esdev/templates/app/_option/render/static+language/ts/app/_config.ts +6 -0
  81. package/esdev/templates/app/_option/render/static+server/no/esdev.json +32 -0
  82. package/esdev/templates/app/_option/render/static+server/no/ssg.js +131 -0
  83. package/esdev/templates/app/_option/render/static+server/no+styling/css+language/js/README.md +14 -0
  84. package/esdev/templates/app/_option/render/static+server/no+styling/css+language/js/app/layout.jsx +13 -0
  85. package/esdev/templates/app/_option/render/static+server/no+styling/css+language/js/package.json +20 -0
  86. package/esdev/templates/app/_option/render/static+server/no+styling/css+language/ts/README.md +15 -0
  87. package/esdev/templates/app/_option/render/static+server/no+styling/css+language/ts/app/layout.tsx +13 -0
  88. package/esdev/templates/app/_option/render/static+server/no+styling/css+language/ts/package.json +22 -0
  89. package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/js/README.md +15 -0
  90. package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/js/app/layout.jsx +13 -0
  91. package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/js/package.json +21 -0
  92. package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/ts/README.md +16 -0
  93. package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/ts/app/layout.tsx +13 -0
  94. package/esdev/templates/app/_option/render/static+server/no+styling/tailwind+language/ts/package.json +23 -0
  95. package/esdev/templates/app/_option/render/static+server/yes/esdev.json +28 -0
  96. package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/js/README.md +15 -0
  97. package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/js/app/layout.jsx +14 -0
  98. package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/js/package.json +19 -0
  99. package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/ts/README.md +16 -0
  100. package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/ts/app/layout.tsx +14 -0
  101. package/esdev/templates/app/_option/render/static+server/yes+styling/css+language/ts/package.json +21 -0
  102. package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/js/README.md +16 -0
  103. package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/js/app/layout.jsx +14 -0
  104. package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/js/package.json +20 -0
  105. package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/ts/README.md +17 -0
  106. package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/ts/app/layout.tsx +14 -0
  107. package/esdev/templates/app/_option/render/static+server/yes+styling/tailwind+language/ts/package.json +22 -0
  108. package/esdev/templates/app/_option/server/yes/server.js +52 -0
  109. package/esdev/templates/app/_option/server/yes+language/js/app/_middleware.js +9 -0
  110. package/esdev/templates/app/_option/server/yes+language/js/app/api/hello/route.js +4 -0
  111. package/esdev/templates/app/_option/server/yes+language/js/app/todos/loader.js +7 -0
  112. package/esdev/templates/app/_option/server/yes+language/js/app/todos/todos.server.js +15 -0
  113. package/esdev/templates/app/_option/server/yes+language/js/tests/server/api.test.js +8 -0
  114. package/esdev/templates/app/_option/server/yes+language/ts/app/_middleware.ts +9 -0
  115. package/esdev/templates/app/_option/server/yes+language/ts/app/api/hello/route.ts +4 -0
  116. package/esdev/templates/app/_option/server/yes+language/ts/app/todos/loader.ts +7 -0
  117. package/esdev/templates/app/_option/server/yes+language/ts/app/todos/todos.server.ts +15 -0
  118. package/esdev/templates/app/_option/server/yes+language/ts/tests/server/api.test.ts +8 -0
  119. package/esdev/templates/app/_option/server/yes+styling/css+language/js/app/todos/page.jsx +29 -0
  120. package/esdev/templates/app/_option/server/yes+styling/css+language/ts/app/todos/page.tsx +29 -0
  121. package/esdev/templates/app/_option/server/yes+styling/tailwind+language/js/app/todos/page.jsx +29 -0
  122. package/esdev/templates/app/_option/server/yes+styling/tailwind+language/ts/app/todos/page.tsx +29 -0
  123. package/esdev/templates/app/_option/styling/css/app/global.css +16 -0
  124. package/esdev/templates/app/_option/styling/css+language/js/app/Counter.jsx +10 -0
  125. package/esdev/templates/app/_option/styling/css+language/js/app/page.jsx +13 -0
  126. package/esdev/templates/app/_option/styling/css+language/ts/app/Counter.tsx +10 -0
  127. package/esdev/templates/app/_option/styling/css+language/ts/app/page.tsx +13 -0
  128. package/esdev/templates/app/_option/styling/tailwind/app/global.css +7 -0
  129. package/esdev/templates/app/_option/styling/tailwind+language/js/app/Counter.jsx +10 -0
  130. package/esdev/templates/app/_option/styling/tailwind+language/js/app/page.jsx +13 -0
  131. package/esdev/templates/app/_option/styling/tailwind+language/ts/app/Counter.tsx +10 -0
  132. package/esdev/templates/app/_option/styling/tailwind+language/ts/app/page.tsx +13 -0
  133. package/esdev/templates/app/app/about/page.md +7 -0
  134. package/esdev/templates/app/template.json +96 -0
  135. package/esdev/templates/catalog.json +15 -0
  136. package/esdev/templates/docs/_gitignore +18 -0
  137. package/esdev/templates/docs/_option/blog/no/afw.config.js +13 -0
  138. package/esdev/templates/docs/_option/blog/no+language/js/README.md +14 -0
  139. package/esdev/templates/docs/_option/blog/no+language/js/app/page.jsx +15 -0
  140. package/esdev/templates/docs/_option/blog/no+language/js/tests/ui/Home.test.js +9 -0
  141. package/esdev/templates/docs/_option/blog/no+language/ts/README.md +15 -0
  142. package/esdev/templates/docs/_option/blog/no+language/ts/app/page.tsx +15 -0
  143. package/esdev/templates/docs/_option/blog/no+language/ts/tests/ui/Home.test.ts +9 -0
  144. package/esdev/templates/docs/_option/blog/yes/afw.config.js +15 -0
  145. package/esdev/templates/docs/_option/blog/yes/app/blog/hello-world/page.mdx +10 -0
  146. package/esdev/templates/docs/_option/blog/yes+language/js/README.md +14 -0
  147. package/esdev/templates/docs/_option/blog/yes+language/js/app/blog/layout.jsx +7 -0
  148. package/esdev/templates/docs/_option/blog/yes+language/js/app/blog/page.jsx +13 -0
  149. package/esdev/templates/docs/_option/blog/yes+language/js/app/page.jsx +15 -0
  150. package/esdev/templates/docs/_option/blog/yes+language/js/tests/ui/Home.test.js +10 -0
  151. package/esdev/templates/docs/_option/blog/yes+language/ts/README.md +15 -0
  152. package/esdev/templates/docs/_option/blog/yes+language/ts/app/blog/layout.tsx +7 -0
  153. package/esdev/templates/docs/_option/blog/yes+language/ts/app/blog/page.tsx +13 -0
  154. package/esdev/templates/docs/_option/blog/yes+language/ts/app/page.tsx +15 -0
  155. package/esdev/templates/docs/_option/blog/yes+language/ts/tests/ui/Home.test.ts +10 -0
  156. package/esdev/templates/docs/_option/language/js/app/_config.js +4 -0
  157. package/esdev/templates/docs/_option/language/js/app/docs/layout.jsx +6 -0
  158. package/esdev/templates/docs/_option/language/js/app/layout.jsx +3 -0
  159. package/esdev/templates/docs/_option/language/js/entry.js +6 -0
  160. package/esdev/templates/docs/_option/language/js/index.html +12 -0
  161. package/esdev/templates/docs/_option/language/js/jsconfig.json +6 -0
  162. package/esdev/templates/docs/_option/language/js/package.json +21 -0
  163. package/esdev/templates/docs/_option/language/ts/app/_config.ts +4 -0
  164. package/esdev/templates/docs/_option/language/ts/app/docs/layout.tsx +6 -0
  165. package/esdev/templates/docs/_option/language/ts/app/layout.tsx +3 -0
  166. package/esdev/templates/docs/_option/language/ts/entry.ts +6 -0
  167. package/esdev/templates/docs/_option/language/ts/index.html +12 -0
  168. package/esdev/templates/docs/_option/language/ts/package.json +23 -0
  169. package/esdev/templates/docs/_option/language/ts/tsconfig.json +32 -0
  170. package/esdev/templates/docs/app/docs/_meta.js +5 -0
  171. package/esdev/templates/docs/app/docs/getting-started/page.mdx +11 -0
  172. package/esdev/templates/docs/app/docs/guides/writing-pages/page.mdx +20 -0
  173. package/esdev/templates/docs/app/docs/page.mdx +14 -0
  174. package/esdev/templates/docs/app/global.css +1 -0
  175. package/esdev/templates/docs/esdev.json +39 -0
  176. package/esdev/templates/docs/ssg.js +131 -0
  177. package/esdev/templates/docs/template.json +43 -0
  178. package/esdev/templates/library/_gitignore +18 -0
  179. package/esdev/templates/library/_option/language/js/entry.js +4 -0
  180. package/esdev/templates/library/_option/language/js/index.html +13 -0
  181. package/esdev/templates/library/_option/language/js/index.js +2 -0
  182. package/esdev/templates/library/_option/language/js/jsconfig.json +6 -0
  183. package/esdev/templates/library/_option/language/js/tests/ui/Counter.test.js +10 -0
  184. package/esdev/templates/library/_option/language/ts/entry.ts +4 -0
  185. package/esdev/templates/library/_option/language/ts/index.html +13 -0
  186. package/esdev/templates/library/_option/language/ts/index.ts +2 -0
  187. package/esdev/templates/library/_option/language/ts/tests/ui/Counter.test.ts +10 -0
  188. package/esdev/templates/library/_option/language/ts/tsconfig.json +32 -0
  189. package/esdev/templates/library/_option/styling/css/app/global.css +16 -0
  190. package/esdev/templates/library/_option/styling/css+language/js/README.md +12 -0
  191. package/esdev/templates/library/_option/styling/css+language/js/app/page.jsx +10 -0
  192. package/esdev/templates/library/_option/styling/css+language/js/package.json +26 -0
  193. package/esdev/templates/library/_option/styling/css+language/js/src/Counter.jsx +10 -0
  194. package/esdev/templates/library/_option/styling/css+language/ts/README.md +13 -0
  195. package/esdev/templates/library/_option/styling/css+language/ts/app/page.tsx +10 -0
  196. package/esdev/templates/library/_option/styling/css+language/ts/package.json +28 -0
  197. package/esdev/templates/library/_option/styling/css+language/ts/src/Counter.tsx +10 -0
  198. package/esdev/templates/library/_option/styling/tailwind/app/global.css +7 -0
  199. package/esdev/templates/library/_option/styling/tailwind+language/js/README.md +13 -0
  200. package/esdev/templates/library/_option/styling/tailwind+language/js/app/page.jsx +10 -0
  201. package/esdev/templates/library/_option/styling/tailwind+language/js/package.json +27 -0
  202. package/esdev/templates/library/_option/styling/tailwind+language/js/src/Counter.jsx +10 -0
  203. package/esdev/templates/library/_option/styling/tailwind+language/ts/README.md +14 -0
  204. package/esdev/templates/library/_option/styling/tailwind+language/ts/app/page.tsx +10 -0
  205. package/esdev/templates/library/_option/styling/tailwind+language/ts/package.json +29 -0
  206. package/esdev/templates/library/_option/styling/tailwind+language/ts/src/Counter.tsx +10 -0
  207. package/esdev/templates/library/esdev.json +18 -0
  208. package/esdev/templates/library/template.json +44 -0
  209. package/index.js +28 -13
  210. package/package.json +14 -9
  211. package/templates.js +300 -101
  212. package/versions.json +4 -4
@@ -0,0 +1,15 @@
1
+ import { Link } from "@opentf/afw";
2
+
3
+ export const metadata = { title: "{{name}}", description: "Documentation." };
4
+
5
+ export default function Home() {
6
+ return (
7
+ <main class="afwd-prose">
8
+ <h1>{{name}}</h1>
9
+ <p>Documentation, written in MDX.</p>
10
+ <p>
11
+ <Link href="/docs">Read the docs</Link>
12
+ </p>
13
+ </main>
14
+ );
15
+ }
@@ -0,0 +1,9 @@
1
+ import { expect, test } from "@opentf/afw-test/test";
2
+ import { render } from "@opentf/afw-test";
3
+ import Home from "../../app/page.tsx";
4
+
5
+ test("the home page links to the docs", () => {
6
+ const { getByRole } = render(Home);
7
+ expect(getByRole("heading", { level: 1 }).textContent).toBe("{{name}}");
8
+ expect(getByRole("link", { name: "Read the docs" }).getAttribute("href")).toBe("/docs");
9
+ });
@@ -0,0 +1,15 @@
1
+ import { defineDocsConfig } from "@opentf/afw-docs/config";
2
+
3
+ export default defineDocsConfig({
4
+ // Your site's URL: canonical links, sitemap.xml, feeds and llms.txt use it.
5
+ site: { url: "https://example.com" },
6
+ docs: {
7
+ title: "{{name}}",
8
+ nav: [
9
+ { label: "Docs", href: "/docs" },
10
+ { label: "Blog", href: "/blog" },
11
+ ],
12
+ search: { provider: "afw" },
13
+ },
14
+ blog: { dir: "blog", title: "{{name}} Blog" },
15
+ });
@@ -0,0 +1,10 @@
1
+ ---
2
+ title: Hello, world
3
+ description: The first post.
4
+ date: 2026-01-01
5
+ author: {{name}}
6
+ ---
7
+
8
+ # Hello, world
9
+
10
+ Posts live in `app/blog/`; each one appears in the post list and the RSS and Atom feeds.
@@ -0,0 +1,14 @@
1
+ # {{name}}
2
+
3
+ A documentation site and blog built with [AFW](https://afw.opentechf.org) and `@opentf/afw-docs` on esdev and 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 preview` | Preview the production build |
10
+ | `{{pm}} run test` | Run the tests with esdev |
11
+
12
+ - Docs pages live in `app/docs/`, posts in `app/blog/`; `app/docs/_meta.js` orders the sidebar.
13
+ - `{{pm}} run build` prerenders every page and writes the search index, `sitemap.xml`, RSS and Atom feeds and `llms.txt`.
14
+ - Set your site's URL in `afw.config.js`.
@@ -0,0 +1,7 @@
1
+ import { BlogLayout } from "@opentf/afw-docs";
2
+ import { posts } from "@opentf/afw-docs/posts";
3
+ import config from "../../afw.config.js";
4
+
5
+ export default function Blog({ children }) {
6
+ return <BlogLayout config={config.docs} posts={posts} siteUrl={config.site.url}>{children}</BlogLayout>;
7
+ }
@@ -0,0 +1,13 @@
1
+ import { PostList } from "@opentf/afw-docs";
2
+ import { posts } from "@opentf/afw-docs/posts";
3
+
4
+ export const metadata = { title: "Blog" };
5
+
6
+ export default function BlogIndex() {
7
+ return (
8
+ <section>
9
+ <h1>Blog</h1>
10
+ <PostList posts={posts} />
11
+ </section>
12
+ );
13
+ }
@@ -0,0 +1,15 @@
1
+ import { Link } from "@opentf/afw";
2
+
3
+ export const metadata = { title: "{{name}}", description: "Documentation and blog." };
4
+
5
+ export default function Home() {
6
+ return (
7
+ <main class="afwd-prose">
8
+ <h1>{{name}}</h1>
9
+ <p>Documentation and a blog, written in MDX.</p>
10
+ <p>
11
+ <Link href="/docs">Read the docs</Link> · <Link href="/blog">Visit the blog</Link>
12
+ </p>
13
+ </main>
14
+ );
15
+ }
@@ -0,0 +1,10 @@
1
+ import { expect, test } from "@opentf/afw-test/test";
2
+ import { render } from "@opentf/afw-test";
3
+ import Home from "../../app/page.jsx";
4
+
5
+ test("the home page links to the docs and the blog", () => {
6
+ const { getByRole } = render(Home);
7
+ expect(getByRole("heading", { level: 1 }).textContent).toBe("{{name}}");
8
+ expect(getByRole("link", { name: "Read the docs" }).getAttribute("href")).toBe("/docs");
9
+ expect(getByRole("link", { name: "Visit the blog" }).getAttribute("href")).toBe("/blog");
10
+ });
@@ -0,0 +1,15 @@
1
+ # {{name}}
2
+
3
+ A documentation site and blog built with [AFW](https://afw.opentechf.org) and `@opentf/afw-docs` on esdev and 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 preview` | Preview the production build |
10
+ | `{{pm}} run test` | Run the tests with esdev |
11
+ | `{{pm}} run typecheck` | Check types |
12
+
13
+ - Docs pages live in `app/docs/`, posts in `app/blog/`; `app/docs/_meta.js` orders the sidebar.
14
+ - `{{pm}} run build` prerenders every page and writes the search index, `sitemap.xml`, RSS and Atom feeds and `llms.txt`.
15
+ - Set your site's URL in `afw.config.js`.
@@ -0,0 +1,7 @@
1
+ import { BlogLayout } from "@opentf/afw-docs";
2
+ import { posts } from "@opentf/afw-docs/posts";
3
+ import config from "../../afw.config.js";
4
+
5
+ export default function Blog({ children }: { children: unknown }) {
6
+ return <BlogLayout config={config.docs} posts={posts} siteUrl={config.site.url}>{children}</BlogLayout>;
7
+ }
@@ -0,0 +1,13 @@
1
+ import { PostList } from "@opentf/afw-docs";
2
+ import { posts } from "@opentf/afw-docs/posts";
3
+
4
+ export const metadata = { title: "Blog" };
5
+
6
+ export default function BlogIndex() {
7
+ return (
8
+ <section>
9
+ <h1>Blog</h1>
10
+ <PostList posts={posts} />
11
+ </section>
12
+ );
13
+ }
@@ -0,0 +1,15 @@
1
+ import { Link } from "@opentf/afw";
2
+
3
+ export const metadata = { title: "{{name}}", description: "Documentation and blog." };
4
+
5
+ export default function Home() {
6
+ return (
7
+ <main class="afwd-prose">
8
+ <h1>{{name}}</h1>
9
+ <p>Documentation and a blog, written in MDX.</p>
10
+ <p>
11
+ <Link href="/docs">Read the docs</Link> · <Link href="/blog">Visit the blog</Link>
12
+ </p>
13
+ </main>
14
+ );
15
+ }
@@ -0,0 +1,10 @@
1
+ import { expect, test } from "@opentf/afw-test/test";
2
+ import { render } from "@opentf/afw-test";
3
+ import Home from "../../app/page.tsx";
4
+
5
+ test("the home page links to the docs and the blog", () => {
6
+ const { getByRole } = render(Home);
7
+ expect(getByRole("heading", { level: 1 }).textContent).toBe("{{name}}");
8
+ expect(getByRole("link", { name: "Read the docs" }).getAttribute("href")).toBe("/docs");
9
+ expect(getByRole("link", { name: "Visit the blog" }).getAttribute("href")).toBe("/blog");
10
+ });
@@ -0,0 +1,4 @@
1
+ import { defineRoute } from "@opentf/afw";
2
+
3
+ // The site is prerendered: every page is built once, at build time.
4
+ export default defineRoute({ render: "static" });
@@ -0,0 +1,6 @@
1
+ import { DocsLayout } from "@opentf/afw-docs";
2
+ import config from "../../afw.config.js";
3
+
4
+ export default function Docs({ children }) {
5
+ return <DocsLayout config={config.docs} siteUrl={config.site.url}>{children}</DocsLayout>;
6
+ }
@@ -0,0 +1,3 @@
1
+ export default function Root({ children }) {
2
+ return <div>{children}</div>;
3
+ }
@@ -0,0 +1,6 @@
1
+ import { mountApp } from "@opentf/afw";
2
+ import { guard, loaderRoutes, pages } from "@afw/routes";
3
+
4
+ import "./app/global.css";
5
+
6
+ mountApp({ pages, guard, loaders: loaderRoutes, target: document.getElementById("app") });
@@ -0,0 +1,12 @@
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
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="./entry.js"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,6 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "preserve",
4
+ "jsxImportSource": "@opentf/afw"
5
+ }
6
+ }
@@ -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",
9
+ "test": "esdev test --dom --setup=@opentf/afw-test/setup tests/ui"
10
+ },
11
+ "dependencies": {
12
+ "@opentf/afw": "{{registry:@opentf/afw}}",
13
+ "@opentf/afw-docs": "{{registry:@opentf/afw-docs}}"
14
+ },
15
+ "devDependencies": {
16
+ "@opentf/afw-cli": "{{registry:@opentf/afw-cli}}",
17
+ "@opentf/afw-test": "{{registry:@opentf/afw-test}}",
18
+ "@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
19
+ "@opentf/esrun-types": "{{registry:@opentf/esrun-types}}"
20
+ }
21
+ }
@@ -0,0 +1,4 @@
1
+ import { defineRoute } from "@opentf/afw";
2
+
3
+ // The site is prerendered: every page is built once, at build time.
4
+ export default defineRoute({ render: "static" });
@@ -0,0 +1,6 @@
1
+ import { DocsLayout } from "@opentf/afw-docs";
2
+ import config from "../../afw.config.js";
3
+
4
+ export default function Docs({ children }: { children: unknown }) {
5
+ return <DocsLayout config={config.docs} siteUrl={config.site.url}>{children}</DocsLayout>;
6
+ }
@@ -0,0 +1,3 @@
1
+ export default function Root({ children }: { children: unknown }) {
2
+ return <div>{children}</div>;
3
+ }
@@ -0,0 +1,6 @@
1
+ import { mountApp } from "@opentf/afw";
2
+ import { guard, loaderRoutes, pages } from "@afw/routes";
3
+
4
+ import "./app/global.css";
5
+
6
+ mountApp({ pages, guard, loaders: loaderRoutes, target: document.getElementById("app")! });
@@ -0,0 +1,12 @@
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
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="./entry.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "esdev start",
7
+ "build": "esdev build",
8
+ "preview": "esdev preview",
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
+ "@opentf/afw-docs": "{{registry:@opentf/afw-docs}}"
15
+ },
16
+ "devDependencies": {
17
+ "@opentf/afw-cli": "{{registry:@opentf/afw-cli}}",
18
+ "@opentf/afw-test": "{{registry:@opentf/afw-test}}",
19
+ "@opentf/esdev-plugin-afw": "{{registry:@opentf/esdev-plugin-afw}}",
20
+ "@opentf/esrun-types": "{{registry:@opentf/esrun-types}}",
21
+ "typescript": "{{registry:typescript}}"
22
+ }
23
+ }
@@ -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
+ "allowJs": true
25
+ },
26
+ "include": [
27
+ "app",
28
+ "tests",
29
+ "entry.ts",
30
+ "afw.config.js"
31
+ ]
32
+ }
@@ -0,0 +1,5 @@
1
+ // Sidebar order and labels. Folders not listed here follow, alphabetically.
2
+ export default {
3
+ "getting-started": "Getting Started",
4
+ guides: "Guides",
5
+ };
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Getting Started
3
+ description: Install and run the project.
4
+ ---
5
+
6
+ # Getting Started
7
+
8
+ ```bash
9
+ {{pm}} install
10
+ {{pm}} run dev
11
+ ```
@@ -0,0 +1,20 @@
1
+ ---
2
+ title: Writing Pages
3
+ description: MDX pages, components and code blocks.
4
+ ---
5
+
6
+ import { Steps } from "@opentf/afw-docs";
7
+
8
+ # Writing Pages
9
+
10
+ <Steps>
11
+
12
+ ### Add a folder
13
+
14
+ Create `app/docs/my-topic/page.mdx`.
15
+
16
+ ### Write MDX
17
+
18
+ Markdown with components, like this list of steps.
19
+
20
+ </Steps>
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Introduction
3
+ description: What this project is and where to start.
4
+ ---
5
+
6
+ import { Callout } from "@opentf/afw-docs";
7
+
8
+ # Introduction
9
+
10
+ Welcome to the {{name}} docs.
11
+
12
+ <Callout type="tip">
13
+ Every folder under `app/docs/` with a `page.mdx` becomes a page in the sidebar.
14
+ </Callout>
@@ -0,0 +1 @@
1
+ @import "@opentf/afw-docs/theme";
@@ -0,0 +1,39 @@
1
+ {
2
+ "plugins": [
3
+ {
4
+ "module": "@opentf/esdev-plugin-afw",
5
+ "options": {
6
+ "appDir": "app"
7
+ }
8
+ },
9
+ {
10
+ "module": "@opentf/afw-docs/build",
11
+ "export": "afwDocsPlugin",
12
+ "options": {
13
+ "appDir": "app"
14
+ }
15
+ },
16
+ {
17
+ "module": "@opentf/afw-cli/ssg",
18
+ "export": "siteOutputPlugin",
19
+ "options": {
20
+ "root": ".",
21
+ "target": "web",
22
+ "prerenderTarget": "site-ssg"
23
+ }
24
+ }
25
+ ],
26
+ "build": {
27
+ "targets": {
28
+ "web": {
29
+ "entry": "index.html",
30
+ "outdir": "dist"
31
+ },
32
+ "site-ssg": {
33
+ "entry": "ssg.js",
34
+ "out": ".ssg/ssg.js",
35
+ "then": "run"
36
+ }
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,131 @@
1
+ // Release prerender step for `esdev build` (the `site-ssg` target, `"then": "run"`).
2
+ //
3
+ // Runs after every target is built. Its outputs land in the staged site; the
4
+ // `siteOutputPlugin` in esdev.json then indexes the prerendered HTML and
5
+ // generates feeds and LLM files. Development never runs here: without a
6
+ // staging area the step skips (the dev loop serves the live CSR shell).
7
+ import { env, exit } from "runtime:process";
8
+ import { basename, dirname, fromFileURL, join, toFileURL } from "runtime:path";
9
+
10
+ const t0 = performance.now();
11
+
12
+ // Anchor on this bundle's own path: under a full `esdev build` it is the
13
+ // staged copy (`<root>/.esdev-build-*/…`), otherwise the final output.
14
+ const bundlePath = fromFileURL(import.meta.url).replace(/\\/g, "/");
15
+ const bundleDir = dirname(bundlePath);
16
+ let stagingRoot = null;
17
+ for (let dir = bundleDir; ; ) {
18
+ if (basename(dir).startsWith(".esdev-build-")) {
19
+ stagingRoot = dir;
20
+ break;
21
+ }
22
+ const up = dirname(dir);
23
+ if (up === dir) break;
24
+ dir = up;
25
+ }
26
+ if (!stagingRoot) {
27
+ console.log("ssg: no staging area — prerender runs on a release `esdev build`, skipping.");
28
+ exit(0);
29
+ }
30
+ // Keep package-relative binary paths intact: load installed tooling at runtime.
31
+ const ssgModule = ["@opentf", "afw-cli", "ssg"].join("/");
32
+ const {
33
+ assertNoRouteConflicts,
34
+ closeCompilers,
35
+ discoverPages,
36
+ exists,
37
+ fmtMs,
38
+ loadConfig,
39
+ loadDocsPlugins,
40
+ readText,
41
+ resolveCompiler,
42
+ resolveFrom,
43
+ runPrerender,
44
+ stampHydrateSentinel,
45
+ step,
46
+ writePrerenderReport,
47
+ } = await import(ssgModule);
48
+ const { realPath } = await import("runtime:fs");
49
+
50
+ const root = dirname(stagingRoot);
51
+ const outName = "dist";
52
+ const appDir = join(root, "app");
53
+ const stagedOut = join(stagingRoot, outName);
54
+ if (!(await exists(appDir))) {
55
+ console.error(`✗ ssg: cannot anchor sources (bundle at ${bundleDir})`);
56
+ exit(1);
57
+ }
58
+
59
+ const shellPath = join(stagedOut, "index.html");
60
+ if (!(await exists(shellPath))) {
61
+ console.error(
62
+ `✗ ssg: no staged site at ${shellPath}\n` +
63
+ ` Build the site target first (a full \`esdev build\` builds every target).`,
64
+ );
65
+ exit(1);
66
+ }
67
+
68
+ const exclude = new Set((env.EXCLUDE_ROUTES ?? "").split(",").filter(Boolean));
69
+ const config = await loadConfig(root);
70
+ const baseUrl = String(config?.site?.url ?? "").replace(/\/+$/, "");
71
+ if (!baseUrl && (config?.docs || config?.blog)) {
72
+ console.error(
73
+ `✗ site.url is required for this production build.\n` +
74
+ ` Add it to afw.config.js:\n\n` +
75
+ ` export default defineDocsConfig({\n` +
76
+ ` site: { url: "https://example.com" }\n` +
77
+ ` })`,
78
+ );
79
+ exit(1);
80
+ }
81
+
82
+ const pages = await discoverPages(appDir, exclude);
83
+ if (pages.length === 0) {
84
+ console.error(`✗ no page.jsx files found under ${appDir}`);
85
+ exit(1);
86
+ }
87
+ await assertNoRouteConflicts(appDir, exclude);
88
+
89
+ const docsPlugins = await loadDocsPlugins(root, appDir, config, exclude);
90
+
91
+ // The site target composed this shell (bundle + stylesheet already injected);
92
+ // stamp the `#app` sentinel so the client adopts the server markup.
93
+ const shellHtml = stampHydrateSentinel(await readText(shellPath));
94
+
95
+ // Use the same canonical package path as the bundler's package resolver; pnpm
96
+ // symlink paths otherwise create separate router instances in the server bundle.
97
+ const afwEntry = await resolveFrom("@opentf/afw", root).then(realPath).catch(() => {
98
+ console.error(`✗ cannot resolve "@opentf/afw" from ${root}`);
99
+ exit(1);
100
+ });
101
+ const { afwc } = await resolveCompiler();
102
+
103
+ const ssgStep = step("Pre-rendering pages");
104
+ let ssgCompiled = 0;
105
+ const ssg = await runPrerender({
106
+ root,
107
+ pages,
108
+ afwEntry,
109
+ afwc,
110
+ shellHtml,
111
+ outDir: stagedOut,
112
+ baseUrl,
113
+ docsPlugins,
114
+ chunkManifest: null,
115
+ onCompile: (id) => ssgStep.update(`compiling ${id.split("/").pop()} (${++ssgCompiled})`),
116
+ onRender: (done, total) => ssgStep.update(`rendering ${done}/${total}`),
117
+ });
118
+ if (!ssg.count || ssg.failed.length) {
119
+ await closeCompilers();
120
+ throw new Error(`Site prerender failed: ${ssg.count} page(s) rendered, ${ssg.failed.length} failed`);
121
+ }
122
+ ssgStep.done(`Pre-rendered ${ssg.count} page(s)`);
123
+
124
+ // The finish plugin consumes this handoff and generates search, feeds and LLM files.
125
+ await writePrerenderReport(stagedOut, ssg);
126
+
127
+ // Stop the `afwc serve` children: an open reader on a child's stdout keeps the
128
+ // runtime alive, so this is what lets a finished build actually exit.
129
+ await closeCompilers();
130
+
131
+ console.log(`\n → ${outName}/ prerendered in ${fmtMs(performance.now() - t0)}\n`);
@@ -0,0 +1,43 @@
1
+ {
2
+ "label": "Docs",
3
+ "description": "A documentation site with search, and optionally a blog (afw-docs)",
4
+ "group": "AFW",
5
+ "options": [
6
+ {
7
+ "name": "blog",
8
+ "question": "Add a blog? (posts with RSS and Atom feeds)",
9
+ "kind": "confirm",
10
+ "default": "no",
11
+ "choices": [
12
+ {
13
+ "value": "yes",
14
+ "label": "Yes",
15
+ "description": "Posts with RSS and Atom feeds"
16
+ },
17
+ {
18
+ "value": "no",
19
+ "label": "No",
20
+ "description": "Docs only"
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "name": "language",
26
+ "question": "Select a language:",
27
+ "kind": "choice",
28
+ "default": "ts",
29
+ "choices": [
30
+ {
31
+ "value": "ts",
32
+ "label": "TypeScript",
33
+ "description": "TypeScript: .tsx sources and a tsconfig.json"
34
+ },
35
+ {
36
+ "value": "js",
37
+ "label": "JavaScript",
38
+ "description": "JavaScript: .jsx sources"
39
+ }
40
+ ]
41
+ }
42
+ ]
43
+ }
@@ -0,0 +1,18 @@
1
+ # dependencies
2
+ node_modules/
3
+
4
+ # build output
5
+ dist/
6
+
7
+ # toolchain working dirs (dev server + temp build dirs)
8
+ .dev
9
+ .esdev-build-*
10
+ .ssg/
11
+
12
+ # environment files
13
+ .env
14
+ .env.local
15
+ *.local
16
+
17
+ # OS files
18
+ .DS_Store
@@ -0,0 +1,4 @@
1
+ import { mountApp } from "@opentf/afw";
2
+ import { guard, loaderRoutes, pages } from "@afw/routes";
3
+
4
+ mountApp({ pages, guard, loaders: loaderRoutes, target: document.getElementById("app") });