@rqml/cli 0.1.0 → 0.1.1
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/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { __commonJS, __toESM } from './chunk-5WRI5ZAA.js';
|
|
3
|
-
import { existsSync, writeFileSync, readFileSync, readdirSync } from 'fs';
|
|
3
|
+
import { existsSync, writeFileSync, readFileSync, statSync, readdirSync } from 'fs';
|
|
4
4
|
import { resolve, isAbsolute } from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
|
|
@@ -3378,9 +3378,12 @@ function resolveSpecPath(args) {
|
|
|
3378
3378
|
if (explicit !== void 0) {
|
|
3379
3379
|
const p = resolve(args.baseDir, explicit);
|
|
3380
3380
|
if (!existsSync(p)) throw new UsageError(`spec file not found: ${explicit}`);
|
|
3381
|
+
if (statSync(p).isDirectory()) {
|
|
3382
|
+
throw new UsageError(`"${explicit}" is a directory, not an .rqml file`);
|
|
3383
|
+
}
|
|
3381
3384
|
return p;
|
|
3382
3385
|
}
|
|
3383
|
-
const candidates = readdirSync(args.baseDir).filter((
|
|
3386
|
+
const candidates = readdirSync(args.baseDir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".rqml")).map((e) => e.name).sort();
|
|
3384
3387
|
if (candidates.length === 0) {
|
|
3385
3388
|
throw new UsageError("no .rqml document found in this directory; pass a path");
|
|
3386
3389
|
}
|