-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (33 loc) · 1.11 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const checkLockVersion = require("./lib/checks/lockVersion");
const checkForPreRelease = require("./lib/checks/preReleases");
const checkForWorkspaces = require("./lib/checks/workspaces");
const hasMSBridgeConfig = require("./lib/checks/msbridge");
const hasYarnLock = require("./lib/checks/yarn");
const { FatalError } = require("./lib/errors");
const { getPackageLock, getAllPackages } = require("./lib/utils");
function lint() {
const pkgLock = getPackageLock();
const allPkgs = getAllPackages();
const errors = [];
errors.push(hasYarnLock());
errors.push(checkLockVersion(pkgLock));
allPkgs.forEach((pkg) => {
console.log(`Checking ${pkg.filename}`);
errors.push(checkForPreRelease(pkg.content));
errors.push(checkForWorkspaces(pkg.content));
});
errors.push(hasMSBridgeConfig());
for (const error of errors) {
if (error instanceof FatalError) {
process.stderr.write(`${error.message}\n`);
process.exit(1);
}
if (error instanceof Error) {
process.stderr.write(`${error.message}\n`);
}
if (error) {
process.stderr.write(`${error}\n`);
}
}
}
lint();