nestjs-docfy 0.2.2 → 0.2.4
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/dist/cli/extract-methods.d.ts +31 -4
- package/dist/cli/extract-methods.js +237 -38
- package/dist/cli/extract-methods.js.map +1 -1
- package/dist/cli/generate-file.d.ts +5 -0
- package/dist/cli/generate-file.js +200 -38
- package/dist/cli/generate-file.js.map +1 -1
- package/dist/cli/index.js +97 -58
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/parse-args.d.ts +2 -0
- package/dist/cli/parse-args.js +1 -0
- package/dist/cli/parse-args.js.map +1 -1
- package/dist/cli/scan-controllers.js +3 -1
- package/dist/cli/scan-controllers.js.map +1 -1
- package/dist/cli/watch.d.ts +12 -0
- package/dist/cli/watch.js +112 -0
- package/dist/cli/watch.js.map +1 -0
- package/dist/cli/writer.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.relativeImport = relativeImport;
|
|
7
|
+
exports.inferSummary = inferSummary;
|
|
7
8
|
exports.renderDocsFile = renderDocsFile;
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
@@ -21,6 +22,9 @@ function sanitizeHttpPath(value) {
|
|
|
21
22
|
return '';
|
|
22
23
|
return '/' + value.replace(/[^a-zA-Z0-9/_:.-]/g, '');
|
|
23
24
|
}
|
|
25
|
+
function sanitizeParamName(value) {
|
|
26
|
+
return value.replace(/[^a-zA-Z0-9_-]/g, '').slice(0, 100);
|
|
27
|
+
}
|
|
24
28
|
// ---------------------------------------------------------------------------
|
|
25
29
|
// HTTP verb → default success status code
|
|
26
30
|
// ---------------------------------------------------------------------------
|
|
@@ -39,28 +43,66 @@ function relativeImport(docsFilePath, controllerFilePath) {
|
|
|
39
43
|
const withoutExt = rel.replace(/\.ts$/, '');
|
|
40
44
|
return withoutExt.startsWith('.') ? withoutExt : `./${withoutExt}`;
|
|
41
45
|
}
|
|
46
|
+
function resolvedImportPath(docsFilePath, absolutePath) {
|
|
47
|
+
const rel = path_1.default.relative(path_1.default.dirname(docsFilePath), absolutePath);
|
|
48
|
+
const importPath = rel.replace(/\.ts$/, '').replace(/\\/g, '/');
|
|
49
|
+
return importPath.startsWith('.') ? importPath : `./${importPath}`;
|
|
50
|
+
}
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Primitive TypeScript type → JavaScript constructor name
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
const PRIMITIVE_MAP = {
|
|
55
|
+
string: 'String',
|
|
56
|
+
number: 'Number',
|
|
57
|
+
boolean: 'Boolean',
|
|
58
|
+
};
|
|
42
59
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* Validates each type name with IDENTIFIER_RE before including.
|
|
60
|
+
* Maps a TS primitive type string to its JS constructor for Swagger.
|
|
61
|
+
* Returns null for non-primitives (DTOs, unknown, etc.).
|
|
46
62
|
*/
|
|
47
|
-
function
|
|
63
|
+
function primitiveToConstructor(tsType) {
|
|
64
|
+
const base = tsType.replace(/\[\]$/, '').trim();
|
|
65
|
+
return PRIMITIVE_MAP[base] ?? null;
|
|
66
|
+
}
|
|
67
|
+
function collectDtoImports(methods, docsFilePath) {
|
|
48
68
|
const seen = new Map(); // name → importPath
|
|
49
|
-
|
|
50
|
-
const rt = m.responseType;
|
|
69
|
+
const register = (rt) => {
|
|
51
70
|
if (!rt)
|
|
52
|
-
|
|
71
|
+
return;
|
|
53
72
|
if (!IDENTIFIER_RE.test(rt.name))
|
|
54
|
-
|
|
73
|
+
return;
|
|
74
|
+
if (rt.isInterface)
|
|
75
|
+
return; // interfaces have no runtime value — don't import
|
|
55
76
|
if (seen.has(rt.name))
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
return;
|
|
78
|
+
seen.set(rt.name, resolvedImportPath(docsFilePath, rt.absolutePath));
|
|
79
|
+
};
|
|
80
|
+
for (const m of methods) {
|
|
81
|
+
register(m.responseType);
|
|
82
|
+
for (const p of m.params) {
|
|
83
|
+
register(p.bodyType ?? null);
|
|
84
|
+
}
|
|
61
85
|
}
|
|
62
86
|
return Array.from(seen.entries()).map(([name, importPath]) => ({ name, importPath }));
|
|
63
87
|
}
|
|
88
|
+
function collectSwaggerDecorators(ctrl) {
|
|
89
|
+
const used = new Set(['ApiTags', 'ApiOperation', 'ApiResponse']);
|
|
90
|
+
for (const m of ctrl.methods) {
|
|
91
|
+
if (m.requiresAuth)
|
|
92
|
+
used.add('ApiBearerAuth');
|
|
93
|
+
for (const p of m.params) {
|
|
94
|
+
if (p.nestDecorator === '@Param' && p.nestDecoratorArg !== null)
|
|
95
|
+
used.add('ApiParam');
|
|
96
|
+
if (p.nestDecorator === '@Query' && p.nestDecoratorArg !== null)
|
|
97
|
+
used.add('ApiQuery');
|
|
98
|
+
if (p.nestDecorator === '@Body' && p.nestDecoratorArg === null)
|
|
99
|
+
used.add('ApiBody');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (ctrl.controllerRequiresAuth)
|
|
103
|
+
used.add('ApiBearerAuth');
|
|
104
|
+
return used;
|
|
105
|
+
}
|
|
64
106
|
// ---------------------------------------------------------------------------
|
|
65
107
|
// Method signature comment
|
|
66
108
|
// ---------------------------------------------------------------------------
|
|
@@ -80,32 +122,149 @@ function methodSignatureComment(m) {
|
|
|
80
122
|
return `${route}${asyncPrefix}${methodName}(${paramList}): ${returnType}${inherited}`;
|
|
81
123
|
}
|
|
82
124
|
// ---------------------------------------------------------------------------
|
|
125
|
+
// Per-param decorator renderers
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
function renderApiParam(p, indent) {
|
|
128
|
+
if (p.nestDecorator !== '@Param' || p.nestDecoratorArg === null)
|
|
129
|
+
return null;
|
|
130
|
+
const name = sanitizeParamName(p.nestDecoratorArg);
|
|
131
|
+
if (!name)
|
|
132
|
+
return null;
|
|
133
|
+
const constructor = primitiveToConstructor(p.type) ?? 'String';
|
|
134
|
+
return `${indent}ApiParam({ name: '${name}', type: ${constructor} }),`;
|
|
135
|
+
}
|
|
136
|
+
function renderApiQuery(p, indent) {
|
|
137
|
+
if (p.nestDecorator !== '@Query' || p.nestDecoratorArg === null)
|
|
138
|
+
return null;
|
|
139
|
+
const name = sanitizeParamName(p.nestDecoratorArg);
|
|
140
|
+
if (!name)
|
|
141
|
+
return null;
|
|
142
|
+
const constructor = primitiveToConstructor(p.type) ?? 'String';
|
|
143
|
+
const required = !p.type.includes('?') && !p.type.includes('undefined');
|
|
144
|
+
return `${indent}ApiQuery({ name: '${name}', type: ${constructor}, required: ${required} }),`;
|
|
145
|
+
}
|
|
146
|
+
function renderApiBody(p, indent) {
|
|
147
|
+
if (p.nestDecorator !== '@Body' || p.nestDecoratorArg !== null)
|
|
148
|
+
return null;
|
|
149
|
+
if (p.bodyType && IDENTIFIER_RE.test(p.bodyType.name)) {
|
|
150
|
+
if (p.bodyType.isInterface && p.bodyType.inlineSchema) {
|
|
151
|
+
const schemaStr = renderSchemaArg(p.bodyType.inlineSchema, false, indent);
|
|
152
|
+
return `${indent}ApiBody({ schema: ${schemaStr} }),`;
|
|
153
|
+
}
|
|
154
|
+
if (p.bodyType.isInterface) {
|
|
155
|
+
return `${indent}ApiBody({}),`;
|
|
156
|
+
}
|
|
157
|
+
return `${indent}ApiBody({ type: ${p.bodyType.name} }),`;
|
|
158
|
+
}
|
|
159
|
+
const constructor = primitiveToConstructor(p.type);
|
|
160
|
+
if (constructor) {
|
|
161
|
+
return `${indent}ApiBody({ type: ${constructor} }),`;
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// Inline schema rendering (for interface-typed DTOs)
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
function renderSchemaProperty(prop, indent) {
|
|
169
|
+
const inner = `${indent} `;
|
|
170
|
+
const pairs = [];
|
|
171
|
+
if (prop.type !== undefined)
|
|
172
|
+
pairs.push(`${inner}type: '${prop.type}'`);
|
|
173
|
+
if (prop.nullable)
|
|
174
|
+
pairs.push(`${inner}nullable: true`);
|
|
175
|
+
if (prop.items !== undefined) {
|
|
176
|
+
pairs.push(`${inner}items: ${renderSchemaProperty(prop.items, inner)}`);
|
|
177
|
+
}
|
|
178
|
+
if (prop.properties !== undefined) {
|
|
179
|
+
const propLines = Object.entries(prop.properties)
|
|
180
|
+
.map(([k, v]) => `${inner} ${k}: ${renderSchemaProperty(v, `${inner} `)}`)
|
|
181
|
+
.join(',\n');
|
|
182
|
+
pairs.push(`${inner}properties: {\n${propLines},\n${inner}}`);
|
|
183
|
+
}
|
|
184
|
+
if (prop.required && prop.required.length > 0) {
|
|
185
|
+
pairs.push(`${inner}required: [${prop.required.map((r) => `'${r}'`).join(', ')}]`);
|
|
186
|
+
}
|
|
187
|
+
if (pairs.length === 0)
|
|
188
|
+
return '{}';
|
|
189
|
+
return `{\n${pairs.join(',\n')},\n${indent}}`;
|
|
190
|
+
}
|
|
191
|
+
function renderSchemaArg(schema, isArray, indent) {
|
|
192
|
+
const inner = `${indent} `;
|
|
193
|
+
const objectProp = {
|
|
194
|
+
type: 'object',
|
|
195
|
+
...(Object.keys(schema.properties).length > 0 ? { properties: schema.properties } : {}),
|
|
196
|
+
...(schema.required.length > 0 ? { required: schema.required } : {}),
|
|
197
|
+
};
|
|
198
|
+
if (isArray) {
|
|
199
|
+
return renderSchemaProperty({ type: 'array', items: objectProp }, inner);
|
|
200
|
+
}
|
|
201
|
+
return renderSchemaProperty(objectProp, inner);
|
|
202
|
+
}
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
83
204
|
// ApiResponse rendering
|
|
84
205
|
// ---------------------------------------------------------------------------
|
|
85
|
-
function renderApiResponse(status, responseType) {
|
|
206
|
+
function renderApiResponse(status, responseType, baseIndent) {
|
|
86
207
|
if (!responseType || !IDENTIFIER_RE.test(responseType.name)) {
|
|
87
208
|
return `ApiResponse({ status: ${status} })`;
|
|
88
209
|
}
|
|
210
|
+
if (responseType.isInterface && responseType.inlineSchema) {
|
|
211
|
+
const schemaStr = renderSchemaArg(responseType.inlineSchema, responseType.isArray, baseIndent);
|
|
212
|
+
return `ApiResponse({\n${baseIndent} status: ${status},\n${baseIndent} schema: ${schemaStr},\n${baseIndent}})`;
|
|
213
|
+
}
|
|
214
|
+
if (responseType.isInterface) {
|
|
215
|
+
// fallback: no schema available — emit without type
|
|
216
|
+
return `ApiResponse({ status: ${status} })`;
|
|
217
|
+
}
|
|
89
218
|
const typePart = responseType.isArray
|
|
90
219
|
? `[${responseType.name}]`
|
|
91
220
|
: responseType.name;
|
|
92
221
|
return `ApiResponse({ status: ${status}, type: ${typePart} })`;
|
|
93
222
|
}
|
|
94
223
|
// ---------------------------------------------------------------------------
|
|
224
|
+
// Summary inference
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
/**
|
|
227
|
+
* Converts a camelCase method name into a human-readable Swagger summary.
|
|
228
|
+
* findAll → "Find all", createUser → "Create user", getProfileById → "Get profile by id"
|
|
229
|
+
*/
|
|
230
|
+
function inferSummary(methodName) {
|
|
231
|
+
const words = methodName
|
|
232
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2') // HTTPMethod → HTTP Method
|
|
233
|
+
.replace(/([a-z\d])([A-Z])/g, '$1 $2') // camelCase → camel Case
|
|
234
|
+
.split(' ')
|
|
235
|
+
.filter(Boolean);
|
|
236
|
+
if (words.length === 0)
|
|
237
|
+
return '';
|
|
238
|
+
return words
|
|
239
|
+
.map((w, i) => (i === 0 ? w.charAt(0).toUpperCase() + w.slice(1).toLowerCase() : w.toLowerCase()))
|
|
240
|
+
.join(' ');
|
|
241
|
+
}
|
|
242
|
+
// ---------------------------------------------------------------------------
|
|
95
243
|
// Method block
|
|
96
244
|
// ---------------------------------------------------------------------------
|
|
97
245
|
function renderMethod(m, indent) {
|
|
98
246
|
const name = sanitizeIdentifier(m.name, '_method');
|
|
99
247
|
const sig = methodSignatureComment(m);
|
|
100
248
|
const status = defaultStatusCode(m.httpDecorator);
|
|
101
|
-
const
|
|
102
|
-
|
|
249
|
+
const summary = inferSummary(name); // use sanitized name, not raw m.name
|
|
250
|
+
const inner = `${indent} `;
|
|
251
|
+
const lines = [
|
|
103
252
|
`${indent}// ${sig}`,
|
|
104
253
|
`${indent}${name}: [`,
|
|
105
|
-
`${
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
254
|
+
`${inner}ApiOperation({ summary: '${summary}' }),`,
|
|
255
|
+
];
|
|
256
|
+
if (m.requiresAuth)
|
|
257
|
+
lines.push(`${inner}ApiBearerAuth(),`);
|
|
258
|
+
for (const p of m.params) {
|
|
259
|
+
const paramLine = renderApiParam(p, inner)
|
|
260
|
+
?? renderApiQuery(p, inner)
|
|
261
|
+
?? renderApiBody(p, inner);
|
|
262
|
+
if (paramLine)
|
|
263
|
+
lines.push(paramLine);
|
|
264
|
+
}
|
|
265
|
+
lines.push(`${inner}${renderApiResponse(status, m.responseType, inner)},`);
|
|
266
|
+
lines.push(`${indent}],`);
|
|
267
|
+
return lines.join('\n');
|
|
109
268
|
}
|
|
110
269
|
// ---------------------------------------------------------------------------
|
|
111
270
|
// ApiTags value
|
|
@@ -121,31 +280,38 @@ function apiTagValue(ctrl) {
|
|
|
121
280
|
function renderDocsFile(ctrl, docsFilePath, format) {
|
|
122
281
|
const importPath = relativeImport(docsFilePath, ctrl.filePath);
|
|
123
282
|
const className = sanitizeIdentifier(ctrl.className, 'Controller');
|
|
124
|
-
const controllerRoute = ctrl.controllerPath !== null
|
|
125
|
-
? ` (route: "${sanitizeHttpPath(ctrl.controllerPath)}")`
|
|
126
|
-
: '';
|
|
127
|
-
const timestamp = new Date().toISOString();
|
|
128
283
|
const tag = apiTagValue(ctrl);
|
|
129
|
-
const
|
|
284
|
+
const dtoImports = collectDtoImports(ctrl.methods, docsFilePath);
|
|
285
|
+
const swaggerDecorators = collectSwaggerDecorators(ctrl);
|
|
286
|
+
const swaggerImportList = [
|
|
287
|
+
'ApiTags', 'ApiOperation', 'ApiResponse',
|
|
288
|
+
...(swaggerDecorators.has('ApiBearerAuth') ? ['ApiBearerAuth'] : []),
|
|
289
|
+
...(swaggerDecorators.has('ApiParam') ? ['ApiParam'] : []),
|
|
290
|
+
...(swaggerDecorators.has('ApiQuery') ? ['ApiQuery'] : []),
|
|
291
|
+
...(swaggerDecorators.has('ApiBody') ? ['ApiBody'] : []),
|
|
292
|
+
].join(', ');
|
|
293
|
+
const classDecoratorLines = [
|
|
294
|
+
` ApiTags('${tag}'),`,
|
|
295
|
+
...(ctrl.controllerRequiresAuth ? [` ApiBearerAuth(),`] : []),
|
|
296
|
+
].join('\n');
|
|
130
297
|
const methodsBlock = ctrl.methods.length === 0
|
|
131
298
|
? ' // No public HTTP methods found.'
|
|
132
299
|
: ctrl.methods.map((m) => renderMethod(m, ' ')).join('\n\n');
|
|
133
300
|
if (format === 'js') {
|
|
134
|
-
const requireLines =
|
|
301
|
+
const requireLines = dtoImports
|
|
135
302
|
.map((i) => `const { ${i.name} } = require('${i.importPath}');`)
|
|
136
303
|
.join('\n');
|
|
137
304
|
return [
|
|
138
|
-
`// Auto-generated by nestjs-docfy`,
|
|
139
|
-
`// Generated: ${timestamp}`,
|
|
305
|
+
`// Auto-generated by nestjs-docfy — do not edit manually`,
|
|
140
306
|
``,
|
|
141
307
|
`const { docs } = require('nestjs-docfy');`,
|
|
142
|
-
`const {
|
|
308
|
+
`const { ${swaggerImportList} } = require('@nestjs/swagger');`,
|
|
143
309
|
`const { ${className} } = require('${importPath}');`,
|
|
144
310
|
...(requireLines ? [requireLines] : []),
|
|
145
311
|
``,
|
|
146
312
|
`docs(${className}, {`,
|
|
147
313
|
` classDecorators: [`,
|
|
148
|
-
|
|
314
|
+
classDecoratorLines,
|
|
149
315
|
` ],`,
|
|
150
316
|
` methods: {`,
|
|
151
317
|
methodsBlock.split('\n').map((l) => (l ? ` ${l}` : l)).join('\n'),
|
|
@@ -154,23 +320,19 @@ function renderDocsFile(ctrl, docsFilePath, format) {
|
|
|
154
320
|
``,
|
|
155
321
|
].join('\n');
|
|
156
322
|
}
|
|
157
|
-
const importLines =
|
|
323
|
+
const importLines = dtoImports
|
|
158
324
|
.map((i) => `import { ${i.name} } from '${i.importPath}';`)
|
|
159
325
|
.join('\n');
|
|
160
326
|
return [
|
|
161
|
-
|
|
162
|
-
` * Auto-generated by nestjs-docfy`,
|
|
163
|
-
` * Controller: ${className}${controllerRoute}`,
|
|
164
|
-
` * Generated: ${timestamp}`,
|
|
165
|
-
` */`,
|
|
327
|
+
`// Auto-generated by nestjs-docfy — do not edit manually`,
|
|
166
328
|
`import { docs } from 'nestjs-docfy';`,
|
|
167
|
-
`import {
|
|
329
|
+
`import { ${swaggerImportList} } from '@nestjs/swagger';`,
|
|
168
330
|
`import { ${className} } from '${importPath}';`,
|
|
169
331
|
...(importLines ? [importLines] : []),
|
|
170
332
|
``,
|
|
171
333
|
`docs(${className}, {`,
|
|
172
334
|
` classDecorators: [`,
|
|
173
|
-
|
|
335
|
+
classDecoratorLines,
|
|
174
336
|
` ],`,
|
|
175
337
|
` methods: {`,
|
|
176
338
|
methodsBlock,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-file.js","sourceRoot":"","sources":["../../src/cli/generate-file.ts"],"names":[],"mappings":";;;;;AAsCA,wCAIC;AAyGD,wCAsEC;AAzND,gDAAwB;AAGxB,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E,MAAM,aAAa,GAAG,4BAA4B,CAAC;AAEnD,SAAS,kBAAkB,CAAC,KAAa,EAAE,QAAgB;IACzD,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC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YAAY,iBAAiB,4BAA4B;QACzD,YAAY,SAAS,YAAY,UAAU,IAAI;QAC/C,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrC,EAAE;QACF,QAAQ,SAAS,KAAK;QACtB,sBAAsB;QACtB,mBAAmB;QACnB,MAAM;QACN,cAAc;QACd,YAAY;QACZ,MAAM;QACN,KAAK;QACL,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const errors_1 = require("./errors");
|
|
|
12
12
|
const detect_project_1 = require("./detect-project");
|
|
13
13
|
const scan_controllers_1 = require("./scan-controllers");
|
|
14
14
|
const writer_1 = require("./writer");
|
|
15
|
+
const watch_1 = require("./watch");
|
|
15
16
|
const program = new commander_1.Command();
|
|
16
17
|
program
|
|
17
18
|
.name('nestjs-docfy')
|
|
@@ -19,6 +20,68 @@ program
|
|
|
19
20
|
.version(
|
|
20
21
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
21
22
|
require('../../package.json').version, '-v, --version');
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Shared pipeline: detect → scan → write
|
|
25
|
+
// Returns number of errors (0 = success).
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
function runPipeline(options, silent = false) {
|
|
28
|
+
const context = (0, detect_project_1.detectProject)(options.root, options.tsconfig);
|
|
29
|
+
if (!silent) {
|
|
30
|
+
const kindLabel = {
|
|
31
|
+
'simple': 'Simple project',
|
|
32
|
+
'nx': 'NX Monorepo',
|
|
33
|
+
'nest-cli-monorepo': 'Nest CLI Monorepo',
|
|
34
|
+
'generic-monorepo': 'Generic Monorepo',
|
|
35
|
+
};
|
|
36
|
+
(0, logger_1.log)('success', `Project type: ${kindLabel[context.kind]} (${context.apps.length} app${context.apps.length !== 1 ? 's' : ''})`);
|
|
37
|
+
}
|
|
38
|
+
const scanResult = (0, scan_controllers_1.scanAllApps)(context.apps, context.root, options.pattern !== '**/*.controller.ts' ? options.pattern : undefined, options.format);
|
|
39
|
+
for (const err of scanResult.errors) {
|
|
40
|
+
(0, logger_1.log)('error', `${err.file}: ${err.message}`);
|
|
41
|
+
}
|
|
42
|
+
if (scanResult.controllers.length === 0 && scanResult.errors.length === 0) {
|
|
43
|
+
if (!silent)
|
|
44
|
+
(0, logger_1.log)('warn', 'No controllers found matching the pattern.');
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
const writeResults = (0, writer_1.writeAllDocs)(scanResult.controllers, {
|
|
48
|
+
projectRoot: context.root,
|
|
49
|
+
outDir: options.out,
|
|
50
|
+
force: options.force,
|
|
51
|
+
dryRun: options.dryRun,
|
|
52
|
+
format: options.format,
|
|
53
|
+
});
|
|
54
|
+
let created = 0, skipped = 0, errors = scanResult.errors.length;
|
|
55
|
+
for (const r of writeResults) {
|
|
56
|
+
switch (r.outcome) {
|
|
57
|
+
case 'created':
|
|
58
|
+
(0, logger_1.log)('success', `${r.controllerClass} → ${r.docsFilePath} ${picocolors_1.default.green('[created]')}`);
|
|
59
|
+
created++;
|
|
60
|
+
break;
|
|
61
|
+
case 'merged':
|
|
62
|
+
(0, logger_1.log)('success', `${r.controllerClass} → ${r.docsFilePath} ${picocolors_1.default.cyan('[merged]')}${r.addedMethods?.length ? ` (+${r.addedMethods.join(', ')})` : ''}`);
|
|
63
|
+
created++;
|
|
64
|
+
break;
|
|
65
|
+
case 'skipped':
|
|
66
|
+
(0, logger_1.log)('skip', `${r.controllerClass} → ${r.docsFilePath} ${picocolors_1.default.gray('[skipped — already exists]')}`);
|
|
67
|
+
skipped++;
|
|
68
|
+
break;
|
|
69
|
+
case 'dry':
|
|
70
|
+
break;
|
|
71
|
+
case 'error':
|
|
72
|
+
(0, logger_1.log)('error', `${r.controllerClass}: ${r.error}`);
|
|
73
|
+
errors++;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (!options.dryRun && !silent) {
|
|
78
|
+
(0, logger_1.summary)(created, skipped, errors);
|
|
79
|
+
}
|
|
80
|
+
return errors;
|
|
81
|
+
}
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
// generate command
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
22
85
|
program
|
|
23
86
|
.command('generate')
|
|
24
87
|
.description('Scan controllers and generate *.controller.docs.ts files')
|
|
@@ -30,6 +93,7 @@ program
|
|
|
30
93
|
.option('--dry-run', 'Print what would be generated without writing files', false)
|
|
31
94
|
.option('--quiet', 'Suppress all output except errors', false)
|
|
32
95
|
.option('--format <format>', 'Output format: ts or js', 'ts')
|
|
96
|
+
.option('--watch', 'Re-generate on controller file changes', false)
|
|
33
97
|
.action(async (rawOpts) => {
|
|
34
98
|
try {
|
|
35
99
|
const options = (0, parse_args_1.parseAndValidateOptions)(rawOpts);
|
|
@@ -49,66 +113,41 @@ program
|
|
|
49
113
|
(0, logger_1.log)('warn', 'Force mode — new methods merged, existing decorators preserved.');
|
|
50
114
|
if (options.dryRun)
|
|
51
115
|
(0, logger_1.log)('dry', 'Dry-run mode — no files will be written.');
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
(0, logger_1.log)('success', `Project type detected: ${kindLabel[context.kind]} (${context.apps.length} app${context.apps.length !== 1 ? 's' : ''})`);
|
|
61
|
-
for (const app of context.apps) {
|
|
62
|
-
(0, logger_1.log)('info', ` App "${app.name}" → ${app.tsconfig}`);
|
|
63
|
-
}
|
|
64
|
-
// ── Scan controllers ────────────────────────────────────────────────
|
|
65
|
-
(0, logger_1.header)('Scanning controllers...');
|
|
66
|
-
const scanResult = (0, scan_controllers_1.scanAllApps)(context.apps, context.root, options.pattern !== '**/*.controller.ts' ? options.pattern : undefined, options.format);
|
|
67
|
-
for (const err of scanResult.errors) {
|
|
68
|
-
(0, logger_1.log)('error', `${err.file}: ${err.message}`);
|
|
116
|
+
if (options.watch)
|
|
117
|
+
(0, logger_1.log)('info', 'Watch mode enabled.');
|
|
118
|
+
// Initial run
|
|
119
|
+
const initialErrors = runPipeline(options);
|
|
120
|
+
if (!options.watch) {
|
|
121
|
+
process.exit(initialErrors > 0 ? 1 /* CliExitCode.PartialError */ : 0 /* CliExitCode.Ok */);
|
|
122
|
+
return;
|
|
69
123
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
124
|
+
// Watch mode: re-run pipeline on changes, force=true so new methods are merged
|
|
125
|
+
const watchOptions = { ...options, force: true, quiet: true };
|
|
126
|
+
const stopWatching = (0, watch_1.watchProject)({
|
|
127
|
+
root: options.root,
|
|
128
|
+
pattern: options.pattern,
|
|
129
|
+
onRebuild: () => {
|
|
130
|
+
try {
|
|
131
|
+
runPipeline(watchOptions, false);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
if (err instanceof errors_1.CliError) {
|
|
135
|
+
(0, logger_1.log)('error', err.message);
|
|
136
|
+
}
|
|
137
|
+
else if (err instanceof Error) {
|
|
138
|
+
(0, logger_1.log)('error', err.message);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
83
142
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
(0, logger_1.log)('success', `${r.controllerClass} → ${r.docsFilePath} ${picocolors_1.default.cyan('[merged]')}${r.addedMethods?.length ? ` (+${r.addedMethods.join(', ')})` : ''}`);
|
|
93
|
-
created++;
|
|
94
|
-
break;
|
|
95
|
-
case 'skipped':
|
|
96
|
-
(0, logger_1.log)('skip', `${r.controllerClass} → ${r.docsFilePath} ${picocolors_1.default.gray('[skipped — already exists]')}`);
|
|
97
|
-
skipped++;
|
|
98
|
-
break;
|
|
99
|
-
case 'dry':
|
|
100
|
-
// output already written inline by writer
|
|
101
|
-
break;
|
|
102
|
-
case 'error':
|
|
103
|
-
(0, logger_1.log)('error', `${r.controllerClass}: ${r.error}`);
|
|
104
|
-
errors++;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (!options.dryRun) {
|
|
109
|
-
(0, logger_1.summary)(created, skipped, errors);
|
|
110
|
-
}
|
|
111
|
-
process.exit(errors > 0 ? 1 /* CliExitCode.PartialError */ : 0 /* CliExitCode.Ok */);
|
|
143
|
+
// Graceful shutdown
|
|
144
|
+
const shutdown = () => {
|
|
145
|
+
stopWatching();
|
|
146
|
+
(0, logger_1.log)('info', 'Watch stopped.');
|
|
147
|
+
process.exit(0 /* CliExitCode.Ok */);
|
|
148
|
+
};
|
|
149
|
+
process.on('SIGINT', shutdown);
|
|
150
|
+
process.on('SIGTERM', shutdown);
|
|
112
151
|
}
|
|
113
152
|
catch (err) {
|
|
114
153
|
if (err instanceof errors_1.CliError) {
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;AACA,yCAAoC;AACpC,4DAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;AACA,yCAAoC;AACpC,4DAA4B;AAC5B,6CAAwE;AACxE,qCAA0D;AAC1D,qCAAiD;AACjD,qDAAiD;AACjD,yDAAiD;AACjD,qCAAwC;AACxC,mCAAuC;AAEvC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,cAAc,CAAC;KACpB,WAAW,CAAC,sDAAsD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,CAAC,KAAK,CAAC,KAAK,oBAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC;QACrE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,oBAAE,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,CAAC,IAAI,2BAAmB,CAAC;IAClC,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;IAC1C,OAAO,CAAC,IAAI,2BAAmB,CAAC;AAClC,CAAC,CAAC,CAAC"}
|
package/dist/cli/parse-args.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface CliOptions {
|
|
|
8
8
|
dryRun: boolean;
|
|
9
9
|
quiet: boolean;
|
|
10
10
|
format: OutputFormat;
|
|
11
|
+
watch: boolean;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Validates that a resolved path stays inside the project root.
|
|
@@ -39,4 +40,5 @@ export declare function parseAndValidateOptions(raw: {
|
|
|
39
40
|
dryRun?: boolean;
|
|
40
41
|
quiet?: boolean;
|
|
41
42
|
format?: string;
|
|
43
|
+
watch?: boolean;
|
|
42
44
|
}): CliOptions;
|