v8r 4.0.0 → 4.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 📦 [4.0.1](https://www.npmjs.com/package/v8r/v/4.0.1) - 2024-08-19
4
+
5
+ * De-duplicate and sort files before validating
6
+
3
7
  ## 📦 [4.0.0](https://www.npmjs.com/package/v8r/v/4.0.0) - 2024-08-19
4
8
 
5
9
  * **Breaking:** Change to the JSON output format. The `results` key is now an array instead of an object.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v8r",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "A command-line JSON, YAML and TOML validator that's on your wavelength",
5
5
  "scripts": {
6
6
  "test": "V8R_CACHE_NAME=v8r-test c8 --reporter=text mocha \"src/**/*.spec.js\"",
package/src/cli.js CHANGED
@@ -113,6 +113,10 @@ function Validator() {
113
113
  filenames = filenames.concat(matches);
114
114
  }
115
115
 
116
+ // de-dupe and sort
117
+ filenames = [...new Set(filenames)];
118
+ filenames.sort((a, b) => a.localeCompare(b));
119
+
116
120
  const ttl = secondsToMilliseconds(config.cacheTtl || 0);
117
121
  const cache = new Cache(getFlatCache(), ttl);
118
122
 
package/src/glob.js CHANGED
@@ -3,9 +3,7 @@ import logger from "./logger.js";
3
3
 
4
4
  async function getFiles(pattern) {
5
5
  try {
6
- let matches = await glob(pattern, { dot: true, dotRelative: true });
7
- matches.sort((a, b) => a.localeCompare(b));
8
- return matches;
6
+ return await glob(pattern, { dot: true, dotRelative: true });
9
7
  } catch (e) {
10
8
  logger.error(e.message);
11
9
  return [];