@canonical/summon-application 0.33.0 → 0.35.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 (88) hide show
  1. package/README.md +9 -9
  2. package/dist/esm/application/react/index.js +403 -277
  3. package/dist/esm/application/react/index.js.map +1 -1
  4. package/dist/esm/application/react/templates/.storybook/decorators/index.ts.ejs +4 -0
  5. package/dist/esm/application/react/templates/.storybook/decorators/withI18n.tsx +35 -0
  6. package/dist/esm/application/react/templates/.storybook/decorators/withRouter.tsx +18 -20
  7. package/dist/esm/application/react/templates/.storybook/preview.ts.ejs +35 -0
  8. package/dist/esm/application/react/templates/index.html.ejs +2 -1
  9. package/dist/esm/application/react/templates/package.json.ejs +34 -3
  10. package/dist/esm/application/react/templates/src/client/entry.tsx.ejs +109 -10
  11. package/dist/esm/application/react/templates/src/domains/account/{AccountPage.tsx → AccountPage.tsx.ejs} +13 -0
  12. package/dist/esm/application/react/templates/src/domains/account/LoginPage.tsx.ejs +51 -0
  13. package/dist/esm/application/react/templates/src/domains/account/routes.ts +21 -8
  14. package/dist/esm/application/react/templates/src/domains/catalog/CatalogPage.tsx.ejs +97 -0
  15. package/dist/esm/application/react/templates/src/domains/catalog/{ErrorBoundary.tests.tsx → ErrorBoundary.tests.tsx.ejs} +24 -0
  16. package/dist/esm/application/react/templates/src/domains/catalog/{ProductCard.tsx → ProductCard.tsx.ejs} +31 -0
  17. package/dist/esm/application/react/templates/src/domains/catalog/{ProductList.stories.tsx → ProductList.stories.tsx.ejs} +63 -4
  18. package/dist/esm/application/react/templates/src/domains/catalog/{ProductList.tests.tsx → ProductList.tests.tsx.ejs} +44 -0
  19. package/dist/esm/application/react/templates/src/domains/catalog/{ProductList.tsx → ProductList.tsx.ejs} +30 -2
  20. package/dist/esm/application/react/templates/src/domains/catalog/routes.ts +25 -0
  21. package/dist/esm/application/react/templates/src/domains/contact/{ContactPage.tsx → ContactPage.tsx.ejs} +40 -0
  22. package/dist/esm/application/react/templates/src/domains/marketing/GuidePage.tsx.ejs +33 -0
  23. package/dist/esm/application/react/templates/src/domains/marketing/{HomePage.tsx → HomePage.tsx.ejs} +30 -0
  24. package/dist/esm/application/react/templates/src/domains/marketing/routes.ts +25 -0
  25. package/dist/esm/application/react/templates/src/i18n/ar.ts +74 -0
  26. package/dist/esm/application/react/templates/src/i18n/catalogs.ts +14 -0
  27. package/dist/esm/application/react/templates/src/i18n/config.ts +19 -0
  28. package/dist/esm/application/react/templates/src/i18n/en.ts +73 -0
  29. package/dist/esm/application/react/templates/src/i18n/fr.ts +70 -0
  30. package/dist/esm/application/react/templates/src/i18n/index.ts +5 -0
  31. package/dist/esm/application/react/templates/src/i18n/negotiation.tests.ts +92 -0
  32. package/dist/esm/application/react/templates/src/lib/LocaleSelector/LocaleSelector.tests.tsx +60 -0
  33. package/dist/esm/application/react/templates/src/lib/LocaleSelector/LocaleSelector.tsx +44 -0
  34. package/dist/esm/application/react/templates/src/lib/LocaleSelector/index.ts +1 -0
  35. package/dist/esm/application/react/templates/src/lib/Navigation/Navigation.tsx.ejs +34 -0
  36. package/dist/esm/application/react/templates/src/lib/ThemeSelector/{ThemeSelector.tsx → ThemeSelector.tsx.ejs} +16 -0
  37. package/dist/esm/application/react/templates/src/lib/index.ts.ejs +3 -0
  38. package/dist/esm/application/react/templates/src/relay/environment.ts +153 -5
  39. package/dist/esm/application/react/templates/src/routes.tsx.ejs +137 -33
  40. package/dist/esm/application/react/templates/src/server/entry.tsx.ejs +293 -11
  41. package/dist/esm/application/react/templates/src/server/preview.bun.ts +30 -7
  42. package/dist/esm/application/react/templates/src/server/preview.express.ts +19 -4
  43. package/dist/esm/application/react/templates/src/server/renderer.tsx.ejs +125 -0
  44. package/dist/esm/application/react/templates/src/server/{server.bun.ts → server.bun.ts.ejs} +56 -4
  45. package/dist/esm/application/react/templates/src/server/{server.express.ts → server.express.ts.ejs} +48 -4
  46. package/dist/esm/application/react/templates/test/e2e/servers.e2e.ts.ejs +197 -0
  47. package/dist/esm/application/react/templates/tsconfig.json.ejs +3 -0
  48. package/dist/esm/application/react/templates/vite.config.ts.ejs +5 -0
  49. package/dist/esm/domain/index.js +8 -1
  50. package/dist/esm/domain/index.js.map +1 -1
  51. package/dist/esm/route/index.js +12 -2
  52. package/dist/esm/route/index.js.map +1 -1
  53. package/dist/esm/route/insertRoute.js +39 -11
  54. package/dist/esm/route/insertRoute.js.map +1 -1
  55. package/dist/esm/shared/packageName.js +7 -0
  56. package/dist/esm/shared/packageName.js.map +1 -0
  57. package/dist/esm/shared/packageVersion.js +50 -0
  58. package/dist/esm/shared/packageVersion.js.map +1 -0
  59. package/dist/esm/shared/validators.js +61 -0
  60. package/dist/esm/shared/validators.js.map +1 -0
  61. package/dist/esm/shared/versions.js +87 -55
  62. package/dist/esm/shared/versions.js.map +1 -1
  63. package/dist/esm/shared/workspace.js +57 -0
  64. package/dist/esm/shared/workspace.js.map +1 -1
  65. package/dist/esm/wrapper/index.js +8 -1
  66. package/dist/esm/wrapper/index.js.map +1 -1
  67. package/dist/types/application/react/index.d.ts +1 -2
  68. package/dist/types/application/react/index.d.ts.map +1 -1
  69. package/dist/types/domain/index.d.ts.map +1 -1
  70. package/dist/types/route/index.d.ts.map +1 -1
  71. package/dist/types/shared/packageName.d.ts +7 -0
  72. package/dist/types/shared/packageName.d.ts.map +1 -0
  73. package/dist/types/shared/packageVersion.d.ts +15 -0
  74. package/dist/types/shared/packageVersion.d.ts.map +1 -0
  75. package/dist/types/shared/validators.d.ts +21 -0
  76. package/dist/types/shared/validators.d.ts.map +1 -0
  77. package/dist/types/shared/versions.d.ts +14 -5
  78. package/dist/types/shared/versions.d.ts.map +1 -1
  79. package/dist/types/shared/workspace.d.ts.map +1 -1
  80. package/dist/types/wrapper/index.d.ts.map +1 -1
  81. package/package.json +8 -8
  82. package/dist/esm/application/react/templates/.storybook/decorators/index.ts +0 -1
  83. package/dist/esm/application/react/templates/.storybook/preview.ts +0 -10
  84. package/dist/esm/application/react/templates/src/domains/account/LoginPage.tsx +0 -27
  85. package/dist/esm/application/react/templates/src/domains/catalog/CatalogPage.tsx +0 -50
  86. package/dist/esm/application/react/templates/src/domains/marketing/GuidePage.tsx +0 -17
  87. package/dist/esm/application/react/templates/src/server/renderer.tsx +0 -50
  88. package/dist/esm/application/react/templates/test/e2e/servers.e2e.ts +0 -99
package/README.md CHANGED
@@ -10,7 +10,7 @@ Scaffolds a complete React application with SSR, routing, Storybook, and two sta
10
10
 
11
11
  ```bash
12
12
  summon application/react my-app
13
- summon application/react --forms my-app
13
+ summon application/react --no-forms my-app
14
14
  summon application/react --relay my-app
15
15
  ```
16
16
 
@@ -35,7 +35,7 @@ my-app/
35
35
  │ ├── domains/
36
36
  │ │ ├── marketing/ # HomePage, GuidePage, routes
37
37
  │ │ ├── account/ # AccountPage, LoginPage, routes
38
- │ │ ├── contact/ # ContactPage, routes (--forms only)
38
+ │ │ ├── contact/ # ContactPage, routes (omitted with --no-forms)
39
39
  │ │ └── catalog/ # CatalogPage, ProductList, ProductCard (--relay only)
40
40
  │ ├── lib/
41
41
  │ │ ├── Navigation/
@@ -55,7 +55,7 @@ my-app/
55
55
  └── vite.config.ts
56
56
  ```
57
57
 
58
- The `--forms` flag adds the contact domain with form components and wires `contactRoutes` into `routes.tsx`.
58
+ Form components are ON by default: the contact domain and its `contactRoutes` wiring in `routes.tsx` ship unless `--no-forms` is passed.
59
59
 
60
60
  #### `--relay`: Relay (GraphQL) data layer
61
61
 
@@ -136,7 +136,7 @@ const [billing] = group(publicLayout, [billingRoutes.billing] as const);
136
136
 
137
137
  ### `summon route <domain>/<name>`
138
138
 
139
- Adds a page component to an existing domain and appends the import to its `routes.ts`.
139
+ Adds a page component to an existing domain and wires it into the domain's `routes.ts` — no manual edit needed.
140
140
 
141
141
  ```bash
142
142
  summon route billing/invoices
@@ -147,16 +147,16 @@ Produces:
147
147
  ```
148
148
  src/domains/billing/
149
149
  ├── InvoicesPage.tsx # New page component
150
- └── routes.ts # Import + TODO comment appended
150
+ └── routes.ts # Import + route entry inserted
151
151
  ```
152
152
 
153
- The generator appends the import and a comment with the route entry. Add the route to the `routes` object manually:
153
+ The generator locates the `routes` object with the TypeScript AST and splices in both the import and the full entry:
154
154
 
155
155
  ```ts
156
156
  invoices: route({ url: "/billing/invoices", content: InvoicesPage }),
157
157
  ```
158
158
 
159
- Create the domain first with `summon domain <name>`.
159
+ Running with `--undo` removes that entry and import again — safe when the insertion actually added a new key. If the route key already existed the insertion was a no-op, and `--undo` would remove the pre-existing route (the generator help documents the same caveat). Create the domain first with `summon domain <name>`.
160
160
 
161
161
  ### `summon wrapper <name>`
162
162
 
@@ -204,7 +204,7 @@ src/
204
204
  │ │ ├── AccountPage.tsx
205
205
  │ │ ├── LoginPage.tsx
206
206
  │ │ └── routes.ts
207
- │ ├── contact/ # When --forms is enabled
207
+ │ ├── contact/ # Omitted with --no-forms
208
208
  │ │ ├── ContactPage.tsx
209
209
  │ │ └── routes.ts
210
210
  │ └── catalog/ # When --relay is enabled
@@ -252,7 +252,7 @@ export default routes;
252
252
 
253
253
  - `content` receives the component directly (not a wrapper function)
254
254
  - Pages use `useHead()` from `@canonical/react-head` for title and meta
255
- - No `fetch()` / `prefetch()` unless needed for cache warming
255
+ - No `fetch()` / `warm()` unless needed for cache warming
256
256
  - No `.error` — use React error boundaries
257
257
  - Route files are `.ts` (no JSX in route definitions)
258
258