Skip to content

Commit 3350afa

Browse files
committed
chore: fix "lint versions" script"
1 parent ca87c9b commit 3350afa

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

scripts/lint-versions.js

100644100755
Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable */
1+
#!/usr/bin/env node
22
const { readdirSync, existsSync, readFileSync } = require('fs');
33

44
const getDirectories = source =>
@@ -53,28 +53,24 @@ let currentVersions = readPackageJsonDeps('./package.json');
5353
let endReturn = 0;
5454

5555
// find all versions in the monorepo
56-
['./packages', './demo/projects'].forEach(rootDir => {
57-
getDirectories(rootDir).forEach(subPackage => {
58-
const filePath = `${rootDir}/${subPackage}/package.json`;
59-
currentVersions = { ...currentVersions, ...readPackageJsonNameVersion(filePath) };
60-
});
61-
});
56+
for (const subPackage of getDirectories('./packages')) {
57+
const filePath = `./packages/${subPackage}/package.json`;
58+
currentVersions = { ...currentVersions, ...readPackageJsonNameVersion(filePath) };
59+
}
6260

6361
// lint all versions in packages
64-
['./packages', './demo/projects'].forEach(rootDir => {
65-
getDirectories(rootDir).forEach(subPackage => {
66-
const filePath = `${rootDir}/${subPackage}/package.json`;
67-
const subPackageVersions = readPackageJsonDeps(filePath);
68-
const { output, newVersions } = compareVersions(currentVersions, subPackageVersions);
69-
currentVersions = { ...newVersions };
70-
if (output) {
71-
console.log(`Version mismatches found in "${filePath}":`);
72-
console.log(output);
73-
console.log();
74-
endReturn = 1;
75-
}
76-
});
77-
});
62+
for (const subPackage of getDirectories('./packages')) {
63+
const filePath = `./packages/${subPackage}/package.json`;
64+
const subPackageVersions = readPackageJsonDeps(filePath);
65+
const { output, newVersions } = compareVersions(currentVersions, subPackageVersions);
66+
currentVersions = { ...newVersions };
67+
if (output) {
68+
console.log(`Version mismatches found in "${filePath}":`);
69+
console.log(output);
70+
console.log();
71+
endReturn = 1;
72+
}
73+
}
7874

7975
if (endReturn === 0) {
8076
console.log('All versions are aligned 💪');

0 commit comments

Comments
 (0)