specatlas 0.1.31 → 0.1.32
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/bin.js +29 -2
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -14748,15 +14748,42 @@ async function checkAdapters(opts) {
|
|
|
14748
14748
|
// src/paths.ts
|
|
14749
14749
|
import path27 from "path";
|
|
14750
14750
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
14751
|
+
async function isSourceRepoRoot(dir) {
|
|
14752
|
+
if (!await exists(path27.join(dir, "pnpm-workspace.yaml"))) return false;
|
|
14753
|
+
const raw = await readTextIfExists(path27.join(dir, "packages", "cli", "package.json"));
|
|
14754
|
+
if (raw === void 0) return false;
|
|
14755
|
+
try {
|
|
14756
|
+
return JSON.parse(raw).name === "specatlas";
|
|
14757
|
+
} catch {
|
|
14758
|
+
return false;
|
|
14759
|
+
}
|
|
14760
|
+
}
|
|
14761
|
+
async function sourceRepoRoot(startDir) {
|
|
14762
|
+
let dir = startDir;
|
|
14763
|
+
for (let i = 0; i < 5; i += 1) {
|
|
14764
|
+
if (await isSourceRepoRoot(dir)) return dir;
|
|
14765
|
+
const parent = path27.dirname(dir);
|
|
14766
|
+
if (parent === dir) break;
|
|
14767
|
+
dir = parent;
|
|
14768
|
+
}
|
|
14769
|
+
return void 0;
|
|
14770
|
+
}
|
|
14771
|
+
async function resolveFromSource(relative) {
|
|
14772
|
+
const start = path27.dirname(fileURLToPath2(import.meta.url));
|
|
14773
|
+
const root = await sourceRepoRoot(start);
|
|
14774
|
+
if (!root) return void 0;
|
|
14775
|
+
const candidate = path27.join(root, relative);
|
|
14776
|
+
return await exists(candidate) ? candidate : void 0;
|
|
14777
|
+
}
|
|
14751
14778
|
async function resolveProfilesDir() {
|
|
14752
14779
|
const env = process.env["SPECATLAS_PROFILES_DIR"];
|
|
14753
14780
|
if (env && await exists(env)) return env;
|
|
14754
|
-
return walkUpFor("profiles");
|
|
14781
|
+
return await resolveFromSource("profiles") ?? walkUpFor("profiles");
|
|
14755
14782
|
}
|
|
14756
14783
|
async function resolveWorkflowDir() {
|
|
14757
14784
|
const env = process.env["SPECATLAS_WORKFLOW_DIR"];
|
|
14758
14785
|
if (env && await exists(env)) return env;
|
|
14759
|
-
return walkUpFor(path27.join("workflow", "phases"));
|
|
14786
|
+
return await resolveFromSource("workflow") ?? walkUpFor(path27.join("workflow", "phases"));
|
|
14760
14787
|
}
|
|
14761
14788
|
async function walkUpFor(relative) {
|
|
14762
14789
|
let dir = path27.dirname(fileURLToPath2(import.meta.url));
|