@ws-test-realm/admin-kit 0.6.3-ng20 → 0.6.5-ng20
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/lib/bom-shape.js +18 -4
- package/lib/generate-module.js +6 -3
- package/package.json +1 -1
package/lib/bom-shape.js
CHANGED
|
@@ -94,6 +94,12 @@ function camelBase(name) {
|
|
|
94
94
|
// SubModuleRouting + adminSettings + the path/route constant convention.
|
|
95
95
|
// Devs typically re-point `parent: adminSettings` to whatever main module
|
|
96
96
|
// makes sense (crm/admin-settings/...) after generation.
|
|
97
|
+
//
|
|
98
|
+
// Adopts the ng20+ naming convention emitted by the schematic:
|
|
99
|
+
// - file: src/lib/<name>-module.ts (dash suffix, no dot)
|
|
100
|
+
// - module cls: <Pascal>Module
|
|
101
|
+
// - component: ./<name> (flat in lib/, no .component infix)
|
|
102
|
+
// - cmp cls: <Pascal> (no Component suffix)
|
|
97
103
|
function moduleSource(name) {
|
|
98
104
|
const className = classBase(name);
|
|
99
105
|
const constName = constantBase(name);
|
|
@@ -101,7 +107,7 @@ function moduleSource(name) {
|
|
|
101
107
|
import { CommonModule } from '@angular/common';
|
|
102
108
|
import { SubModuleRouting, adminSettings } from '@ws-test-realm/ws-core';
|
|
103
109
|
|
|
104
|
-
import { ${className}
|
|
110
|
+
import { ${className} } from './${name}';
|
|
105
111
|
|
|
106
112
|
export const ${constName}_PATH = '${name}';
|
|
107
113
|
export const ${constName}_ROUTE = '/' + ${constName}_PATH;
|
|
@@ -114,16 +120,24 @@ export const ${constName}_ROUTE = '/' + ${constName}_PATH;
|
|
|
114
120
|
\ticonPath: 'assets/svg/module.svg',
|
|
115
121
|
})
|
|
116
122
|
@NgModule({
|
|
117
|
-
\tdeclarations: [${className}
|
|
123
|
+
\tdeclarations: [${className}],
|
|
118
124
|
\timports: [CommonModule],
|
|
119
|
-
\texports: [${className}
|
|
125
|
+
\texports: [${className}],
|
|
120
126
|
})
|
|
121
127
|
export class ${className}Module {}
|
|
122
128
|
`;
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
function publicApiSource(name) {
|
|
126
|
-
|
|
132
|
+
// ng-packagr's NG3001 requires every class declared by a re-exported
|
|
133
|
+
// module to be reachable from public-api too. Re-exporting the component
|
|
134
|
+
// satisfies that. (This also doubles as the DCE-protection convention
|
|
135
|
+
// for any @ExpansionEntry-decorated components the dev adds later — they
|
|
136
|
+
// just need to be exported by name from the component file, which `export
|
|
137
|
+
// *` covers automatically.)
|
|
138
|
+
return `export * from './lib/${name}-module';
|
|
139
|
+
export * from './lib/${name}';
|
|
140
|
+
`;
|
|
127
141
|
}
|
|
128
142
|
|
|
129
143
|
module.exports = {
|
package/lib/generate-module.js
CHANGED
|
@@ -56,7 +56,9 @@ function generateModule({ workspaceDir, name }) {
|
|
|
56
56
|
// 1. Angular schematic: scaffolds projects/<name>/ + updates angular.json
|
|
57
57
|
// + adds tsconfig.json paths entry. Adds tsconfig.lib(.prod).json,
|
|
58
58
|
// tsconfig.spec.json, ng-package.json, package.json, README.md,
|
|
59
|
-
// src/public-api.ts, src/lib/<name
|
|
59
|
+
// src/public-api.ts, src/lib/<name>-module.ts, src/lib/<name>.ts
|
|
60
|
+
// (ng20+ naming: dash suffix, no .component infix, classes are plain
|
|
61
|
+
// <Pascal> / <Pascal>Module).
|
|
60
62
|
ngGenerateLibrary({ workspaceDir, name });
|
|
61
63
|
|
|
62
64
|
// 2. Overwrite the schematic's package.json with the BOM-only shape.
|
|
@@ -70,9 +72,10 @@ function generateModule({ workspaceDir, name }) {
|
|
|
70
72
|
);
|
|
71
73
|
|
|
72
74
|
// 4. Overwrite the schematic's module file with our @SubModuleRouting
|
|
73
|
-
// stamp + the <NAME>_PATH/_ROUTE constants convention.
|
|
75
|
+
// stamp + the <NAME>_PATH/_ROUTE constants convention. ng20 emits
|
|
76
|
+
// `<name>-module.ts` (dash suffix, no dot).
|
|
74
77
|
fs.writeFileSync(
|
|
75
|
-
path.join(projectDir, "src", "lib", `${name}
|
|
78
|
+
path.join(projectDir, "src", "lib", `${name}-module.ts`),
|
|
76
79
|
moduleSource(name)
|
|
77
80
|
);
|
|
78
81
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ws-test-realm/admin-kit",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5-ng20",
|
|
4
4
|
"description": "Workflow CLI + scaffolding for Wiresphere admin-modules workspaces (Angular 20 + native-federation line). Ships `ws-init-workspace`, `ws-modules` (build+deploy driver), `ws-generate-module`/`ws-drop-module`, `ws-wire-host`, `ws-wire-pom`, `ws-sync-paths`, and `ws-purge`. Depends on @ws-test-realm/devkit (toolchain BOM) + @ws-test-realm/shared (runtime BOM + native-federation share map).",
|
|
5
5
|
"license": "Artistic-2.0",
|
|
6
6
|
"publishConfig": {
|