1
0
mirror of https://github.com/bitwarden/browser synced 2025-01-18 23:42:17 +01:00
bitwarden-estensione-browser/scripts/dep-ownership.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
987 B
TypeScript
Raw Normal View History

/* eslint-disable no-console */
/// Ensure that all dependencies in package.json have an owner in the renovate.json file.
import fs from "fs";
import path from "path";
const renovateConfig = JSON.parse(
fs.readFileSync(path.join(__dirname, "..", "..", ".github", "renovate.json"), "utf8"),
);
const packagesWithOwners = renovateConfig.packageRules
.flatMap((rule: any) => rule.matchPackageNames)
.filter((packageName: string) => packageName != null);
const packageJson = JSON.parse(
fs.readFileSync(path.join(__dirname, "..", "..", "package.json"), "utf8"),
);
const dependencies = Object.keys(packageJson.dependencies).concat(
Object.keys(packageJson.devDependencies),
);
const missingOwners = dependencies.filter((dep) => !packagesWithOwners.includes(dep));
if (missingOwners.length > 0) {
console.error("Missing owners for the following dependencies:");
console.error(missingOwners.join("\n"));
process.exit(1);
}
console.log("All dependencies have owners.");