ng-openapi 0.0.27 → 0.0.28
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/cli.cjs +12 -1
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -2352,6 +2352,17 @@ __name(generateFromConfig, "generateFromConfig");
|
|
|
2352
2352
|
|
|
2353
2353
|
// src/lib/cli.ts
|
|
2354
2354
|
var program = new import_commander.Command();
|
|
2355
|
+
function getPackageVersion() {
|
|
2356
|
+
try {
|
|
2357
|
+
const packagePath = path9.join(__dirname, "../../package.json");
|
|
2358
|
+
const packageJson = JSON.parse(fs4.readFileSync(packagePath, "utf-8"));
|
|
2359
|
+
return packageJson.version;
|
|
2360
|
+
} catch {
|
|
2361
|
+
console.warn("Warning: Could not determine package version");
|
|
2362
|
+
return "unknown";
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
__name(getPackageVersion, "getPackageVersion");
|
|
2355
2366
|
async function loadConfigFile(configPath) {
|
|
2356
2367
|
const resolvedPath = path9.resolve(configPath);
|
|
2357
2368
|
if (!fs4.existsSync(resolvedPath)) {
|
|
@@ -2407,7 +2418,7 @@ async function generateFromOptions(options) {
|
|
|
2407
2418
|
}
|
|
2408
2419
|
}
|
|
2409
2420
|
__name(generateFromOptions, "generateFromOptions");
|
|
2410
|
-
program.name("ng-openapi").description("Generate Angular services and types from Swagger/OpenAPI spec").version(
|
|
2421
|
+
program.name("ng-openapi").description("Generate Angular services and types from Swagger/OpenAPI spec").version(getPackageVersion()).option("-c, --config <path>", "Path to configuration file").option("-i, --input <path>", "Path to Swagger/OpenAPI specification file").option("-o, --output <path>", "Output directory", "./src/generated").option("--types-only", "Generate only TypeScript interfaces").option("--date-type <type>", "Date type to use (string | Date)", "Date").action(async (options) => {
|
|
2411
2422
|
await generateFromOptions(options);
|
|
2412
2423
|
});
|
|
2413
2424
|
program.command("generate").alias("gen").description("Generate code from Swagger specification").option("-c, --config <path>", "Path to configuration file").option("-i, --input <path>", "Path to Swagger/OpenAPI specification file").option("-o, --output <path>", "Output directory", "./src/generated").option("--types-only", "Generate only TypeScript interfaces").option("--date-type <type>", "Date type to use (string | Date)", "Date").action(async (options) => {
|