@asad_dev/leo-generator 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/utils/documentationUpdater.js +11 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -530,17 +530,17 @@ function main() {
|
|
|
530
530
|
postmanCollectionId: config.postmanCollectionId
|
|
531
531
|
}, hasFile);
|
|
532
532
|
});
|
|
533
|
-
// Documentation update command
|
|
534
533
|
program
|
|
535
534
|
.command("update-docs")
|
|
536
535
|
.alias("docs")
|
|
537
536
|
.description("Update Postman and Swagger documentation for existing modules")
|
|
537
|
+
.argument("[modules...]", "Specific modules to update (optional)")
|
|
538
538
|
.option("--modules-dir <path>", "Path to modules directory", "src/app/modules")
|
|
539
539
|
.option("--no-postman", "Skip Postman collection generation")
|
|
540
540
|
.option("--no-swagger", "Skip Swagger documentation generation")
|
|
541
541
|
.option("--postman-dir <path>", "Custom Postman output directory", "postman")
|
|
542
542
|
.option("--swagger-file <path>", "Custom Swagger file path", "swagger.json")
|
|
543
|
-
.action((options) => __awaiter(this, void 0, void 0, function* () {
|
|
543
|
+
.action((modules, options) => __awaiter(this, void 0, void 0, function* () {
|
|
544
544
|
yield (0, documentationUpdater_1.updateExistingModulesDocumentation)(options.modulesDir, {
|
|
545
545
|
updatePostman: options.postman !== false,
|
|
546
546
|
updateSwagger: options.swagger !== false,
|
|
@@ -548,7 +548,7 @@ function main() {
|
|
|
548
548
|
swaggerFile: options.swaggerFile,
|
|
549
549
|
postmanApiKey: config.postmanApiKey,
|
|
550
550
|
postmanCollectionId: config.postmanCollectionId
|
|
551
|
-
});
|
|
551
|
+
}, modules);
|
|
552
552
|
}));
|
|
553
553
|
// Legacy support - direct module generation (backward compatibility)
|
|
554
554
|
program
|
|
@@ -84,16 +84,25 @@ function updateAllDocumentation(moduleName_1, fields_1) {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
function updateExistingModulesDocumentation() {
|
|
87
|
-
return __awaiter(this, arguments, void 0, function* (modulesDir = "src/app/modules", options = {}) {
|
|
87
|
+
return __awaiter(this, arguments, void 0, function* (modulesDir = "src/app/modules", options = {}, targetModules = []) {
|
|
88
88
|
const fullModulesPath = path.join(process.cwd(), modulesDir);
|
|
89
89
|
if (!fs.existsSync(fullModulesPath)) {
|
|
90
90
|
console.error(`❌ Modules directory not found: ${fullModulesPath}`);
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
console.log("🔄 Scanning existing modules for documentation updates...");
|
|
94
|
-
|
|
94
|
+
let moduleDirectories = fs.readdirSync(fullModulesPath, { withFileTypes: true })
|
|
95
95
|
.filter(dirent => dirent.isDirectory())
|
|
96
96
|
.map(dirent => dirent.name);
|
|
97
|
+
// Filter if target modules are specified
|
|
98
|
+
if (targetModules && targetModules.length > 0) {
|
|
99
|
+
const targets = targetModules.map(m => m.toLowerCase());
|
|
100
|
+
moduleDirectories = moduleDirectories.filter(dir => targets.includes(dir.toLowerCase()));
|
|
101
|
+
if (moduleDirectories.length === 0) {
|
|
102
|
+
console.warn(`⚠️ None of the specified modules were found: ${targetModules.join(', ')}`);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
97
106
|
let updatedCount = 0;
|
|
98
107
|
// Process modules sequentially to avoid race conditions with Postman API
|
|
99
108
|
for (const moduleDir of moduleDirectories) {
|
package/package.json
CHANGED