1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-25 02:51:59 +01:00
bitwarden-browser/scripts/dep-ownership.ts
Todd Martin 2622422cf7
Migrate Renovate config to JSON5 (#13233)
* Renamed to JSON5

* Updated linting script to use new file name.

* Add JSON5 dependency

* Added JSON5 to renovate.

* Removed JSON5 formatting

* Prettier

* Added comment for demonstration

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
2025-02-18 10:42:16 -05:00

34 lines
1017 B
TypeScript

/* 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";
import JSON5 from "json5";
const renovateConfig = JSON5.parse(
fs.readFileSync(path.join(__dirname, "..", "..", ".github", "renovate.json5"), "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.");