From 8fe532e593ee36320101de686d4f8c2666b1f239 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 12 May 2020 18:48:02 +0200 Subject: [PATCH] build(dev-infra): cleanup package dependencies for shared package (#36980) As per our discussion in the dev-infra sync meeting, we don't want to have all dependencies show up as peer dependencies. Instead, we only want to have larger dependencies such as `typescript` or buildifier as peer dependencies. Tslib is also included for the sake of it being generally a peer dependency of all Angular framework packages. The rationale is that Yarn is smart enough to collapse packages if all satisfy a given range. This means that we don't necessarily need to have all dependencies as peer dependencies. The initial idea was to keep all dependencies as peer dependencies so that we have control over duplication of packages as downloading multiple packages w/ different versions impacts local dev, CI and caches. At the same time though, we don't want to bother with setting up peer dependencies all the time. Not every consumer of the shared dev-infra package would like to manually specify `yaml` or `multimatch` etc. in the project `package.json`. Hence we decided to go with a hybrid approach where only more impactful dependencies are peer dependencies, and other smaller ones can be standard depdencies that are usually collapsed by Yarn anyway. Also this commit removes tslib from build targets that don't rely on it. PR Close #36980 --- dev-infra/commit-message/BUILD.bazel | 1 - dev-infra/format/BUILD.bazel | 1 - dev-infra/pullapprove/BUILD.bazel | 1 - dev-infra/tmpl-package.json | 14 ++++++++------ dev-infra/ts-circular-dependencies/BUILD.bazel | 1 - 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dev-infra/commit-message/BUILD.bazel b/dev-infra/commit-message/BUILD.bazel index fbfe3fe234..152bc195b7 100644 --- a/dev-infra/commit-message/BUILD.bazel +++ b/dev-infra/commit-message/BUILD.bazel @@ -18,7 +18,6 @@ ts_library( "@npm//@types/shelljs", "@npm//@types/yargs", "@npm//shelljs", - "@npm//tslib", "@npm//yargs", ], ) diff --git a/dev-infra/format/BUILD.bazel b/dev-infra/format/BUILD.bazel index 0d1b4d80a2..2b340e6aeb 100644 --- a/dev-infra/format/BUILD.bazel +++ b/dev-infra/format/BUILD.bazel @@ -18,7 +18,6 @@ ts_library( "@npm//inquirer", "@npm//multimatch", "@npm//shelljs", - "@npm//tslib", "@npm//yargs", ], ) diff --git a/dev-infra/pullapprove/BUILD.bazel b/dev-infra/pullapprove/BUILD.bazel index b27e1df543..f73a2aaeca 100644 --- a/dev-infra/pullapprove/BUILD.bazel +++ b/dev-infra/pullapprove/BUILD.bazel @@ -21,7 +21,6 @@ ts_library( "@npm//@types/yargs", "@npm//minimatch", "@npm//shelljs", - "@npm//tslib", "@npm//yaml", "@npm//yargs", ], diff --git a/dev-infra/tmpl-package.json b/dev-infra/tmpl-package.json index 86f4c39cfd..4d18d6ad8e 100644 --- a/dev-infra/tmpl-package.json +++ b/dev-infra/tmpl-package.json @@ -8,19 +8,21 @@ "ng-dev": "./cli.js", "ts-circular-deps": "./ts-circular-dependencies/index.js" }, - "peerDependencies": { - "@bazel/buildifier": "", + "dependencies": { "chalk": "", - "clang-format": "", "cli-progress": "", "glob": "", "inquirer": "", "minimatch": "", "multimatch": "", "shelljs": "", - "typescript": "", "yaml": "", - "yargs": "", - "tslib": "" + "yargs": "" + }, + "peerDependencies": { + "@bazel/buildifier": "", + "clang-format": "", + "tslib": "", + "typescript": "" } } diff --git a/dev-infra/ts-circular-dependencies/BUILD.bazel b/dev-infra/ts-circular-dependencies/BUILD.bazel index 6b87b1e835..e084b268ba 100644 --- a/dev-infra/ts-circular-dependencies/BUILD.bazel +++ b/dev-infra/ts-circular-dependencies/BUILD.bazel @@ -11,7 +11,6 @@ ts_library( "@npm//@types/node", "@npm//@types/yargs", "@npm//chalk", - "@npm//tslib", "@npm//typescript", ], )