@webpieces/nx-webpieces-rules 0.0.1 → 0.2.114
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 +4 -4
- package/src/executor-result.d.ts +4 -0
- package/src/executor-result.js +10 -0
- package/src/executor-result.js.map +1 -0
- package/src/executors/generate/executor.d.ts +16 -0
- package/src/executors/generate/{executor.ts → executor.js} +15 -30
- package/src/executors/generate/executor.js.map +1 -0
- package/src/executors/help/executor.d.ts +8 -0
- package/src/executors/help/{executor.ts → executor.js} +5 -12
- package/src/executors/help/executor.js.map +1 -0
- package/src/executors/validate-architecture-unchanged/executor.d.ts +17 -0
- package/src/executors/validate-architecture-unchanged/{executor.ts → executor.js} +24 -46
- package/src/executors/validate-architecture-unchanged/executor.js.map +1 -0
- package/src/executors/validate-catch-error-pattern/executor.d.ts +3 -0
- package/src/executors/validate-catch-error-pattern/executor.js +10 -0
- package/src/executors/validate-catch-error-pattern/executor.js.map +1 -0
- package/src/executors/validate-code/executor.d.ts +3 -0
- package/src/executors/validate-code/executor.js +10 -0
- package/src/executors/validate-code/executor.js.map +1 -0
- package/src/executors/validate-dtos/executor.d.ts +3 -0
- package/src/executors/validate-dtos/executor.js +10 -0
- package/src/executors/validate-dtos/executor.js.map +1 -0
- package/src/executors/validate-eslint-sync/executor.d.ts +7 -0
- package/src/executors/validate-eslint-sync/{executor.ts → executor.js} +19 -37
- package/src/executors/validate-eslint-sync/executor.js.map +1 -0
- package/src/executors/validate-modified-files/executor.d.ts +3 -0
- package/src/executors/validate-modified-files/executor.js +10 -0
- package/src/executors/validate-modified-files/executor.js.map +1 -0
- package/src/executors/validate-modified-methods/executor.d.ts +3 -0
- package/src/executors/validate-modified-methods/executor.js +10 -0
- package/src/executors/validate-modified-methods/executor.js.map +1 -0
- package/src/executors/validate-new-methods/executor.d.ts +3 -0
- package/src/executors/validate-new-methods/executor.js +10 -0
- package/src/executors/validate-new-methods/executor.js.map +1 -0
- package/src/executors/validate-no-any-unknown/executor.d.ts +3 -0
- package/src/executors/validate-no-any-unknown/executor.js +10 -0
- package/src/executors/validate-no-any-unknown/executor.js.map +1 -0
- package/src/executors/validate-no-architecture-cycles/executor.d.ts +16 -0
- package/src/executors/validate-no-architecture-cycles/{executor.ts → executor.js} +16 -28
- package/src/executors/validate-no-architecture-cycles/executor.js.map +1 -0
- package/src/executors/validate-no-destructure/executor.d.ts +3 -0
- package/src/executors/validate-no-destructure/executor.js +10 -0
- package/src/executors/validate-no-destructure/executor.js.map +1 -0
- package/src/executors/validate-no-direct-api-resolver/executor.d.ts +3 -0
- package/src/executors/validate-no-direct-api-resolver/executor.js +10 -0
- package/src/executors/validate-no-direct-api-resolver/executor.js.map +1 -0
- package/src/executors/validate-no-implicit-any/executor.d.ts +3 -0
- package/src/executors/validate-no-implicit-any/executor.js +10 -0
- package/src/executors/validate-no-implicit-any/executor.js.map +1 -0
- package/src/executors/validate-no-inline-types/executor.d.ts +3 -0
- package/src/executors/validate-no-inline-types/executor.js +10 -0
- package/src/executors/validate-no-inline-types/executor.js.map +1 -0
- package/src/executors/validate-no-skiplevel-deps/executor.d.ts +19 -0
- package/src/executors/validate-no-skiplevel-deps/{executor.ts → executor.js} +23 -63
- package/src/executors/validate-no-skiplevel-deps/executor.js.map +1 -0
- package/src/executors/validate-no-unmanaged-exceptions/executor.d.ts +3 -0
- package/src/executors/validate-no-unmanaged-exceptions/executor.js +10 -0
- package/src/executors/validate-no-unmanaged-exceptions/executor.js.map +1 -0
- package/src/executors/validate-packagejson/executor.d.ts +16 -0
- package/src/executors/validate-packagejson/{executor.ts → executor.js} +15 -32
- package/src/executors/validate-packagejson/executor.js.map +1 -0
- package/src/executors/validate-prisma-converters/executor.d.ts +3 -0
- package/src/executors/validate-prisma-converters/executor.js +10 -0
- package/src/executors/validate-prisma-converters/executor.js.map +1 -0
- package/src/executors/validate-return-types/executor.d.ts +3 -0
- package/src/executors/validate-return-types/executor.js +10 -0
- package/src/executors/validate-return-types/executor.js.map +1 -0
- package/src/executors/validate-ts-in-src/executor.d.ts +32 -0
- package/src/executors/validate-ts-in-src/{executor.ts → executor.js} +80 -135
- package/src/executors/validate-ts-in-src/executor.js.map +1 -0
- package/src/executors/validate-versions-locked/executor.d.ts +22 -0
- package/src/executors/validate-versions-locked/{executor.ts → executor.js} +49 -116
- package/src/executors/validate-versions-locked/executor.js.map +1 -0
- package/src/executors/visualize/executor.d.ts +17 -0
- package/src/executors/visualize/{executor.ts → executor.js} +16 -30
- package/src/executors/visualize/executor.js.map +1 -0
- package/src/{index.ts → index.d.ts} +5 -1
- package/src/index.js +14 -0
- package/src/index.js.map +1 -0
- package/src/lib/graph-comparator.d.ts +39 -0
- package/src/lib/{graph-comparator.ts → graph-comparator.js} +18 -67
- package/src/lib/graph-comparator.js.map +1 -0
- package/src/lib/graph-generator.d.ts +19 -0
- package/src/lib/{graph-generator.ts → graph-generator.js} +17 -30
- package/src/lib/graph-generator.js.map +1 -0
- package/src/lib/graph-loader.d.ts +31 -0
- package/src/lib/{graph-loader.ts → graph-loader.js} +24 -42
- package/src/lib/graph-loader.js.map +1 -0
- package/src/lib/graph-sorter.d.ts +37 -0
- package/src/lib/{graph-sorter.ts → graph-sorter.js} +26 -53
- package/src/lib/graph-sorter.js.map +1 -0
- package/src/lib/graph-visualizer.d.ts +31 -0
- package/src/lib/{graph-visualizer.ts → graph-visualizer.js} +32 -56
- package/src/lib/graph-visualizer.js.map +1 -0
- package/src/lib/package-validator.d.ts +40 -0
- package/src/lib/package-validator.js +175 -0
- package/src/lib/package-validator.js.map +1 -0
- package/src/plugin.d.ts +86 -0
- package/src/{plugin.ts → plugin.js} +100 -255
- package/src/plugin.js.map +1 -0
- package/src/toError.d.ts +5 -0
- package/src/{toError.ts → toError.js} +7 -6
- package/src/toError.js.map +1 -0
- package/LICENSE +0 -373
- package/src/executor-result.ts +0 -7
- package/src/executors/validate-catch-error-pattern/executor.ts +0 -11
- package/src/executors/validate-code/executor.ts +0 -11
- package/src/executors/validate-dtos/executor.ts +0 -11
- package/src/executors/validate-modified-files/executor.ts +0 -11
- package/src/executors/validate-modified-methods/executor.ts +0 -11
- package/src/executors/validate-new-methods/executor.ts +0 -11
- package/src/executors/validate-no-any-unknown/executor.ts +0 -11
- package/src/executors/validate-no-destructure/executor.ts +0 -11
- package/src/executors/validate-no-direct-api-resolver/executor.ts +0 -11
- package/src/executors/validate-no-implicit-any/executor.ts +0 -11
- package/src/executors/validate-no-inline-types/executor.ts +0 -11
- package/src/executors/validate-no-unmanaged-exceptions/executor.ts +0 -11
- package/src/executors/validate-prisma-converters/executor.ts +0 -11
- package/src/executors/validate-return-types/executor.ts +0 -11
- package/src/lib/package-validator.ts +0 -184
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Unified Nx Inference Plugin for @webpieces/nx-webpieces-rules
|
|
3
4
|
*
|
|
@@ -15,79 +16,11 @@
|
|
|
15
16
|
*
|
|
16
17
|
* Then all targets appear automatically without manual project.json configuration.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
CreateNodesContextV2,
|
|
24
|
-
CreateNodesResultV2,
|
|
25
|
-
CreateNodesResult,
|
|
26
|
-
TargetConfiguration,
|
|
27
|
-
} from '@nx/devkit';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Circular dependency checking options
|
|
31
|
-
*/
|
|
32
|
-
export interface CircularDepsOptions {
|
|
33
|
-
enabled?: boolean;
|
|
34
|
-
targetName?: string;
|
|
35
|
-
excludePatterns?: string[];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Validation options for architecture checks
|
|
40
|
-
*/
|
|
41
|
-
export interface ValidationOptions {
|
|
42
|
-
noCycles?: boolean;
|
|
43
|
-
noSkipLevelDeps?: boolean;
|
|
44
|
-
architectureUnchanged?: boolean;
|
|
45
|
-
validatePackageJson?: boolean;
|
|
46
|
-
validateNewMethods?: boolean;
|
|
47
|
-
validateModifiedMethods?: boolean;
|
|
48
|
-
validateModifiedFiles?: boolean;
|
|
49
|
-
validateVersionsLocked?: boolean;
|
|
50
|
-
validateTsInSrc?: boolean;
|
|
51
|
-
newMethodsMaxLines?: number;
|
|
52
|
-
modifiedAndNewMethodsMaxLines?: number;
|
|
53
|
-
modifiedFilesMaxLines?: number;
|
|
54
|
-
/**
|
|
55
|
-
* Validation mode for method/file size limits:
|
|
56
|
-
* - STRICT: All limits enforced, disable comments ignored
|
|
57
|
-
* - NORMAL: Limits enforced, disable comments with dates work
|
|
58
|
-
* - OFF: Skip size validations entirely (for fast iteration)
|
|
59
|
-
*/
|
|
60
|
-
validationMode?: 'STRICT' | 'NORMAL' | 'OFF';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Feature flags for workspace targets
|
|
65
|
-
*/
|
|
66
|
-
export interface FeatureOptions {
|
|
67
|
-
generate?: boolean;
|
|
68
|
-
visualize?: boolean;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Workspace-level configuration options
|
|
73
|
-
*/
|
|
74
|
-
export interface WorkspaceOptions {
|
|
75
|
-
enabled?: boolean;
|
|
76
|
-
targetPrefix?: string;
|
|
77
|
-
graphPath?: string;
|
|
78
|
-
validations?: ValidationOptions;
|
|
79
|
-
features?: FeatureOptions;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Configuration for @webpieces/nx-webpieces-rules Nx plugin
|
|
84
|
-
*/
|
|
85
|
-
export interface ArchitecturePluginOptions {
|
|
86
|
-
circularDeps?: CircularDepsOptions;
|
|
87
|
-
workspace?: WorkspaceOptions;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const DEFAULT_OPTIONS: Required<ArchitecturePluginOptions> = {
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.createNodesV2 = void 0;
|
|
21
|
+
const path_1 = require("path");
|
|
22
|
+
const fs_1 = require("fs");
|
|
23
|
+
const DEFAULT_OPTIONS = {
|
|
91
24
|
circularDeps: {
|
|
92
25
|
enabled: true,
|
|
93
26
|
targetName: 'validate-no-file-import-cycles',
|
|
@@ -118,15 +51,11 @@ const DEFAULT_OPTIONS: Required<ArchitecturePluginOptions> = {
|
|
|
118
51
|
},
|
|
119
52
|
},
|
|
120
53
|
};
|
|
121
|
-
|
|
122
|
-
function normalizeOptions(
|
|
123
|
-
options: ArchitecturePluginOptions | undefined,
|
|
124
|
-
): Required<ArchitecturePluginOptions> {
|
|
54
|
+
function normalizeOptions(options) {
|
|
125
55
|
const circularDeps = {
|
|
126
56
|
...DEFAULT_OPTIONS.circularDeps,
|
|
127
57
|
...options?.circularDeps,
|
|
128
58
|
};
|
|
129
|
-
|
|
130
59
|
const workspace = {
|
|
131
60
|
...DEFAULT_OPTIONS.workspace,
|
|
132
61
|
...options?.workspace,
|
|
@@ -139,45 +68,30 @@ function normalizeOptions(
|
|
|
139
68
|
...options?.workspace?.features,
|
|
140
69
|
},
|
|
141
70
|
};
|
|
142
|
-
|
|
143
71
|
return {
|
|
144
72
|
circularDeps,
|
|
145
73
|
workspace,
|
|
146
|
-
}
|
|
74
|
+
};
|
|
147
75
|
}
|
|
148
|
-
|
|
149
|
-
async function createNodesFunction(
|
|
150
|
-
projectFiles: readonly string[],
|
|
151
|
-
options: ArchitecturePluginOptions | undefined,
|
|
152
|
-
context: CreateNodesContextV2,
|
|
153
|
-
): Promise<CreateNodesResultV2> {
|
|
76
|
+
async function createNodesFunction(projectFiles, options, context) {
|
|
154
77
|
const opts = normalizeOptions(options);
|
|
155
|
-
const results
|
|
156
|
-
|
|
78
|
+
const results = [];
|
|
157
79
|
// Add workspace-level architecture targets
|
|
158
80
|
addArchitectureProject(results, projectFiles, opts, context);
|
|
159
|
-
|
|
160
81
|
// Add per-project targets (circular-deps, ci)
|
|
161
82
|
addPerProjectTargets(results, projectFiles, opts, context);
|
|
162
|
-
|
|
163
83
|
return results;
|
|
164
84
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
): void {
|
|
172
|
-
if (!opts.workspace.enabled) return;
|
|
173
|
-
|
|
174
|
-
const archDirPath = join(context.workspaceRoot, 'architecture');
|
|
175
|
-
if (!existsSync(archDirPath)) return;
|
|
176
|
-
|
|
85
|
+
function addArchitectureProject(results, projectFiles, opts, context) {
|
|
86
|
+
if (!opts.workspace.enabled)
|
|
87
|
+
return;
|
|
88
|
+
const archDirPath = (0, path_1.join)(context.workspaceRoot, 'architecture');
|
|
89
|
+
if (!(0, fs_1.existsSync)(archDirPath))
|
|
90
|
+
return;
|
|
177
91
|
const workspaceTargets = createWorkspaceTargetsWithoutPrefix(opts);
|
|
178
|
-
if (Object.keys(workspaceTargets).length === 0)
|
|
179
|
-
|
|
180
|
-
const result
|
|
92
|
+
if (Object.keys(workspaceTargets).length === 0)
|
|
93
|
+
return;
|
|
94
|
+
const result = {
|
|
181
95
|
projects: {
|
|
182
96
|
architecture: {
|
|
183
97
|
name: 'architecture',
|
|
@@ -186,127 +100,106 @@ function addArchitectureProject(
|
|
|
186
100
|
},
|
|
187
101
|
},
|
|
188
102
|
};
|
|
189
|
-
|
|
190
103
|
const firstProjectFile = projectFiles[0];
|
|
191
104
|
if (firstProjectFile) {
|
|
192
|
-
results.push([firstProjectFile, result]
|
|
105
|
+
results.push([firstProjectFile, result]);
|
|
193
106
|
}
|
|
194
107
|
}
|
|
195
|
-
|
|
196
|
-
function addPerProjectTargets(
|
|
197
|
-
results: CreateNodesResultV2,
|
|
198
|
-
projectFiles: readonly string[],
|
|
199
|
-
opts: Required<ArchitecturePluginOptions>,
|
|
200
|
-
context: CreateNodesContextV2,
|
|
201
|
-
): void {
|
|
108
|
+
function addPerProjectTargets(results, projectFiles, opts, context) {
|
|
202
109
|
// Track processed project roots to avoid duplicates when both files exist
|
|
203
|
-
const processedRoots = new Set
|
|
204
|
-
|
|
110
|
+
const processedRoots = new Set();
|
|
205
111
|
for (const projectFile of projectFiles) {
|
|
206
112
|
const isProjectJson = projectFile.endsWith('project.json');
|
|
207
113
|
const isPackageJson = projectFile.endsWith('package.json');
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const projectRoot = dirname(projectFile);
|
|
212
|
-
|
|
114
|
+
if (!isProjectJson && !isPackageJson)
|
|
115
|
+
continue;
|
|
116
|
+
const projectRoot = (0, path_1.dirname)(projectFile);
|
|
213
117
|
// Skip root (workspace manifest, not a project)
|
|
214
|
-
if (projectRoot === '.')
|
|
215
|
-
|
|
118
|
+
if (projectRoot === '.')
|
|
119
|
+
continue;
|
|
216
120
|
// Skip if we've already processed this project root
|
|
217
|
-
if (processedRoots.has(projectRoot))
|
|
218
|
-
|
|
121
|
+
if (processedRoots.has(projectRoot))
|
|
122
|
+
continue;
|
|
219
123
|
// For package.json, skip if project.json also exists in same directory
|
|
220
124
|
// (prefer project.json - it will be processed separately)
|
|
221
125
|
if (isPackageJson) {
|
|
222
|
-
const projectJsonPath = join(context.workspaceRoot, projectRoot, 'project.json');
|
|
223
|
-
if (existsSync(projectJsonPath))
|
|
126
|
+
const projectJsonPath = (0, path_1.join)(context.workspaceRoot, projectRoot, 'project.json');
|
|
127
|
+
if ((0, fs_1.existsSync)(projectJsonPath))
|
|
128
|
+
continue;
|
|
224
129
|
}
|
|
225
|
-
|
|
226
130
|
processedRoots.add(projectRoot);
|
|
227
|
-
|
|
228
|
-
const targets: Record<string, TargetConfiguration> = {};
|
|
229
|
-
|
|
131
|
+
const targets = {};
|
|
230
132
|
// Add circular-deps target ONLY for project.json projects
|
|
231
133
|
// (package.json-only projects may not have TypeScript source)
|
|
232
134
|
if (isProjectJson && opts.circularDeps.enabled) {
|
|
233
|
-
if (!isExcluded(projectRoot, opts.circularDeps.excludePatterns
|
|
234
|
-
const targetName = opts.circularDeps.targetName
|
|
135
|
+
if (!isExcluded(projectRoot, opts.circularDeps.excludePatterns)) {
|
|
136
|
+
const targetName = opts.circularDeps.targetName;
|
|
235
137
|
targets[targetName] = createCircularDepsTarget(projectRoot, targetName);
|
|
236
138
|
}
|
|
237
139
|
}
|
|
238
|
-
|
|
239
140
|
// Add ci target to ALL projects (both project.json and package.json)
|
|
240
141
|
targets['ci'] = createCiTarget();
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const result: CreateNodesResult = {
|
|
142
|
+
if (Object.keys(targets).length === 0)
|
|
143
|
+
continue;
|
|
144
|
+
const result = {
|
|
245
145
|
projects: {
|
|
246
146
|
[projectRoot]: {
|
|
247
147
|
targets,
|
|
248
148
|
},
|
|
249
149
|
},
|
|
250
150
|
};
|
|
251
|
-
|
|
252
|
-
results.push([projectFile, result] as const);
|
|
151
|
+
results.push([projectFile, result]);
|
|
253
152
|
}
|
|
254
153
|
}
|
|
255
|
-
|
|
256
154
|
/**
|
|
257
155
|
* Nx V2 Inference Plugin
|
|
258
156
|
* Matches project.json and package.json files to create targets
|
|
259
157
|
*/
|
|
260
|
-
|
|
158
|
+
exports.createNodesV2 = [
|
|
261
159
|
// Pattern to match project.json and package.json files
|
|
262
160
|
'**/{project,package}.json',
|
|
263
|
-
|
|
264
161
|
// Inference function
|
|
265
162
|
createNodesFunction,
|
|
266
163
|
];
|
|
267
|
-
|
|
268
164
|
/**
|
|
269
165
|
* Build list of enabled validation target names for validate-complete dependency chain
|
|
270
166
|
*/
|
|
271
|
-
function buildValidationTargetsList(
|
|
272
|
-
|
|
273
|
-
)
|
|
274
|
-
|
|
275
|
-
if (validations
|
|
276
|
-
|
|
277
|
-
if (validations
|
|
278
|
-
|
|
167
|
+
function buildValidationTargetsList(validations) {
|
|
168
|
+
const targets = [];
|
|
169
|
+
if (validations.noCycles)
|
|
170
|
+
targets.push('validate-no-architecture-cycles');
|
|
171
|
+
if (validations.architectureUnchanged)
|
|
172
|
+
targets.push('validate-architecture-unchanged');
|
|
173
|
+
if (validations.noSkipLevelDeps)
|
|
174
|
+
targets.push('validate-no-skiplevel-deps');
|
|
175
|
+
if (validations.validatePackageJson)
|
|
176
|
+
targets.push('validate-packagejson');
|
|
279
177
|
// Use combined validate-code instead of 3 separate targets
|
|
280
|
-
if (
|
|
281
|
-
validations
|
|
282
|
-
validations
|
|
283
|
-
validations!.validateModifiedFiles
|
|
284
|
-
) {
|
|
178
|
+
if (validations.validateNewMethods ||
|
|
179
|
+
validations.validateModifiedMethods ||
|
|
180
|
+
validations.validateModifiedFiles) {
|
|
285
181
|
targets.push('validate-code');
|
|
286
182
|
}
|
|
287
|
-
if (validations
|
|
288
|
-
|
|
183
|
+
if (validations.validateVersionsLocked)
|
|
184
|
+
targets.push('validate-versions-locked');
|
|
185
|
+
if (validations.validateTsInSrc)
|
|
186
|
+
targets.push('validate-ts-in-src');
|
|
289
187
|
return targets;
|
|
290
188
|
}
|
|
291
|
-
|
|
292
189
|
/**
|
|
293
190
|
* Create workspace-level architecture validation targets WITHOUT prefix
|
|
294
191
|
* Used for virtual 'architecture' project
|
|
295
192
|
*/
|
|
296
|
-
function createWorkspaceTargetsWithoutPrefix(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const
|
|
300
|
-
const graphPath = opts.workspace.graphPath!;
|
|
301
|
-
const validations = opts.workspace.validations!;
|
|
302
|
-
|
|
193
|
+
function createWorkspaceTargetsWithoutPrefix(opts) {
|
|
194
|
+
const targets = {};
|
|
195
|
+
const graphPath = opts.workspace.graphPath;
|
|
196
|
+
const validations = opts.workspace.validations;
|
|
303
197
|
// Add help target (always available)
|
|
304
198
|
targets['help'] = createHelpTarget();
|
|
305
|
-
|
|
306
|
-
if (opts.workspace.features!.generate) {
|
|
199
|
+
if (opts.workspace.features.generate) {
|
|
307
200
|
targets['generate'] = createGenerateTarget(graphPath);
|
|
308
201
|
}
|
|
309
|
-
if (opts.workspace.features
|
|
202
|
+
if (opts.workspace.features.visualize) {
|
|
310
203
|
targets['visualize'] = createVisualizeTargetWithoutPrefix(graphPath);
|
|
311
204
|
}
|
|
312
205
|
if (validations.noCycles) {
|
|
@@ -324,11 +217,9 @@ function createWorkspaceTargetsWithoutPrefix(
|
|
|
324
217
|
// Use combined validate-code instead of 3 separate targets
|
|
325
218
|
// Options come from webpieces.config.json at the workspace root
|
|
326
219
|
// (loaded via @webpieces/rules-config; same source of truth as @webpieces/ai-hook-rules)
|
|
327
|
-
if (
|
|
328
|
-
validations.validateNewMethods ||
|
|
220
|
+
if (validations.validateNewMethods ||
|
|
329
221
|
validations.validateModifiedMethods ||
|
|
330
|
-
validations.validateModifiedFiles
|
|
331
|
-
) {
|
|
222
|
+
validations.validateModifiedFiles) {
|
|
332
223
|
targets['validate-code'] = createValidateCodeTarget();
|
|
333
224
|
}
|
|
334
225
|
if (validations.validateVersionsLocked) {
|
|
@@ -337,70 +228,53 @@ function createWorkspaceTargetsWithoutPrefix(
|
|
|
337
228
|
if (validations.validateTsInSrc) {
|
|
338
229
|
targets['validate-ts-in-src'] = createValidateTsInSrcTarget();
|
|
339
230
|
}
|
|
340
|
-
|
|
341
231
|
// Add validate-complete target that runs all enabled validations
|
|
342
232
|
const validationTargets = buildValidationTargetsList(validations);
|
|
343
233
|
if (validationTargets.length > 0) {
|
|
344
234
|
targets['validate-complete'] = createValidateCompleteTarget(validationTargets);
|
|
345
235
|
}
|
|
346
|
-
|
|
347
236
|
return targets;
|
|
348
237
|
}
|
|
349
|
-
|
|
350
238
|
/**
|
|
351
239
|
* Create workspace-level architecture validation targets (DEPRECATED - keeping for backward compat)
|
|
352
240
|
* Used when root project.json exists (old style with '.' project)
|
|
353
241
|
*/
|
|
354
|
-
function createWorkspaceTargets(
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const
|
|
358
|
-
const prefix = opts.workspace.targetPrefix!;
|
|
359
|
-
const graphPath = opts.workspace.graphPath!;
|
|
360
|
-
|
|
242
|
+
function createWorkspaceTargets(opts) {
|
|
243
|
+
const targets = {};
|
|
244
|
+
const prefix = opts.workspace.targetPrefix;
|
|
245
|
+
const graphPath = opts.workspace.graphPath;
|
|
361
246
|
// Add help target (always available)
|
|
362
247
|
targets[`${prefix}help`] = createHelpTarget();
|
|
363
|
-
|
|
364
|
-
if (opts.workspace.features!.generate) {
|
|
248
|
+
if (opts.workspace.features.generate) {
|
|
365
249
|
targets[`${prefix}generate`] = createGenerateTarget(graphPath);
|
|
366
250
|
}
|
|
367
|
-
|
|
368
|
-
if (opts.workspace.features!.visualize) {
|
|
251
|
+
if (opts.workspace.features.visualize) {
|
|
369
252
|
targets[`${prefix}visualize`] = createVisualizeTarget(prefix, graphPath);
|
|
370
253
|
}
|
|
371
|
-
|
|
372
|
-
if (opts.workspace.validations!.noCycles) {
|
|
254
|
+
if (opts.workspace.validations.noCycles) {
|
|
373
255
|
targets[`${prefix}validate-no-architecture-cycles`] = createValidateNoCyclesTarget();
|
|
374
256
|
}
|
|
375
|
-
|
|
376
|
-
if (opts.workspace.validations!.architectureUnchanged) {
|
|
257
|
+
if (opts.workspace.validations.architectureUnchanged) {
|
|
377
258
|
targets[`${prefix}validate-architecture-unchanged`] =
|
|
378
259
|
createValidateUnchangedTarget(graphPath);
|
|
379
260
|
}
|
|
380
|
-
|
|
381
|
-
if (opts.workspace.validations!.noSkipLevelDeps) {
|
|
261
|
+
if (opts.workspace.validations.noSkipLevelDeps) {
|
|
382
262
|
targets[`${prefix}validate-no-skiplevel-deps`] = createValidateNoSkipLevelTarget();
|
|
383
263
|
}
|
|
384
|
-
|
|
385
|
-
if (opts.workspace.validations!.validatePackageJson) {
|
|
264
|
+
if (opts.workspace.validations.validatePackageJson) {
|
|
386
265
|
targets[`${prefix}validate-packagejson`] = createValidatePackageJsonTarget();
|
|
387
266
|
}
|
|
388
|
-
|
|
389
267
|
// Use combined validate-code instead of 3 separate targets
|
|
390
268
|
// Options come from webpieces.config.json at the workspace root
|
|
391
269
|
// (loaded via @webpieces/rules-config; same source of truth as @webpieces/ai-hook-rules)
|
|
392
|
-
if (
|
|
393
|
-
opts.workspace.validations
|
|
394
|
-
opts.workspace.validations
|
|
395
|
-
opts.workspace.validations!.validateModifiedFiles
|
|
396
|
-
) {
|
|
270
|
+
if (opts.workspace.validations.validateNewMethods ||
|
|
271
|
+
opts.workspace.validations.validateModifiedMethods ||
|
|
272
|
+
opts.workspace.validations.validateModifiedFiles) {
|
|
397
273
|
targets[`${prefix}validate-code`] = createValidateCodeTarget();
|
|
398
274
|
}
|
|
399
|
-
|
|
400
275
|
return targets;
|
|
401
276
|
}
|
|
402
|
-
|
|
403
|
-
function createGenerateTarget(graphPath: string): TargetConfiguration {
|
|
277
|
+
function createGenerateTarget(graphPath) {
|
|
404
278
|
return {
|
|
405
279
|
executor: '@webpieces/nx-webpieces-rules:generate',
|
|
406
280
|
cache: false,
|
|
@@ -412,8 +286,7 @@ function createGenerateTarget(graphPath: string): TargetConfiguration {
|
|
|
412
286
|
},
|
|
413
287
|
};
|
|
414
288
|
}
|
|
415
|
-
|
|
416
|
-
function createVisualizeTargetWithoutPrefix(graphPath: string): TargetConfiguration {
|
|
289
|
+
function createVisualizeTargetWithoutPrefix(graphPath) {
|
|
417
290
|
return {
|
|
418
291
|
executor: '@webpieces/nx-webpieces-rules:visualize',
|
|
419
292
|
dependsOn: ['generate'],
|
|
@@ -424,8 +297,7 @@ function createVisualizeTargetWithoutPrefix(graphPath: string): TargetConfigurat
|
|
|
424
297
|
},
|
|
425
298
|
};
|
|
426
299
|
}
|
|
427
|
-
|
|
428
|
-
function createVisualizeTarget(prefix: string, graphPath: string): TargetConfiguration {
|
|
300
|
+
function createVisualizeTarget(prefix, graphPath) {
|
|
429
301
|
return {
|
|
430
302
|
executor: '@webpieces/nx-webpieces-rules:visualize',
|
|
431
303
|
dependsOn: [`${prefix}generate`],
|
|
@@ -436,8 +308,7 @@ function createVisualizeTarget(prefix: string, graphPath: string): TargetConfigu
|
|
|
436
308
|
},
|
|
437
309
|
};
|
|
438
310
|
}
|
|
439
|
-
|
|
440
|
-
function createValidateNoCyclesTarget(): TargetConfiguration {
|
|
311
|
+
function createValidateNoCyclesTarget() {
|
|
441
312
|
return {
|
|
442
313
|
executor: '@webpieces/nx-webpieces-rules:validate-no-architecture-cycles',
|
|
443
314
|
cache: true,
|
|
@@ -448,8 +319,7 @@ function createValidateNoCyclesTarget(): TargetConfiguration {
|
|
|
448
319
|
},
|
|
449
320
|
};
|
|
450
321
|
}
|
|
451
|
-
|
|
452
|
-
function createValidateUnchangedTarget(graphPath: string): TargetConfiguration {
|
|
322
|
+
function createValidateUnchangedTarget(graphPath) {
|
|
453
323
|
return {
|
|
454
324
|
executor: '@webpieces/nx-webpieces-rules:validate-architecture-unchanged',
|
|
455
325
|
cache: false,
|
|
@@ -461,8 +331,7 @@ function createValidateUnchangedTarget(graphPath: string): TargetConfiguration {
|
|
|
461
331
|
},
|
|
462
332
|
};
|
|
463
333
|
}
|
|
464
|
-
|
|
465
|
-
function createValidateNoSkipLevelTarget(): TargetConfiguration {
|
|
334
|
+
function createValidateNoSkipLevelTarget() {
|
|
466
335
|
return {
|
|
467
336
|
executor: '@webpieces/nx-webpieces-rules:validate-no-skiplevel-deps',
|
|
468
337
|
cache: true,
|
|
@@ -473,8 +342,7 @@ function createValidateNoSkipLevelTarget(): TargetConfiguration {
|
|
|
473
342
|
},
|
|
474
343
|
};
|
|
475
344
|
}
|
|
476
|
-
|
|
477
|
-
function createValidatePackageJsonTarget(): TargetConfiguration {
|
|
345
|
+
function createValidatePackageJsonTarget() {
|
|
478
346
|
return {
|
|
479
347
|
executor: '@webpieces/nx-webpieces-rules:validate-packagejson',
|
|
480
348
|
cache: true,
|
|
@@ -485,11 +353,7 @@ function createValidatePackageJsonTarget(): TargetConfiguration {
|
|
|
485
353
|
},
|
|
486
354
|
};
|
|
487
355
|
}
|
|
488
|
-
|
|
489
|
-
function createValidateNewMethodsTarget(
|
|
490
|
-
maxLines: number,
|
|
491
|
-
mode: 'STRICT' | 'NORMAL' | 'OFF',
|
|
492
|
-
): TargetConfiguration {
|
|
356
|
+
function createValidateNewMethodsTarget(maxLines, mode) {
|
|
493
357
|
return {
|
|
494
358
|
executor: '@webpieces/nx-webpieces-rules:validate-new-methods',
|
|
495
359
|
cache: false, // Don't cache - depends on git state
|
|
@@ -501,11 +365,7 @@ function createValidateNewMethodsTarget(
|
|
|
501
365
|
},
|
|
502
366
|
};
|
|
503
367
|
}
|
|
504
|
-
|
|
505
|
-
function createValidateModifiedMethodsTarget(
|
|
506
|
-
maxLines: number,
|
|
507
|
-
mode: 'STRICT' | 'NORMAL' | 'OFF',
|
|
508
|
-
): TargetConfiguration {
|
|
368
|
+
function createValidateModifiedMethodsTarget(maxLines, mode) {
|
|
509
369
|
return {
|
|
510
370
|
executor: '@webpieces/nx-webpieces-rules:validate-modified-methods',
|
|
511
371
|
cache: false, // Don't cache - depends on git state
|
|
@@ -517,11 +377,7 @@ function createValidateModifiedMethodsTarget(
|
|
|
517
377
|
},
|
|
518
378
|
};
|
|
519
379
|
}
|
|
520
|
-
|
|
521
|
-
function createValidateModifiedFilesTarget(
|
|
522
|
-
maxLines: number,
|
|
523
|
-
mode: 'STRICT' | 'NORMAL' | 'OFF',
|
|
524
|
-
): TargetConfiguration {
|
|
380
|
+
function createValidateModifiedFilesTarget(maxLines, mode) {
|
|
525
381
|
return {
|
|
526
382
|
executor: '@webpieces/nx-webpieces-rules:validate-modified-files',
|
|
527
383
|
cache: false, // Don't cache - depends on git state
|
|
@@ -533,13 +389,12 @@ function createValidateModifiedFilesTarget(
|
|
|
533
389
|
},
|
|
534
390
|
};
|
|
535
391
|
}
|
|
536
|
-
|
|
537
392
|
/**
|
|
538
393
|
* Create combined validate-code target
|
|
539
394
|
* Options come from webpieces.config.json at the workspace root
|
|
540
395
|
* (loaded by the executor via @webpieces/rules-config — same source of truth as @webpieces/ai-hook-rules)
|
|
541
396
|
*/
|
|
542
|
-
function createValidateCodeTarget()
|
|
397
|
+
function createValidateCodeTarget() {
|
|
543
398
|
return {
|
|
544
399
|
executor: '@webpieces/nx-webpieces-rules:validate-code',
|
|
545
400
|
cache: false, // Don't cache - depends on git state
|
|
@@ -551,21 +406,18 @@ function createValidateCodeTarget(): TargetConfiguration {
|
|
|
551
406
|
},
|
|
552
407
|
};
|
|
553
408
|
}
|
|
554
|
-
|
|
555
|
-
function createValidateVersionsLockedTarget(): TargetConfiguration {
|
|
409
|
+
function createValidateVersionsLockedTarget() {
|
|
556
410
|
return {
|
|
557
411
|
executor: '@webpieces/nx-webpieces-rules:validate-versions-locked',
|
|
558
412
|
cache: true,
|
|
559
413
|
inputs: ['{workspaceRoot}/**/package.json'],
|
|
560
414
|
metadata: {
|
|
561
415
|
technologies: ['nx'],
|
|
562
|
-
description:
|
|
563
|
-
'Validate package.json versions are locked (no semver ranges) and consistent across projects',
|
|
416
|
+
description: 'Validate package.json versions are locked (no semver ranges) and consistent across projects',
|
|
564
417
|
},
|
|
565
418
|
};
|
|
566
419
|
}
|
|
567
|
-
|
|
568
|
-
function createValidateTsInSrcTarget(): TargetConfiguration {
|
|
420
|
+
function createValidateTsInSrcTarget() {
|
|
569
421
|
return {
|
|
570
422
|
executor: '@webpieces/nx-webpieces-rules:validate-ts-in-src',
|
|
571
423
|
cache: false,
|
|
@@ -576,8 +428,7 @@ function createValidateTsInSrcTarget(): TargetConfiguration {
|
|
|
576
428
|
},
|
|
577
429
|
};
|
|
578
430
|
}
|
|
579
|
-
|
|
580
|
-
function createValidateCompleteTarget(validationTargets: string[]): TargetConfiguration {
|
|
431
|
+
function createValidateCompleteTarget(validationTargets) {
|
|
581
432
|
return {
|
|
582
433
|
executor: 'nx:noop',
|
|
583
434
|
cache: true,
|
|
@@ -588,7 +439,6 @@ function createValidateCompleteTarget(validationTargets: string[]): TargetConfig
|
|
|
588
439
|
},
|
|
589
440
|
};
|
|
590
441
|
}
|
|
591
|
-
|
|
592
442
|
/**
|
|
593
443
|
* Create per-project ci target - Gradle-style composite target
|
|
594
444
|
* Runs lint, build, and test in parallel
|
|
@@ -596,7 +446,7 @@ function createValidateCompleteTarget(validationTargets: string[]): TargetConfig
|
|
|
596
446
|
*
|
|
597
447
|
* NOTE: Type checking is done by the build target (@nx/js:tsc) during compilation.
|
|
598
448
|
*/
|
|
599
|
-
function createCiTarget()
|
|
449
|
+
function createCiTarget() {
|
|
600
450
|
return {
|
|
601
451
|
executor: 'nx:noop',
|
|
602
452
|
cache: true,
|
|
@@ -607,8 +457,7 @@ function createCiTarget(): TargetConfiguration {
|
|
|
607
457
|
},
|
|
608
458
|
};
|
|
609
459
|
}
|
|
610
|
-
|
|
611
|
-
function createHelpTarget(): TargetConfiguration {
|
|
460
|
+
function createHelpTarget() {
|
|
612
461
|
return {
|
|
613
462
|
executor: '@webpieces/nx-webpieces-rules:help',
|
|
614
463
|
cache: false, // Never cache - always show help output
|
|
@@ -618,17 +467,16 @@ function createHelpTarget(): TargetConfiguration {
|
|
|
618
467
|
},
|
|
619
468
|
};
|
|
620
469
|
}
|
|
621
|
-
|
|
622
470
|
/**
|
|
623
471
|
* Create per-project circular dependency checking target
|
|
624
472
|
* Runs on project root (.) to check ALL TypeScript files in the project
|
|
625
473
|
*/
|
|
626
|
-
function createCircularDepsTarget(projectRoot
|
|
474
|
+
function createCircularDepsTarget(projectRoot, targetName) {
|
|
627
475
|
return {
|
|
628
476
|
executor: 'nx:run-commands',
|
|
629
477
|
cache: true,
|
|
630
478
|
inputs: ['default'],
|
|
631
|
-
outputs: []
|
|
479
|
+
outputs: [],
|
|
632
480
|
options: {
|
|
633
481
|
command: 'npx madge --circular --extensions ts,tsx .',
|
|
634
482
|
cwd: projectRoot,
|
|
@@ -639,28 +487,25 @@ function createCircularDepsTarget(projectRoot: string, targetName: string): Targ
|
|
|
639
487
|
},
|
|
640
488
|
};
|
|
641
489
|
}
|
|
642
|
-
|
|
643
490
|
/**
|
|
644
491
|
* Check if a project should be excluded based on patterns
|
|
645
492
|
*/
|
|
646
|
-
function isExcluded(projectRoot
|
|
493
|
+
function isExcluded(projectRoot, excludePatterns) {
|
|
647
494
|
if (excludePatterns.length === 0) {
|
|
648
495
|
return false;
|
|
649
496
|
}
|
|
650
|
-
|
|
651
497
|
// Simple glob matching (could be enhanced with minimatch if needed)
|
|
652
498
|
return excludePatterns.some((pattern) => {
|
|
653
499
|
// Convert glob pattern to regex
|
|
654
500
|
const regexPattern = pattern
|
|
655
501
|
.replace(/\*\*/g, '.*') // ** matches any path
|
|
656
502
|
.replace(/\*/g, '[^/]*'); // * matches any string except /
|
|
657
|
-
|
|
658
503
|
const regex = new RegExp(`^${regexPattern}$`);
|
|
659
504
|
return regex.test(projectRoot);
|
|
660
505
|
});
|
|
661
506
|
}
|
|
662
|
-
|
|
663
507
|
/**
|
|
664
508
|
* Export plugin as default for Nx
|
|
665
509
|
*/
|
|
666
|
-
|
|
510
|
+
exports.default = { createNodesV2: exports.createNodesV2 };
|
|
511
|
+
//# sourceMappingURL=plugin.js.map
|