Comparing version 0.9.0 to 0.10.0
# Changelog | ||
## 📦 [0.10.0](https://www.npmjs.com/package/v8r/v/0.10.0) - 2022-01-03 | ||
* Accept multiple filenames or globs as positional args. e.g: | ||
```bash | ||
v8r file1.json file2.json 'dir/*.yaml' | ||
``` | ||
## 📦 [0.9.0](https://www.npmjs.com/package/v8r/v/0.9.0) - 2021-12-27 | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "v8r", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "A command-line JSON and YAML validator that's on your wavelength", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -28,3 +28,3 @@ # v8r | ||
v8r can validate JSON or YAML files. You can pass either a single filename or a glob pattern: | ||
v8r can validate JSON or YAML files. You can pass filenames or glob patterns: | ||
@@ -35,5 +35,7 @@ ```bash | ||
# multiple files | ||
$ v8r file1.json file2.json | ||
# glob patterns | ||
$ v8r '**/.eslintrc.yml' | ||
$ v8r '{file1.json,file2.json}' | ||
$ v8r 'dir/*.yml' 'dir/*.yaml' | ||
``` | ||
@@ -83,3 +85,3 @@ | ||
* v8r always exits with code `0` when: | ||
* The input glob pattern matched one or more files, all input files were validated against a schema, and all input files were **valid** | ||
* The input glob pattern(s) matched one or more files, all input files were validated against a schema, and all input files were **valid** | ||
* `v8r` was called with `--help` or `--version` flags | ||
@@ -96,4 +98,4 @@ | ||
* v8r always exits with code `98` when: | ||
* The input glob pattern was invalid | ||
* The input glob pattern was valid but did not match any files | ||
* An input glob pattern was invalid | ||
* An input glob pattern was valid but did not match any files | ||
@@ -100,0 +102,0 @@ * v8r always exits with code `99` when: |
@@ -155,7 +155,12 @@ import flatCache from "flat-cache"; | ||
return async function (args) { | ||
const filenames = await getFiles(args.pattern); | ||
if (filenames.length === 0) { | ||
logging.error(`Pattern '${args.pattern}' did not match any files`); | ||
return EXIT.NOTFOUND; | ||
let filenames = []; | ||
for (const pattern of args.patterns) { | ||
const matches = await getFiles(pattern); | ||
if (matches.length === 0) { | ||
logging.error(`Pattern '${pattern}' did not match any files`); | ||
return EXIT.NOTFOUND; | ||
} | ||
filenames = filenames.concat(matches); | ||
} | ||
const ttl = secondsToMilliseconds(args.cacheTtl || 0); | ||
@@ -189,7 +194,8 @@ const cache = new Cache(getFlatCache(), ttl); | ||
.command( | ||
"$0 <pattern>", | ||
"$0 <patterns..>", | ||
"Validate local json/yaml files against schema(s)", | ||
(yargs) => { | ||
yargs.positional("pattern", { | ||
describe: "Glob pattern describing local file or files to validate", | ||
yargs.positional("patterns", { | ||
describe: | ||
"One or more filenames or glob patterns describing local file or files to validate", | ||
}); | ||
@@ -217,4 +223,4 @@ } | ||
"If not supplied, we will attempt to find an appropriate schema on " + | ||
"schemastore.org using the filename. If passed with a glob pattern " + | ||
"that matches multiple files, all matching files will be validated " + | ||
"schemastore.org using the filename. If passed with glob pattern(s) " + | ||
"matching multiple files, all matching files will be validated " + | ||
"against this schema", | ||
@@ -221,0 +227,0 @@ }) |
23470
434
131