@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
@@ -1,5 +1,7 @@
1
- import { createRequire } from "node:module";
2
- import { exec, flatMap, info, map, pure, recover } from "@canonical/task";
1
+ import { readFileSync } from "node:fs";
2
+ import * as path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { info, map } from "@canonical/task";
3
5
  /**
4
6
  * Resolve the pragma workspace version range that a generated app should pin
5
7
  * for the @canonical/* packages it depends on directly — react-ds-global(-form),
@@ -12,77 +14,107 @@ import { exec, flatMap, info, map, pure, recover } from "@canonical/task";
12
14
  * - `@canonical/design-tokens` is versioned SEPARATELY and is NOT pinned here —
13
15
  * it reaches the app transitively via `@canonical/styles`, which owns its range.
14
16
  *
15
- * Resolution strategy (in order):
16
- * 1. At summon time, query the npm registry for the latest published version of
17
- * a representative workspace package and pin `^<latest>`. This keeps freshly
18
- * scaffolded apps on the newest release without a manual bump here.
19
- * 2. If the query fails (offline, registry down, npm missing), fall back to the
20
- * version of the generator itself — because summon-application is released in
21
- * lockstep with the rest of the workspace, its own version is the correct
22
- * release line for the app it just generated. This is always at least as
23
- * fresh as the generator binary in use.
17
+ * Resolution is fully offline, by design: `pragma create` performs no network
18
+ * calls. The generator pins the version of the release line it belongs to —
19
+ * summon-application is published in lockstep with the workspace packages an
20
+ * app depends on, so `^<own version>` is always release-correct, and two
21
+ * scaffolds of the same generator are byte-identical (a registry lookup here
22
+ * once made concurrent scaffolds race the network and diverge).
24
23
  */
25
- const require = createRequire(import.meta.url);
24
+ const OWN_PACKAGE = "@canonical/summon-application";
26
25
  /**
27
- * A representative workspace package whose `latest` dist-tag tracks the shared
28
- * lerna release line. Any of the co-released packages would do; styles is a
29
- * root dependency of every generated app.
26
+ * Walk up from `from` until a `package.json` names `packageName`, and return
27
+ * its version. A manifest that is unreadable, is not JSON, names another
28
+ * package, or carries no version is just an ancestor directory that happens to
29
+ * hold a `package.json`, so the walk continues; running out of parents yields
30
+ * "unknown".
31
+ *
32
+ * @note Impure — reads the filesystem.
30
33
  */
31
- const REPRESENTATIVE_PACKAGE = "@canonical/styles";
32
- /** Read a package's version from the installed tree (offline fallback). */
33
- function readVersion(packageName) {
34
- try {
35
- const pkg = require(`${packageName}/package.json`);
36
- return pkg.version ?? "unknown";
34
+ function findVersionAbove(from, packageName) {
35
+ let dir = from;
36
+ for (;;) {
37
+ try {
38
+ const manifest = JSON.parse(readFileSync(path.join(dir, "package.json"), "utf-8"));
39
+ if (manifest.name === packageName && manifest.version) {
40
+ return manifest.version;
41
+ }
42
+ }
43
+ catch {
44
+ // No readable manifest at this level — keep walking.
45
+ }
46
+ const parent = path.dirname(dir);
47
+ if (parent === dir) {
48
+ return "unknown";
49
+ }
50
+ dir = parent;
37
51
  }
38
- catch {
39
- return "unknown";
52
+ }
53
+ /**
54
+ * Read an installed package's version. Not `require("<pkg>/package.json")`:
55
+ * none of the workspace packages export `./package.json` (and their ESM-only
56
+ * exports maps make `require.resolve` itself throw), so module resolution is
57
+ * avoided entirely — the standard `node_modules/<name>/package.json` location
58
+ * is probed at each ancestor of this module instead, exactly the way node
59
+ * itself would look the package up.
60
+ *
61
+ * @note Impure — reads the filesystem.
62
+ */
63
+ export function readVersion(packageName) {
64
+ let dir = path.dirname(fileURLToPath(import.meta.url));
65
+ for (;;) {
66
+ try {
67
+ const manifest = JSON.parse(readFileSync(path.join(dir, "node_modules", ...packageName.split("/"), "package.json"), "utf-8"));
68
+ if (manifest.version) {
69
+ return manifest.version;
70
+ }
71
+ }
72
+ catch {
73
+ // No such package at this level — keep walking.
74
+ }
75
+ const parent = path.dirname(dir);
76
+ if (parent === dir) {
77
+ return "unknown";
78
+ }
79
+ dir = parent;
40
80
  }
41
81
  }
42
82
  /**
43
- * The generator's own release-line version, used as the offline fallback range.
83
+ * This generator's own version, read by walking up from THIS module — correct
84
+ * from `src/` and from `dist/esm/` alike, with no build-layout coupling (see
85
+ * summon-package's packageVersion for the full rationale). Lazy and cached so
86
+ * importing this module performs no IO.
87
+ */
88
+ let cachedOwnVersion;
89
+ export function ownVersion() {
90
+ cachedOwnVersion ??= findVersionAbove(path.dirname(fileURLToPath(import.meta.url)), OWN_PACKAGE);
91
+ return cachedOwnVersion;
92
+ }
93
+ /**
94
+ * The generator's own release-line version, used as the pinned range.
44
95
  * summon-application is published in lockstep with the workspace packages an app
45
- * depends on, so `^<own version>` is a safe, non-stale default.
96
+ * depends on, so `^<own version>` is a safe, non-stale default. The module
97
+ * always sits inside its own package, so the walk cannot miss in practice; the
98
+ * "latest" escape survives only as a last resort for a mangled installation.
46
99
  */
47
- function fallbackRange() {
48
- const own = readVersion("@canonical/summon-application");
100
+ function pinnedRange() {
101
+ const own = ownVersion();
49
102
  return own === "unknown" ? "latest" : `^${own}`;
50
103
  }
51
- const coreVersion = readVersion("@canonical/summon-core");
52
- const appVersion = readVersion("@canonical/summon-application");
53
- const SEMVER = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/;
54
104
  /**
55
- * Resolve the version range as a Task, so the npm query participates in the
56
- * generator pipeline (dry-run visible, cancellable) instead of firing on module
57
- * import. Runs `npm view <pkg> version`; on any failure or unparseable output it
58
- * yields the offline fallback range.
59
- *
60
- * @note Impure — spawns `npm` and reads the registry over the network.
105
+ * Resolve the version range as a Task so the decision is visible in the
106
+ * generator pipeline (dry-run included). Deterministic and offline: the range
107
+ * comes from the installed generator's own release line.
61
108
  */
62
109
  export function resolvePragmaVersion() {
63
- const fallback = fallbackRange();
64
- return flatMap(
65
- // A missing `npm` binary makes the spawn reject (a task failure) rather
66
- // than resolve with a nonzero exit code, so recover to a synthetic failed
67
- // ExecResult. Both spawn errors and nonzero exits then flow through the
68
- // single fallback branch below.
69
- recover(exec("npm", ["view", REPRESENTATIVE_PACKAGE, "version"], undefined, {
70
- // Best-effort lookup — never let a registry miss undo prior file writes.
71
- undo: null,
72
- }), () => pure({ stdout: "", stderr: "", exitCode: 1 })), (result) => {
73
- const latest = result.stdout.trim();
74
- if (result.exitCode === 0 && SEMVER.test(latest)) {
75
- return map(info(`Pinning @canonical/* packages to ^${latest} (latest on npm).`), () => `^${latest}`);
76
- }
77
- return map(info(`Could not reach npm for the latest @canonical/* version; ` +
78
- `pinning ${fallback} (from the installed generator).`), () => fallback);
79
- });
110
+ const pinned = pinnedRange();
111
+ return map(info(`Pinning @canonical/* packages to ${pinned} (the installed generator's release line).`), () => pinned);
80
112
  }
81
113
  /**
82
114
  * Print a version table for the current generator run.
83
115
  */
84
116
  export function printVersions(generatorName) {
85
- return info(`@canonical/summon-core ${coreVersion}\n` +
86
- `@canonical/summon-application ${appVersion} (${generatorName})`);
117
+ return info(`@canonical/summon-core ${readVersion("@canonical/summon-core")}\n` +
118
+ `@canonical/summon-application ${ownVersion()} (${generatorName})`);
87
119
  }
88
120
  //# sourceMappingURL=versions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../src/shared/versions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAEnD,2EAA2E;AAC3E,SAAS,WAAW,CAAC,WAAmB;IACtC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,WAAW,eAAe,CAAC,CAAC;QACnD,OAAO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AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,OAAO,GAAG,CACR,IAAI,CACF,oCAAoC,MAAM,4CAA4C,CACvF,EACD,GAAG,EAAE,CAAC,MAAM,CACb,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,aAAqB;IACjD,OAAO,IAAI,CACT,kCAAkC,WAAW,CAAC,wBAAwB,CAAC,IAAI;QACzE,kCAAkC,UAAU,EAAE,MAAM,aAAa,GAAG,CACvE,CAAC;AACJ,CAAC"}
@@ -55,6 +55,43 @@ function readWorkspaceGlobs(manifestPath) {
55
55
  const patterns = globs.filter((glob) => typeof glob === "string" && glob.length > 0);
56
56
  return patterns.length > 0 ? patterns : null;
57
57
  }
58
+ /**
59
+ * Read the member patterns from a `pnpm-workspace.yaml` with a minimal
60
+ * parser: the top-level `packages:` block's `- pattern` items (quoted or
61
+ * bare, `!`-negations preserved). Returns `null` when the file is missing,
62
+ * unreadable, or declares no patterns — a malformed file up the tree must
63
+ * not break scaffolding, and full YAML is deliberately out of scope.
64
+ *
65
+ * @note Impure — reads the filesystem.
66
+ */
67
+ function readPnpmWorkspaceGlobs(yamlPath) {
68
+ let content;
69
+ try {
70
+ content = readFileSync(yamlPath, "utf8");
71
+ }
72
+ catch {
73
+ return null;
74
+ }
75
+ const patterns = [];
76
+ let inPackages = false;
77
+ for (const line of content.split("\n")) {
78
+ if (/^packages\s*:/.test(line)) {
79
+ inPackages = true;
80
+ continue;
81
+ }
82
+ // A new top-level key ends the block.
83
+ if (inPackages && /^\S/.test(line)) {
84
+ break;
85
+ }
86
+ if (!inPackages)
87
+ continue;
88
+ const item = /^\s*-\s*(['"]?)(.+?)\1\s*$/.exec(line);
89
+ if (item?.[2]) {
90
+ patterns.push(item[2]);
91
+ }
92
+ }
93
+ return patterns.length > 0 ? patterns : null;
94
+ }
58
95
  /** Escape a literal glob segment for regex use, keeping `*`/`?` wildcards. */
59
96
  function compileGlobSegment(segment) {
60
97
  return segment
@@ -119,6 +156,26 @@ export function findEnclosingWorkspaceRoot(appDirectory) {
119
156
  return current;
120
157
  }
121
158
  }
159
+ // A pnpm workspace declares its members in pnpm-workspace.yaml, not in
160
+ // package.json `workspaces`. Membership is decided by its `packages`
161
+ // patterns (including `!` exclusions), so match them rather than claiming
162
+ // every descendant — a non-member below a pnpm root is standalone and
163
+ // still needs its app-local patches.
164
+ const pnpmGlobs = readPnpmWorkspaceGlobs(path.join(current, "pnpm-workspace.yaml"));
165
+ if (pnpmGlobs !== null) {
166
+ const relativePath = path
167
+ .relative(current, target)
168
+ .split(path.sep)
169
+ .join("/");
170
+ const includes = pnpmGlobs.filter((glob) => !glob.startsWith("!"));
171
+ const excludes = pnpmGlobs
172
+ .filter((glob) => glob.startsWith("!"))
173
+ .map((glob) => glob.slice(1));
174
+ if (coversRelativePath(includes, relativePath) &&
175
+ !coversRelativePath(excludes, relativePath)) {
176
+ return current;
177
+ }
178
+ }
122
179
  const parent = path.dirname(current);
123
180
  if (parent === current)
124
181
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../src/shared/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;GASG;AACH,SAAS,kBAAkB,CAAC,YAAoB;IAC9C,IAAI,QAAiB,CAAC;IACtB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI;QAAE,OA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UAAU,CAAC,GAAG,CAAC,CAAC;iBACtC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAChC,IACE,kBAAkB,CAAC,QAAQ,EAAE,YAAY,CAAC;gBAC1C,CAAC,kBAAkB,CAAC,QAAQ,EAAE,YAAY,CAAC,EAC3C,CAAC;gBACD,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QACpC,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -2,6 +2,8 @@ import * as path from "node:path";
2
2
  import { exists, fail, flatMap, info, mkdir, sequence_, writeFile, } from "@canonical/task";
3
3
  import { toKebabCase, toPascalCase } from "@canonical/utils";
4
4
  import { normalizeCommandPath } from "../shared/casing.js";
5
+ import { packageVersion } from "../shared/packageVersion.js";
6
+ import { validateCommandPath } from "../shared/validators.js";
5
7
  const prompts = [
6
8
  {
7
9
  name: "wrapperName",
@@ -9,6 +11,11 @@ const prompts = [
9
11
  message: "Wrapper name (for example settings):",
10
12
  default: "example",
11
13
  positional: true,
14
+ validate: validateCommandPath({
15
+ label: "Wrapper name",
16
+ maxSegments: 1,
17
+ example: "settings",
18
+ }),
12
19
  group: "Wrapper",
13
20
  },
14
21
  ];
@@ -34,7 +41,7 @@ export const generator = {
34
41
  name: "wrapper",
35
42
  displayName: "@canonical/summon-application:wrapper",
36
43
  description: "Create a layout wrapper component",
37
- version: "0.1.0",
44
+ version: packageVersion(),
38
45
  help: `Creates a layout wrapper component under src/lib/.
39
46
 
40
47
  Given a name like "settings", creates:
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,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AAS,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;QAEtD,MAAM,QAAQ,GAAG,SAAS,CAAC;YACzB,IAAI,CAAC,qBAAqB,UAAU,MAAM,CAAC;YAC3C,KAAK,CAAC,SAAS,CAAC;YAChB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,UAAU,MAAM,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;YACvE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;YAC9D,IAAI,CAAC,YAAY,UAAU,gBAAgB,SAAS,GAAG,CAAC;SACzD,CAAC,CAAC;QAEH,2EAA2E;QAC3E,6EAA6E;QAC7E,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAC5C,OAAO;YACL,CAAC,CAAC,IAAI,CAAC;gBACH,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,YAAY,SAAS,+DAA+D;aAC9F,CAAC;YACJ,CAAC,CAAC,QAAQ,CACb,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import type { GeneratorDefinition } from "@canonical/summon-core";
2
2
  export interface ApplicationReactAnswers {
3
3
  readonly appPath: string;
4
- readonly ssr: boolean;
5
- readonly router: boolean;
6
4
  readonly forms: boolean;
5
+ readonly intl: boolean;
7
6
  readonly relay: boolean;
8
7
  readonly runInstall: boolean;
9
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/application/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAiBhC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAsDD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,uBAAuB,CAoYlE,CAAC;AAEF,eAAe,SAAS,CAAC"}
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;AAsED,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,uBAAuB,CAkgBlE,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAchC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAiDD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,aAAa,CA+CxD,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAgBhC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAsDD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,aAAa,CA+CxD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/route/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAchC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAiCD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,YAAY,CAkGvD,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/route/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAgBhC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAsCD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,YAAY,CAmGvD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The published package name, used in generator `displayName` labels and the
3
+ * version walk-up. A constant rather than a `package.json` JSON import: the
4
+ * import path would resolve differently from `src/` and `dist/esm/`.
5
+ */
6
+ export declare const PACKAGE_NAME = "@canonical/summon-application";
7
+ //# sourceMappingURL=packageName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageName.d.ts","sourceRoot":"","sources":["../../../src/shared/packageName.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,YAAY,kCAAkC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Walk up from `from` until a `package.json` names this package, and return
3
+ * its `version`. Exported for tests; production callers use
4
+ * {@link packageVersion}.
5
+ *
6
+ * A manifest that is unreadable, is not JSON, names another package, or
7
+ * carries no version is not a failure — it is an ancestor directory that
8
+ * happens to have a `package.json` (the workspace root, say), so the walk
9
+ * continues. Only running out of parents throws.
10
+ *
11
+ * @note Impure — reads the filesystem.
12
+ */
13
+ export declare function findOwnVersion(from: string): string;
14
+ export declare function packageVersion(): string;
15
+ //# sourceMappingURL=packageVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../../../src/shared/packageVersion.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqBnD;AAYD,wBAAgB,cAAc,IAAI,MAAM,CAGvC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Build a `PromptDefinition.validate` for a slash-separated command path
3
+ * (`billing`, `account/settings`). Returns `true | string` per the prompt
4
+ * contract; never throws.
5
+ */
6
+ export declare function validateCommandPath(options: {
7
+ /** Human label for messages, e.g. "Route path". */
8
+ label: string;
9
+ /** Minimum segment count (route needs domain/name = 2). */
10
+ minSegments?: number;
11
+ /** Maximum segment count (a domain or wrapper name is a single segment). */
12
+ maxSegments?: number;
13
+ /** Example shown in error messages. */
14
+ example: string;
15
+ }): (value: unknown) => true | string;
16
+ /**
17
+ * Validate the application directory path: non-empty, relative, and free of
18
+ * `..` traversal — the generator writes an entire tree under it.
19
+ */
20
+ export declare function validateAppPath(value: unknown): true | string;
21
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/shared/validators.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,CA2BpC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAgB7D"}
@@ -1,11 +1,20 @@
1
1
  import type { Task } from "@canonical/task";
2
2
  /**
3
- * Resolve the version range as a Task, so the npm query participates in the
4
- * generator pipeline (dry-run visible, cancellable) instead of firing on module
5
- * import. Runs `npm view <pkg> version`; on any failure or unparseable output it
6
- * yields the offline fallback range.
3
+ * Read an installed package's version. Not `require("<pkg>/package.json")`:
4
+ * none of the workspace packages export `./package.json` (and their ESM-only
5
+ * exports maps make `require.resolve` itself throw), so module resolution is
6
+ * avoided entirely — the standard `node_modules/<name>/package.json` location
7
+ * is probed at each ancestor of this module instead, exactly the way node
8
+ * itself would look the package up.
7
9
  *
8
- * @note Impure — spawns `npm` and reads the registry over the network.
10
+ * @note Impure — reads the filesystem.
11
+ */
12
+ export declare function readVersion(packageName: string): string;
13
+ export declare function ownVersion(): string;
14
+ /**
15
+ * Resolve the version range as a Task so the decision is visible in the
16
+ * generator pipeline (dry-run included). Deterministic and offline: the range
17
+ * comes from the installed generator's own release line.
9
18
  */
10
19
  export declare function resolvePragmaVersion(): Task<string>;
11
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../src/shared/versions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA4DxD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAAC,MAAM,CAAC,CA+BnD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAK/D"}
1
+ {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../src/shared/versions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAuD5C;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA2BvD;AASD,wBAAgB,UAAU,IAAI,MAAM,CAMnC;AAcD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAAC,MAAM,CAAC,CAQnD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAK/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/shared/workspace.ts"],"names":[],"mappings":"AAsGA;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAmBf"}
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/shared/workspace.ts"],"names":[],"mappings":"AA0IA;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CA2Cf"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wrapper/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAahC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAkCD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,cAAc,CA4CzD,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wrapper/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAehC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAuCD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,cAAc,CA4CzD,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.33.0",
4
+ "version": "0.35.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.33.0",
40
- "@canonical/task": "^0.33.0",
41
- "@canonical/utils": "^0.33.0",
39
+ "@canonical/summon-core": "^0.35.0",
40
+ "@canonical/task": "^0.35.0",
41
+ "@canonical/utils": "^0.35.0",
42
42
  "typescript": "^5.9.3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@biomejs/biome": "2.4.9",
46
- "@canonical/biome-config": "^0.33.0",
47
- "@canonical/webarchitect": "^0.33.0",
48
- "@types/node": "^24.12.0",
46
+ "@canonical/biome-config": "^0.35.0",
47
+ "@canonical/webarchitect": "^0.35.0",
48
+ "@types/node": "^26.0.0",
49
49
  "vitest": "^4.0.18"
50
50
  },
51
- "gitHead": "fca2bc4440fff2d511fc8db6686f9b19222fdbc7"
51
+ "gitHead": "5198c5399ef657959272c0e35924391573d81146"
52
52
  }
@@ -1 +0,0 @@
1
- export { default as withRouter } from "./withRouter.js";
@@ -1,10 +0,0 @@
1
- import previewConfig from "@canonical/storybook-config/preview";
2
- import type { Preview } from "@storybook/react-vite";
3
-
4
- import "../src/styles/index.css";
5
-
6
- const preview: Preview = {
7
- ...previewConfig,
8
- };
9
-
10
- export default preview;
@@ -1,27 +0,0 @@
1
- import { useHead } from "@canonical/react-head";
2
- import type { ReactElement } from "react";
3
-
4
- interface LoginSearch {
5
- readonly from?: string;
6
- }
7
-
8
- export default function LoginPage({
9
- search,
10
- }: {
11
- search: LoginSearch;
12
- }): ReactElement {
13
- useHead({ title: "Login — Boilerplate" });
14
-
15
- return (
16
- <section aria-labelledby="login-title">
17
- <h1 id="login-title">Login</h1>
18
- <p>
19
- Demo login. Add <code>?auth=1</code> to any protected URL to simulate
20
- authentication.
21
- </p>
22
- {search.from && (
23
- <p>You will be redirected to {search.from} after login.</p>
24
- )}
25
- </section>
26
- );
27
- }
@@ -1,50 +0,0 @@
1
- import { useHead } from "@canonical/react-head";
2
- import { type ReactElement, Suspense } from "react";
3
- import { ClientOnly } from "#lib/index.js";
4
- import ErrorBoundary from "./ErrorBoundary.js";
5
- import ProductList from "./ProductList.js";
6
-
7
- export default function CatalogPage(): ReactElement {
8
- useHead({ title: "Catalog — Boilerplate" });
9
-
10
- return (
11
- <section aria-labelledby="catalog-title">
12
- <h1 id="catalog-title">Catalog</h1>
13
- <p>
14
- This page demonstrates the Relay data layer. <code>ProductList</code>{" "}
15
- issues a <code>useLazyLoadQuery</code>, each <code>ProductCard</code>{" "}
16
- reads its own <code>useFragment</code>, and the environment resolves
17
- operations against the local mock schema in{" "}
18
- <code>src/relay/schema.ts</code> — set <code>VITE_GRAPHQL_URL</code> to
19
- point it at a real endpoint instead.
20
- </p>
21
- {/*
22
- SSR guard: `useLazyLoadQuery` fetches (and suspends) while rendering,
23
- and the server has no way to serialize the fetched store for the
24
- client yet — that lands in the follow-up SSR data-hydration PR. Until
25
- then `ClientOnly` keeps the query off the server render path: the
26
- server streams the fallback and the browser fetches after hydration.
27
- */}
28
- {/*
29
- The canonical Relay pairing: Suspense renders the pending state while
30
- `useLazyLoadQuery` is in flight, and the ErrorBoundary renders the
31
- failure state when the query errors (e.g. an unreachable endpoint in
32
- `VITE_GRAPHQL_URL` mode) — without it a thrown query error would
33
- unmount the whole tree to a blank page.
34
- */}
35
- <ClientOnly fallback={<p>Loading catalog…</p>}>
36
- <ErrorBoundary
37
- fallback={
38
- <p role="alert">
39
- The catalog failed to load. Reload the page to try again.
40
- </p>
41
- }
42
- >
43
- <Suspense fallback={<p>Loading catalog…</p>}>
44
- <ProductList />
45
- </Suspense>
46
- </ErrorBoundary>
47
- </ClientOnly>
48
- </section>
49
- );
50
- }
@@ -1,17 +0,0 @@
1
- import { useHead } from "@canonical/react-head";
2
- import type { ReactElement } from "react";
3
-
4
- export default function GuidePage({
5
- params,
6
- }: {
7
- params: { slug: string };
8
- }): ReactElement {
9
- useHead({ title: `${params.slug} — Guides` }, [params.slug]);
10
-
11
- return (
12
- <section aria-labelledby="guide-title">
13
- <h1 id="guide-title">{params.slug}</h1>
14
- <p>Guide content for {params.slug}.</p>
15
- </section>
16
- );
17
- }