@canonical/summon-application 0.34.0 → 0.36.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 +9 -9
- package/dist/esm/application/react/index.js +403 -277
- package/dist/esm/application/react/index.js.map +1 -1
- package/dist/esm/application/react/templates/.storybook/decorators/index.ts.ejs +4 -0
- package/dist/esm/application/react/templates/.storybook/decorators/withI18n.tsx +35 -0
- package/dist/esm/application/react/templates/.storybook/decorators/withRouter.tsx +18 -20
- package/dist/esm/application/react/templates/.storybook/preview.ts.ejs +35 -0
- package/dist/esm/application/react/templates/index.html.ejs +2 -1
- package/dist/esm/application/react/templates/package.json.ejs +34 -3
- package/dist/esm/application/react/templates/src/client/entry.tsx.ejs +109 -10
- package/dist/esm/application/react/templates/src/domains/account/{AccountPage.tsx → AccountPage.tsx.ejs} +13 -0
- package/dist/esm/application/react/templates/src/domains/account/LoginPage.tsx.ejs +51 -0
- package/dist/esm/application/react/templates/src/domains/account/routes.ts +21 -8
- package/dist/esm/application/react/templates/src/domains/catalog/CatalogPage.tsx.ejs +97 -0
- package/dist/esm/application/react/templates/src/domains/catalog/{ErrorBoundary.tests.tsx → ErrorBoundary.tests.tsx.ejs} +24 -0
- package/dist/esm/application/react/templates/src/domains/catalog/{ProductCard.tsx → ProductCard.tsx.ejs} +31 -0
- package/dist/esm/application/react/templates/src/domains/catalog/{ProductList.stories.tsx → ProductList.stories.tsx.ejs} +63 -4
- package/dist/esm/application/react/templates/src/domains/catalog/{ProductList.tests.tsx → ProductList.tests.tsx.ejs} +44 -0
- package/dist/esm/application/react/templates/src/domains/catalog/{ProductList.tsx → ProductList.tsx.ejs} +30 -2
- package/dist/esm/application/react/templates/src/domains/catalog/routes.ts +25 -0
- package/dist/esm/application/react/templates/src/domains/contact/{ContactPage.tsx → ContactPage.tsx.ejs} +40 -0
- package/dist/esm/application/react/templates/src/domains/marketing/GuidePage.tsx.ejs +33 -0
- package/dist/esm/application/react/templates/src/domains/marketing/{HomePage.tsx → HomePage.tsx.ejs} +30 -0
- package/dist/esm/application/react/templates/src/domains/marketing/routes.ts +25 -0
- package/dist/esm/application/react/templates/src/i18n/ar.ts +74 -0
- package/dist/esm/application/react/templates/src/i18n/catalogs.ts +14 -0
- package/dist/esm/application/react/templates/src/i18n/config.ts +19 -0
- package/dist/esm/application/react/templates/src/i18n/en.ts +73 -0
- package/dist/esm/application/react/templates/src/i18n/fr.ts +70 -0
- package/dist/esm/application/react/templates/src/i18n/index.ts +5 -0
- package/dist/esm/application/react/templates/src/i18n/negotiation.tests.ts +92 -0
- package/dist/esm/application/react/templates/src/lib/LocaleSelector/LocaleSelector.tests.tsx +60 -0
- package/dist/esm/application/react/templates/src/lib/LocaleSelector/LocaleSelector.tsx +44 -0
- package/dist/esm/application/react/templates/src/lib/LocaleSelector/index.ts +1 -0
- package/dist/esm/application/react/templates/src/lib/Navigation/Navigation.tsx.ejs +34 -0
- package/dist/esm/application/react/templates/src/lib/ThemeSelector/{ThemeSelector.tsx → ThemeSelector.tsx.ejs} +16 -0
- package/dist/esm/application/react/templates/src/lib/index.ts.ejs +3 -0
- package/dist/esm/application/react/templates/src/relay/environment.ts +153 -5
- package/dist/esm/application/react/templates/src/routes.tsx.ejs +137 -33
- package/dist/esm/application/react/templates/src/server/entry.tsx.ejs +293 -11
- package/dist/esm/application/react/templates/src/server/preview.bun.ts +30 -7
- package/dist/esm/application/react/templates/src/server/preview.express.ts +19 -4
- package/dist/esm/application/react/templates/src/server/renderer.tsx.ejs +125 -0
- package/dist/esm/application/react/templates/src/server/{server.bun.ts → server.bun.ts.ejs} +56 -4
- package/dist/esm/application/react/templates/src/server/{server.express.ts → server.express.ts.ejs} +48 -4
- package/dist/esm/application/react/templates/test/e2e/servers.e2e.ts.ejs +197 -0
- package/dist/esm/application/react/templates/tsconfig.json.ejs +3 -0
- package/dist/esm/application/react/templates/vite.config.ts.ejs +5 -0
- package/dist/esm/domain/index.js +8 -1
- package/dist/esm/domain/index.js.map +1 -1
- package/dist/esm/route/index.js +12 -2
- package/dist/esm/route/index.js.map +1 -1
- package/dist/esm/route/insertRoute.js +39 -11
- package/dist/esm/route/insertRoute.js.map +1 -1
- package/dist/esm/shared/packageName.js +7 -0
- package/dist/esm/shared/packageName.js.map +1 -0
- package/dist/esm/shared/packageVersion.js +50 -0
- package/dist/esm/shared/packageVersion.js.map +1 -0
- package/dist/esm/shared/validators.js +61 -0
- package/dist/esm/shared/validators.js.map +1 -0
- package/dist/esm/shared/versions.js +87 -55
- package/dist/esm/shared/versions.js.map +1 -1
- package/dist/esm/shared/workspace.js +57 -0
- package/dist/esm/shared/workspace.js.map +1 -1
- package/dist/esm/wrapper/index.js +8 -1
- package/dist/esm/wrapper/index.js.map +1 -1
- package/dist/types/application/react/index.d.ts +1 -2
- package/dist/types/application/react/index.d.ts.map +1 -1
- package/dist/types/domain/index.d.ts.map +1 -1
- package/dist/types/route/index.d.ts.map +1 -1
- package/dist/types/shared/packageName.d.ts +7 -0
- package/dist/types/shared/packageName.d.ts.map +1 -0
- package/dist/types/shared/packageVersion.d.ts +15 -0
- package/dist/types/shared/packageVersion.d.ts.map +1 -0
- package/dist/types/shared/validators.d.ts +21 -0
- package/dist/types/shared/validators.d.ts.map +1 -0
- package/dist/types/shared/versions.d.ts +14 -5
- package/dist/types/shared/versions.d.ts.map +1 -1
- package/dist/types/shared/workspace.d.ts.map +1 -1
- package/dist/types/wrapper/index.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/esm/application/react/templates/.storybook/decorators/index.ts +0 -1
- package/dist/esm/application/react/templates/.storybook/preview.ts +0 -10
- package/dist/esm/application/react/templates/src/domains/account/LoginPage.tsx +0 -27
- package/dist/esm/application/react/templates/src/domains/catalog/CatalogPage.tsx +0 -50
- package/dist/esm/application/react/templates/src/domains/marketing/GuidePage.tsx +0 -17
- package/dist/esm/application/react/templates/src/server/renderer.tsx +0 -50
- 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
|
|
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
|
-
|
|
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
|
|
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 +
|
|
150
|
+
└── routes.ts # Import + route entry inserted
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
The generator
|
|
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/ #
|
|
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()` / `
|
|
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
|
|