@abgov/nx-adsp 13.31.0 → 13.31.2
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 +41 -32
- package/package.json +1 -1
- package/src/generators/angular-app/angular-app.js +2 -2
- package/src/generators/angular-app/files/AGENTS.md__tmpl__ +16 -0
- package/src/generators/express-service/express-service.spec.ts +26 -13
- package/src/generators/express-service/schema.json +1 -1
- package/src/generators/react-app/files/AGENTS.md__tmpl__ +16 -0
- package/src/generators/react-app/react-app.js +2 -2
- package/src/generators/vue-admin-crud/files/src/views/__editViewFileName__.vue__tmpl__ +3 -5
- package/src/generators/vue-admin-crud/files/src/views/__listViewFileName__.vue__tmpl__ +33 -4
- package/src/generators/vue-admin-crud/schema.d.ts +2 -0
- package/src/generators/vue-admin-crud/schema.json +7 -8
- package/src/generators/vue-admin-crud/vue-admin-crud.js +6 -1
- package/src/generators/vue-admin-crud/vue-admin-crud.js.map +1 -1
- package/src/generators/vue-admin-crud/vue-admin-crud.spec.ts +96 -13
- package/src/generators/vue-app/files/AGENTS.md__tmpl__ +56 -11
- package/src/generators/vue-app/files/src/App.vue__tmpl__ +2 -1
- package/src/generators/vue-app/files/src/composables/useApi.spec.ts__tmpl__ +5 -3
- package/src/generators/vue-app/files/src/composables/useApi.ts__tmpl__ +14 -2
- package/src/generators/vue-app/vue-app.js +33 -6
- package/src/generators/vue-app/vue-app.js.map +1 -1
- package/src/generators/vue-app/vue-app.spec.ts +133 -13
- package/src/generators/vue-components/files/AGENTS.md__tmpl__ +36 -17
- package/src/generators/vue-components/files/src/index.ts__tmpl__ +3 -0
- package/src/generators/vue-components/files/src/lib/formatters.ts__tmpl__ +58 -0
- package/src/generators/vue-components/files/src/lib/patterns/AppSideMenu.vue__tmpl__ +14 -3
- package/src/generators/vue-components/files/src/lib/patterns/FilterBar.vue__tmpl__ +7 -1
- package/src/generators/vue-components/files/src/lib/patterns/WorkspaceTable.vue__tmpl__ +7 -1
- package/src/generators/vue-components/vue-components.d.ts +1 -0
- package/src/generators/vue-components/vue-components.js +18 -39
- package/src/generators/vue-components/vue-components.js.map +1 -1
- package/src/generators/vue-components/vue-components.spec.ts +94 -2
- package/src/generators/vue-detail-view/files/src/views/__viewFileName__.vue__tmpl__ +51 -2
- package/src/generators/vue-detail-view/schema.d.ts +18 -0
- package/src/generators/vue-detail-view/schema.json +2 -2
- package/src/generators/vue-detail-view/vue-detail-view.js +4 -1
- package/src/generators/vue-detail-view/vue-detail-view.js.map +1 -1
- package/src/generators/vue-detail-view/vue-detail-view.spec.ts +36 -6
- package/src/generators/vue-intake-view/files/shared/src/views/__confirmationViewFileName__.vue__tmpl__ +60 -6
- package/src/generators/vue-intake-view/files/shared/src/views/__reviewViewFileName__.vue__tmpl__ +37 -1
- package/src/generators/vue-intake-view/files/steps/src/views/__stepViewFileName__.vue__tmpl__ +1 -1
- package/src/generators/vue-intake-view/schema.d.ts +10 -0
- package/src/generators/vue-intake-view/schema.json +12 -9
- package/src/generators/vue-intake-view/vue-intake-view.js +9 -3
- package/src/generators/vue-intake-view/vue-intake-view.js.map +1 -1
- package/src/generators/vue-intake-view/vue-intake-view.spec.ts +113 -12
- package/src/generators/vue-workspace-view/files/src/views/__viewFileName__.vue__tmpl__ +49 -1
- package/src/generators/vue-workspace-view/schema.d.ts +22 -0
- package/src/generators/vue-workspace-view/schema.json +8 -9
- package/src/generators/vue-workspace-view/vue-workspace-view.js +7 -1
- package/src/generators/vue-workspace-view/vue-workspace-view.js.map +1 -1
- package/src/generators/vue-workspace-view/vue-workspace-view.spec.ts +73 -7
- package/src/utils/paired-project.d.ts +10 -0
- package/src/utils/paired-project.js +125 -18
- package/src/utils/paired-project.js.map +1 -1
- package/src/utils/paired-project.spec.ts +126 -0
- package/src/utils/quality.js +43 -9
- package/src/utils/quality.js.map +1 -1
- package/src/utils/quality.spec.ts +35 -2
- package/src/utils/vue-eslint.d.ts +2 -0
- package/src/utils/vue-eslint.js +48 -0
- package/src/utils/vue-eslint.js.map +1 -0
- package/src/utils/vue-side-menu.d.ts +13 -1
- package/src/utils/vue-side-menu.js +50 -5
- package/src/utils/vue-side-menu.js.map +1 -1
- package/src/utils/vue-side-menu.spec.ts +100 -0
- package/src/utils/vue-tsconfig.d.ts +26 -0
- package/src/utils/vue-tsconfig.js +49 -0
- package/src/utils/vue-tsconfig.js.map +1 -0
|
@@ -11,8 +11,42 @@ exports.insertSideMenuItem = insertSideMenuItem;
|
|
|
11
11
|
// read and change in one obvious place -- not behaviour resolved at runtime by
|
|
12
12
|
// the shell that every app then has to work around.
|
|
13
13
|
const ANCHOR = 'const primaryItems = [';
|
|
14
|
+
// Finds the `]` closing the array literal that ANCHOR opens, so items can be
|
|
15
|
+
// appended at the end rather than inserted at the head. Tracks nesting depth and
|
|
16
|
+
// skips over string literals, so a label containing a bracket can't end the scan
|
|
17
|
+
// early. Returns -1 if the literal is unterminated (a hand-edited App.vue we
|
|
18
|
+
// shouldn't touch).
|
|
19
|
+
function findArrayEnd(content, openIndex) {
|
|
20
|
+
let depth = 1;
|
|
21
|
+
let quote = null;
|
|
22
|
+
for (let i = openIndex; i < content.length; i++) {
|
|
23
|
+
const ch = content[i];
|
|
24
|
+
if (quote) {
|
|
25
|
+
if (ch === '\\')
|
|
26
|
+
i++;
|
|
27
|
+
else if (ch === quote)
|
|
28
|
+
quote = null;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (ch === "'" || ch === '"' || ch === '`')
|
|
32
|
+
quote = ch;
|
|
33
|
+
else if (ch === '[' || ch === '{')
|
|
34
|
+
depth++;
|
|
35
|
+
else if (ch === ']' || ch === '}') {
|
|
36
|
+
depth--;
|
|
37
|
+
if (depth === 0)
|
|
38
|
+
return i;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return -1;
|
|
42
|
+
}
|
|
14
43
|
/**
|
|
15
|
-
*
|
|
44
|
+
* Appends a nav item to a generated app's side menu.
|
|
45
|
+
*
|
|
46
|
+
* Appends rather than prepends so the shell's own 'Home' entry stays first and
|
|
47
|
+
* generated items accumulate in the order they were run. Inserting at the head
|
|
48
|
+
* (an earlier version of this function) pushed Home to the bottom of the nav
|
|
49
|
+
* after the first generator run, which no consuming app wants.
|
|
16
50
|
*
|
|
17
51
|
* A no-op when the app has no `primaryItems` array. That is the signal the app
|
|
18
52
|
* was generated with `--layout=header` (a public app has no side menu at all),
|
|
@@ -33,9 +67,20 @@ function insertSideMenuItem(host, projectRoot, item) {
|
|
|
33
67
|
return;
|
|
34
68
|
if (content.includes(`to: '${item.to}'`))
|
|
35
69
|
return;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
70
|
+
const openIndex = anchorIndex + ANCHOR.length;
|
|
71
|
+
const closeIndex = findArrayEnd(content, openIndex);
|
|
72
|
+
if (closeIndex === -1)
|
|
73
|
+
return;
|
|
74
|
+
const icon = item.icon ? `, icon: '${item.icon}'` : '';
|
|
75
|
+
const entry = `{ label: '${item.label}', to: '${item.to}'${icon} },`;
|
|
76
|
+
// Trim the whitespace ahead of the closing bracket and re-emit it, rather than
|
|
77
|
+
// inserting in front of it: the array may already end with a newline (a
|
|
78
|
+
// previous append) or not (the one-line literal formatFiles produces), and
|
|
79
|
+
// prepending a newline to the former leaves a blank line between entries.
|
|
80
|
+
const head = content.slice(0, closeIndex).replace(/\s+$/, '');
|
|
81
|
+
// The last element may or may not carry a trailing comma depending on whether
|
|
82
|
+
// formatFiles has run; add one if it's missing so appending stays valid.
|
|
83
|
+
const separator = head.endsWith('[') || head.endsWith(',') ? '' : ',';
|
|
84
|
+
host.write(appPath, `${head}${separator}\n ${entry}\n` + content.slice(closeIndex));
|
|
40
85
|
}
|
|
41
86
|
//# sourceMappingURL=vue-side-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue-side-menu.js","sourceRoot":"","sources":["../../../../../packages/nx-adsp/src/utils/vue-side-menu.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"vue-side-menu.js","sourceRoot":"","sources":["../../../../../packages/nx-adsp/src/utils/vue-side-menu.ts"],"names":[],"mappings":"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"}
|
|
@@ -68,4 +68,104 @@ describe('insertSideMenuItem', () => {
|
|
|
68
68
|
insertSideMenuItem(host, 'apps/missing', { label: 'X', to: '/x' }),
|
|
69
69
|
).not.toThrow();
|
|
70
70
|
});
|
|
71
|
+
|
|
72
|
+
// The original spec asserted both items were present but never their relative
|
|
73
|
+
// order, so it passed while the function prepended and pushed Home to the
|
|
74
|
+
// bottom of every generated app's nav.
|
|
75
|
+
it("appends after the shell's own Home entry rather than before it", () => {
|
|
76
|
+
host.write('apps/staff/src/App.vue', INTERNAL_APP);
|
|
77
|
+
insertSideMenuItem(host, 'apps/staff', {
|
|
78
|
+
label: 'Review queue',
|
|
79
|
+
to: '/queue',
|
|
80
|
+
});
|
|
81
|
+
const app = host.read('apps/staff/src/App.vue')?.toString() ?? '';
|
|
82
|
+
expect(app.indexOf("to: '/'")).toBeLessThan(app.indexOf("to: '/queue'"));
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('accumulates multiple items in the order they were added', () => {
|
|
86
|
+
host.write('apps/staff/src/App.vue', INTERNAL_APP);
|
|
87
|
+
insertSideMenuItem(host, 'apps/staff', { label: 'Queue', to: '/queue' });
|
|
88
|
+
insertSideMenuItem(host, 'apps/staff', {
|
|
89
|
+
label: 'Livestock categories',
|
|
90
|
+
to: '/livestock',
|
|
91
|
+
});
|
|
92
|
+
const app = host.read('apps/staff/src/App.vue')?.toString() ?? '';
|
|
93
|
+
expect(app.indexOf("to: '/'")).toBeLessThan(app.indexOf("to: '/queue'"));
|
|
94
|
+
expect(app.indexOf("to: '/queue'")).toBeLessThan(
|
|
95
|
+
app.indexOf("to: '/livestock'"),
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('emits the icon, which the element needs to render a non-blank item', () => {
|
|
100
|
+
host.write('apps/staff/src/App.vue', INTERNAL_APP);
|
|
101
|
+
insertSideMenuItem(host, 'apps/staff', {
|
|
102
|
+
label: 'Queue',
|
|
103
|
+
to: '/queue',
|
|
104
|
+
icon: 'list',
|
|
105
|
+
});
|
|
106
|
+
expect(host.read('apps/staff/src/App.vue')?.toString()).toContain(
|
|
107
|
+
"{ label: 'Queue', to: '/queue', icon: 'list' },",
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('appends validly when the array literal has no trailing comma', () => {
|
|
112
|
+
host.write(
|
|
113
|
+
'apps/staff/src/App.vue',
|
|
114
|
+
`<script setup lang="ts">
|
|
115
|
+
const primaryItems = [{ label: 'Home', to: '/' }];
|
|
116
|
+
</script>
|
|
117
|
+
`,
|
|
118
|
+
);
|
|
119
|
+
insertSideMenuItem(host, 'apps/staff', { label: 'Queue', to: '/queue' });
|
|
120
|
+
const app = host.read('apps/staff/src/App.vue')?.toString() ?? '';
|
|
121
|
+
expect(app).toContain("{ label: 'Home', to: '/' },");
|
|
122
|
+
expect(app.indexOf("to: '/'")).toBeLessThan(app.indexOf("to: '/queue'"));
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('does not end its scan early on a bracket inside a label', () => {
|
|
126
|
+
host.write(
|
|
127
|
+
'apps/staff/src/App.vue',
|
|
128
|
+
`<script setup lang="ts">
|
|
129
|
+
const primaryItems = [
|
|
130
|
+
{ label: 'Reports [beta]', to: '/reports' },
|
|
131
|
+
];
|
|
132
|
+
</script>
|
|
133
|
+
`,
|
|
134
|
+
);
|
|
135
|
+
insertSideMenuItem(host, 'apps/staff', { label: 'Queue', to: '/queue' });
|
|
136
|
+
const app = host.read('apps/staff/src/App.vue')?.toString() ?? '';
|
|
137
|
+
expect(app.indexOf("to: '/reports'")).toBeLessThan(
|
|
138
|
+
app.indexOf("to: '/queue'"),
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('is a silent no-op on an unterminated array literal', () => {
|
|
143
|
+
const broken = `<script setup lang="ts">
|
|
144
|
+
const primaryItems = [
|
|
145
|
+
</script>
|
|
146
|
+
`;
|
|
147
|
+
host.write('apps/staff/src/App.vue', broken);
|
|
148
|
+
insertSideMenuItem(host, 'apps/staff', { label: 'Queue', to: '/queue' });
|
|
149
|
+
expect(host.read('apps/staff/src/App.vue')?.toString()).toBe(broken);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('does not leave blank lines between accumulated entries', () => {
|
|
153
|
+
host.write('apps/staff/src/App.vue', INTERNAL_APP);
|
|
154
|
+
insertSideMenuItem(host, 'apps/staff', {
|
|
155
|
+
label: 'A',
|
|
156
|
+
to: '/a',
|
|
157
|
+
icon: 'list',
|
|
158
|
+
});
|
|
159
|
+
insertSideMenuItem(host, 'apps/staff', {
|
|
160
|
+
label: 'B',
|
|
161
|
+
to: '/b',
|
|
162
|
+
icon: 'list',
|
|
163
|
+
});
|
|
164
|
+
const app = host.read('apps/staff/src/App.vue')?.toString() ?? '';
|
|
165
|
+
const array = app.slice(
|
|
166
|
+
app.indexOf('const primaryItems = ['),
|
|
167
|
+
app.indexOf('];') + 2,
|
|
168
|
+
);
|
|
169
|
+
expect(array).not.toMatch(/\n\s*\n/);
|
|
170
|
+
});
|
|
71
171
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* Backfills a `module` setting on a generated Vue project's tsconfig when it
|
|
4
|
+
* declares `moduleResolution: "bundler"` without one.
|
|
5
|
+
*
|
|
6
|
+
* @nx/vue's library and application generators write `moduleResolution:
|
|
7
|
+
* "bundler"` into the project's tsconfig.json but leave `module` to be
|
|
8
|
+
* inherited. In a create-nx-workspace TS-solution workspace the base sets
|
|
9
|
+
* `module: "nodenext"`, and that pair is invalid two ways over:
|
|
10
|
+
*
|
|
11
|
+
* error TS5095: Option 'bundler' can only be used when 'module' is set to
|
|
12
|
+
* 'preserve', 'commonjs', or 'es2015' or later.
|
|
13
|
+
* error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left
|
|
14
|
+
* unspecified) when option 'module' is set to 'NodeNext'.
|
|
15
|
+
*
|
|
16
|
+
* so `nx build` fails on completely unmodified generator output. `esnext`
|
|
17
|
+
* matches what @nx/vue itself writes beside `bundler` in the app's
|
|
18
|
+
* tsconfig.app.json, so this aligns the project with its own sibling config
|
|
19
|
+
* rather than introducing a third convention.
|
|
20
|
+
*
|
|
21
|
+
* Deliberately conditional and idempotent: it only acts when
|
|
22
|
+
* `moduleResolution` is bundler-flavoured *and* `module` is absent, so a
|
|
23
|
+
* project whose tsconfig is already valid -- or which has been deliberately
|
|
24
|
+
* pinned to something else -- is left alone.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ensureBundlerModuleOption(host: Tree, tsconfigPath: string): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureBundlerModuleOption = ensureBundlerModuleOption;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
// `moduleResolution` values that TypeScript only accepts alongside a
|
|
6
|
+
// bundler-compatible `module` (TS5095) and which additionally conflict with an
|
|
7
|
+
// inherited `module: nodenext` (TS5109).
|
|
8
|
+
const BUNDLER_RESOLUTIONS = ['bundler', 'Bundler'];
|
|
9
|
+
/**
|
|
10
|
+
* Backfills a `module` setting on a generated Vue project's tsconfig when it
|
|
11
|
+
* declares `moduleResolution: "bundler"` without one.
|
|
12
|
+
*
|
|
13
|
+
* @nx/vue's library and application generators write `moduleResolution:
|
|
14
|
+
* "bundler"` into the project's tsconfig.json but leave `module` to be
|
|
15
|
+
* inherited. In a create-nx-workspace TS-solution workspace the base sets
|
|
16
|
+
* `module: "nodenext"`, and that pair is invalid two ways over:
|
|
17
|
+
*
|
|
18
|
+
* error TS5095: Option 'bundler' can only be used when 'module' is set to
|
|
19
|
+
* 'preserve', 'commonjs', or 'es2015' or later.
|
|
20
|
+
* error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left
|
|
21
|
+
* unspecified) when option 'module' is set to 'NodeNext'.
|
|
22
|
+
*
|
|
23
|
+
* so `nx build` fails on completely unmodified generator output. `esnext`
|
|
24
|
+
* matches what @nx/vue itself writes beside `bundler` in the app's
|
|
25
|
+
* tsconfig.app.json, so this aligns the project with its own sibling config
|
|
26
|
+
* rather than introducing a third convention.
|
|
27
|
+
*
|
|
28
|
+
* Deliberately conditional and idempotent: it only acts when
|
|
29
|
+
* `moduleResolution` is bundler-flavoured *and* `module` is absent, so a
|
|
30
|
+
* project whose tsconfig is already valid -- or which has been deliberately
|
|
31
|
+
* pinned to something else -- is left alone.
|
|
32
|
+
*/
|
|
33
|
+
function ensureBundlerModuleOption(host, tsconfigPath) {
|
|
34
|
+
if (!host.exists(tsconfigPath))
|
|
35
|
+
return;
|
|
36
|
+
(0, devkit_1.updateJson)(host, tsconfigPath, (tsconfig) => {
|
|
37
|
+
const compilerOptions = tsconfig.compilerOptions;
|
|
38
|
+
if (!compilerOptions)
|
|
39
|
+
return tsconfig;
|
|
40
|
+
if (!BUNDLER_RESOLUTIONS.includes(compilerOptions.moduleResolution)) {
|
|
41
|
+
return tsconfig;
|
|
42
|
+
}
|
|
43
|
+
if (compilerOptions.module)
|
|
44
|
+
return tsconfig;
|
|
45
|
+
compilerOptions.module = 'esnext';
|
|
46
|
+
return tsconfig;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=vue-tsconfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-tsconfig.js","sourceRoot":"","sources":["../../../../../packages/nx-adsp/src/utils/vue-tsconfig.ts"],"names":[],"mappings":";;AA+BA,8DAiBC;AAhDD,uCAA8C;AAE9C,qEAAqE;AACrE,+EAA+E;AAC/E,yCAAyC;AACzC,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,yBAAyB,CACvC,IAAU,EACV,YAAoB;IAEpB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QAAE,OAAO;IAEvC,IAAA,mBAAU,EAAC,IAAI,EAAE,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC1C,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;QACjD,IAAI,CAAC,eAAe;YAAE,OAAO,QAAQ,CAAC;QACtC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,eAAe,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACpE,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,IAAI,eAAe,CAAC,MAAM;YAAE,OAAO,QAAQ,CAAC;QAE5C,eAAe,CAAC,MAAM,GAAG,QAAQ,CAAC;QAClC,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|