@canonical/summon-application 0.40.0 → 0.43.0-experimental.1
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 +23 -10
- package/dist/esm/application/react/index.js.map +1 -1
- package/dist/esm/application/react/templates/README.md.ejs +1 -1
- package/dist/esm/application/react/templates/package.json.ejs +1 -1
- package/dist/esm/application/react/templates/src/formatDocumentTitle.ts.ejs +1 -1
- package/dist/esm/application/react/templates/tsconfig.json.ejs +1 -13
- package/dist/esm/domain/index.js +13 -34
- package/dist/esm/domain/index.js.map +1 -1
- package/dist/esm/domain/templates/MainPage.tsx.ejs +12 -0
- package/dist/esm/domain/templates/routes.ts.ejs +11 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/page/index.js +182 -0
- package/dist/esm/page/index.js.map +1 -0
- package/dist/esm/page/templates/Page.tsx.ejs +11 -0
- package/dist/esm/page/templates/routingGuide.txt.ejs +24 -0
- package/dist/esm/shared/packageVersion.js.map +1 -1
- package/dist/esm/shared/renderTemplate.js +21 -0
- package/dist/esm/shared/renderTemplate.js.map +1 -0
- package/dist/esm/shared/validators.js +20 -1
- package/dist/esm/shared/validators.js.map +1 -1
- package/dist/esm/shared/versions.js.map +1 -1
- package/dist/esm/wrapper/index.js +9 -19
- package/dist/esm/wrapper/index.js.map +1 -1
- package/dist/esm/wrapper/templates/Layout.tsx.ejs +7 -0
- package/dist/esm/wrapper/templates/index.ts.ejs +1 -0
- package/dist/types/application/react/index.d.ts.map +1 -1
- package/dist/types/domain/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/page/index.d.ts +7 -0
- package/dist/types/page/index.d.ts.map +1 -0
- package/dist/types/shared/packageManager.d.ts.map +1 -1
- package/dist/types/shared/renderTemplate.d.ts +17 -0
- package/dist/types/shared/renderTemplate.d.ts.map +1 -0
- package/dist/types/shared/validators.d.ts +14 -2
- package/dist/types/shared/validators.d.ts.map +1 -1
- package/dist/types/wrapper/index.d.ts.map +1 -1
- package/package.json +15 -11
- package/dist/esm/route/index.js +0 -124
- package/dist/esm/route/index.js.map +0 -1
- package/dist/esm/route/insertRoute.js +0 -206
- package/dist/esm/route/insertRoute.js.map +0 -1
- package/dist/types/route/index.d.ts +0 -7
- package/dist/types/route/index.d.ts.map +0 -1
- package/dist/types/route/insertRoute.d.ts +0 -34
- package/dist/types/route/insertRoute.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/shared/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,OAAO,GAAG,yBAAyB,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OASnC;IACC,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACjE,OAAO,CAAC,KAAc,EAAiB,EAAE;QACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACrD,OAAO,GAAG,KAAK,6BAA6B,OAAO,GAAG,CAAC;QACzD,CAAC;QACD,MAAM,UAAU,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,UAAU,KAAK,EAAE,EAAE,CAAC;YACtB,OAAO,GAAG,KAAK,6BAA6B,OAAO,GAAG,CAAC;QACzD,CAAC;QACD,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,QAAQ,CAAC,MAAM,GAAG,WAAW,EAAE,CAAC;YAClC,OAAO,GAAG,KAAK,mBAAmB,WAAW,0BAA0B,OAAO,GAAG,CAAC;QACpF,CAAC;QACD,IAAI,WAAW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R,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"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
2
3
|
import { exists, fail, flatMap, info, mkdir, sequence_, writeFile, } from "@canonical/task";
|
|
3
4
|
import { toKebabCase, toPascalCase } from "@canonical/utils";
|
|
4
5
|
import { normalizeCommandPath } from "../shared/casing.js";
|
|
5
6
|
import { packageVersion } from "../shared/packageVersion.js";
|
|
7
|
+
import { renderTemplate } from "../shared/renderTemplate.js";
|
|
6
8
|
import { validateCommandPath } from "../shared/validators.js";
|
|
7
9
|
const prompts = [
|
|
8
10
|
{
|
|
@@ -19,23 +21,8 @@ const prompts = [
|
|
|
19
21
|
group: "Wrapper",
|
|
20
22
|
},
|
|
21
23
|
];
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const className = `${toKebabCase(wrapperName)}-layout`;
|
|
25
|
-
return `import type { ReactNode, ReactElement } from "react";
|
|
26
|
-
|
|
27
|
-
export default function ${layoutName}({
|
|
28
|
-
children,
|
|
29
|
-
}: { children: ReactNode }): ReactElement {
|
|
30
|
-
return <div className="${className}">{children}</div>;
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
}
|
|
34
|
-
function buildBarrel(wrapperName) {
|
|
35
|
-
const layoutName = `${toPascalCase(wrapperName)}Layout`;
|
|
36
|
-
return `export { default } from "./${layoutName}.js";
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
24
|
+
/** The wrapper generator's own templates, copied next to it by the build. */
|
|
25
|
+
const templatesDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "templates");
|
|
39
26
|
export const generator = {
|
|
40
27
|
meta: {
|
|
41
28
|
name: "wrapper",
|
|
@@ -61,8 +48,11 @@ Given a name like "settings", creates:
|
|
|
61
48
|
const scaffold = sequence_([
|
|
62
49
|
info(`Creating wrapper "${layoutName}"...`),
|
|
63
50
|
mkdir(layoutDir),
|
|
64
|
-
writeFile(path.join(layoutDir, `${layoutName}.tsx`),
|
|
65
|
-
|
|
51
|
+
writeFile(path.join(layoutDir, `${layoutName}.tsx`), renderTemplate(templatesDir, "Layout.tsx.ejs", {
|
|
52
|
+
layoutName,
|
|
53
|
+
className: `${toKebabCase(name)}-layout`,
|
|
54
|
+
})),
|
|
55
|
+
writeFile(path.join(layoutDir, "index.ts"), renderTemplate(templatesDir, "index.ts.ejs", { layoutName })),
|
|
66
56
|
info(`Wrapper "${layoutName}" created at ${layoutDir}.`),
|
|
67
57
|
]);
|
|
68
58
|
// Refuse to run when the layout already exists — mkdir/writeFile undos are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,KAAK,EACL,SAAS,EACT,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAA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AS,CACP,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,UAAU,MAAM,CAAC,EACzC,cAAc,CAAC,YAAY,EAAE,gBAAgB,EAAE;gBAC7C,UAAU;gBACV,SAAS,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS;aACzC,CAAC,CACH;YACD,SAAS,CACP,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAChC,cAAc,CAAC,YAAY,EAAE,cAAc,EAAE,EAAE,UAAU,EAAE,CAAC,CAC7D;YACD,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./<%= layoutName %>.js";
|
|
@@ -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,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,CAokBlE,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,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,CAokBlE,CAAC;eAEa,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAiBhC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAwBD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,aAAa,CA2DxD,CAAC;eAEa,SAAS"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const generators: {
|
|
2
2
|
readonly "application/react": import("@canonical/summon-core").GeneratorDefinition<import("./application/react/index.js").ApplicationReactAnswers>;
|
|
3
3
|
readonly domain: import("@canonical/summon-core").GeneratorDefinition<import("./domain/index.js").DomainAnswers>;
|
|
4
|
-
readonly
|
|
4
|
+
readonly page: import("@canonical/summon-core").GeneratorDefinition<import("./page/index.js").PageAnswers>;
|
|
5
5
|
readonly wrapper: import("@canonical/summon-core").GeneratorDefinition<import("./wrapper/index.js").WrapperAnswers>;
|
|
6
6
|
};
|
|
7
7
|
export default generators;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU;;;;;CAK0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU;;;;;CAK0B,CAAC;eAEnC,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/page/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,wBAAwB,CAAC;AAwBhC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAqGD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAoFtD,CAAC;eAEa,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageManager.d.ts","sourceRoot":"","sources":["../../../src/shared/packageManager.ts"],"names":[],"mappings":"AAGA,gFAAgF;AAChF,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageManager.d.ts","sourceRoot":"","sources":["../../../src/shared/packageManager.ts"],"names":[],"mappings":"AAGA,gFAAgF;AAChF,QAAA,MAAM,UAAU,YAAI,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAC3D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAiBzD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,GAAG,IAAI,CAK1D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render one of a generator's `.ejs` templates with its variables.
|
|
3
|
+
*
|
|
4
|
+
* The template is read when this is called — on `generate()`, never at module
|
|
5
|
+
* evaluation — from the generator's own `templates/` directory, which the build
|
|
6
|
+
* copies next to the compiled generator. The rendered text is what the
|
|
7
|
+
* generator writes with `writeFile`, so each written file keeps `writeFile`'s
|
|
8
|
+
* own undo (deleting that file) and nothing else.
|
|
9
|
+
*
|
|
10
|
+
* @param templatesDir - The generator's `templates/` directory.
|
|
11
|
+
* @param file - The template's file name within it.
|
|
12
|
+
* @param vars - The template's variables.
|
|
13
|
+
* @returns The rendered text.
|
|
14
|
+
* @note Impure — reads the template from disk.
|
|
15
|
+
*/
|
|
16
|
+
export declare function renderTemplate(templatesDir: string, file: string, vars: Record<string, unknown>): string;
|
|
17
|
+
//# sourceMappingURL=renderTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderTemplate.d.ts","sourceRoot":"","sources":["../../../src/shared/renderTemplate.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAKR"}
|
|
@@ -4,15 +4,27 @@
|
|
|
4
4
|
* contract; never throws.
|
|
5
5
|
*/
|
|
6
6
|
export declare function validateCommandPath(options: {
|
|
7
|
-
/** Human label for messages, e.g. "
|
|
7
|
+
/** Human label for messages, e.g. "Page path". */
|
|
8
8
|
label: string;
|
|
9
|
-
/** Minimum segment count (
|
|
9
|
+
/** Minimum segment count (a page needs domain/name = 2). */
|
|
10
10
|
minSegments?: number;
|
|
11
11
|
/** Maximum segment count (a domain or wrapper name is a single segment). */
|
|
12
12
|
maxSegments?: number;
|
|
13
13
|
/** Example shown in error messages. */
|
|
14
14
|
example: string;
|
|
15
15
|
}): (value: unknown) => true | string;
|
|
16
|
+
/**
|
|
17
|
+
* Build a validator for a name that other names are derived from mechanically
|
|
18
|
+
* (`order-lines` → `OrderLinesPage`, `orderLines`), so it must be kebab-case:
|
|
19
|
+
* a name such as `DETAIL` would leave those mappings to guess. Returns
|
|
20
|
+
* `true | string`; never throws.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateKebabName(options: {
|
|
23
|
+
/** Human label for messages, e.g. "Page name". */
|
|
24
|
+
label: string;
|
|
25
|
+
/** Example shown in error messages. */
|
|
26
|
+
example: string;
|
|
27
|
+
}): (value: unknown) => true | string;
|
|
16
28
|
/**
|
|
17
29
|
* Validate the application directory path: non-empty, relative, and free of
|
|
18
30
|
* `..` traversal — the generator writes an entire tree under it.
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/shared/validators.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,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,CA6BpC;AAQD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,CAMpC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAgB7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wrapper/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wrapper/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAgBhC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAwBD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,cAAc,CAqDzD,CAAC;eAEa,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/summon-application",
|
|
3
|
-
"description": "Summon generators for application scaffolding: domain,
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "Summon generators for application scaffolding: application, domain, page, and wrapper",
|
|
4
|
+
"version": "0.43.0-experimental.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/canonical/pragma"
|
|
24
|
+
"url": "https://github.com/canonical/pragma-core"
|
|
25
25
|
},
|
|
26
26
|
"license": "GPL-3.0",
|
|
27
27
|
"scripts": {
|
|
@@ -36,17 +36,21 @@
|
|
|
36
36
|
"test": "vitest run"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@canonical/summon-core": "^0.
|
|
40
|
-
"@canonical/task": "^0.
|
|
41
|
-
"@canonical/utils": "^0.
|
|
42
|
-
"typescript": "^5.9.3"
|
|
39
|
+
"@canonical/summon-core": "^0.43.0-experimental.1",
|
|
40
|
+
"@canonical/task": "^0.43.0-experimental.0",
|
|
41
|
+
"@canonical/utils": "^0.43.0-experimental.1"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@biomejs/biome": "2.5.
|
|
46
|
-
"@canonical/biome-config": "^0.
|
|
47
|
-
"@canonical/webarchitect": "^0.
|
|
44
|
+
"@biomejs/biome": "2.5.14",
|
|
45
|
+
"@canonical/biome-config": "^0.43.0-experimental.0",
|
|
46
|
+
"@canonical/webarchitect": "^0.43.0-experimental.0",
|
|
48
47
|
"@types/node": "^26.0.0",
|
|
48
|
+
"typescript": "^7.0.2",
|
|
49
49
|
"vitest": "^4.0.18"
|
|
50
50
|
},
|
|
51
|
-
"
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/canonical/pragma-core/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/canonical/pragma-core#readme",
|
|
55
|
+
"gitHead": "5c1b1bdbb95844fac6211f1fe6ba10c29238d6ee"
|
|
52
56
|
}
|
package/dist/esm/route/index.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import * as path from "node:path";
|
|
2
|
-
import { exists, fail, flatMap, info, sequence_, transformFile, writeFile, } from "@canonical/task";
|
|
3
|
-
import { toCamelCase, toPascalCase, toTitleCase } from "@canonical/utils";
|
|
4
|
-
import { normalizeCommandPath } from "../shared/casing.js";
|
|
5
|
-
import { packageVersion } from "../shared/packageVersion.js";
|
|
6
|
-
import { validateCommandPath } from "../shared/validators.js";
|
|
7
|
-
import { insertRoute, removeRoute } from "./insertRoute.js";
|
|
8
|
-
const prompts = [
|
|
9
|
-
{
|
|
10
|
-
name: "routePath",
|
|
11
|
-
type: "text",
|
|
12
|
-
message: "Route path (for example account/settings):",
|
|
13
|
-
default: "example/page",
|
|
14
|
-
positional: true,
|
|
15
|
-
validate: validateCommandPath({
|
|
16
|
-
label: "Route path",
|
|
17
|
-
minSegments: 2,
|
|
18
|
-
example: "account/settings",
|
|
19
|
-
}),
|
|
20
|
-
group: "Route",
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
function buildPage(routeName) {
|
|
24
|
-
const pageName = `${toPascalCase(routeName)}Page`;
|
|
25
|
-
const title = toTitleCase(routeName);
|
|
26
|
-
const slugId = toCamelCase(routeName);
|
|
27
|
-
return `import { Head } from "@canonical/react-head";
|
|
28
|
-
import type { ReactElement } from "react";
|
|
29
|
-
|
|
30
|
-
export default function ${pageName}(): ReactElement {
|
|
31
|
-
return (
|
|
32
|
-
<section aria-labelledby="${slugId}-title">
|
|
33
|
-
<Head title="${title}" />
|
|
34
|
-
<h1 id="${slugId}-title">${title}</h1>
|
|
35
|
-
</section>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
export const generator = {
|
|
41
|
-
meta: {
|
|
42
|
-
name: "route",
|
|
43
|
-
displayName: "@canonical/summon-application:route",
|
|
44
|
-
description: "Add a route page to an existing domain",
|
|
45
|
-
version: packageVersion(),
|
|
46
|
-
help: `Creates a page component inside an existing domain directory.
|
|
47
|
-
|
|
48
|
-
Given a path like "account/settings":
|
|
49
|
-
- Domain = first segment ("account")
|
|
50
|
-
- Route = last segment ("settings")
|
|
51
|
-
|
|
52
|
-
Creates:
|
|
53
|
-
- src/domains/<domain>/<RouteName>Page.tsx
|
|
54
|
-
- Inserts the import + route entry into src/domains/<domain>/routes.ts
|
|
55
|
-
|
|
56
|
-
Refuses to overwrite an existing page file.
|
|
57
|
-
|
|
58
|
-
Create the domain first with: summon domain <name>
|
|
59
|
-
|
|
60
|
-
Note on --undo: undo removes the route entry and import it added. It assumes the
|
|
61
|
-
route was newly created — running --undo after an insert that was a no-op (the
|
|
62
|
-
route key already existed) would remove a route you already had.`,
|
|
63
|
-
examples: [
|
|
64
|
-
"summon route account/settings",
|
|
65
|
-
"summon route billing/invoices",
|
|
66
|
-
"summon route --dry-run user/profile",
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
prompts,
|
|
70
|
-
generate: (answers) => {
|
|
71
|
-
const normalized = normalizeCommandPath(answers.routePath);
|
|
72
|
-
const segments = normalized.split("/");
|
|
73
|
-
if (segments.length < 2) {
|
|
74
|
-
return fail({
|
|
75
|
-
code: "ROUTE_PATH_INVALID",
|
|
76
|
-
message: `Route path must include a domain and route name (e.g. "account/settings"), got "${normalized}"`,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
const domainName = segments[0];
|
|
80
|
-
const routeName = segments[segments.length - 1];
|
|
81
|
-
const pageName = `${toPascalCase(routeName)}Page`;
|
|
82
|
-
const domainDir = path.join("src", "domains", domainName);
|
|
83
|
-
const pageFile = path.join(domainDir, `${pageName}.tsx`);
|
|
84
|
-
const routesFile = path.join(domainDir, "routes.ts");
|
|
85
|
-
const url = `/${normalized}`;
|
|
86
|
-
const routeKey = toCamelCase(routeName);
|
|
87
|
-
const scaffold = sequence_([
|
|
88
|
-
info(`Adding route "${routeName}" to domain "${domainName}"...`),
|
|
89
|
-
// No mkdir: this generator targets an *existing* domain (guarded below).
|
|
90
|
-
// mkdir's default undo is DeleteDirectory, which on `--undo` could remove
|
|
91
|
-
// a pre-existing domain folder.
|
|
92
|
-
writeFile(pageFile, buildPage(routeName)),
|
|
93
|
-
// Insert the import + route entry into the domain's routes object via a
|
|
94
|
-
// pure AST-located transform (no manual edit needed afterwards). Undo
|
|
95
|
-
// removes exactly the lines we added, rather than restoring a snapshot.
|
|
96
|
-
transformFile(routesFile, (source) => insertRoute(source, {
|
|
97
|
-
pageName,
|
|
98
|
-
importPath: `./${pageName}.js`,
|
|
99
|
-
routeKey,
|
|
100
|
-
url,
|
|
101
|
-
}), {
|
|
102
|
-
undo: transformFile(routesFile, (source) => removeRoute(source, { pageName, routeKey })),
|
|
103
|
-
}),
|
|
104
|
-
info(`Route "${routeName}" wired into ${routesFile}.`),
|
|
105
|
-
]);
|
|
106
|
-
// Guard before touching anything:
|
|
107
|
-
// - the domain must exist (this generator adds to an existing domain);
|
|
108
|
-
// - the page must NOT exist (its write's undo is a delete, so overwriting a
|
|
109
|
-
// hand-authored page then `--undo` would destroy the original).
|
|
110
|
-
return flatMap(exists(routesFile), (domainPresent) => !domainPresent
|
|
111
|
-
? fail({
|
|
112
|
-
code: "ROUTE_DOMAIN_MISSING",
|
|
113
|
-
message: `Domain "${domainName}" not found (${routesFile} missing). Create it first with: summon domain ${domainName}`,
|
|
114
|
-
})
|
|
115
|
-
: flatMap(exists(pageFile), (pagePresent) => pagePresent
|
|
116
|
-
? fail({
|
|
117
|
-
code: "ROUTE_PAGE_EXISTS",
|
|
118
|
-
message: `Page "${pageFile}" already exists. Choose a different route name or remove the file first.`,
|
|
119
|
-
})
|
|
120
|
-
: scaffold));
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
export default generator;
|
|
124
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/route/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAKlC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,SAAS,EACT,aAAa,EACb,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM5D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U,GAAG,CAAC;SACvD,CAAC,CAAC;QAEH,kCAAkC;QAClC,uEAAuE;QACvE,4EAA4E;QAC5E,kEAAkE;QAClE,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,aAAa,EAAE,EAAE,CACnD,CAAC,aAAa;YACZ,CAAC,CAAC,IAAI,CAAC;gBACH,IAAI,EAAE,sBAAsB;gBAC5B,OAAO,EAAE,WAAW,UAAU,gBAAgB,UAAU,kDAAkD,UAAU,EAAE;aACvH,CAAC;YACJ,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CACxC,WAAW;gBACT,CAAC,CAAC,IAAI,CAAC;oBACH,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,SAAS,QAAQ,2EAA2E;iBACtG,CAAC;gBACJ,CAAC,CAAC,QAAQ,CACb,CACN,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
/**
|
|
3
|
-
* Peel `as const` / type assertions / parentheses off an initializer to reach
|
|
4
|
-
* the underlying object literal (e.g. `{ ... } as const`), if any.
|
|
5
|
-
*/
|
|
6
|
-
function unwrapObjectLiteral(expr) {
|
|
7
|
-
let node = expr;
|
|
8
|
-
while (ts.isAsExpression(node) ||
|
|
9
|
-
ts.isParenthesizedExpression(node) ||
|
|
10
|
-
ts.isTypeAssertionExpression(node) ||
|
|
11
|
-
ts.isSatisfiesExpression(node)) {
|
|
12
|
-
node = node.expression;
|
|
13
|
-
}
|
|
14
|
-
return ts.isObjectLiteralExpression(node) ? node : undefined;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Insert a route into a domain `routes.ts` source.
|
|
18
|
-
*
|
|
19
|
-
* Uses the TypeScript compiler API only to *locate* the insertion points (the
|
|
20
|
-
* last import declaration and the `routes` object literal), then splices text
|
|
21
|
-
* at those offsets. Locating with the AST is robust to formatting; editing by
|
|
22
|
-
* string keeps the rest of the file byte-for-byte unchanged (no full re-print,
|
|
23
|
-
* so it doesn't fight the formatter).
|
|
24
|
-
*
|
|
25
|
-
* Idempotent: if `routeKey` already exists in the routes object, the source is
|
|
26
|
-
* returned unchanged. Throws if the `routes` object literal cannot be found.
|
|
27
|
-
*/
|
|
28
|
-
export function insertRoute(source, ins) {
|
|
29
|
-
const sf = ts.createSourceFile("routes.ts", source, ts.ScriptTarget.Latest,
|
|
30
|
-
/* setParentNodes */ true);
|
|
31
|
-
// Locate the `routes` object literal and the last import declaration.
|
|
32
|
-
let routesObject;
|
|
33
|
-
let lastImportEnd;
|
|
34
|
-
for (const stmt of sf.statements) {
|
|
35
|
-
if (ts.isImportDeclaration(stmt)) {
|
|
36
|
-
lastImportEnd = stmt.end;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
if (ts.isVariableStatement(stmt)) {
|
|
40
|
-
for (const decl of stmt.declarationList.declarations) {
|
|
41
|
-
if (ts.isIdentifier(decl.name) &&
|
|
42
|
-
decl.name.text === "routes" &&
|
|
43
|
-
decl.initializer) {
|
|
44
|
-
const obj = unwrapObjectLiteral(decl.initializer);
|
|
45
|
-
if (obj)
|
|
46
|
-
routesObject = obj;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (!routesObject) {
|
|
52
|
-
throw new Error("insertRoute: could not find a `const routes = { ... }` object literal");
|
|
53
|
-
}
|
|
54
|
-
// Idempotency: skip if the key is already present.
|
|
55
|
-
const exists = routesObject.properties.some((p) => p.name &&
|
|
56
|
-
(ts.isIdentifier(p.name) || ts.isStringLiteral(p.name)) &&
|
|
57
|
-
p.name.text === ins.routeKey);
|
|
58
|
-
if (exists)
|
|
59
|
-
return source;
|
|
60
|
-
// Indentation of the existing properties (fall back to two spaces).
|
|
61
|
-
const indent = detectIndent(source, routesObject) ?? " ";
|
|
62
|
-
const importLine = `import ${ins.pageName} from "${ins.importPath}";\n`;
|
|
63
|
-
const entry = `${indent}${ins.routeKey}: route({\n` +
|
|
64
|
-
`${indent}${indent}url: "${ins.url}",\n` +
|
|
65
|
-
`${indent}${indent}content: ${ins.pageName},\n` +
|
|
66
|
-
`${indent}}),\n`;
|
|
67
|
-
// Insert after the last existing property, or — for an empty object — just
|
|
68
|
-
// inside the braces. Use AST node bounds, never a brace text-scan (which can
|
|
69
|
-
// match a nested `route({ ... })` brace on a single-line object).
|
|
70
|
-
const props = routesObject.properties;
|
|
71
|
-
let out;
|
|
72
|
-
if (props.length > 0) {
|
|
73
|
-
const last = props[props.length - 1];
|
|
74
|
-
// Find the insertion point: just after the last property, including its
|
|
75
|
-
// trailing comma if it has one (so the existing comma stays attached to the
|
|
76
|
-
// existing property). If there's no trailing comma, add one.
|
|
77
|
-
let at = last.end;
|
|
78
|
-
let prefix = ",\n";
|
|
79
|
-
if (source[at] === ",") {
|
|
80
|
-
at += 1; // step past the existing comma
|
|
81
|
-
prefix = "\n";
|
|
82
|
-
}
|
|
83
|
-
out = `${source.slice(0, at)}${prefix}${entry.replace(/\n$/, "")}${source.slice(at)}`;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
// Empty object: insert between the braces.
|
|
87
|
-
const openBrace = routesObject.getStart(sf) +
|
|
88
|
-
source.slice(routesObject.getStart(sf)).indexOf("{") +
|
|
89
|
-
1;
|
|
90
|
-
out = `${source.slice(0, openBrace)}\n${entry}${source.slice(openBrace)}`;
|
|
91
|
-
}
|
|
92
|
-
// Insert the import after the last existing import (offsets in the original
|
|
93
|
-
// source are still valid because the route entry was added later in the file).
|
|
94
|
-
if (lastImportEnd !== undefined) {
|
|
95
|
-
out =
|
|
96
|
-
out.slice(0, lastImportEnd) +
|
|
97
|
-
`\n${importLine.trimEnd()}` +
|
|
98
|
-
out.slice(lastImportEnd);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
out = importLine + out;
|
|
102
|
-
}
|
|
103
|
-
return out;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Inverse of {@link insertRoute}: remove the route entry and its import.
|
|
107
|
-
*
|
|
108
|
-
* Used as the route generator's undo. Rather than restoring a stored copy of
|
|
109
|
-
* the file, it deletes exactly the lines that {@link insertRoute} added — the
|
|
110
|
-
* `routeKey` property in the `routes` object and the `import <pageName> ...`
|
|
111
|
-
* line. Idempotent: returns the source unchanged if neither is present, and
|
|
112
|
-
* leaves any other content (including manual edits) intact.
|
|
113
|
-
*/
|
|
114
|
-
export function removeRoute(source, ins) {
|
|
115
|
-
const sf = ts.createSourceFile("routes.ts", source, ts.ScriptTarget.Latest,
|
|
116
|
-
/* setParentNodes */ true);
|
|
117
|
-
let result = source;
|
|
118
|
-
// 1. Remove the route entry (the property whose name === routeKey).
|
|
119
|
-
for (const stmt of sf.statements) {
|
|
120
|
-
if (!ts.isVariableStatement(stmt))
|
|
121
|
-
continue;
|
|
122
|
-
for (const decl of stmt.declarationList.declarations) {
|
|
123
|
-
if (!ts.isIdentifier(decl.name) ||
|
|
124
|
-
decl.name.text !== "routes" ||
|
|
125
|
-
!decl.initializer) {
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
const obj = unwrapObjectLiteral(decl.initializer);
|
|
129
|
-
if (!obj)
|
|
130
|
-
continue;
|
|
131
|
-
const prop = obj.properties.find((p) => p.name &&
|
|
132
|
-
(ts.isIdentifier(p.name) || ts.isStringLiteral(p.name)) &&
|
|
133
|
-
p.name.text === ins.routeKey);
|
|
134
|
-
if (prop) {
|
|
135
|
-
result = removePropertySpan(result, prop.getStart(sf), prop.end);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
// 2. Remove the import line for the page component.
|
|
140
|
-
// Re-parse because offsets shifted after the entry removal.
|
|
141
|
-
const sf2 = ts.createSourceFile("routes.ts", result, ts.ScriptTarget.Latest, true);
|
|
142
|
-
for (const stmt of sf2.statements) {
|
|
143
|
-
if (ts.isImportDeclaration(stmt) &&
|
|
144
|
-
stmt.importClause?.name?.text === ins.pageName &&
|
|
145
|
-
// Only remove a pure default import (`import Page from "..."`), which is
|
|
146
|
-
// exactly what insertRoute creates. If a user merged named bindings into
|
|
147
|
-
// it (`import Page, { x } from "..."`), leave it — removing the whole line
|
|
148
|
-
// would discard their bindings.
|
|
149
|
-
!stmt.importClause.namedBindings) {
|
|
150
|
-
result = removeLinesOrSpan(result, stmt.getStart(sf2), stmt.end);
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return result;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Remove a property node's span [start, end) plus its separator comma: the
|
|
158
|
-
* trailing comma when one follows, otherwise the preceding one (the
|
|
159
|
-
* last-property case), so the object literal stays syntactically valid.
|
|
160
|
-
*/
|
|
161
|
-
function removePropertySpan(source, start, end) {
|
|
162
|
-
let spanStart = start;
|
|
163
|
-
let spanEnd = end;
|
|
164
|
-
let after = spanEnd;
|
|
165
|
-
while (after < source.length && /\s/.test(source.charAt(after)))
|
|
166
|
-
after++;
|
|
167
|
-
if (source.charAt(after) === ",") {
|
|
168
|
-
spanEnd = after + 1;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
let before = spanStart - 1;
|
|
172
|
-
while (before >= 0 && /\s/.test(source.charAt(before)))
|
|
173
|
-
before--;
|
|
174
|
-
if (source.charAt(before) === ",")
|
|
175
|
-
spanStart = before;
|
|
176
|
-
}
|
|
177
|
-
return removeLinesOrSpan(source, spanStart, spanEnd);
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Remove [start, end): as whole lines (including leading indentation and the
|
|
181
|
-
* trailing newline, so no blank line is left behind) when the span owns its
|
|
182
|
-
* lines — but as an exact span when other code shares a line with it, so a
|
|
183
|
-
* single-line `const routes = { billing: route(...) } as const;` loses only
|
|
184
|
-
* the property, never the code around it.
|
|
185
|
-
*/
|
|
186
|
-
function removeLinesOrSpan(source, start, end) {
|
|
187
|
-
const lineStart = source.lastIndexOf("\n", start - 1) + 1;
|
|
188
|
-
const newlineAfter = source.indexOf("\n", end);
|
|
189
|
-
const lineEnd = newlineAfter === -1 ? source.length : newlineAfter + 1;
|
|
190
|
-
const leading = source.slice(lineStart, start);
|
|
191
|
-
const trailing = source.slice(end, newlineAfter === -1 ? source.length : newlineAfter);
|
|
192
|
-
if (/^\s*$/.test(leading) && /^\s*$/.test(trailing)) {
|
|
193
|
-
return source.slice(0, lineStart) + source.slice(lineEnd);
|
|
194
|
-
}
|
|
195
|
-
return source.slice(0, start) + source.slice(end);
|
|
196
|
-
}
|
|
197
|
-
/** Detect the indentation used by the first property of the object literal. */
|
|
198
|
-
function detectIndent(source, obj) {
|
|
199
|
-
const first = obj.properties[0];
|
|
200
|
-
if (!first)
|
|
201
|
-
return undefined;
|
|
202
|
-
const lineStart = source.lastIndexOf("\n", first.getStart()) + 1;
|
|
203
|
-
const ws = source.slice(lineStart, first.getStart());
|
|
204
|
-
return /^\s+$/.test(ws) ? ws : undefined;
|
|
205
|
-
}
|
|
206
|
-
//# sourceMappingURL=insertRoute.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insertRoute.js","sourceRoot":"","sources":["../../../src/route/insertRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;GAGG;AACH,SAAS,mBAAmB,CAC1B,IAAmB;IAEnB,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,OACE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC;QACvB,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC;QAClC,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC;QAClC,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAC9B,CAAC;QACD,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IACD,OAAO,EAAE,CAAC,yBAAyB,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AAC,CAAC,CAAC,SAAS,CAAC;AAC3C,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { GeneratorDefinition } from "@canonical/summon-core";
|
|
2
|
-
export interface RouteAnswers {
|
|
3
|
-
readonly routePath: string;
|
|
4
|
-
}
|
|
5
|
-
export declare const generator: GeneratorDefinition<RouteAnswers>;
|
|
6
|
-
export default generator;
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAqCD,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,YAAY,CAmGvD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|