ng-openapi 0.1.6 → 0.1.8-pr-14-bugfix-working-directory-ee4104d.0

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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/cli.cjs +26 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- <div style="display: flex; flex-direction: column; align-items: center; text-align: center;">
2
- <h1><img src="https://raw.githubusercontent.com/ng-openapi/ng-openapi/HEAD/docs/public/ng-openapi-logo.svg" alt="Logo" style="height: 12vh; margin-bottom: 2vh;"></h1>
3
- <h1><b>Angular OpenAPI Client Generator</b></h1>
4
- <p>💪 Made with ❤️ by Angular Devs for Angular Devs</p>
1
+ <div align="center">
2
+ <h1 align="center"><img src="https://raw.githubusercontent.com/ng-openapi/ng-openapi/HEAD/docs/public/ng-openapi-logo.svg" alt="Logo" style="height: 12vh; margin-bottom: 2vh;" width="160"></h1>
3
+ <h1 align="center"><b>Angular OpenAPI Client Generator</b></h1>
4
+ <p align="center">💪 Made with ❤️ by Angular Devs for Angular Devs</p>
5
5
  </div>
6
6
 
7
7
 
package/cli.cjs CHANGED
@@ -2437,7 +2437,7 @@ async function generateFromConfig(config) {
2437
2437
  __name(generateFromConfig, "generateFromConfig");
2438
2438
 
2439
2439
  // package.json
2440
- var version = "0.1.5";
2440
+ var version = "0.1.7";
2441
2441
 
2442
2442
  // src/lib/cli.ts
2443
2443
  var program = new import_commander.Command();
@@ -2456,12 +2456,31 @@ async function loadConfigFile(configPath) {
2456
2456
  if (!config.input || !config.output) {
2457
2457
  throw new Error('Configuration must include "input" and "output" properties');
2458
2458
  }
2459
+ const configDir = path10.dirname(resolvedPath);
2460
+ if (!isUrl2(config.input) && !path10.isAbsolute(config.input)) {
2461
+ config.input = path10.resolve(configDir, config.input);
2462
+ }
2463
+ if (!path10.isAbsolute(config.output)) {
2464
+ config.output = path10.resolve(configDir, config.output);
2465
+ }
2459
2466
  return config;
2460
2467
  } catch (error) {
2461
2468
  throw new Error(`Failed to load configuration file: ${error instanceof Error ? error.message : error}`);
2462
2469
  }
2463
2470
  }
2464
2471
  __name(loadConfigFile, "loadConfigFile");
2472
+ function validateInputExtension(inputPath) {
2473
+ const extension = path10.extname(inputPath).toLowerCase();
2474
+ const supportedExtensions = [
2475
+ ".json",
2476
+ ".yaml",
2477
+ ".yml"
2478
+ ];
2479
+ if (!supportedExtensions.includes(extension)) {
2480
+ throw new Error(`Failed to parse ${extension || "specification"}. Supported formats are .json, .yaml, and .yml.`);
2481
+ }
2482
+ }
2483
+ __name(validateInputExtension, "validateInputExtension");
2465
2484
  function isUrl2(input) {
2466
2485
  try {
2467
2486
  new URL(input);
@@ -2500,7 +2519,12 @@ async function generateFromOptions(options) {
2500
2519
  try {
2501
2520
  if (options.config) {
2502
2521
  const config = await loadConfigFile(options.config);
2503
- validateInput2(config.input);
2522
+ if (!isUrl2(config.input)) {
2523
+ if (!fs4.existsSync(config.input)) {
2524
+ throw new Error(`Input file not found: ${config.input}`);
2525
+ }
2526
+ validateInputExtension(config.input);
2527
+ }
2504
2528
  await generateFromConfig(config);
2505
2529
  } else if (options.input) {
2506
2530
  validateInput2(options.input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-openapi",
3
- "version": "0.1.6",
3
+ "version": "0.1.8-pr-14-bugfix-working-directory-ee4104d.0",
4
4
  "description": "Generate Angular services and TypeScript types from OpenAPI/Swagger specifications",
5
5
  "keywords": [
6
6
  "ng-openapi",