expodoc
Version:
A tool to generate API documentation automatically for Express.js applications.
45 lines (44 loc) • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../index");
const help_1 = require("./help");
const init_1 = require("./init");
const packageJson = require("../../package.json");
function main() {
if (process.argv.includes("--version")) {
console.log(`✅ ExpressDocgen CLI v${packageJson.version}`);
process.exit(0);
}
else if (process.argv.includes("--help") || process.argv.includes("-h")) {
(0, help_1.helpCommand)();
process.exit(0);
}
else if (process.argv.includes("--init")) {
(0, init_1.initConfig)();
process.exit(0);
}
else if (process.argv.includes("--postman")) {
const projectPath = process.argv[3] || ".";
const parser = new index_1.RouteParser(projectPath);
parser.parseAllRoutes();
const postmanPath = parser.createPostmanFile();
console.log(`✅ Postman collection generated at: ${postmanPath}`);
}
else if (process.argv.includes("--print")) {
const projectPath = process.argv[3] || ".";
const parser = new index_1.RouteParser(projectPath);
parser.parseAllRoutes();
console.log("✅ Routes JSON:");
console.log(parser.getRoutesJson());
}
else {
console.log("❌ Invalid command. Use --help to see available commands.");
}
}
try {
main();
}
catch (error) {
console.error("❌ An error occurred while executing the command:", error);
process.exit(1);
}