mirror of
https://github.com/bitwarden/browser
synced 2025-01-12 18:34:54 +01:00
[PM-16845] Lint unowned dependencies (#12748)
* Lint unowned dependencies * Split npm ci and run linter * Set explicit versions for unchanged parts of the workflow .... * Rename yao-pkg * Add owners for sdk-internal, fuses and angular-eslint/schematics * Assign owners for angular and storybook * Add typescript-strict-plugin * Add two more unowned dependencies --------- Co-authored-by: Todd Martin <106564991+trmartin4@users.noreply.github.com> Co-authored-by: Addison Beck <github@addisonbeck.com>
This commit is contained in:
parent
38c1cdfb62
commit
48f99099b2
16
.github/renovate.json
vendored
16
.github/renovate.json
vendored
@ -104,6 +104,8 @@
|
||||
"matchPackageNames": [
|
||||
"@babel/core",
|
||||
"@babel/preset-env",
|
||||
"@bitwarden/sdk-internal",
|
||||
"@electron/fuses",
|
||||
"@electron/notarize",
|
||||
"@electron/rebuild",
|
||||
"@ngtools/webpack",
|
||||
@ -115,7 +117,7 @@
|
||||
"@types/node",
|
||||
"@types/node-forge",
|
||||
"@types/node-ipc",
|
||||
"@yao-pkg",
|
||||
"@yao-pkg/pkg",
|
||||
"babel-loader",
|
||||
"browserslist",
|
||||
"copy-webpack-plugin",
|
||||
@ -135,6 +137,7 @@
|
||||
"tsconfig-paths-webpack-plugin",
|
||||
"type-fest",
|
||||
"typescript",
|
||||
"typescript-strict-plugin",
|
||||
"webpack",
|
||||
"webpack-cli",
|
||||
"webpack-dev-server",
|
||||
@ -151,12 +154,13 @@
|
||||
"@angular/cdk",
|
||||
"@angular/cli",
|
||||
"@angular/common",
|
||||
"@angular/compiler",
|
||||
"@angular/compiler-cli",
|
||||
"@angular/compiler",
|
||||
"@angular/core",
|
||||
"@angular/forms",
|
||||
"@angular/platform-browser-dynamic",
|
||||
"@angular/platform-browser",
|
||||
"@angular/platform",
|
||||
"@angular/compiler",
|
||||
"@angular/router",
|
||||
"@compodoc/compodoc",
|
||||
"@ng-select/ng-select",
|
||||
@ -164,8 +168,11 @@
|
||||
"@storybook/addon-actions",
|
||||
"@storybook/addon-designs",
|
||||
"@storybook/addon-essentials",
|
||||
"@storybook/addon-interactions",
|
||||
"@storybook/addon-links",
|
||||
"@storybook/angular",
|
||||
"@storybook/manager-api",
|
||||
"@storybook/theming",
|
||||
"@types/react",
|
||||
"autoprefixer",
|
||||
"bootstrap",
|
||||
@ -188,7 +195,9 @@
|
||||
"matchPackageNames": [
|
||||
"@angular-eslint/eslint-plugin",
|
||||
"@angular-eslint/eslint-plugin-template",
|
||||
"@angular-eslint/schematics",
|
||||
"@angular-eslint/template-parser",
|
||||
"@angular/elements",
|
||||
"@types/jest",
|
||||
"@typescript-eslint/eslint-plugin",
|
||||
"@typescript-eslint/parser",
|
||||
@ -201,6 +210,7 @@
|
||||
"eslint-plugin-storybook",
|
||||
"eslint-plugin-tailwindcss",
|
||||
"husky",
|
||||
"jest-extended",
|
||||
"jest-junit",
|
||||
"jest-mock-extended",
|
||||
"jest-preset-angular",
|
||||
|
@ -23,6 +23,7 @@
|
||||
"test:watch:all": "jest --watchAll",
|
||||
"test:types": "node ./scripts/test-types.js",
|
||||
"test:locales": "tsc --project ./scripts/tsconfig.json && node ./scripts/dist/test-locales.js",
|
||||
"lint:dep-ownership": "tsc --project ./scripts/tsconfig.json && node ./scripts/dist/dep-ownership.js",
|
||||
"docs:json": "compodoc -p ./tsconfig.json -e json -d . --disableRoutesGraph",
|
||||
"storybook": "ng run components:storybook",
|
||||
"build-storybook": "ng run components:build-storybook",
|
||||
|
31
scripts/dep-ownership.ts
Normal file
31
scripts/dep-ownership.ts
Normal file
@ -0,0 +1,31 @@
|
||||
/* 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.");
|
Loading…
Reference in New Issue
Block a user