@canonical/summon-application 0.36.0 → 0.37.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 +53 -5
- package/dist/esm/application/react/index.js +81 -33
- package/dist/esm/application/react/index.js.map +1 -1
- package/dist/esm/application/react/templates/README.md.ejs +88 -5
- package/dist/esm/application/react/templates/index.html.ejs +4 -0
- package/dist/esm/application/react/templates/package.json.ejs +20 -0
- package/dist/esm/application/react/templates/src/client/entry.tsx.ejs +64 -12
- package/dist/esm/application/react/templates/src/domains/catalog/CatalogPage.tsx.ejs +12 -0
- package/dist/esm/application/react/templates/src/domains/catalog/ProductList.tsx.ejs +2 -2
- package/dist/esm/application/react/templates/src/domains/marketing/HomePage.tsx.ejs +9 -0
- package/dist/esm/application/react/templates/src/lib/index.ts.ejs +1 -1
- package/dist/esm/application/react/templates/src/routes.tsx.ejs +22 -3
- package/dist/esm/application/react/templates/test/e2e/servers.e2e.ts.ejs +41 -0
- package/dist/esm/application/react/templates/tsconfig.json.ejs +2 -0
- package/dist/esm/application/react/templates/vite.config.ts.ejs +46 -1
- package/dist/types/application/react/index.d.ts +1 -0
- package/dist/types/application/react/index.d.ts.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -6,12 +6,14 @@ Summon generators for scaffolding application structure: full applications, doma
|
|
|
6
6
|
|
|
7
7
|
### `summon application/react <name>`
|
|
8
8
|
|
|
9
|
-
Scaffolds a complete React application with
|
|
9
|
+
Scaffolds a complete React application with routing, Storybook, and two starter domains — server-rendered by default, or client-only with `--rendering spa`.
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
summon application/react my-app
|
|
13
13
|
summon application/react --no-forms my-app
|
|
14
|
+
summon application/react --intl my-app
|
|
14
15
|
summon application/react --relay my-app
|
|
16
|
+
summon application/react --rendering spa my-app
|
|
15
17
|
```
|
|
16
18
|
|
|
17
19
|
Produces:
|
|
@@ -27,7 +29,7 @@ my-app/
|
|
|
27
29
|
├── patches/ # bun dependency patches (--relay only)
|
|
28
30
|
├── src/
|
|
29
31
|
│ ├── client/entry.tsx # Client hydration
|
|
30
|
-
│ ├── server/
|
|
32
|
+
│ ├── server/ # (omitted with --rendering spa)
|
|
31
33
|
│ │ ├── entry.tsx # SSR render
|
|
32
34
|
│ │ ├── server.express.ts # Express dev server
|
|
33
35
|
│ │ ├── server.bun.ts # Bun dev server
|
|
@@ -42,7 +44,8 @@ my-app/
|
|
|
42
44
|
│ │ ├── ThemeSelector/
|
|
43
45
|
│ │ ├── ExampleComponent/
|
|
44
46
|
│ │ ├── LazyComponent/
|
|
45
|
-
│ │ └── ClientOnly/ # SSR query guard (--relay only)
|
|
47
|
+
│ │ └── ClientOnly/ # SSR query guard (--relay only; omitted with --rendering spa)
|
|
48
|
+
│ ├── i18n/ # Locale config, message catalogs (--intl only)
|
|
46
49
|
│ ├── relay/ # Environment factory, mock schema, __generated__ (--relay only)
|
|
47
50
|
│ ├── styles/
|
|
48
51
|
│ ├── routes.tsx
|
|
@@ -57,6 +60,44 @@ my-app/
|
|
|
57
60
|
|
|
58
61
|
Form components are ON by default: the contact domain and its `contactRoutes` wiring in `routes.tsx` ship unless `--no-forms` is passed.
|
|
59
62
|
|
|
63
|
+
#### `--intl`: internationalisation
|
|
64
|
+
|
|
65
|
+
Off by default. `--intl` adds locale negotiation (cookie > `Accept-Language` >
|
|
66
|
+
default), per-locale message catalogs for `en`/`fr`/`ar` under `src/i18n/`, a
|
|
67
|
+
`LocaleSelector` in the chrome, the Storybook locale toolbar and its `withI18n`
|
|
68
|
+
decorator, and translated copy across every page. Under `--rendering spa` the same
|
|
69
|
+
negotiation runs in the browser (cookie, then `navigator.languages`) because no
|
|
70
|
+
server saw the request.
|
|
71
|
+
|
|
72
|
+
#### `--rendering spa`: client-only, no SSR layer
|
|
73
|
+
|
|
74
|
+
Off by default — a scaffolded app server-renders. `--rendering spa` is subtractive: it
|
|
75
|
+
emits a strict subset of the default tree, and nothing that is SPA-only.
|
|
76
|
+
|
|
77
|
+
Omitted:
|
|
78
|
+
|
|
79
|
+
- `src/server/` — the SSR entry, the compiled renderer, and the Express and Bun
|
|
80
|
+
dev/preview servers.
|
|
81
|
+
- `src/sitemap/` — `/sitemap.xml` is a server-rendered route, and its renderer
|
|
82
|
+
is the getters' only consumer.
|
|
83
|
+
- `src/lib/ClientOnly/` — an SSR-safety wrapper, so a no-op here.
|
|
84
|
+
- The `dev:*`, `preview:*` and `build:server` scripts, `--ssrManifest` on
|
|
85
|
+
`build:client`, and the `express`, `@canonical/react-ssr`, `@types/express`,
|
|
86
|
+
`tsx` and `bun-types` dependencies.
|
|
87
|
+
|
|
88
|
+
Kept: the e2e suite. Its harness spawns a script and polls HTTP — `vite` and
|
|
89
|
+
`vite preview` are servers too — so the matrix keeps its two non-SSR cells and
|
|
90
|
+
`bun run test:e2e` still covers `dev` and `preview`.
|
|
91
|
+
|
|
92
|
+
**What a SPA gives up.** The client router still performs the auth redirect,
|
|
93
|
+
the `/home` redirect and the not-found route. What is lost is the HTTP status
|
|
94
|
+
on a *cold* request — no 404, 301 or 302 from a server — plus `/sitemap.xml`
|
|
95
|
+
and the server-painted first paint (`<html lang dir>` and the cookie-derived
|
|
96
|
+
theme class), so expect a brief default theme/locale flash. With `--relay` the
|
|
97
|
+
catalog page always suspends and fetches rather than arriving with prefetched
|
|
98
|
+
data. Static hosting needs a history-API fallback the scaffold does not
|
|
99
|
+
configure.
|
|
100
|
+
|
|
60
101
|
#### `--relay`: Relay (GraphQL) data layer
|
|
61
102
|
|
|
62
103
|
The `--relay` flag (off by default) mirrors the boilerplate's Relay data layer:
|
|
@@ -193,8 +234,8 @@ The generators enforce the conventions established by the boilerplate:
|
|
|
193
234
|
|
|
194
235
|
```
|
|
195
236
|
src/
|
|
196
|
-
├── client/ # Client entry point (hydration)
|
|
197
|
-
├── server/ # Server entry points (Express, Bun)
|
|
237
|
+
├── client/ # Client entry point (hydration; createRoot with --rendering spa)
|
|
238
|
+
├── server/ # Server entry points (Express, Bun) — omitted with --rendering spa
|
|
198
239
|
├── domains/ # Feature domains
|
|
199
240
|
│ ├── marketing/
|
|
200
241
|
│ │ ├── HomePage.tsx
|
|
@@ -314,6 +355,13 @@ This enables typed `<Link to="invoices">`, `router.navigate("invoices")`, and `r
|
|
|
314
355
|
|
|
315
356
|
Design decisions about the generated output that are not yet settled:
|
|
316
357
|
|
|
358
|
+
- **A `--rendering spa` app has no sitemap.** `/sitemap.xml` is a server-rendered route, so
|
|
359
|
+
`--rendering spa` drops `src/sitemap/` entirely. The getters themselves are portable — a
|
|
360
|
+
build step could write a static `public/sitemap.xml` and a static host would serve
|
|
361
|
+
it fine — but that is new tooling nothing else needs, and keeping the renderer
|
|
362
|
+
would hold `@canonical/react-ssr` as a dependency for otherwise-dead code.
|
|
363
|
+
**Open:** whether SEO-facing SPAs should get a build-time sitemap emitter.
|
|
364
|
+
|
|
317
365
|
- **Pinned pragma version is fetched at summon time.** Generated apps pin the pragma
|
|
318
366
|
workspace packages (`react-ds-global`, `router-core`, `styles`, …) at `^<latest>`, where
|
|
319
367
|
`<latest>` is queried from the npm registry when the app is scaffolded
|
|
@@ -17,13 +17,16 @@ const prompts = [
|
|
|
17
17
|
validate: validateAppPath,
|
|
18
18
|
group: "Application",
|
|
19
19
|
},
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
20
|
+
// The router is NOT a prompt: it is always on (every template assumes it), so
|
|
21
|
+
// a question that only ever accepted its default was a dead wizard step and,
|
|
22
|
+
// worse, an unanswerable refusal — a default-`true` confirm can be made
|
|
23
|
+
// explicit ONLY by negating it (`--no-router`), which the old cross-answer
|
|
24
|
+
// guard then rejected, leaving `create application react` with no reachable
|
|
25
|
+
// all-flags completion. SSR was retired alongside it for the same reason, but
|
|
26
|
+
// the reason has since expired: `rendering` below IS the second answer SSR
|
|
27
|
+
// lacked. It is a select rather than a revived confirm, so its explicit
|
|
28
|
+
// spelling is a VALUE (`--rendering spa`) and never a negation — the shape
|
|
29
|
+
// that made the old pair unanswerable. No cross-answer guard comes back.
|
|
27
30
|
{
|
|
28
31
|
name: "forms",
|
|
29
32
|
type: "confirm",
|
|
@@ -38,6 +41,27 @@ const prompts = [
|
|
|
38
41
|
default: false,
|
|
39
42
|
group: "Application",
|
|
40
43
|
},
|
|
44
|
+
// A select, not a confirm: rendering is an axis with two answers, not a
|
|
45
|
+
// capability you bolt on, and the wizard should show both. Note the frozen
|
|
46
|
+
// covenant's flag array is compared index-wise
|
|
47
|
+
// (kernel/spec/surfaceConformance.ts), and that order derives from this list.
|
|
48
|
+
{
|
|
49
|
+
name: "rendering",
|
|
50
|
+
type: "select",
|
|
51
|
+
message: "Rendering — ssr keeps the server layer (SSR servers and sitemap), spa is client-only",
|
|
52
|
+
choices: [
|
|
53
|
+
{
|
|
54
|
+
label: "ssr - server-side rendering (Express + Bun servers, sitemap)",
|
|
55
|
+
value: "ssr",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: "spa - client-only single-page app (no server layer)",
|
|
59
|
+
value: "spa",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
default: "ssr",
|
|
63
|
+
group: "Application",
|
|
64
|
+
},
|
|
41
65
|
{
|
|
42
66
|
name: "relay",
|
|
43
67
|
type: "confirm",
|
|
@@ -74,11 +98,12 @@ export const generator = {
|
|
|
74
98
|
meta: {
|
|
75
99
|
name: "application/react",
|
|
76
100
|
displayName: "@canonical/summon-application:application/react",
|
|
77
|
-
description: "Scaffold a complete React application with
|
|
101
|
+
description: "Scaffold a complete React application with routing, and either server-side rendering or a client-only SPA",
|
|
78
102
|
version: packageVersion(),
|
|
79
103
|
help: `Creates a full React application with:
|
|
80
104
|
- Vite build + dev server
|
|
81
|
-
- Server-side rendering (Express + Bun dev servers)
|
|
105
|
+
- Server-side rendering (Express + Bun dev servers) — the default
|
|
106
|
+
--rendering ssr; --rendering spa omits the whole server layer
|
|
82
107
|
- Routing with @canonical/router-core
|
|
83
108
|
- Head management with @canonical/react-head
|
|
84
109
|
- Two domains (marketing + account) with pages
|
|
@@ -89,16 +114,26 @@ export const generator = {
|
|
|
89
114
|
- Storybook with router decorator
|
|
90
115
|
- Biome + TypeScript configuration
|
|
91
116
|
|
|
92
|
-
|
|
117
|
+
Routing is always included. Rendering is a choice: ssr (the default) or spa,
|
|
118
|
+
which omits the server layer entirely — no src/server/, no sitemap, no
|
|
119
|
+
express/tsx/bun-types. Under spa the client router still handles the auth
|
|
120
|
+
redirect, the /home redirect and the not-found route, but a cold request gets
|
|
121
|
+
no 302/301/404 HTTP status and no server-painted first paint, so expect a
|
|
122
|
+
brief default theme/locale flash. A static host will need a history-API
|
|
123
|
+
fallback.`,
|
|
93
124
|
examples: [
|
|
94
125
|
"summon application/react my-app",
|
|
95
126
|
"summon application/react --no-forms my-app",
|
|
96
127
|
"summon application/react --relay my-app",
|
|
128
|
+
"summon application/react --rendering spa my-app",
|
|
97
129
|
"summon application/react --no-forms --relay my-app",
|
|
98
130
|
],
|
|
99
131
|
},
|
|
100
132
|
prompts,
|
|
101
133
|
generate: (answers) => {
|
|
134
|
+
// One axis, one boolean. The templates gate on `spa`, not on the answer
|
|
135
|
+
// string, so the prompt's shape is not their concern.
|
|
136
|
+
const spa = answers.rendering === "spa";
|
|
102
137
|
// The app path is a directory path, not a route path — keep it as given
|
|
103
138
|
// (absolute or relative), only trimming surrounding whitespace and any
|
|
104
139
|
// trailing slash.
|
|
@@ -156,6 +191,7 @@ SSR and routing are always included; standalone SPA mode is not supported.`,
|
|
|
156
191
|
forms: answers.forms,
|
|
157
192
|
intl: answers.intl,
|
|
158
193
|
relay: answers.relay,
|
|
194
|
+
spa,
|
|
159
195
|
standalone,
|
|
160
196
|
pragmaVersion,
|
|
161
197
|
});
|
|
@@ -187,6 +223,14 @@ SSR and routing are always included; standalone SPA mode is not supported.`,
|
|
|
187
223
|
// a machine where another manager was detected, say so up front.
|
|
188
224
|
when(pm !== null && pm !== "bun", warn(`Detected ${pm}, but the generated scripts use \`bun run\` — ` +
|
|
189
225
|
"install bun to run the app's composite scripts.")),
|
|
226
|
+
// The SPA arm trades away things SSR gives for free. Say so at
|
|
227
|
+
// scaffold time rather than leaving it to the README.
|
|
228
|
+
when(spa, info("Client-only SPA: no src/server/ and no /sitemap.xml. The router " +
|
|
229
|
+
"still handles the auth redirect, the /home redirect and the " +
|
|
230
|
+
"not-found route, but a cold request gets no 302/301/404 HTTP " +
|
|
231
|
+
"status and no server-painted first paint (expect a brief " +
|
|
232
|
+
"default theme/locale flash). Static hosting needs a " +
|
|
233
|
+
"history-API fallback.")),
|
|
190
234
|
// EJS templates (files needing interpolation)
|
|
191
235
|
template({
|
|
192
236
|
source: src("package.json.ejs"),
|
|
@@ -265,40 +309,44 @@ SSR and routing are always included; standalone SPA mode is not supported.`,
|
|
|
265
309
|
dest: dest("src/client/entry.tsx"),
|
|
266
310
|
vars,
|
|
267
311
|
}),
|
|
268
|
-
// Server — dev (Vite + HMR) and preview (compiled)
|
|
269
|
-
// between the app + sitemap renderers; the renderers
|
|
312
|
+
// Server (omitted by the SPA arm) — dev (Vite + HMR) and preview (compiled)
|
|
313
|
+
// servers each route between the app + sitemap renderers; the renderers
|
|
314
|
+
// stay routing-agnostic.
|
|
270
315
|
// Server entry (EJS — a per-request RelayEnvironmentProvider only when --relay)
|
|
271
|
-
template({
|
|
316
|
+
when(!spa, template({
|
|
272
317
|
source: src("src/server/entry.tsx.ejs"),
|
|
273
318
|
dest: dest("src/server/entry.tsx"),
|
|
274
319
|
vars,
|
|
275
|
-
}),
|
|
276
|
-
template({
|
|
320
|
+
})),
|
|
321
|
+
when(!spa, template({
|
|
277
322
|
source: src("src/server/renderer.tsx.ejs"),
|
|
278
323
|
dest: dest("src/server/renderer.tsx"),
|
|
279
324
|
vars,
|
|
280
|
-
}),
|
|
281
|
-
template({
|
|
325
|
+
})),
|
|
326
|
+
when(!spa, template({
|
|
282
327
|
source: src("src/server/server.express.ts.ejs"),
|
|
283
328
|
dest: dest("src/server/server.express.ts"),
|
|
284
329
|
vars,
|
|
285
|
-
}),
|
|
286
|
-
template({
|
|
330
|
+
})),
|
|
331
|
+
when(!spa, template({
|
|
287
332
|
source: src("src/server/server.bun.ts.ejs"),
|
|
288
333
|
dest: dest("src/server/server.bun.ts"),
|
|
289
334
|
vars,
|
|
290
|
-
}),
|
|
291
|
-
copy("src/server/preview.express.ts"),
|
|
292
|
-
copy("src/server/preview.bun.ts"),
|
|
293
|
-
// Sitemap (rendered route at /sitemap.xml)
|
|
294
|
-
|
|
335
|
+
})),
|
|
336
|
+
when(!spa, copy("src/server/preview.express.ts")),
|
|
337
|
+
when(!spa, copy("src/server/preview.bun.ts")),
|
|
338
|
+
// Sitemap (rendered route at /sitemap.xml) — omitted by the SPA arm.
|
|
339
|
+
// The getters are portable, but the renderer is the only consumer and it
|
|
340
|
+
// is served at runtime by the servers above; keeping either would hold
|
|
341
|
+
// @canonical/react-ssr as a dependency for dead code.
|
|
342
|
+
when(!spa, copy("src/sitemap/renderer.ts")),
|
|
295
343
|
// sitemap getters (EJS — /contact entry only when forms is on, /catalog
|
|
296
344
|
// entry only when relay is on)
|
|
297
|
-
template({
|
|
345
|
+
when(!spa, template({
|
|
298
346
|
source: src("src/sitemap/getSitemapItems.ts.ejs"),
|
|
299
347
|
dest: dest("src/sitemap/getSitemapItems.ts"),
|
|
300
348
|
vars,
|
|
301
|
-
}),
|
|
349
|
+
})),
|
|
302
350
|
// Domain: marketing
|
|
303
351
|
template({
|
|
304
352
|
source: src("src/domains/marketing/HomePage.tsx.ejs"),
|
|
@@ -447,13 +495,13 @@ SSR and routing are always included; standalone SPA mode is not supported.`,
|
|
|
447
495
|
copy("src/lib/LazyComponent/LazyComponent.tsx"),
|
|
448
496
|
copy("src/lib/LazyComponent/LazyComponent.stories.tsx"),
|
|
449
497
|
copy("src/lib/LazyComponent/index.ts"),
|
|
450
|
-
// Lib: ClientOnly (when --relay is enabled
|
|
451
|
-
//
|
|
452
|
-
//
|
|
453
|
-
when(answers.relay, copy("src/lib/ClientOnly/ClientOnly.tsx")),
|
|
454
|
-
when(answers.relay, copy("src/lib/ClientOnly/ClientOnly.tests.tsx")),
|
|
455
|
-
when(answers.relay, copy("src/lib/ClientOnly/index.ts")),
|
|
456
|
-
// Lib barrel (EJS — ClientOnly export only when --relay)
|
|
498
|
+
// Lib: ClientOnly (when --relay is enabled, on the SSR arm only — it is
|
|
499
|
+
// an SSR-safety wrapper that defers a subtree past the first hydration
|
|
500
|
+
// pass, which in a client-only app is a guaranteed no-op)
|
|
501
|
+
when(answers.relay && !spa, copy("src/lib/ClientOnly/ClientOnly.tsx")),
|
|
502
|
+
when(answers.relay && !spa, copy("src/lib/ClientOnly/ClientOnly.tests.tsx")),
|
|
503
|
+
when(answers.relay && !spa, copy("src/lib/ClientOnly/index.ts")),
|
|
504
|
+
// Lib barrel (EJS — ClientOnly export only when --relay, on the SSR arm)
|
|
457
505
|
template({
|
|
458
506
|
source: src("src/lib/index.ts.ejs"),
|
|
459
507
|
dest: dest("src/lib/index.ts"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/application/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMzC,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,IAAI,GACL,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,E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wBAChC,IAAI;qBACL,CAAC;oBACF,QAAQ,CAAC;wBACP,MAAM,EAAE,GAAG,CAAC,2BAA2B,CAAC;wBACxC,IAAI,EAAE,IAAI,CAAC,uBAAuB,CAAC;wBACnC,IAAI;qBACL,CAAC;oBACF,IAAI,CAAC,sCAAsC,CAAC;oBAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,oCAAoC,CAAC,CAAC;oBAC9D,QAAQ,CAAC;wBACP,MAAM,EAAE,GAAG,CAAC,oCAAoC,CAAC;wBACjD,IAAI,EAAE,IAAI,CAAC,gCAAgC,CAAC;wBAC5C,IAAI;qBACL,CAAC;oBAEF,gFAAgF;oBAChF,IAAI,CAAC,qBAAqB,CAAC;oBAC3B,IAAI,CAAC,iBAAiB,CAAC;oBACvB,IAAI,CAAC,mBAAmB,CAAC;oBAEzB,qEAAqE;oBACrE,qEAAqE;oBACrE,wEAAwE;oBACxE,mEAAmE;oBACnE,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC;oBAE9B,IAAI,CAAC,YAAY,CAAC;iBACnB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/application/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMzC,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,IAAI,GACL,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE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IAAI,CAAC,uBAAuB,CAAC;wBACnC,IAAI;qBACL,CAAC;oBACF,IAAI,CAAC,sCAAsC,CAAC;oBAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,oCAAoC,CAAC,CAAC;oBAC9D,QAAQ,CAAC;wBACP,MAAM,EAAE,GAAG,CAAC,oCAAoC,CAAC;wBACjD,IAAI,EAAE,IAAI,CAAC,gCAAgC,CAAC;wBAC5C,IAAI;qBACL,CAAC;oBAEF,gFAAgF;oBAChF,IAAI,CAAC,qBAAqB,CAAC;oBAC3B,IAAI,CAAC,iBAAiB,CAAC;oBACvB,IAAI,CAAC,mBAAmB,CAAC;oBAEzB,qEAAqE;oBACrE,qEAAqE;oBACrE,wEAAwE;oBACxE,mEAAmE;oBACnE,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC;oBAE9B,IAAI,CAAC,YAAY,CAAC;iBACnB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# <%= name %>
|
|
2
2
|
|
|
3
|
+
<% if (spa) { -%>
|
|
4
|
+
A client-only React single-page application, generated by `@canonical/summon`.
|
|
5
|
+
It is built on Canonical's shared design system and router packages, and ships
|
|
6
|
+
file-based routing, a component library wired to design tokens, and Storybook.
|
|
7
|
+
It was scaffolded with `--rendering spa`, so it has no server layer: see
|
|
8
|
+
[What a SPA gives up](#what-a-spa-gives-up).
|
|
9
|
+
|
|
10
|
+
## Quick start
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bun install
|
|
14
|
+
bun run dev # Vite dev server with HMR, on http://localhost:5173
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Edit anything under `src/` and the page hot-reloads. To check the production
|
|
18
|
+
build before shipping, run `bun run preview` instead.
|
|
19
|
+
|
|
20
|
+
## Running the app
|
|
21
|
+
|
|
22
|
+
Two scripts, one for each mode:
|
|
23
|
+
|
|
24
|
+
| `dev` — transform, HMR | `preview` — compiled, production-faithful |
|
|
25
|
+
| ---------------------- | ----------------------------------------- |
|
|
26
|
+
| `bun run dev` | `bun run preview` |
|
|
27
|
+
|
|
28
|
+
Reach for `dev` while building — it is the fast inner loop, with HMR and no
|
|
29
|
+
build step — and for `preview` when verifying that the production bundle behaves
|
|
30
|
+
before a deploy: `preview` builds the client and serves the built assets, the
|
|
31
|
+
same artifact that deploys.
|
|
32
|
+
<% } else { -%>
|
|
3
33
|
A React application with server-side rendering and routing, generated by
|
|
4
34
|
`@canonical/summon`. It is built on Canonical's shared design system, router, and
|
|
5
35
|
SSR packages, and ships SSR on two runtimes (Bun and Node), file-based routing, a
|
|
@@ -32,6 +62,7 @@ suffix selects the **SSR runtime**, and the `dev` / `preview` prefix selects the
|
|
|
32
62
|
and no build step — and for `preview:*` when verifying that the production bundle
|
|
33
63
|
behaves before a deploy: `preview:*` builds the client and runs a compiled
|
|
34
64
|
renderer over the built assets, the same artifact that deploys.
|
|
65
|
+
<% } -%>
|
|
35
66
|
|
|
36
67
|
```bash
|
|
37
68
|
bun run storybook # component workshop
|
|
@@ -42,10 +73,33 @@ Relay's compiler artifacts are committed, not rebuilt on the fly:
|
|
|
42
73
|
|
|
43
74
|
```bash
|
|
44
75
|
bun run relay # regenerate src/relay/__generated__ after schema/query edits
|
|
76
|
+
<% if (spa) { -%>
|
|
77
|
+
bun run relay:watch # the same, re-running on change — pair with dev
|
|
78
|
+
<% } else { -%>
|
|
45
79
|
bun run relay:watch # the same, re-running on change — pair with dev:*
|
|
80
|
+
<% } -%>
|
|
46
81
|
```
|
|
47
82
|
<% } -%>
|
|
48
83
|
|
|
84
|
+
<% if (spa) { -%>
|
|
85
|
+
## What a SPA gives up
|
|
86
|
+
|
|
87
|
+
Scaffolded with `--rendering spa`, this app has no server layer. The router still does
|
|
88
|
+
its job in the browser — the auth guard still bounces `/account` to `/login`,
|
|
89
|
+
`/home` still redirects to `/`, and an unmatched path still renders the
|
|
90
|
+
not-found page. What is missing is everything only a server can do:
|
|
91
|
+
|
|
92
|
+
- **No HTTP status on a cold request.** Those three outcomes are 200s to a
|
|
93
|
+
crawler or a `curl`; only in-app navigation sees them as redirects.
|
|
94
|
+
- **No `/sitemap.xml`.**
|
|
95
|
+
- **No server-painted first paint.** `<html lang dir>` and the theme class are
|
|
96
|
+
applied by React on mount, so the first frame uses the defaults.
|
|
97
|
+
- **Static hosting needs a history-API fallback** — every unmatched path must
|
|
98
|
+
serve `index.html`, or deep links 404 at the CDN.
|
|
99
|
+
|
|
100
|
+
Re-scaffold without `--rendering spa` to get the SSR layer back.
|
|
101
|
+
|
|
102
|
+
<% } -%>
|
|
49
103
|
## Adding routes
|
|
50
104
|
|
|
51
105
|
`summon` scaffolds the building blocks of the app so new features follow the
|
|
@@ -62,6 +116,15 @@ summon wrapper sidebar # a layout wrapper
|
|
|
62
116
|
```bash
|
|
63
117
|
bun run test # unit + component tests (Vitest, jsdom)
|
|
64
118
|
bun run test:coverage # the same, with a coverage report
|
|
119
|
+
<% if (spa) { -%>
|
|
120
|
+
bun run test:e2e # boots the dev and preview servers and asserts each serves
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`test:e2e` is an end-to-end test *of the build*: it runs both server scripts —
|
|
124
|
+
including the production build that `preview` performs — and asserts that each
|
|
125
|
+
returns a rendered document and serves its client assets with the correct
|
|
126
|
+
content type.
|
|
127
|
+
<% } else { -%>
|
|
65
128
|
bun run test:e2e # boots all six matrix servers and asserts each serves
|
|
66
129
|
```
|
|
67
130
|
|
|
@@ -69,13 +132,18 @@ bun run test:e2e # boots all six matrix servers and asserts each serves
|
|
|
69
132
|
scripts — including the production builds that `preview:*` performs — and asserts
|
|
70
133
|
that every server returns a rendered document and serves its client assets with
|
|
71
134
|
the correct content type.
|
|
135
|
+
<% } -%>
|
|
72
136
|
|
|
73
137
|
## Project structure
|
|
74
138
|
|
|
75
139
|
```
|
|
76
140
|
src/
|
|
141
|
+
<% if (spa) { -%>
|
|
142
|
+
├── client/ Client entry (createRoot)
|
|
143
|
+
<% } else { -%>
|
|
77
144
|
├── client/ Client entry (hydration)
|
|
78
145
|
├── server/ Server entry, compiled renderer, dev servers, sitemap
|
|
146
|
+
<% } -%>
|
|
79
147
|
├── domains/ Feature domains (each owns its routes and pages)
|
|
80
148
|
├── lib/ Shared components
|
|
81
149
|
<% if (relay) { -%>
|
|
@@ -86,7 +154,11 @@ src/
|
|
|
86
154
|
├── assets/ Assets imported in code (bundled and hashed by Vite)
|
|
87
155
|
└── routes.tsx Root route map
|
|
88
156
|
public/ Files served verbatim at a fixed URL (favicon, robots.txt)
|
|
157
|
+
<% if (spa) { -%>
|
|
158
|
+
test/e2e/ The dev + preview end-to-end suite
|
|
159
|
+
<% } else { -%>
|
|
89
160
|
test/e2e/ The 2×3 server-matrix end-to-end suite
|
|
161
|
+
<% } -%>
|
|
90
162
|
```
|
|
91
163
|
|
|
92
164
|
Domains are the unit of feature organisation: each owns its routes and pages, so
|
|
@@ -115,17 +187,28 @@ changes needed.
|
|
|
115
187
|
after editing a `graphql` tag or the schema, run `bun run relay` (or keep
|
|
116
188
|
`bun run relay:watch` running) to regenerate the artifacts, and commit them.
|
|
117
189
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
190
|
+
<% if (spa) { -%>
|
|
191
|
+
**Queries run in the browser.** With no server to prefetch against,
|
|
192
|
+
`useLazyLoadQuery` fetches (and suspends) on mount: the catalog page shows its
|
|
193
|
+
Suspense fallback, then renders once the operation resolves.
|
|
194
|
+
<% } else { -%>
|
|
195
|
+
**SSR prefetches declared queries.** `src/routes.tsx` declares `serverQueries`
|
|
196
|
+
per route; the server awaits the matched route's query before rendering and
|
|
197
|
+
serializes the captured operations into `__INITIAL_DATA__.relayPayloads`, which
|
|
198
|
+
the client entry replays into the browser store — so the catalog page arrives
|
|
199
|
+
server-rendered and does not refetch on hydration.
|
|
200
|
+
<% } -%>
|
|
123
201
|
|
|
124
202
|
<% if (standalone) { -%>
|
|
125
203
|
**Patched dependencies.** `patches/` carries three package patches applied via
|
|
126
204
|
`patchedDependencies` in `package.json` (a bun feature — with another package
|
|
127
205
|
manager, apply the equivalent mechanism): `react-relay@21.0.1` needs a
|
|
206
|
+
<% if (spa) { -%>
|
|
207
|
+
cjs-module-lexer export hint so named imports survive Vite's module runner
|
|
208
|
+
(which vitest uses),
|
|
209
|
+
<% } else { -%>
|
|
128
210
|
cjs-module-lexer export hint so named imports survive Node SSR,
|
|
211
|
+
<% } -%>
|
|
129
212
|
`relay-runtime@21.0.1` needs real runtime bindings for type-only names its
|
|
130
213
|
compiler artifacts import as values (`ConcreteRequest`, `ReaderFragment`,
|
|
131
214
|
`FragmentRefs`), and `relay-runtime-network@0.1.0` ships a broken `imports`
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<% if (spa) { -%>
|
|
7
|
+
<meta name="description" content="<%= name %> — a React application built with the Canonical design system and router packages." />
|
|
8
|
+
<% } else { -%>
|
|
6
9
|
<meta name="description" content="<%= name %> — a React application built with the Canonical design system, router, and SSR packages." />
|
|
10
|
+
<% } -%>
|
|
7
11
|
<link rel="icon" type="image/png" sizes="32x32" href="https://assets.ubuntu.com/v1/be7e4cc6-COF-favicon-32x32.png">
|
|
8
12
|
<title><%= name %></title>
|
|
9
13
|
</head>
|
|
@@ -17,18 +17,28 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"dev": "vite",
|
|
20
|
+
<% if (!spa) { -%>
|
|
20
21
|
"dev:express": "node --import tsx src/server/server.express.ts",
|
|
21
22
|
"dev:bun": "bun src/server/server.bun.ts",
|
|
23
|
+
<% } -%>
|
|
22
24
|
"preview": "bun run build:client && vite preview --outDir dist/client",
|
|
25
|
+
<% if (!spa) { -%>
|
|
23
26
|
"preview:bun": "bun run build:client && bun run build:server && bun src/server/preview.bun.ts",
|
|
24
27
|
"preview:express": "bun run build:client && bun run build:server && node --import tsx src/server/preview.express.ts",
|
|
28
|
+
<% } -%>
|
|
25
29
|
"build": "bun run build:client",
|
|
26
30
|
"build:all": "bun run build:client && bun run build:storybook",
|
|
27
31
|
<% if (intl) { -%>
|
|
28
32
|
"build:storybook": "storybook build",
|
|
29
33
|
<% } -%>
|
|
34
|
+
<%# --ssrManifest exists for the server build's asset lookup; nothing else -%>
|
|
35
|
+
<%# reads the manifest, so the SPA build does not emit one. -%>
|
|
36
|
+
<% if (spa) { -%>
|
|
37
|
+
"build:client": "vite build --outDir dist/client",
|
|
38
|
+
<% } else { -%>
|
|
30
39
|
"build:client": "vite build --ssrManifest --outDir dist/client",
|
|
31
40
|
"build:server": "vite build --mode server",
|
|
41
|
+
<% } -%>
|
|
32
42
|
<% if (!intl) { -%>
|
|
33
43
|
"build:storybook": "storybook build",
|
|
34
44
|
<% } -%>
|
|
@@ -65,7 +75,9 @@
|
|
|
65
75
|
<% } -%>
|
|
66
76
|
"@canonical/react-head": "<%= pragmaVersion %>",
|
|
67
77
|
"@canonical/react-hooks": "<%= pragmaVersion %>",
|
|
78
|
+
<% if (!spa) { -%>
|
|
68
79
|
"@canonical/react-ssr": "<%= pragmaVersion %>",
|
|
80
|
+
<% } -%>
|
|
69
81
|
"@canonical/router-core": "<%= pragmaVersion %>",
|
|
70
82
|
"@canonical/router-react": "<%= pragmaVersion %>",
|
|
71
83
|
<% if (relay) { -%>
|
|
@@ -74,7 +86,9 @@
|
|
|
74
86
|
"@canonical/storybook-addon-utils": "<%= pragmaVersion %>",
|
|
75
87
|
"@canonical/storybook-config": "<%= pragmaVersion %>",
|
|
76
88
|
"@canonical/styles": "<%= pragmaVersion %>",
|
|
89
|
+
<% if (!spa) { -%>
|
|
77
90
|
"express": "^5.2.1",
|
|
91
|
+
<% } -%>
|
|
78
92
|
<% if (relay) { -%>
|
|
79
93
|
"graphql": "^16.11.0",
|
|
80
94
|
<% } -%>
|
|
@@ -98,7 +112,9 @@
|
|
|
98
112
|
"@testing-library/jest-dom": "^6.9.1",
|
|
99
113
|
<% } -%>
|
|
100
114
|
"@testing-library/react": "^16.3.2",
|
|
115
|
+
<% if (!spa) { -%>
|
|
101
116
|
"@types/express": "^5.0.6",
|
|
117
|
+
<% } -%>
|
|
102
118
|
<% if (intl) { -%>
|
|
103
119
|
"@types/node": "^26.0.0",
|
|
104
120
|
<% } else { -%>
|
|
@@ -114,7 +130,9 @@
|
|
|
114
130
|
"@vitejs/plugin-react": "^6.0.0",
|
|
115
131
|
"@vitest/coverage-v8": "^4.0.18",
|
|
116
132
|
"browserslist": "^4.28.1",
|
|
133
|
+
<% if (!spa) { -%>
|
|
117
134
|
"bun-types": "^1.3.9",
|
|
135
|
+
<% } -%>
|
|
118
136
|
"jsdom": "^28.1.0",
|
|
119
137
|
"lightningcss": "^1.32.0",
|
|
120
138
|
<% if (relay) { -%>
|
|
@@ -122,7 +140,9 @@
|
|
|
122
140
|
"relay-test-utils": "^21.0.1",
|
|
123
141
|
<% } -%>
|
|
124
142
|
"storybook": "^10.3.1",
|
|
143
|
+
<% if (!spa) { -%>
|
|
125
144
|
"tsx": "^4.19.0",
|
|
145
|
+
<% } -%>
|
|
126
146
|
"typescript": "^5.9.3",
|
|
127
147
|
"vite": "^8.0.1",
|
|
128
148
|
<% if (relay) { -%>
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
<% if (intl) { -%>
|
|
2
|
+
<% if (spa) { -%>
|
|
3
|
+
import { negotiateLocale } from "@canonical/i18n-core";
|
|
4
|
+
<% } else { -%>
|
|
2
5
|
import { isSupportedLocale, negotiateLocale } from "@canonical/i18n-core";
|
|
6
|
+
<% } -%>
|
|
3
7
|
import { I18nProvider } from "@canonical/i18n-react";
|
|
4
8
|
<% } -%>
|
|
5
9
|
import { HeadProvider } from "@canonical/react-head";
|
|
6
10
|
import { createBrowserAdapter, createRouter } from "@canonical/router-core";
|
|
11
|
+
<%# Without readDehydratedState the specifier list fits on one line, which is -%>
|
|
12
|
+
<%# what the formatter insists on — so the SPA arm cannot share this block. -%>
|
|
13
|
+
<% if (spa) { -%>
|
|
14
|
+
import { Outlet, RouterProvider } from "@canonical/router-react";
|
|
15
|
+
<% } else { -%>
|
|
7
16
|
import {
|
|
8
17
|
Outlet,
|
|
9
18
|
<% if (intl) { -%>
|
|
@@ -14,7 +23,12 @@ import {
|
|
|
14
23
|
RouterProvider,
|
|
15
24
|
<% } -%>
|
|
16
25
|
} from "@canonical/router-react";
|
|
26
|
+
<% } -%>
|
|
27
|
+
<% if (spa) { -%>
|
|
28
|
+
import { createRoot } from "react-dom/client";
|
|
29
|
+
<% } else { -%>
|
|
17
30
|
import { hydrateRoot } from "react-dom/client";
|
|
31
|
+
<% } -%>
|
|
18
32
|
<% if (relay) { -%>
|
|
19
33
|
import { RelayEnvironmentProvider } from "react-relay";
|
|
20
34
|
<% } -%>
|
|
@@ -24,6 +38,11 @@ import { catalogs, i18nConfig } from "#i18n/index.js";
|
|
|
24
38
|
<% if (relay) { -%>
|
|
25
39
|
import { getBrowserEnvironment } from "#relay/environment.js";
|
|
26
40
|
<% } -%>
|
|
41
|
+
<%# Same story: the SPA arm never pulls the two SSR payload symbols, so the three -%>
|
|
42
|
+
<%# base names fit on one line and the formatter requires them there. -%>
|
|
43
|
+
<% if (spa) { -%>
|
|
44
|
+
import { appRoutes, middleware, notFoundRoute } from "../routes.js";
|
|
45
|
+
<% } else { -%>
|
|
27
46
|
import {
|
|
28
47
|
appRoutes,
|
|
29
48
|
middleware,
|
|
@@ -33,8 +52,17 @@ import {
|
|
|
33
52
|
type SerializedRelayPayload,
|
|
34
53
|
<% } -%>
|
|
35
54
|
} from "../routes.js";
|
|
55
|
+
<% } -%>
|
|
36
56
|
import "#styles/index.css";
|
|
37
|
-
<% if (relay) { -%>
|
|
57
|
+
<% if (relay && spa) { -%>
|
|
58
|
+
|
|
59
|
+
// Claim the browser-session Relay environment FIRST — before the router exists
|
|
60
|
+
// — so the first `useLazyLoadQuery` and any warm hook fired during router
|
|
61
|
+
// construction share one store. A client-only app has no server-captured
|
|
62
|
+
// payload to seed from, so the store starts empty and the first query fetches.
|
|
63
|
+
const relayEnvironment = getBrowserEnvironment();
|
|
64
|
+
<% } -%>
|
|
65
|
+
<% if (relay && !spa) { -%>
|
|
38
66
|
|
|
39
67
|
// Seed the browser-session Relay environment FIRST — before the router exists
|
|
40
68
|
// — from the server-captured payloads riding __INITIAL_DATA__ (SSR pages) so
|
|
@@ -54,6 +82,15 @@ const relayEnvironment = getBrowserEnvironment({
|
|
|
54
82
|
});
|
|
55
83
|
<% } -%>
|
|
56
84
|
|
|
85
|
+
<% if (spa) { -%>
|
|
86
|
+
// Nothing was rendered server-side, so there is no dehydrated state to resume
|
|
87
|
+
// from: the router always performs a normal initial load.
|
|
88
|
+
const router = createRouter(appRoutes, {
|
|
89
|
+
adapter: createBrowserAdapter(),
|
|
90
|
+
middleware: [...middleware],
|
|
91
|
+
notFound: notFoundRoute,
|
|
92
|
+
});
|
|
93
|
+
<% } else { -%>
|
|
57
94
|
// On SSR pages __INITIAL_DATA__ carries the flat dehydrated router state
|
|
58
95
|
// (href/kind/routeId/status); hydrating from it resumes the server-rendered
|
|
59
96
|
// match and skips the duplicate initial load. In the SPA cells there is no
|
|
@@ -65,8 +102,24 @@ const router = createRouter(appRoutes, {
|
|
|
65
102
|
notFound: notFoundRoute,
|
|
66
103
|
hydratedState: readDehydratedState() ?? undefined,
|
|
67
104
|
});
|
|
105
|
+
<% } -%>
|
|
68
106
|
|
|
69
|
-
<% if (intl) { -%>
|
|
107
|
+
<% if (intl && spa) { -%>
|
|
108
|
+
/**
|
|
109
|
+
* Resolve the locale for the first client render. Nothing negotiated it
|
|
110
|
+
* server-side, so the pure negotiation runs here: the cookie wins, then the
|
|
111
|
+
* browser's language list (the client-side stand-in for the Accept-Language
|
|
112
|
+
* header).
|
|
113
|
+
*/
|
|
114
|
+
function resolveInitialLocale(): string {
|
|
115
|
+
return negotiateLocale(i18nConfig, {
|
|
116
|
+
cookieHeader: document.cookie,
|
|
117
|
+
acceptLanguage: navigator.languages?.join(",") ?? navigator.language,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
<% } -%>
|
|
122
|
+
<% if (intl && !spa) { -%>
|
|
70
123
|
/**
|
|
71
124
|
* Resolve the locale for the first client render.
|
|
72
125
|
*
|
|
@@ -94,10 +147,15 @@ if (!root) {
|
|
|
94
147
|
throw new Error('Root element "#root" not found');
|
|
95
148
|
}
|
|
96
149
|
|
|
97
|
-
|
|
150
|
+
<%# One mount site, four provider stacks. The stacks differ only by nesting -%>
|
|
151
|
+
<%# depth, so they cannot share a body without changing every indent. -%>
|
|
152
|
+
<% if (spa) { -%>
|
|
153
|
+
createRoot(root).render(
|
|
154
|
+
<% } else { -%>
|
|
98
155
|
hydrateRoot(
|
|
99
156
|
root,
|
|
100
|
-
<%
|
|
157
|
+
<% } -%>
|
|
158
|
+
<% if (relay && intl) { -%>
|
|
101
159
|
<I18nProvider
|
|
102
160
|
config={i18nConfig}
|
|
103
161
|
catalogs={catalogs}
|
|
@@ -111,7 +169,7 @@ hydrateRoot(
|
|
|
111
169
|
</RelayEnvironmentProvider>
|
|
112
170
|
</HeadProvider>
|
|
113
171
|
</I18nProvider>,
|
|
114
|
-
<% } else { -%>
|
|
172
|
+
<% } else if (relay) { -%>
|
|
115
173
|
<HeadProvider>
|
|
116
174
|
<RelayEnvironmentProvider environment={relayEnvironment}>
|
|
117
175
|
<RouterProvider router={router}>
|
|
@@ -119,12 +177,7 @@ hydrateRoot(
|
|
|
119
177
|
</RouterProvider>
|
|
120
178
|
</RelayEnvironmentProvider>
|
|
121
179
|
</HeadProvider>,
|
|
122
|
-
<% } -%>
|
|
123
|
-
);
|
|
124
|
-
<% } else { -%>
|
|
125
|
-
hydrateRoot(
|
|
126
|
-
root,
|
|
127
|
-
<% if (intl) { -%>
|
|
180
|
+
<% } else if (intl) { -%>
|
|
128
181
|
<I18nProvider
|
|
129
182
|
config={i18nConfig}
|
|
130
183
|
catalogs={catalogs}
|
|
@@ -144,4 +197,3 @@ hydrateRoot(
|
|
|
144
197
|
</HeadProvider>,
|
|
145
198
|
<% } -%>
|
|
146
199
|
);
|
|
147
|
-
<% } -%>
|
|
@@ -44,6 +44,15 @@ export default function CatalogPage(): ReactElement {
|
|
|
44
44
|
<code>src/relay/schema.ts</code> — set <code>VITE_GRAPHQL_URL</code> to
|
|
45
45
|
point it at a real endpoint instead.
|
|
46
46
|
</p>
|
|
47
|
+
<% if (spa) { -%>
|
|
48
|
+
{/*
|
|
49
|
+
There is no server to prefetch against, so `useLazyLoadQuery`
|
|
50
|
+
(store-or-network) always goes to the network on first render and
|
|
51
|
+
suspends until it resolves. `canRenderQuery` below is therefore
|
|
52
|
+
always true here — it exists for the SSR arm, where the server may
|
|
53
|
+
have nothing seeded to render from.
|
|
54
|
+
*/}
|
|
55
|
+
<% } else { -%>
|
|
47
56
|
{/*
|
|
48
57
|
SSR: the server prefetches this route's declared query (see
|
|
49
58
|
`serverQueries` in src/routes.tsx) and seeds both render environments
|
|
@@ -53,6 +62,7 @@ export default function CatalogPage(): ReactElement {
|
|
|
53
62
|
second fetch. If the prefetch failed, the query suspends and fetches
|
|
54
63
|
through the active environment instead.
|
|
55
64
|
*/}
|
|
65
|
+
<% } -%>
|
|
56
66
|
{/*
|
|
57
67
|
The canonical Relay pairing: Suspense renders the pending state while
|
|
58
68
|
`useLazyLoadQuery` is in flight, and the ErrorBoundary renders the
|
|
@@ -60,6 +70,7 @@ export default function CatalogPage(): ReactElement {
|
|
|
60
70
|
`VITE_GRAPHQL_URL` mode) — without it a thrown query error would
|
|
61
71
|
unmount the whole tree to a blank page.
|
|
62
72
|
*/}
|
|
73
|
+
<% if (!spa) { -%>
|
|
63
74
|
{/*
|
|
64
75
|
On the server, the query renders only when the SSR prefetch already
|
|
65
76
|
seeded the store — after a failed or timed-out prefetch, querying here
|
|
@@ -68,6 +79,7 @@ export default function CatalogPage(): ReactElement {
|
|
|
68
79
|
markup matches, since a client without payloads paints the same
|
|
69
80
|
fallback via Suspense first.
|
|
70
81
|
*/}
|
|
82
|
+
<% } -%>
|
|
71
83
|
{canRenderQuery ? (
|
|
72
84
|
<% if (intl) { -%>
|
|
73
85
|
<ErrorBoundary fallback={<p role="alert">{t("catalog.error")}</p>}>
|
|
@@ -34,8 +34,8 @@ export const productListQuery = graphql`
|
|
|
34
34
|
* renders a `ProductCard` (a `useFragment` child) per edge.
|
|
35
35
|
*
|
|
36
36
|
* The hook suspends while the query is in flight, so render this component
|
|
37
|
-
* inside a `Suspense` boundary
|
|
38
|
-
*
|
|
37
|
+
* inside a `Suspense` boundary. Whether it may render at all is
|
|
38
|
+
* `CatalogPage`'s call: on the server it renders only from a seeded store.
|
|
39
39
|
*/
|
|
40
40
|
export default function ProductList(): ReactElement {
|
|
41
41
|
<% if (intl) { -%>
|
|
@@ -45,12 +45,21 @@ export default function HomePage(): ReactElement {
|
|
|
45
45
|
<% } else { -%>
|
|
46
46
|
<h2>Streaming with Suspense</h2>
|
|
47
47
|
<% } -%>
|
|
48
|
+
<% if (spa) { -%>
|
|
49
|
+
<p>
|
|
50
|
+
<code>LazyComponent</code> reads a synthetic delayed fetch with React 19{" "}
|
|
51
|
+
<code>use()</code>, so it suspends. Inside this <code>Suspense</code>{" "}
|
|
52
|
+
boundary the rest of the page renders immediately and the fallback
|
|
53
|
+
stands in until the resolved content swaps itself back in.
|
|
54
|
+
</p>
|
|
55
|
+
<% } else { -%>
|
|
48
56
|
<p>
|
|
49
57
|
<code>LazyComponent</code> reads a synthetic delayed fetch with React 19{" "}
|
|
50
58
|
<code>use()</code>, so it suspends. Inside this <code>Suspense</code>{" "}
|
|
51
59
|
boundary the server streams the page shell first, shows the fallback,
|
|
52
60
|
then flushes the resolved content in — no full client round-trip.
|
|
53
61
|
</p>
|
|
62
|
+
<% } -%>
|
|
54
63
|
<% if (intl) { -%>
|
|
55
64
|
<Suspense fallback={<p>{t("home.streamFallback")}</p>}>
|
|
56
65
|
<% } else { -%>
|
|
@@ -13,9 +13,13 @@ import {
|
|
|
13
13
|
} from "@canonical/router-core";
|
|
14
14
|
import type { ReactElement, ReactNode } from "react";
|
|
15
15
|
import accountRoutes from "#domains/account/routes.js";
|
|
16
|
-
|
|
16
|
+
<%# getRequest and the ProductList pair exist only for serverQueries and -%>
|
|
17
|
+
<%# resolveRelayPayloads, which the SPA arm omits; catalogRoutes is always used. -%>
|
|
18
|
+
<% if (relay && !spa) { -%>
|
|
17
19
|
import { getRequest } from "relay-runtime";
|
|
18
20
|
import { PAGE_SIZE, productListQuery } from "#domains/catalog/ProductList.js";
|
|
21
|
+
<% } -%>
|
|
22
|
+
<% if (relay) { -%>
|
|
19
23
|
import catalogRoutes from "#domains/catalog/routes.js";
|
|
20
24
|
<% } -%>
|
|
21
25
|
<% if (forms) { -%>
|
|
@@ -23,7 +27,7 @@ import contactRoutes from "#domains/contact/routes.js";
|
|
|
23
27
|
<% } -%>
|
|
24
28
|
import marketingRoutes from "#domains/marketing/routes.js";
|
|
25
29
|
import Navigation from "#lib/Navigation/index.js";
|
|
26
|
-
<% if (relay) { -%>
|
|
30
|
+
<% if (relay && !spa) { -%>
|
|
27
31
|
import type { RelaySeedPayload } from "#relay/environment.js";
|
|
28
32
|
<% } -%>
|
|
29
33
|
|
|
@@ -35,6 +39,9 @@ function hasDemoAuth(search: unknown): boolean {
|
|
|
35
39
|
return authValue === "1";
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
<%# Server-only: its single consumer is src/server/entry.tsx, which the SPA arm does -%>
|
|
43
|
+
<%# not emit. The client path guards the same routes through withAuth below. -%>
|
|
44
|
+
<% if (!spa) { -%>
|
|
38
45
|
/**
|
|
39
46
|
* Auth decision for an already-matched route, from the router's own data —
|
|
40
47
|
* the matched pattern and the schema-validated search. Deriving it from the
|
|
@@ -53,6 +60,7 @@ export function getAuthRedirectForMatch(match: {
|
|
|
53
60
|
return `/login?from=${encodeURIComponent(match.pathname)}`;
|
|
54
61
|
}
|
|
55
62
|
|
|
63
|
+
<% } -%>
|
|
56
64
|
export function withAuth(loginPath: string): RouteMiddleware {
|
|
57
65
|
return <TRoute extends AnyRoute>(currentRoute: TRoute): TRoute => {
|
|
58
66
|
if (!protectedPaths.has(currentRoute.url)) {
|
|
@@ -142,9 +150,16 @@ const [contact] = group(publicLayout, [contactRoutes.contact] as const);
|
|
|
142
150
|
const [catalog] = group(publicLayout, [catalogRoutes.catalog] as const);
|
|
143
151
|
|
|
144
152
|
<% } -%>
|
|
153
|
+
<% if (spa) { -%>
|
|
154
|
+
// Static redirect route: matched entirely from the URL, no content — the
|
|
155
|
+
// router resolves it client-side. There is no server to answer a cold request
|
|
156
|
+
// with a real 301. Static redirects accept 301 or 308 only; runtime redirect()
|
|
157
|
+
// covers the 302 family.
|
|
158
|
+
<% } else { -%>
|
|
145
159
|
// Static redirect route: matched entirely from the URL, no content — the
|
|
146
160
|
// router (and the SSR disposition helper) answers with a real 301. Static
|
|
147
161
|
// redirects accept 301 or 308 only; runtime redirect() covers the 302 family.
|
|
162
|
+
<% } -%>
|
|
148
163
|
const legacyHome = route({
|
|
149
164
|
url: "/home",
|
|
150
165
|
redirect: "/",
|
|
@@ -173,6 +188,9 @@ declare module "@canonical/router-react" {
|
|
|
173
188
|
}
|
|
174
189
|
}
|
|
175
190
|
|
|
191
|
+
<%# Declared for every flag combination EXCEPT the SPA arm, which has no server -%>
|
|
192
|
+
<%# layer whose signatures need to stay uniform. -%>
|
|
193
|
+
<% if (!spa) { -%>
|
|
176
194
|
/**
|
|
177
195
|
* A GraphQL operation captured on the server and replayed on the client:
|
|
178
196
|
* the operation name identifies the query, `variables` rebuilds the operation
|
|
@@ -187,7 +205,8 @@ export interface SerializedRelayPayload {
|
|
|
187
205
|
readonly data: Record<string, unknown>;
|
|
188
206
|
}
|
|
189
207
|
|
|
190
|
-
<%
|
|
208
|
+
<% } -%>
|
|
209
|
+
<% if (relay && !spa) { -%>
|
|
191
210
|
/**
|
|
192
211
|
* Per-route server queries: what the SSR layer fetches (and serializes) for a
|
|
193
212
|
* matched route before rendering it. Keyed by the route ids that
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
// @vitest-environment node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
<% if (spa) { -%>
|
|
5
|
+
* End-to-end test of the build: boot each of the two server scripts (`dev` and
|
|
6
|
+
* `preview`) and assert it serves correctly over HTTP. The defects this guards
|
|
7
|
+
* against live at the HTTP/content-type layer (assets served as text/html; a
|
|
8
|
+
* 500 page), so fetch-level assertions catch them — no browser needed.
|
|
9
|
+
*
|
|
10
|
+
* Each cell runs its real package.json script — including the build that
|
|
11
|
+
* `preview` performs — so the test mirrors the actual user experience. `dev`
|
|
12
|
+
* boots in a second or two (tight readiness budget); `preview` builds the
|
|
13
|
+
* client first, so it gets a larger budget. Kept out of the default `test` run
|
|
14
|
+
* via the `*.e2e.ts` name; invoke with `bun run test:e2e`.
|
|
15
|
+
<% } else { -%>
|
|
4
16
|
* End-to-end test of the build: boot each of the 2×3 server scripts and assert
|
|
5
17
|
* it serves correctly over HTTP. The defects this guards against live at the
|
|
6
18
|
* HTTP/content-type layer (assets served as text/html; a 500 page), so
|
|
@@ -12,14 +24,20 @@
|
|
|
12
24
|
* `preview*` cells build the client + compile the renderer first, so they get a
|
|
13
25
|
* larger budget. Kept out of the default `test` run via the `*.e2e.ts` name;
|
|
14
26
|
* invoke with `bun run test:e2e`.
|
|
27
|
+
<% } -%>
|
|
15
28
|
*/
|
|
16
29
|
import { describe, expect, it } from "vitest";
|
|
17
30
|
import { startServer } from "./serverHarness.js";
|
|
18
31
|
|
|
19
32
|
const CWD = process.cwd();
|
|
20
33
|
|
|
34
|
+
<% if (spa) { -%>
|
|
35
|
+
// Readiness budgets: dev boots straight away; preview builds the client before
|
|
36
|
+
// serving, so it needs a larger budget.
|
|
37
|
+
<% } else { -%>
|
|
21
38
|
// Readiness budgets: dev* boots straight away; preview* builds the client +
|
|
22
39
|
// renderer before serving, so it needs a larger budget.
|
|
40
|
+
<% } -%>
|
|
23
41
|
const DEV_READY_MS = 20_000;
|
|
24
42
|
const PREVIEW_READY_MS = 90_000;
|
|
25
43
|
const TEST_TIMEOUT_MS = PREVIEW_READY_MS + 30_000;
|
|
@@ -27,6 +45,16 @@ const TEST_TIMEOUT_MS = PREVIEW_READY_MS + 30_000;
|
|
|
27
45
|
interface Cell {
|
|
28
46
|
/** package.json script to run. */
|
|
29
47
|
script: string;
|
|
48
|
+
<% if (spa) { -%>
|
|
49
|
+
/** Readiness budget for this cell's boot (and build, for preview). */
|
|
50
|
+
timeoutMs: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const MATRIX: Cell[] = [
|
|
54
|
+
{ script: "dev", timeoutMs: DEV_READY_MS },
|
|
55
|
+
{ script: "preview", timeoutMs: PREVIEW_READY_MS },
|
|
56
|
+
];
|
|
57
|
+
<% } else { -%>
|
|
30
58
|
/** Readiness budget for this cell's boot (and build, for preview*). */
|
|
31
59
|
timeoutMs: number;
|
|
32
60
|
/**
|
|
@@ -45,11 +73,16 @@ const MATRIX: Cell[] = [
|
|
|
45
73
|
{ script: "preview:bun", timeoutMs: PREVIEW_READY_MS, ssr: true },
|
|
46
74
|
{ script: "preview:express", timeoutMs: PREVIEW_READY_MS, ssr: true },
|
|
47
75
|
];
|
|
76
|
+
<% } -%>
|
|
48
77
|
|
|
49
78
|
/** A JS/TS module or CSS-as-JS asset must never come back as the HTML page. */
|
|
50
79
|
const JS_CONTENT_TYPE = /javascript/;
|
|
51
80
|
|
|
81
|
+
<% if (spa) { -%>
|
|
82
|
+
describe("server matrix (dev + preview) serves correctly", () => {
|
|
83
|
+
<% } else { -%>
|
|
52
84
|
describe("server matrix (2×3) serves correctly", () => {
|
|
85
|
+
<% } -%>
|
|
53
86
|
for (const cell of MATRIX) {
|
|
54
87
|
it(
|
|
55
88
|
`${cell.script} serves an HTML page and JS assets (not HTML)`,
|
|
@@ -77,6 +110,7 @@ describe("server matrix (2×3) serves correctly", () => {
|
|
|
77
110
|
const asset = await fetch(new URL(scriptSrc as string, server.base));
|
|
78
111
|
expect(asset.status).toBe(200);
|
|
79
112
|
expect(asset.headers.get("content-type")).toMatch(JS_CONTENT_TYPE);
|
|
113
|
+
<% if (!spa) { -%>
|
|
80
114
|
|
|
81
115
|
// 4. SSR cells render /sitemap.xml as XML from the sitemap renderer —
|
|
82
116
|
// the second renderer, picked by path, never the HTML app. (The SPA
|
|
@@ -90,7 +124,9 @@ describe("server matrix (2×3) serves correctly", () => {
|
|
|
90
124
|
expect(xml).toContain("<loc>");
|
|
91
125
|
}
|
|
92
126
|
|
|
127
|
+
<% } -%>
|
|
93
128
|
<% if (intl) { -%>
|
|
129
|
+
<% if (!spa) { -%>
|
|
94
130
|
// 5. SSR cells negotiate the locale per request (i18n-core:
|
|
95
131
|
// cookie > Accept-Language > default) and render the translated
|
|
96
132
|
// document server-side: `<html lang dir>` plus the localized
|
|
@@ -114,6 +150,8 @@ describe("server matrix (2×3) serves correctly", () => {
|
|
|
114
150
|
}
|
|
115
151
|
|
|
116
152
|
<% } -%>
|
|
153
|
+
<% } -%>
|
|
154
|
+
<% if (!spa) { -%>
|
|
117
155
|
// SSR cells answer with the router's disposition: a matched
|
|
118
156
|
// not-found page is a real 404, static redirect routes and the
|
|
119
157
|
// auth guard are real HTTP redirects, and an authorized request
|
|
@@ -170,6 +208,8 @@ describe("server matrix (2×3) serves correctly", () => {
|
|
|
170
208
|
expect(authorized.status).toBe(200);
|
|
171
209
|
}
|
|
172
210
|
|
|
211
|
+
<% } -%>
|
|
212
|
+
<% if (!spa) { -%>
|
|
173
213
|
// SSR cells serialize Relay data across the boundary (when the app
|
|
174
214
|
// was scaffolded with --relay): the catalog page arrives with
|
|
175
215
|
// server-rendered product markup and carries the captured operation
|
|
@@ -187,6 +227,7 @@ describe("server matrix (2×3) serves correctly", () => {
|
|
|
187
227
|
const home = await fetch(`${server.base}/`);
|
|
188
228
|
expect(await home.text()).not.toContain("relayPayloads");
|
|
189
229
|
}
|
|
230
|
+
<% } -%>
|
|
190
231
|
} finally {
|
|
191
232
|
await server.stop();
|
|
192
233
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import react from "@vitejs/plugin-react";
|
|
2
2
|
import browserslist from "browserslist";
|
|
3
3
|
import { browserslistToTargets } from "lightningcss";
|
|
4
|
+
<% if (spa) { -%>
|
|
5
|
+
import { defineConfig, type UserConfig } from "vite";
|
|
6
|
+
<% } else { -%>
|
|
4
7
|
import { defineConfig } from "vite";
|
|
8
|
+
<% } -%>
|
|
5
9
|
<% if (relay) { -%>
|
|
6
10
|
import relay from "vite-plugin-relay-lite";
|
|
7
11
|
<% } -%>
|
|
@@ -10,6 +14,15 @@ import relay from "vite-plugin-relay-lite";
|
|
|
10
14
|
// in package.json "imports" and resolved natively by Vite — no resolver plugin.
|
|
11
15
|
const PORT = Number(process.env.PORT) || undefined;
|
|
12
16
|
|
|
17
|
+
<% if (spa) { -%>
|
|
18
|
+
// Every command (`dev`, `build:client`, `preview`) serves the same client
|
|
19
|
+
// build (`--outDir dist/client`); there is no second, server-mode pass, so
|
|
20
|
+
// the config takes no mode. It is a named const because a zero-arg config
|
|
21
|
+
// function gets no contextual type from Vite, so every string literal below
|
|
22
|
+
// would widen (`transformer: string`, `cssMinify: string`, ...) and
|
|
23
|
+
// defineConfig would reject the object.
|
|
24
|
+
const config: UserConfig = {
|
|
25
|
+
<% } else { -%>
|
|
13
26
|
// `build:server` runs `vite build --mode server` to compile the two server
|
|
14
27
|
// renderers in a single pass. Each is a separate, individually-instantiated
|
|
15
28
|
// Lego brick, so they are named Rollup inputs — the build emits
|
|
@@ -18,6 +31,7 @@ const PORT = Number(process.env.PORT) || undefined;
|
|
|
18
31
|
// (`dev`, `build:client`, `preview`) uses the default mode and the SPA client
|
|
19
32
|
// build (`--ssrManifest --outDir dist/client`).
|
|
20
33
|
export default defineConfig(({ mode }) => ({
|
|
34
|
+
<% } -%>
|
|
21
35
|
<% if (relay) { -%>
|
|
22
36
|
// Relay's `graphql\`...\`` tags must be rewritten into imports of the
|
|
23
37
|
// compiler-generated artifacts. `@vitejs/plugin-react` v6 is OXC-based (no
|
|
@@ -39,8 +53,12 @@ export default defineConfig(({ mode }) => ({
|
|
|
39
53
|
<% } else { -%>
|
|
40
54
|
plugins: [react()],
|
|
41
55
|
<% } -%>
|
|
56
|
+
<% if (spa) { -%>
|
|
57
|
+
// Honour the PORT env var for `dev` and `preview` alike.
|
|
58
|
+
<% } else { -%>
|
|
42
59
|
// Honour the PORT env var for `dev` (SPA) and `preview` so all server scripts
|
|
43
60
|
// — including the SSR ones, which already read PORT — respond to it uniformly.
|
|
61
|
+
<% } -%>
|
|
44
62
|
server: { port: PORT },
|
|
45
63
|
preview: { port: PORT },
|
|
46
64
|
// CSS delivery is the app's job, not the libraries': @canonical/* packages
|
|
@@ -56,10 +74,16 @@ export default defineConfig(({ mode }) => ({
|
|
|
56
74
|
lightningcss: { targets: browserslistToTargets(browserslist()) },
|
|
57
75
|
},
|
|
58
76
|
build: {
|
|
77
|
+
<% if (spa) { -%>
|
|
78
|
+
// Minify CSS with Lightning CSS too (instead of the esbuild default), so
|
|
79
|
+
// a single tool owns both downleveling and minification.
|
|
80
|
+
<% } else { -%>
|
|
59
81
|
// Minify CSS with Lightning CSS too (instead of the esbuild default), so
|
|
60
82
|
// a single tool owns both downleveling and minification — in the client
|
|
61
83
|
// build and the server build alike.
|
|
84
|
+
<% } -%>
|
|
62
85
|
cssMinify: "lightningcss",
|
|
86
|
+
<% if (!spa) { -%>
|
|
63
87
|
...(mode === "server"
|
|
64
88
|
? {
|
|
65
89
|
ssr: true,
|
|
@@ -72,8 +96,20 @@ export default defineConfig(({ mode }) => ({
|
|
|
72
96
|
},
|
|
73
97
|
}
|
|
74
98
|
: undefined),
|
|
99
|
+
<% } -%>
|
|
75
100
|
},
|
|
101
|
+
<%# The `ssr` key stays in the SPA arm on purpose: this app never runs a -%>
|
|
102
|
+
<%# server, but vitest resolves modules through Vite's SSR (Node-style) -%>
|
|
103
|
+
<%# pipeline, so the same externalisation rules apply to `bun run test`. -%>
|
|
76
104
|
ssr: {
|
|
105
|
+
<% if (spa) { -%>
|
|
106
|
+
// Read by vitest, not by a server: it loads modules through Vite's SSR
|
|
107
|
+
// (Node-style) resolver, which ignores packages that declare only a
|
|
108
|
+
// "module" entry (ERR_RESOLVE_PACKAGE_ENTRY_FAIL) and cannot load the CSS
|
|
109
|
+
// side-effect imports in their built output (ERR_UNKNOWN_FILE_EXTENSION).
|
|
110
|
+
// Bundling the whole @canonical scope sidesteps both, for any current or
|
|
111
|
+
// future dependency.
|
|
112
|
+
<% } else { -%>
|
|
77
113
|
// Bundle @canonical/* for SSR rather than externalising them, for two
|
|
78
114
|
// reasons: (1) some packages declare only a "module" entry (no
|
|
79
115
|
// "main"/"exports"), which Vite's SSR (Node-style) resolver ignores —
|
|
@@ -82,7 +118,8 @@ export default defineConfig(({ mode }) => ({
|
|
|
82
118
|
// which Node cannot load (ERR_UNKNOWN_FILE_EXTENSION) but Vite's SSR
|
|
83
119
|
// transform no-ops. The regex covers the whole scope so any current or
|
|
84
120
|
// future @canonical dependency is handled.
|
|
85
|
-
<%
|
|
121
|
+
<% } -%>
|
|
122
|
+
<% if (relay && !spa) { -%>
|
|
86
123
|
//
|
|
87
124
|
// The Relay packages (react-relay, relay-runtime, relay-runtime-network,
|
|
88
125
|
// graphql) stay externalised like react itself. Three packaging defects
|
|
@@ -98,4 +135,12 @@ export default defineConfig(({ mode }) => ({
|
|
|
98
135
|
<% } -%>
|
|
99
136
|
noExternal: [/^@canonical\//],
|
|
100
137
|
},
|
|
138
|
+
<% if (spa) { -%>
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// Exported as a config FUNCTION, not the object: vitest.config.ts resolves
|
|
142
|
+
// it with viteConfig({ command, mode }) before merging its own settings in.
|
|
143
|
+
export default defineConfig(() => config);
|
|
144
|
+
<% } else { -%>
|
|
101
145
|
}));
|
|
146
|
+
<% } -%>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/application/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,wBAAwB,CAAC;AAwBhC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/application/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,wBAAwB,CAAC;AAwBhC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AA+FD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,uBAAuB,CAqjBlE,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/summon-application",
|
|
3
3
|
"description": "Summon generators for application scaffolding: domain, route, and wrapper",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.37.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"test": "vitest run"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@canonical/summon-core": "^0.
|
|
40
|
-
"@canonical/task": "^0.
|
|
41
|
-
"@canonical/utils": "^0.
|
|
39
|
+
"@canonical/summon-core": "^0.37.0",
|
|
40
|
+
"@canonical/task": "^0.37.0",
|
|
41
|
+
"@canonical/utils": "^0.37.0",
|
|
42
42
|
"typescript": "^5.9.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@biomejs/biome": "2.4.9",
|
|
46
|
-
"@canonical/biome-config": "^0.
|
|
47
|
-
"@canonical/webarchitect": "^0.
|
|
46
|
+
"@canonical/biome-config": "^0.37.0",
|
|
47
|
+
"@canonical/webarchitect": "^0.37.0",
|
|
48
48
|
"@types/node": "^26.0.0",
|
|
49
49
|
"vitest": "^4.0.18"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "ac8383bdb4be1bcd6fa6c4960a1e3d78c0279688"
|
|
52
52
|
}
|