Skip to content

Commit 8a7b229

Browse files
damingerdaimmalerba
authored andcommitted
build: rely on engines to prevent using npm for dependency install (#22643)
Rather than relying on a preinstall script, set `engine-strict` to `true` in a project `.npmrc` file, relying on the `engines` having `npm` set to note that yarn should be used instead (cherry picked from commit 00c73e3)
1 parent bbc4f3c commit 8a7b229

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict = true

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"license": "MIT",
1111
"engines": {
1212
"node": ">=12.0.0 <16.0.0",
13-
"yarn": ">= 1.0.0"
13+
"yarn": ">= 1.0.0",
14+
"npm": "Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/"
1415
},
1516
"scripts": {
1617
"postinstall": "node tools/postinstall/apply-patches.js && ngcc --properties module main --create-ivy-entry-points && node tools/postinstall/update-ngcc-main-fields.js",
@@ -31,7 +32,6 @@
3132
"check-release-output": "ts-node --project tools/release/tsconfig.json tools/release/check-release-output.ts",
3233
"check-rollup-globals": "ts-node --project scripts/tsconfig.json scripts/check-rollup-globals.ts",
3334
"changelog": "ts-node --project tools/release/tsconfig.json tools/release/changelog.ts",
34-
"preinstall": "node ./tools/npm/check-npm.js",
3535
"format": "yarn ng-dev format changed",
3636
"cherry-pick-patch": "ts-node --project tools/cherry-pick-patch/tsconfig.json tools/cherry-pick-patch/cherry-pick-patch.ts",
3737
"ownerslint": "ts-node --project scripts/tsconfig.json scripts/ownerslint.ts",

tools/npm/check-npm.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)