@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.
Files changed (212) hide show
  1. package/README.md +5 -8
  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 +28 -0
  11. package/esdev/templates/app/_option/render/client/_option/language/js/app/_config.js +6 -0
  12. package/esdev/templates/app/_option/render/client/_option/language/ts/app/_config.ts +6 -0
  13. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/js/README.md +14 -0
  14. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/js/app/layout.jsx +13 -0
  15. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/js/package.json +19 -0
  16. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/ts/README.md +15 -0
  17. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/ts/app/layout.tsx +13 -0
  18. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/css/_option/language/ts/package.json +21 -0
  19. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/js/README.md +15 -0
  20. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/js/app/layout.jsx +13 -0
  21. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/js/package.json +20 -0
  22. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/ts/README.md +16 -0
  23. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/ts/app/layout.tsx +13 -0
  24. package/esdev/templates/app/_option/render/client/_option/server/no/_option/styling/tailwind/_option/language/ts/package.json +22 -0
  25. package/esdev/templates/app/_option/render/client/_option/server/no/esdev.json +18 -0
  26. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/js/README.md +15 -0
  27. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/js/app/layout.jsx +14 -0
  28. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/js/package.json +19 -0
  29. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/ts/README.md +16 -0
  30. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/ts/app/layout.tsx +14 -0
  31. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/ts/package.json +21 -0
  32. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +16 -0
  33. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/js/app/layout.jsx +14 -0
  34. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/js/package.json +20 -0
  35. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +17 -0
  36. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/layout.tsx +14 -0
  37. package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/ts/package.json +22 -0
  38. package/esdev/templates/app/_option/render/client/_option/server/yes/esdev.json +28 -0
  39. package/esdev/templates/app/_option/render/mixed/_option/language/js/app/_config.js +6 -0
  40. package/esdev/templates/app/_option/render/mixed/_option/language/js/app/about/_config.js +4 -0
  41. package/esdev/templates/app/_option/render/mixed/_option/language/js/app/dashboard/_config.js +5 -0
  42. package/esdev/templates/app/_option/render/mixed/_option/language/js/app/dashboard/loader.js +4 -0
  43. package/esdev/templates/app/_option/render/mixed/_option/language/ts/app/_config.ts +6 -0
  44. package/esdev/templates/app/_option/render/mixed/_option/language/ts/app/about/_config.ts +4 -0
  45. package/esdev/templates/app/_option/render/mixed/_option/language/ts/app/dashboard/_config.ts +5 -0
  46. package/esdev/templates/app/_option/render/mixed/_option/language/ts/app/dashboard/loader.ts +4 -0
  47. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/js/README.md +15 -0
  48. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/js/app/layout.jsx +15 -0
  49. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/js/package.json +19 -0
  50. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/ts/README.md +16 -0
  51. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/ts/app/layout.tsx +15 -0
  52. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/ts/package.json +21 -0
  53. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +16 -0
  54. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/js/app/layout.jsx +15 -0
  55. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/js/package.json +20 -0
  56. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +17 -0
  57. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/layout.tsx +15 -0
  58. package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/ts/package.json +22 -0
  59. package/esdev/templates/app/_option/render/mixed/_option/server/yes/esdev.json +28 -0
  60. package/esdev/templates/app/_option/render/mixed/_option/styling/css/_option/language/js/app/dashboard/page.jsx +13 -0
  61. package/esdev/templates/app/_option/render/mixed/_option/styling/css/_option/language/ts/app/dashboard/page.tsx +13 -0
  62. package/esdev/templates/app/_option/render/mixed/_option/styling/tailwind/_option/language/js/app/dashboard/page.jsx +13 -0
  63. package/esdev/templates/app/_option/render/mixed/_option/styling/tailwind/_option/language/ts/app/dashboard/page.tsx +13 -0
  64. package/esdev/templates/app/_option/render/server/_option/language/js/app/_config.js +6 -0
  65. package/esdev/templates/app/_option/render/server/_option/language/ts/app/_config.ts +6 -0
  66. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/js/README.md +15 -0
  67. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/js/app/layout.jsx +14 -0
  68. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/js/package.json +19 -0
  69. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/ts/README.md +16 -0
  70. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/ts/app/layout.tsx +14 -0
  71. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/ts/package.json +21 -0
  72. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +16 -0
  73. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/js/app/layout.jsx +14 -0
  74. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/js/package.json +20 -0
  75. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +17 -0
  76. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/layout.tsx +14 -0
  77. package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/ts/package.json +22 -0
  78. package/esdev/templates/app/_option/render/server/_option/server/yes/esdev.json +28 -0
  79. package/esdev/templates/app/_option/render/static/_option/language/js/app/_config.js +6 -0
  80. package/esdev/templates/app/_option/render/static/_option/language/ts/app/_config.ts +6 -0
  81. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/js/README.md +14 -0
  82. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/js/app/layout.jsx +13 -0
  83. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/js/package.json +20 -0
  84. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/ts/README.md +15 -0
  85. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/ts/app/layout.tsx +13 -0
  86. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/css/_option/language/ts/package.json +22 -0
  87. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/js/README.md +15 -0
  88. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/js/app/layout.jsx +13 -0
  89. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/js/package.json +21 -0
  90. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/ts/README.md +16 -0
  91. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/ts/app/layout.tsx +13 -0
  92. package/esdev/templates/app/_option/render/static/_option/server/no/_option/styling/tailwind/_option/language/ts/package.json +23 -0
  93. package/esdev/templates/app/_option/render/static/_option/server/no/esdev.json +32 -0
  94. package/esdev/templates/app/_option/render/static/_option/server/no/ssg.js +131 -0
  95. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/js/README.md +15 -0
  96. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/js/app/layout.jsx +14 -0
  97. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/js/package.json +19 -0
  98. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/ts/README.md +16 -0
  99. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/ts/app/layout.tsx +14 -0
  100. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/ts/package.json +21 -0
  101. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +16 -0
  102. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/js/app/layout.jsx +14 -0
  103. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/js/package.json +20 -0
  104. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +17 -0
  105. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/layout.tsx +14 -0
  106. package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/ts/package.json +22 -0
  107. package/esdev/templates/app/_option/render/static/_option/server/yes/esdev.json +28 -0
  108. package/esdev/templates/app/_option/server/yes/_option/language/js/app/_middleware.js +9 -0
  109. package/esdev/templates/app/_option/server/yes/_option/language/js/app/api/hello/route.js +4 -0
  110. package/esdev/templates/app/_option/server/yes/_option/language/js/app/todos/loader.js +7 -0
  111. package/esdev/templates/app/_option/server/yes/_option/language/js/app/todos/todos.server.js +15 -0
  112. package/esdev/templates/app/_option/server/yes/_option/language/js/tests/server/api.test.js +8 -0
  113. package/esdev/templates/app/_option/server/yes/_option/language/ts/app/_middleware.ts +9 -0
  114. package/esdev/templates/app/_option/server/yes/_option/language/ts/app/api/hello/route.ts +4 -0
  115. package/esdev/templates/app/_option/server/yes/_option/language/ts/app/todos/loader.ts +7 -0
  116. package/esdev/templates/app/_option/server/yes/_option/language/ts/app/todos/todos.server.ts +15 -0
  117. package/esdev/templates/app/_option/server/yes/_option/language/ts/tests/server/api.test.ts +8 -0
  118. package/esdev/templates/app/_option/server/yes/_option/styling/css/_option/language/js/app/todos/page.jsx +29 -0
  119. package/esdev/templates/app/_option/server/yes/_option/styling/css/_option/language/ts/app/todos/page.tsx +29 -0
  120. package/esdev/templates/app/_option/server/yes/_option/styling/tailwind/_option/language/js/app/todos/page.jsx +29 -0
  121. package/esdev/templates/app/_option/server/yes/_option/styling/tailwind/_option/language/ts/app/todos/page.tsx +29 -0
  122. package/esdev/templates/app/_option/server/yes/server.js +53 -0
  123. package/esdev/templates/app/_option/styling/css/_option/language/js/app/Counter.jsx +10 -0
  124. package/esdev/templates/app/_option/styling/css/_option/language/js/app/page.jsx +13 -0
  125. package/esdev/templates/app/_option/styling/css/_option/language/ts/app/Counter.tsx +10 -0
  126. package/esdev/templates/app/_option/styling/css/_option/language/ts/app/page.tsx +13 -0
  127. package/esdev/templates/app/_option/styling/css/app/global.css +16 -0
  128. package/esdev/templates/app/_option/styling/tailwind/_option/language/js/app/Counter.jsx +10 -0
  129. package/esdev/templates/app/_option/styling/tailwind/_option/language/js/app/page.jsx +13 -0
  130. package/esdev/templates/app/_option/styling/tailwind/_option/language/ts/app/Counter.tsx +10 -0
  131. package/esdev/templates/app/_option/styling/tailwind/_option/language/ts/app/page.tsx +13 -0
  132. package/esdev/templates/app/_option/styling/tailwind/app/global.css +7 -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/_option/language/js/README.md +14 -0
  138. package/esdev/templates/docs/_option/blog/no/_option/language/js/app/page.jsx +15 -0
  139. package/esdev/templates/docs/_option/blog/no/_option/language/js/tests/ui/Home.test.js +9 -0
  140. package/esdev/templates/docs/_option/blog/no/_option/language/ts/README.md +15 -0
  141. package/esdev/templates/docs/_option/blog/no/_option/language/ts/app/page.tsx +15 -0
  142. package/esdev/templates/docs/_option/blog/no/_option/language/ts/tests/ui/Home.test.ts +9 -0
  143. package/esdev/templates/docs/_option/blog/no/afw.config.js +13 -0
  144. package/esdev/templates/docs/_option/blog/yes/_option/language/js/README.md +14 -0
  145. package/esdev/templates/docs/_option/blog/yes/_option/language/js/app/blog/layout.jsx +7 -0
  146. package/esdev/templates/docs/_option/blog/yes/_option/language/js/app/blog/page.jsx +13 -0
  147. package/esdev/templates/docs/_option/blog/yes/_option/language/js/app/page.jsx +15 -0
  148. package/esdev/templates/docs/_option/blog/yes/_option/language/js/tests/ui/Home.test.js +10 -0
  149. package/esdev/templates/docs/_option/blog/yes/_option/language/ts/README.md +15 -0
  150. package/esdev/templates/docs/_option/blog/yes/_option/language/ts/app/blog/layout.tsx +7 -0
  151. package/esdev/templates/docs/_option/blog/yes/_option/language/ts/app/blog/page.tsx +13 -0
  152. package/esdev/templates/docs/_option/blog/yes/_option/language/ts/app/page.tsx +15 -0
  153. package/esdev/templates/docs/_option/blog/yes/_option/language/ts/tests/ui/Home.test.ts +10 -0
  154. package/esdev/templates/docs/_option/blog/yes/afw.config.js +15 -0
  155. package/esdev/templates/docs/_option/blog/yes/app/blog/hello-world/page.mdx +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 +30 -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 +30 -0
  189. package/esdev/templates/library/_option/styling/css/_option/language/js/README.md +12 -0
  190. package/esdev/templates/library/_option/styling/css/_option/language/js/app/page.jsx +10 -0
  191. package/esdev/templates/library/_option/styling/css/_option/language/js/package.json +26 -0
  192. package/esdev/templates/library/_option/styling/css/_option/language/js/src/Counter.jsx +10 -0
  193. package/esdev/templates/library/_option/styling/css/_option/language/ts/README.md +13 -0
  194. package/esdev/templates/library/_option/styling/css/_option/language/ts/app/page.tsx +10 -0
  195. package/esdev/templates/library/_option/styling/css/_option/language/ts/package.json +28 -0
  196. package/esdev/templates/library/_option/styling/css/_option/language/ts/src/Counter.tsx +10 -0
  197. package/esdev/templates/library/_option/styling/css/app/global.css +16 -0
  198. package/esdev/templates/library/_option/styling/tailwind/_option/language/js/README.md +13 -0
  199. package/esdev/templates/library/_option/styling/tailwind/_option/language/js/app/page.jsx +10 -0
  200. package/esdev/templates/library/_option/styling/tailwind/_option/language/js/package.json +27 -0
  201. package/esdev/templates/library/_option/styling/tailwind/_option/language/js/src/Counter.jsx +10 -0
  202. package/esdev/templates/library/_option/styling/tailwind/_option/language/ts/README.md +14 -0
  203. package/esdev/templates/library/_option/styling/tailwind/_option/language/ts/app/page.tsx +10 -0
  204. package/esdev/templates/library/_option/styling/tailwind/_option/language/ts/package.json +29 -0
  205. package/esdev/templates/library/_option/styling/tailwind/_option/language/ts/src/Counter.tsx +10 -0
  206. package/esdev/templates/library/_option/styling/tailwind/app/global.css +7 -0
  207. package/esdev/templates/library/esdev.json +18 -0
  208. package/esdev/templates/library/template.json +44 -0
  209. package/index.js +12 -21
  210. package/package.json +14 -9
  211. package/templates.js +257 -77
  212. 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,2 @@
1
+ // The package entry: export each component.
2
+ export { default as Counter } from "./src/Counter.jsx";
@@ -0,0 +1,6 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "preserve",
4
+ "jsxImportSource": "@opentf/afw"
5
+ }
6
+ }
@@ -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,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")! });
@@ -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,2 @@
1
+ // The package entry: export each component.
2
+ export { default as Counter } from "./src/Counter.tsx";
@@ -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,10 @@
1
+ import { Counter } from "../index.js";
2
+
3
+ export default function Preview() {
4
+ return (
5
+ <section>
6
+ <h1>{{name}}</h1>
7
+ <Counter start={1} />
8
+ </section>
9
+ );
10
+ }
@@ -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,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 onclick={() => count++}>Count: {count}</button> Doubled: {doubled}
8
+ </p>
9
+ );
10
+ }
@@ -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,10 @@
1
+ import { Counter } from "../index.ts";
2
+
3
+ export default function Preview() {
4
+ return (
5
+ <section>
6
+ <h1>{{name}}</h1>
7
+ <Counter start={1} />
8
+ </section>
9
+ );
10
+ }
@@ -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,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 onclick={() => count++}>Count: {count}</button> Doubled: {doubled}
8
+ </p>
9
+ );
10
+ }
@@ -0,0 +1,16 @@
1
+ :root {
2
+ font-family: system-ui, sans-serif;
3
+ color-scheme: light dark;
4
+ }
5
+
6
+ body {
7
+ margin: 0 auto;
8
+ max-width: 48rem;
9
+ padding: 2rem 1rem;
10
+ }
11
+
12
+ nav {
13
+ display: flex;
14
+ gap: 1rem;
15
+ margin-bottom: 2rem;
16
+ }
@@ -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,10 @@
1
+ import { Counter } from "../index.js";
2
+
3
+ export default function Preview() {
4
+ return (
5
+ <section>
6
+ <h1 class="mb-4 text-2xl font-bold">{{name}}</h1>
7
+ <Counter start={1} />
8
+ </section>
9
+ );
10
+ }
@@ -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,10 @@
1
+ import { Counter } from "../index.ts";
2
+
3
+ export default function Preview() {
4
+ return (
5
+ <section>
6
+ <h1 class="mb-4 text-2xl font-bold">{{name}}</h1>
7
+ <Counter start={1} />
8
+ </section>
9
+ );
10
+ }
@@ -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,7 @@
1
+ @import "tailwindcss";
2
+
3
+ @layer base {
4
+ body {
5
+ @apply mx-auto max-w-3xl px-4 py-8 font-sans;
6
+ }
7
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "plugins": [
3
+ {
4
+ "module": "@opentf/esdev-plugin-afw",
5
+ "options": {
6
+ "appDir": "app"
7
+ }
8
+ }
9
+ ],
10
+ "build": {
11
+ "targets": {
12
+ "web": {
13
+ "entry": "index.html",
14
+ "outdir": "dist"
15
+ }
16
+ }
17
+ }
18
+ }
@@ -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 { LEGACY_TEMPLATES, RENDERINGS, STYLINGS, TEMPLATES, projectFiles } from "./templates.js";
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 ssr, which always has one)
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] && !LEGACY_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
- const legacy = LEGACY_TEMPLATES[base];
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 === "ssr" && options.server === false) throw new Error("--render ssr always has a server; drop --no-server");
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 = "spa", server = false, blog = false, styling = "css", language = "ts",
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 ? (options.render ?? (interactive ? await choose("How should pages render?", RENDERINGS) : "spa")) : undefined;
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 === "ssr" || (options.server ?? (interactive
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.5.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": ">=22"
23
+ "node": ">=24",
24
+ "esdev": ">=0.28.0"
25
+ },
26
+ "esdev": {
27
+ "templates": "esdev/templates"
23
28
  },
24
29
  "devDependencies": {
25
- "@opentf/afw": "0.37.0",
26
- "@opentf/afw-docs": "0.35.0",
27
- "@opentf/afw-form": "1.32.0",
28
- "@opentf/afw-test": "1.32.0",
29
- "@opentf/vite-plugin-afw": "0.5.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",