adorn-api 1.0.18 → 1.0.20

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.js CHANGED
@@ -2850,7 +2850,7 @@ function partitionSchemas(schemas, graph, schemaGraph, config = {}) {
2850
2850
  complexity: totalComplexity,
2851
2851
  dependencies: []
2852
2852
  }];
2853
- recommendation = recommendation || "Single file mode (--no-split)";
2853
+ recommendation = recommendation || "Single file mode (--split not specified)";
2854
2854
  } else if (strategy === "controller") {
2855
2855
  groups = partitionByController(schemas, graph, finalConfig);
2856
2856
  } else if (strategy === "dependency") {
@@ -3346,16 +3346,31 @@ var ADORN_VERSION = (() => {
3346
3346
  return null;
3347
3347
  }
3348
3348
  };
3349
- const cliDir = dirname3(fileURLToPath(import.meta.url));
3350
- const bundledPkgPath = resolve3(cliDir, "..", "package.json");
3351
- const bundledVersion = tryReadPackageJson(bundledPkgPath);
3352
- if (bundledVersion) return bundledVersion;
3353
- const localPkgPath = resolve3(process2.cwd(), "package.json");
3354
- const localVersion = tryReadPackageJson(localPkgPath);
3355
- if (localVersion) return localVersion;
3356
- const nodeModulesPath = resolve3(cliDir, "..", "package.json");
3357
- const nodeModulesVersion = tryReadPackageJson(nodeModulesPath);
3358
- if (nodeModulesVersion) return nodeModulesVersion;
3349
+ const potentialPaths = [];
3350
+ try {
3351
+ const importMetaUrl = import.meta?.url;
3352
+ if (importMetaUrl && typeof importMetaUrl === "string" && importMetaUrl.length > 0) {
3353
+ const cliDir = dirname3(fileURLToPath(importMetaUrl));
3354
+ potentialPaths.push(
3355
+ resolve3(cliDir, "..", "package.json"),
3356
+ resolve3(cliDir, "package.json")
3357
+ );
3358
+ }
3359
+ } catch {
3360
+ }
3361
+ const cwd = process2.cwd();
3362
+ potentialPaths.push(
3363
+ resolve3(cwd, "package.json"),
3364
+ resolve3(cwd, "node_modules", "adorn-api", "package.json"),
3365
+ resolve3(cwd, "..", "package.json"),
3366
+ resolve3(cwd, "..", "..", "package.json")
3367
+ );
3368
+ for (const pkgPath of potentialPaths) {
3369
+ const version = tryReadPackageJson(pkgPath);
3370
+ if (version) {
3371
+ return version;
3372
+ }
3373
+ }
3359
3374
  return "0.0.0";
3360
3375
  })();
3361
3376
  function log(msg, options) {
@@ -3489,7 +3504,7 @@ async function buildCommand(args) {
3489
3504
  const validationMode = validationModeIndex !== -1 ? args[validationModeIndex + 1] : "ajv-runtime";
3490
3505
  const verbose = args.includes("--verbose");
3491
3506
  const quiet = args.includes("--quiet");
3492
- const noSplit = args.includes("--no-split");
3507
+ const split = args.includes("--split");
3493
3508
  const splitStrategyIndex = args.indexOf("--split-strategy");
3494
3509
  const splitStrategy = splitStrategyIndex !== -1 ? args[splitStrategyIndex + 1] : void 0;
3495
3510
  const splitThresholdIndex = args.indexOf("--split-threshold");
@@ -3567,7 +3582,7 @@ async function buildCommand(args) {
3567
3582
  if (!quiet) openapiSpinner.stop();
3568
3583
  const schemaCount = Object.keys(openapi.components?.schemas || {}).length;
3569
3584
  let splitEnabled = false;
3570
- if (!noSplit && schemaCount >= splitThreshold) {
3585
+ if (split && schemaCount >= splitThreshold) {
3571
3586
  progress.verboseLog(`Schema count (${schemaCount}) >= threshold (${splitThreshold}), analyzing for auto-split...`);
3572
3587
  const graph = buildControllerGraph(controllers);
3573
3588
  const schemaGraph = new SchemaGraph(graph);
@@ -3607,9 +3622,9 @@ async function buildCommand(args) {
3607
3622
  log(` Auto-split not needed: ${partitioning.recommendation}`);
3608
3623
  }
3609
3624
  }
3610
- } else if (noSplit) {
3625
+ } else if (!split) {
3611
3626
  if (!quiet) {
3612
- log(` Splitting disabled (--no-split)`);
3627
+ log(` Splitting disabled (--split not specified)`);
3613
3628
  }
3614
3629
  } else {
3615
3630
  if (!quiet) {
@@ -3730,12 +3745,12 @@ Commands:
3730
3745
  build Generate OpenAPI and manifest from TypeScript source
3731
3746
  clean Remove generated artifacts
3732
3747
 
3733
- Options:
3748
+ Options:
3734
3749
  -p <path> Path to tsconfig.json (default: ./tsconfig.json)
3735
3750
  --output <dir> Output directory (default: .adorn)
3736
3751
  --if-stale Only rebuild if artifacts are stale
3737
3752
  --validation-mode <mode> Validation mode: none, ajv-runtime, precompiled (default: ajv-runtime)
3738
- --no-split Disable automatic schema splitting (default: auto-split enabled)
3753
+ --split Enable automatic schema splitting (default: disabled)
3739
3754
  --split-strategy <mode> Override splitting strategy: controller, dependency, size, auto (default: auto)
3740
3755
  --split-threshold <num> Schema count threshold for auto-split (default: 50)
3741
3756
  --verbose Show detailed progress information
@@ -3746,7 +3761,7 @@ Examples:
3746
3761
  adorn-api build --if-stale
3747
3762
  adorn-api build --validation-mode precompiled
3748
3763
  adorn-api build --verbose
3749
- adorn-api build --no-split # Force single file mode
3764
+ adorn-api build --split # Enable split mode
3750
3765
  adorn-api build --split-strategy controller # Force controller-based splitting
3751
3766
  adorn-api build --split-threshold 100 # Increase threshold to 100
3752
3767
  adorn-api clean