@smartsoft001/claude-plugins 2.123.0 → 2.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/smart/.claude-plugin/plugin.json +1 -1
- package/plugins/smart/skills/scaffold-nx-workspace/SKILL.md +84 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/base-app.md +405 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/base-claude-config.md +188 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/base-shared-lib.md +288 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/patch-delta.md +403 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/version-resolution.md +83 -0
- package/plugins/smart/skills/scaffold-nx-workspace/scripts/derive-prefix.sh +45 -0
- package/plugins/smart/skills/scaffold-nx-workspace/scripts/verify-scaffold.sh +97 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# Base shared lib — `libs/shared/angular`
|
|
2
|
+
|
|
3
|
+
Generate the library then patch it to the generic skeleton below. Substitute `<PREFIX>`.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx nx g @nx/angular:library shared/angular \
|
|
7
|
+
--prefix=smart-<PREFIX> --unitTestRunner=jest --linter=eslint \
|
|
8
|
+
--buildable --interactive=false
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The base lib exports ONLY the SSR environment infra (`environment` + `EnvironmentService`).
|
|
12
|
+
NO feature UI components/services/models/pipes/interceptors/directives — `lib/` folders are
|
|
13
|
+
empty placeholders the module skills fill in later.
|
|
14
|
+
|
|
15
|
+
> The reference's generated `ng-package.json` `dest` and `jest.config.ts` `coverageDirectory`
|
|
16
|
+
> point at `packages/shared/angular` (a generator leftover). Normalize both to
|
|
17
|
+
> `libs/shared/angular` as shown below.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## `libs/shared/angular/src/index.ts` (overwrite — minimal barrel)
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
export * from './lib/environments/environment';
|
|
25
|
+
export * from './lib/services/environment/environment.service';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## `libs/shared/angular/src/lib/environments/environment.ts` (create)
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
export const environment = {
|
|
32
|
+
production: false,
|
|
33
|
+
version:
|
|
34
|
+
typeof window !== 'undefined' && (window as any)['env']
|
|
35
|
+
? (window as any)['env']['version']
|
|
36
|
+
: process.env['APP_VERSION'],
|
|
37
|
+
apiUrl:
|
|
38
|
+
typeof window !== 'undefined' && (window as any)['env']
|
|
39
|
+
? (window as any)['env']['apiUrl']
|
|
40
|
+
: process.env['API_URL'],
|
|
41
|
+
siteUrl:
|
|
42
|
+
typeof window !== 'undefined' && (window as any)['env']
|
|
43
|
+
? (window as any)['env']['siteUrl']
|
|
44
|
+
: process.env['SITE_URL'],
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## `libs/shared/angular/src/lib/environments/environment.prod.ts` (create)
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
export const environment = {
|
|
52
|
+
production: true,
|
|
53
|
+
version:
|
|
54
|
+
typeof window !== 'undefined' && (window as any)['env']
|
|
55
|
+
? (window as any)['env']['version']
|
|
56
|
+
: process.env['APP_VERSION'],
|
|
57
|
+
apiUrl:
|
|
58
|
+
typeof window !== 'undefined' && (window as any)['env']
|
|
59
|
+
? (window as any)['env']['apiUrl']
|
|
60
|
+
: process.env['API_URL'] || 'http://localhost:0/',
|
|
61
|
+
siteUrl:
|
|
62
|
+
typeof window !== 'undefined' && (window as any)['env']
|
|
63
|
+
? (window as any)['env']['siteUrl']
|
|
64
|
+
: process.env['SITE_URL'],
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## `libs/shared/angular/src/lib/services/environment/environment.service.ts` (create)
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { isPlatformServer } from '@angular/common';
|
|
72
|
+
import {
|
|
73
|
+
Injectable,
|
|
74
|
+
PLATFORM_ID,
|
|
75
|
+
inject,
|
|
76
|
+
TransferState,
|
|
77
|
+
makeStateKey,
|
|
78
|
+
} from '@angular/core';
|
|
79
|
+
|
|
80
|
+
import { environment } from '../../environments/environment';
|
|
81
|
+
|
|
82
|
+
const ENV_KEY = makeStateKey<any>('environment');
|
|
83
|
+
|
|
84
|
+
@Injectable({ providedIn: 'root' })
|
|
85
|
+
export class EnvironmentService {
|
|
86
|
+
private platformId = inject(PLATFORM_ID);
|
|
87
|
+
private transferState = inject(TransferState);
|
|
88
|
+
|
|
89
|
+
static initFromProcessEnv(): void {
|
|
90
|
+
if (process.env['API_URL']) {
|
|
91
|
+
environment.apiUrl = process.env['API_URL'];
|
|
92
|
+
}
|
|
93
|
+
if (process.env['APP_VERSION'] || process.env['VERSION']) {
|
|
94
|
+
environment.version =
|
|
95
|
+
process.env['APP_VERSION'] ||
|
|
96
|
+
process.env['VERSION'] ||
|
|
97
|
+
environment.version;
|
|
98
|
+
}
|
|
99
|
+
if (process.env['SITE_URL']) {
|
|
100
|
+
environment.siteUrl = process.env['SITE_URL'];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
init(): void {
|
|
105
|
+
if (isPlatformServer(this.platformId)) {
|
|
106
|
+
EnvironmentService.initFromProcessEnv();
|
|
107
|
+
this.transferState.set(ENV_KEY, environment);
|
|
108
|
+
} else {
|
|
109
|
+
const env = this.transferState.get(ENV_KEY, {} as any);
|
|
110
|
+
|
|
111
|
+
if (env?.apiUrl) {
|
|
112
|
+
environment.apiUrl = env.apiUrl;
|
|
113
|
+
environment.version = env.version;
|
|
114
|
+
environment.siteUrl = env.siteUrl;
|
|
115
|
+
} else {
|
|
116
|
+
const windowEnv = (window as unknown as Record<string, any>)['env'];
|
|
117
|
+
if (windowEnv?.apiUrl) {
|
|
118
|
+
environment.apiUrl = windowEnv.apiUrl;
|
|
119
|
+
environment.version = windowEnv.version;
|
|
120
|
+
environment.siteUrl = windowEnv.siteUrl;
|
|
121
|
+
} else {
|
|
122
|
+
throw new Error('Environment variables not set!');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Empty `lib/` placeholders
|
|
131
|
+
|
|
132
|
+
Create empty dirs with a `.gitkeep` each (the module skills populate them):
|
|
133
|
+
`src/lib/components`, `src/lib/services` (already has `environment/`), `src/lib/models`,
|
|
134
|
+
`src/lib/pipes`, `src/lib/interceptors`, `src/lib/directives`, `src/lib/tools`.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## `libs/shared/angular/project.json` (overwrite)
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"name": "shared-angular",
|
|
143
|
+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
144
|
+
"projectType": "library",
|
|
145
|
+
"sourceRoot": "libs/shared/angular/src",
|
|
146
|
+
"prefix": "smart-<PREFIX>",
|
|
147
|
+
"tags": [],
|
|
148
|
+
"targets": {
|
|
149
|
+
"lint": {
|
|
150
|
+
"executor": "@nx/eslint:lint",
|
|
151
|
+
"options": {
|
|
152
|
+
"lintFilePatterns": [
|
|
153
|
+
"libs/shared/angular/src/**/*.ts",
|
|
154
|
+
"libs/shared/angular/src/**/*.html"
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"test": {
|
|
159
|
+
"executor": "@nx/jest:jest",
|
|
160
|
+
"outputs": ["{workspaceRoot}/coverage/libs/shared/angular"],
|
|
161
|
+
"options": {
|
|
162
|
+
"jestConfig": "libs/shared/angular/jest.config.ts",
|
|
163
|
+
"passWithNoTests": true,
|
|
164
|
+
"tsConfig": "libs/shared/angular/tsconfig.spec.json"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"build": {
|
|
168
|
+
"executor": "@nx/angular:package",
|
|
169
|
+
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
|
|
170
|
+
"options": {
|
|
171
|
+
"project": "libs/shared/angular/ng-package.json",
|
|
172
|
+
"tsConfig": "libs/shared/angular/tsconfig.lib.json"
|
|
173
|
+
},
|
|
174
|
+
"configurations": {
|
|
175
|
+
"production": {
|
|
176
|
+
"tsConfig": "libs/shared/angular/tsconfig.lib.prod.json"
|
|
177
|
+
},
|
|
178
|
+
"development": {}
|
|
179
|
+
},
|
|
180
|
+
"defaultConfiguration": "production"
|
|
181
|
+
},
|
|
182
|
+
"storybook": {
|
|
183
|
+
"executor": "@storybook/angular:start-storybook",
|
|
184
|
+
"options": {
|
|
185
|
+
"port": 4400,
|
|
186
|
+
"configDir": "libs/shared/angular/.storybook",
|
|
187
|
+
"browserTarget": "shared-angular:build-storybook",
|
|
188
|
+
"compodoc": false
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"build-storybook": {
|
|
192
|
+
"executor": "@storybook/angular:build-storybook",
|
|
193
|
+
"outputs": ["{options.outputDir}"],
|
|
194
|
+
"options": {
|
|
195
|
+
"outputDir": "dist/storybook/angular",
|
|
196
|
+
"configDir": "libs/shared/angular/.storybook",
|
|
197
|
+
"browserTarget": "shared-angular:build-storybook",
|
|
198
|
+
"compodoc": false
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## `libs/shared/angular/ng-package.json` (overwrite — normalized dest)
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
|
|
210
|
+
"dest": "../../../dist/libs/shared/angular",
|
|
211
|
+
"lib": {
|
|
212
|
+
"entryFile": "src/index.ts"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## `libs/shared/angular/package.json`
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"name": "@<PREFIX>/angular",
|
|
222
|
+
"version": "1.0.0"
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## `libs/shared/angular/jest.config.ts` (overwrite — normalized paths)
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
export default {
|
|
230
|
+
displayName: 'angular',
|
|
231
|
+
preset: '../../../jest.preset.js',
|
|
232
|
+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
|
233
|
+
coverageDirectory: '../../../coverage/libs/shared/angular',
|
|
234
|
+
transform: {
|
|
235
|
+
'^.+\\.(ts|mjs|js|html)$': [
|
|
236
|
+
'jest-preset-angular',
|
|
237
|
+
{
|
|
238
|
+
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
239
|
+
stringifyContentPathRegex: '\\.(html|svg)$',
|
|
240
|
+
diagnostics: false,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
|
|
245
|
+
snapshotSerializers: [
|
|
246
|
+
'jest-preset-angular/build/serializers/no-ng-attributes',
|
|
247
|
+
'jest-preset-angular/build/serializers/ng-snapshot',
|
|
248
|
+
'jest-preset-angular/build/serializers/html-comment',
|
|
249
|
+
],
|
|
250
|
+
};
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## `libs/shared/angular/src/test-setup.ts`
|
|
254
|
+
|
|
255
|
+
```ts
|
|
256
|
+
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
|
|
257
|
+
|
|
258
|
+
setupZoneTestEnv({
|
|
259
|
+
errorOnUnknownElements: true,
|
|
260
|
+
errorOnUnknownProperties: true,
|
|
261
|
+
});
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## tsconfig set
|
|
267
|
+
|
|
268
|
+
`tsconfig.json`, `tsconfig.lib.json`, `tsconfig.lib.prod.json`, `tsconfig.spec.json` —
|
|
269
|
+
keep as `nx g @nx/angular:library` generated them (they already extend
|
|
270
|
+
`../../../tsconfig.base.json` and enable strict templates). Verify `tsconfig.lib.json` keeps
|
|
271
|
+
`"types": ["node"]` (the SSR env code uses `process.env`).
|
|
272
|
+
|
|
273
|
+
## `.storybook/`
|
|
274
|
+
|
|
275
|
+
Keep `nx g`-generated `.storybook/main.ts`, `.storybook/preview.ts`, `.storybook/tsconfig.json`.
|
|
276
|
+
If absent (generator skipped storybook), add a minimal `.storybook/main.ts`:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
import type { StorybookConfig } from '@storybook/angular';
|
|
280
|
+
|
|
281
|
+
const config: StorybookConfig = {
|
|
282
|
+
stories: ['../**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
|
|
283
|
+
addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'],
|
|
284
|
+
framework: { name: '@storybook/angular', options: {} },
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export default config;
|
|
288
|
+
```
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
# Patch delta — workspace config
|
|
2
|
+
|
|
3
|
+
Apply these after `create-nx-workspace`. Substitute placeholders everywhere:
|
|
4
|
+
|
|
5
|
+
- `<PREFIX>` — confirmed import-alias prefix.
|
|
6
|
+
- `<BASE_BRANCH>` — confirmed base branch (default `origin/development`).
|
|
7
|
+
- `<WORKSPACE_NAME>` — the workspace folder/name.
|
|
8
|
+
- `<NG_VERSION>` / `<NODE_VERSION>` — resolved in `references/version-resolution.md` (never hardcoded).
|
|
9
|
+
|
|
10
|
+
All content below is the **generic, feature-stripped** baseline. Version numbers are not pinned here —
|
|
11
|
+
they come from the version-resolution step.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## `nx.json` (overwrite)
|
|
16
|
+
|
|
17
|
+
Drop `nxCloudId`. Set `defaultBase` to `<BASE_BRANCH>`.
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"$schema": "./node_modules/nx/schemas/nx-schema.json",
|
|
22
|
+
"defaultBase": "<BASE_BRANCH>",
|
|
23
|
+
"namedInputs": {
|
|
24
|
+
"default": ["{projectRoot}/**/*", "sharedGlobals"],
|
|
25
|
+
"production": [
|
|
26
|
+
"default",
|
|
27
|
+
"!{projectRoot}/.eslintrc.json",
|
|
28
|
+
"!{projectRoot}/eslint.config.mjs",
|
|
29
|
+
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
|
|
30
|
+
"!{projectRoot}/tsconfig.spec.json",
|
|
31
|
+
"!{projectRoot}/jest.config.[jt]s",
|
|
32
|
+
"!{projectRoot}/src/test-setup.[jt]s",
|
|
33
|
+
"!{projectRoot}/test-setup.[jt]s",
|
|
34
|
+
"!{projectRoot}/**/*.spec.[jt]s?(x)",
|
|
35
|
+
"!{projectRoot}/playwright.config.[jt]s"
|
|
36
|
+
],
|
|
37
|
+
"sharedGlobals": ["{workspaceRoot}/.github/workflows/ci.yml"]
|
|
38
|
+
},
|
|
39
|
+
"targetDefaults": {
|
|
40
|
+
"@angular/build:application": {
|
|
41
|
+
"cache": true,
|
|
42
|
+
"dependsOn": ["^build"],
|
|
43
|
+
"inputs": ["production", "^production"]
|
|
44
|
+
},
|
|
45
|
+
"@nx/eslint:lint": {
|
|
46
|
+
"cache": true,
|
|
47
|
+
"inputs": [
|
|
48
|
+
"default",
|
|
49
|
+
"{workspaceRoot}/.eslintrc.json",
|
|
50
|
+
"{workspaceRoot}/.eslintignore",
|
|
51
|
+
"{workspaceRoot}/eslint.config.mjs"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"@nx/jest:jest": {
|
|
55
|
+
"cache": true,
|
|
56
|
+
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
|
|
57
|
+
"options": { "passWithNoTests": true },
|
|
58
|
+
"configurations": { "ci": { "ci": true, "codeCoverage": true } }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"plugins": [
|
|
62
|
+
{ "plugin": "@nx/eslint/plugin", "options": { "targetName": "lint" } }
|
|
63
|
+
],
|
|
64
|
+
"generators": {
|
|
65
|
+
"@nx/angular:application": {
|
|
66
|
+
"e2eTestRunner": "playwright",
|
|
67
|
+
"linter": "eslint",
|
|
68
|
+
"style": "scss",
|
|
69
|
+
"unitTestRunner": "jest"
|
|
70
|
+
},
|
|
71
|
+
"@nx/angular:library": { "linter": "eslint", "unitTestRunner": "jest" },
|
|
72
|
+
"@nx/angular:component": { "style": "scss" }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> Everything defaults to `scss` — the app, generated libs, and generated components — so styling
|
|
78
|
+
> is consistent workspace-wide.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## `tsconfig.base.json` (overwrite)
|
|
83
|
+
|
|
84
|
+
Keep `compilerOptions`; replace `paths` with a **single generic** entry. NO module paths.
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"compileOnSave": false,
|
|
89
|
+
"compilerOptions": {
|
|
90
|
+
"rootDir": ".",
|
|
91
|
+
"sourceMap": true,
|
|
92
|
+
"declaration": false,
|
|
93
|
+
"moduleResolution": "bundler",
|
|
94
|
+
"emitDecoratorMetadata": true,
|
|
95
|
+
"experimentalDecorators": true,
|
|
96
|
+
"esModuleInterop": true,
|
|
97
|
+
"importHelpers": true,
|
|
98
|
+
"target": "es2022",
|
|
99
|
+
"module": "es2022",
|
|
100
|
+
"lib": ["es2020", "dom"],
|
|
101
|
+
"skipLibCheck": true,
|
|
102
|
+
"skipDefaultLibCheck": true,
|
|
103
|
+
"baseUrl": ".",
|
|
104
|
+
"paths": {
|
|
105
|
+
"@<PREFIX>/angular": ["libs/shared/angular/src/index.ts"]
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"exclude": ["node_modules", "tmp"]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## `eslint.config.mjs` (overwrite)
|
|
115
|
+
|
|
116
|
+
Thread `<PREFIX>` into the `import/order` `pathGroups`. Keep the storybook block (the base
|
|
117
|
+
shared lib ships `.storybook`).
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
|
|
121
|
+
import storybook from 'eslint-plugin-storybook';
|
|
122
|
+
|
|
123
|
+
import nx from '@nx/eslint-plugin';
|
|
124
|
+
import importPlugin from 'eslint-plugin-import';
|
|
125
|
+
|
|
126
|
+
export default [
|
|
127
|
+
...nx.configs['flat/base'],
|
|
128
|
+
...nx.configs['flat/typescript'],
|
|
129
|
+
...nx.configs['flat/javascript'],
|
|
130
|
+
{
|
|
131
|
+
ignores: ['**/dist'],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
plugins: {
|
|
135
|
+
import: importPlugin,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
|
140
|
+
rules: {
|
|
141
|
+
'import/order': [
|
|
142
|
+
'error',
|
|
143
|
+
{
|
|
144
|
+
'newlines-between': 'always',
|
|
145
|
+
groups: ['external', 'builtin', 'internal'],
|
|
146
|
+
pathGroups: [
|
|
147
|
+
{
|
|
148
|
+
pattern: '@<PREFIX>/**',
|
|
149
|
+
group: 'external',
|
|
150
|
+
position: 'after',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
pathGroupsExcludedImportTypes: [],
|
|
154
|
+
alphabetize: {
|
|
155
|
+
order: 'asc',
|
|
156
|
+
caseInsensitive: true,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
files: [
|
|
164
|
+
'**/*.ts',
|
|
165
|
+
'**/*.tsx',
|
|
166
|
+
'**/*.cts',
|
|
167
|
+
'**/*.mts',
|
|
168
|
+
'**/*.js',
|
|
169
|
+
'**/*.jsx',
|
|
170
|
+
'**/*.cjs',
|
|
171
|
+
'**/*.mjs',
|
|
172
|
+
],
|
|
173
|
+
// Override or add rules here
|
|
174
|
+
rules: {},
|
|
175
|
+
},
|
|
176
|
+
...storybook.configs['flat/recommended'],
|
|
177
|
+
];
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## `jest.preset.js` (overwrite)
|
|
183
|
+
|
|
184
|
+
```js
|
|
185
|
+
const nxPreset = require('@nx/jest/preset').default;
|
|
186
|
+
|
|
187
|
+
module.exports = { ...nxPreset };
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## `jest.config.ts` (overwrite)
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { getJestProjectsAsync } from '@nx/jest';
|
|
194
|
+
|
|
195
|
+
export default async () => ({
|
|
196
|
+
projects: await getJestProjectsAsync(),
|
|
197
|
+
});
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## `.prettierrc` (overwrite)
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"singleQuote": true
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## `.prettierignore` (overwrite — generic lines only)
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
# Add files here to ignore them from prettier formatting
|
|
214
|
+
/dist
|
|
215
|
+
/coverage
|
|
216
|
+
/.nx/cache
|
|
217
|
+
/.nx/workspace-data
|
|
218
|
+
/.cache
|
|
219
|
+
|
|
220
|
+
CHANGELOG.md
|
|
221
|
+
CONTRIBUTING.md
|
|
222
|
+
README.md
|
|
223
|
+
|
|
224
|
+
.angular
|
|
225
|
+
|
|
226
|
+
# index.html may contain meta tags prettier cannot parse
|
|
227
|
+
apps/web/src/index.html
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## `.editorconfig` (overwrite)
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
# Editor configuration, see http://editorconfig.org
|
|
234
|
+
root = true
|
|
235
|
+
|
|
236
|
+
[*]
|
|
237
|
+
charset = utf-8
|
|
238
|
+
indent_style = space
|
|
239
|
+
indent_size = 2
|
|
240
|
+
insert_final_newline = true
|
|
241
|
+
trim_trailing_whitespace = true
|
|
242
|
+
|
|
243
|
+
[*.md]
|
|
244
|
+
max_line_length = off
|
|
245
|
+
trim_trailing_whitespace = false
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## `.eslintignore` (overwrite)
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
node_modules
|
|
252
|
+
**/tailwind.config.js
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## `.nvmrc` (overwrite)
|
|
256
|
+
|
|
257
|
+
Write the resolved `<NODE_VERSION>` (from `references/version-resolution.md`):
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
<NODE_VERSION>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## `commitlint.config.js` (create — generic as-is)
|
|
266
|
+
|
|
267
|
+
Reads `libs/` directory names for `scope-enum`; fully generic.
|
|
268
|
+
|
|
269
|
+
```js
|
|
270
|
+
const fs = require('fs');
|
|
271
|
+
const path = require('path');
|
|
272
|
+
|
|
273
|
+
const getDirectories = (source) =>
|
|
274
|
+
fs
|
|
275
|
+
.readdirSync(source, { withFileTypes: true })
|
|
276
|
+
.filter((dirent) => dirent.isDirectory())
|
|
277
|
+
.map((dirent) => dirent.name);
|
|
278
|
+
|
|
279
|
+
module.exports = {
|
|
280
|
+
extends: ['@commitlint/config-conventional'],
|
|
281
|
+
rules: {
|
|
282
|
+
'scope-enum': async () => {
|
|
283
|
+
return [
|
|
284
|
+
2,
|
|
285
|
+
'always',
|
|
286
|
+
[
|
|
287
|
+
...getDirectories(path.join(__dirname, 'libs')).filter(
|
|
288
|
+
(name) => name.indexOf('-e2e') === -1,
|
|
289
|
+
),
|
|
290
|
+
'nx',
|
|
291
|
+
'github',
|
|
292
|
+
'docker',
|
|
293
|
+
'release',
|
|
294
|
+
],
|
|
295
|
+
];
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## `.husky/` hooks
|
|
304
|
+
|
|
305
|
+
Initialize husky (`npx husky install`) then create:
|
|
306
|
+
|
|
307
|
+
### `.husky/commit-msg`
|
|
308
|
+
|
|
309
|
+
> Reference runs `... lint test build postbuild`. **Drop `postbuild`** (no such target in a fresh scaffold).
|
|
310
|
+
|
|
311
|
+
```sh
|
|
312
|
+
#!/usr/bin/env sh
|
|
313
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
314
|
+
|
|
315
|
+
npx --no -- commitlint --edit "$1"
|
|
316
|
+
npx nx run-many -t lint test build
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### `.husky/pre-push` (thread `<BASE_BRANCH>`)
|
|
320
|
+
|
|
321
|
+
```sh
|
|
322
|
+
#!/usr/bin/env sh
|
|
323
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
324
|
+
|
|
325
|
+
[ -n "$CI" ] && exit 0
|
|
326
|
+
|
|
327
|
+
npx nx format:check
|
|
328
|
+
|
|
329
|
+
npx nx affected --target=lint --base=<BASE_BRANCH> --head=HEAD --parallel=3
|
|
330
|
+
npx nx affected --target=test --base=<BASE_BRANCH> --head=HEAD --parallel=3
|
|
331
|
+
npx nx affected --target=build --base=<BASE_BRANCH> --head=HEAD --parallel=3
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### `.husky/post-merge`
|
|
335
|
+
|
|
336
|
+
```sh
|
|
337
|
+
#!/usr/bin/env sh
|
|
338
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
339
|
+
|
|
340
|
+
export NVM_DIR="$HOME/.nvm"
|
|
341
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
342
|
+
|
|
343
|
+
nvm use 24
|
|
344
|
+
npm i
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## `package.json`
|
|
350
|
+
|
|
351
|
+
### Name + scripts
|
|
352
|
+
|
|
353
|
+
```json
|
|
354
|
+
{
|
|
355
|
+
"name": "@<PREFIX>/source",
|
|
356
|
+
"scripts": {
|
|
357
|
+
"start": "nx serve web",
|
|
358
|
+
"start:prod": "nx serve web --configuration=production",
|
|
359
|
+
"postinstall": "husky install",
|
|
360
|
+
"format": "nx format && nx run-many --target=lint --fix"
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
> Omit the reference's `"update"` script (project-specific tooling).
|
|
366
|
+
|
|
367
|
+
### devDependencies — add the smart plugin + commit tooling
|
|
368
|
+
|
|
369
|
+
So the seeded `.claude` hooks and commit hooks resolve. Pin none of these to a literal —
|
|
370
|
+
resolve each at run time:
|
|
371
|
+
|
|
372
|
+
- `@smartsoft001/claude-plugins` → the version currently providing this skill (`npm view @smartsoft001/claude-plugins version`, or the locally installed one).
|
|
373
|
+
- `husky`, `@commitlint/cli`, `@commitlint/config-conventional` → their current published versions (`npm view <pkg> version`), unless `create-nx-workspace` already added compatible ones.
|
|
374
|
+
|
|
375
|
+
### Toolchain versions — derive, do not pin
|
|
376
|
+
|
|
377
|
+
**There is no hardcoded version table.** `create-nx-workspace@<NX_LINE>` (the Nx line resolved in
|
|
378
|
+
`references/version-resolution.md`) installs a self-consistent toolchain — Nx packages, jest,
|
|
379
|
+
eslint, typescript, playwright, swc, esbuild, prettier, rxjs, zone.js. **Keep whatever it installs.**
|
|
380
|
+
|
|
381
|
+
Only reconcile two things, both driven by the confirmed `<NG_VERSION>`:
|
|
382
|
+
|
|
383
|
+
- **`@angular/*` + `ng-packagr`** — if the bundled Angular differs from `<NG_VERSION>`, set
|
|
384
|
+
`@angular/{core,common,compiler,forms,platform-browser,platform-server,router}`, `@angular/ssr`,
|
|
385
|
+
`@angular/cli`, `@angular/build`, `@angular/compiler-cli`, `@angular/language-service` to `<NG_VERSION>`
|
|
386
|
+
and `ng-packagr` to its matching line (`npm view "ng-packagr@^<NG_MAJOR>" version | tail -1`).
|
|
387
|
+
- **SSR runtime** — ensure `express` and `dotenv` are present (used by `server.ts`); add via
|
|
388
|
+
`npm view <pkg> version` if the preset did not.
|
|
389
|
+
|
|
390
|
+
See `references/version-resolution.md` for the resolution commands.
|
|
391
|
+
|
|
392
|
+
### EXCLUDED — feature deps (never add in the base)
|
|
393
|
+
|
|
394
|
+
`@smartsoft001*` and `@smartsoft001-mobilems*` **feature** libs (angular, crud-shell-angular,
|
|
395
|
+
domain-core, models, utils, objects-_, articles-_, public-collections-_, …) — keep ONLY
|
|
396
|
+
`@smartsoft001/claude-plugins` (toolchain). Also exclude: `@ngrx/_`, `@ngx-translate/_`,
|
|
397
|
+
`@nestjs/_`, `@thisissoon/angular-masonry`, `masonry-layout`, `leaflet`/`@types/leaflet`,
|
|
398
|
+
`openseadragon`/`@types/openseadragon`, `online-3d-viewer`, `swiper`, `ng-dynamic-component`,
|
|
399
|
+
`ng-lazyload-image`, `ngx-_`(captcha/color-picker/cookie/editor/pagination),`mongodb`,
|
|
400
|
+
`typeorm`, `passport_`, `paypal-rest-sdk`, `xlsx`, `json2csv`, `crypto-js`, `md5`/`@types/md5`,
|
|
401
|
+
`moment`/`moment-timezone`, `socket.io`, `busboy`, `class-validator`, `guid-typescript`,
|
|
402
|
+
`jwt-decode`, `lodash-decorators`, `tailwindcss`/`autoprefixer`/`postcss`/`postcss-url`,
|
|
403
|
+
`reflect-metadata`, `pnpm`.
|