@autometa/cli 1.0.0-rc.2 → 1.0.0-rc.4
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.cjs +51 -14
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +55 -18
- package/dist/bin.js.map +1 -1
- package/dist/commands/run.d.ts +5 -0
- package/dist/index.cjs +51 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.js +55 -18
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
package/dist/bin.cjs
CHANGED
|
@@ -1794,14 +1794,39 @@ async function pathExists2(path3) {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
|
|
1796
1796
|
// src/loaders/config.ts
|
|
1797
|
-
var
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1797
|
+
var CONFIG_EXTENSIONS = ["ts", "mts", "cts", "js", "mjs", "cjs"];
|
|
1798
|
+
async function findConfigInDir(dir) {
|
|
1799
|
+
for (const ext of CONFIG_EXTENSIONS) {
|
|
1800
|
+
const candidate = path2.resolve(dir, `autometa.config.${ext}`);
|
|
1801
|
+
if (await fileExists(candidate)) {
|
|
1802
|
+
return candidate;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
try {
|
|
1806
|
+
const entries = await promises.readdir(dir, { withFileTypes: true });
|
|
1807
|
+
const matches = [];
|
|
1808
|
+
const pattern = /^autometa\.[A-Za-z0-9_-]+\.config\.(?:ts|mts|cts|js|mjs|cjs)$/u;
|
|
1809
|
+
for (const entry of entries) {
|
|
1810
|
+
if (!entry.isFile())
|
|
1811
|
+
continue;
|
|
1812
|
+
if (pattern.test(entry.name)) {
|
|
1813
|
+
matches.push(path2.resolve(dir, entry.name));
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
if (matches.length > 0) {
|
|
1817
|
+
matches.sort((a, b) => {
|
|
1818
|
+
const an = a.split("/").pop() ?? a;
|
|
1819
|
+
const bn = b.split("/").pop() ?? b;
|
|
1820
|
+
const alen = an.length;
|
|
1821
|
+
const blen = bn.length;
|
|
1822
|
+
return alen === blen ? an.localeCompare(bn) : alen - blen;
|
|
1823
|
+
});
|
|
1824
|
+
return matches[0];
|
|
1825
|
+
}
|
|
1826
|
+
} catch {
|
|
1827
|
+
}
|
|
1828
|
+
return void 0;
|
|
1829
|
+
}
|
|
1805
1830
|
async function loadExecutorConfig(cwd, options = {}) {
|
|
1806
1831
|
const configPath = await resolveConfigPath(cwd, options.configPath);
|
|
1807
1832
|
const module = await loadModule(configPath, createModuleLoadOptions(cwd, options));
|
|
@@ -1831,14 +1856,24 @@ async function resolveConfigPath(cwd, explicitPath) {
|
|
|
1831
1856
|
await ensureFileExists(absolutePath);
|
|
1832
1857
|
return absolutePath;
|
|
1833
1858
|
}
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1859
|
+
let current = cwd;
|
|
1860
|
+
for (let depth = 0; depth < 50; depth += 1) {
|
|
1861
|
+
const found = await findConfigInDir(current);
|
|
1862
|
+
if (found) {
|
|
1863
|
+
return found;
|
|
1864
|
+
}
|
|
1865
|
+
const parent = path2.dirname(current);
|
|
1866
|
+
if (parent === current) {
|
|
1867
|
+
break;
|
|
1838
1868
|
}
|
|
1869
|
+
current = parent;
|
|
1839
1870
|
}
|
|
1871
|
+
const expected = [
|
|
1872
|
+
...CONFIG_EXTENSIONS.map((ext) => `autometa.config.${ext}`),
|
|
1873
|
+
"autometa.<name>.config.{ts,mts,cts,js,mjs,cjs}"
|
|
1874
|
+
];
|
|
1840
1875
|
throw new Error(
|
|
1841
|
-
`Unable to locate an Autometa config file
|
|
1876
|
+
`Unable to locate an Autometa config file starting from "${cwd}". Expected one of: ${expected.join(
|
|
1842
1877
|
", "
|
|
1843
1878
|
)}`
|
|
1844
1879
|
);
|
|
@@ -2269,7 +2304,7 @@ function registerRunCommand(program) {
|
|
|
2269
2304
|
).option(
|
|
2270
2305
|
"--cache-dir <dir>",
|
|
2271
2306
|
"Directory for Autometa CLI cache (defaults to node_modules/.cache/autometa when available)"
|
|
2272
|
-
).option("--dry-run", "Collect scenarios without executing steps").option("--watch", "Run in watch mode (vitest/jest only)").option("--verbose", "Show detailed output including runner detection").option("--standalone", "Force standalone runtime instead of native runner").option("-e, --environment <environment>", "Select config environment").option(
|
|
2307
|
+
).option("--dry-run", "Collect scenarios without executing steps").option("--watch", "Run in watch mode (vitest/jest only)").option("--verbose", "Show detailed output including runner detection").option("--standalone", "Force standalone runtime instead of native runner").option("-c, --config <path>", "Path to Autometa config file (e.g. autometa.config.ts)").option("-e, --environment <environment>", "Select config environment").option(
|
|
2273
2308
|
"-g, --group <group>",
|
|
2274
2309
|
"Filter module groups to include (affects module/step loading; patterns are not auto-scoped)",
|
|
2275
2310
|
collectRepeatedString,
|
|
@@ -2285,6 +2320,7 @@ function registerRunCommand(program) {
|
|
|
2285
2320
|
const summary = await runFeatures({
|
|
2286
2321
|
cwd: process.cwd(),
|
|
2287
2322
|
...typeof flags?.cacheDir === "string" && flags.cacheDir.trim().length > 0 ? { cacheDir: flags.cacheDir } : {},
|
|
2323
|
+
...typeof flags?.config === "string" && flags.config.trim().length > 0 ? { configPath: flags.config } : {},
|
|
2288
2324
|
...split.patterns.length > 0 ? { patterns: split.patterns } : {},
|
|
2289
2325
|
...split.runnerArgs.length > 0 ? { runnerArgs: split.runnerArgs } : {},
|
|
2290
2326
|
...typeof flags?.dryRun === "boolean" ? { dryRun: flags.dryRun } : {},
|
|
@@ -2430,6 +2466,7 @@ async function runFeatures(options = {}) {
|
|
|
2430
2466
|
const summaryFormatter = options.summaryFormatter ?? formatSummary;
|
|
2431
2467
|
const { resolved } = await loadExecutorConfig(cwd, {
|
|
2432
2468
|
cacheDir,
|
|
2469
|
+
...typeof options.configPath === "string" && options.configPath.trim().length > 0 ? { configPath: options.configPath } : {},
|
|
2433
2470
|
...typeof options.environment === "string" && options.environment.trim().length > 0 ? { environment: options.environment } : {},
|
|
2434
2471
|
...options.modules ? { modules: [...options.modules] } : {},
|
|
2435
2472
|
...options.groups ? { groups: [...options.groups] } : {}
|