build: rely on engines to prevent using npm for dependency install

See c385e74454 for more context
This commit is contained in:
Alan Agius 2021-04-15 14:33:55 +02:00
parent 0f8a74fa14
commit 1dbfffbefd
4 changed files with 3 additions and 16 deletions

1
.npmrc Normal file
View File

@ -0,0 +1 @@
engine-strict = true

View File

@ -30,7 +30,6 @@ yarn_install(
# Ensure that the script is available when running `postinstall` in the Bazel sandbox.
data = [
"//:angular-metadata.tsconfig.json",
"//:tools/npm/check-npm.js",
],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",

View File

@ -18,7 +18,8 @@
},
"engines": {
"node": ">=12.13.0 <15.0.0",
"yarn": ">=1.0.0"
"yarn": ">=1.21.1 <2",
"npm": "Please use yarn instead of NPM to install dependencies"
},
"scripts": {
"postinstall": "ngc -p ./angular-metadata.tsconfig.json && node --preserve-symlinks --preserve-symlinks-main ./tools/postinstall-patches.js && yarn ngcc",
@ -32,7 +33,6 @@
"test": "bazel test //modules/...",
"build:watch": "ibazel build //modules/...",
"test:watch": "ibazel test //modules/...",
"preinstall": "node ./tools/npm/check-npm.js",
"ngcc": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",
"bazel": "bazel"
},

View File

@ -1,13 +0,0 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
if (process.env.npm_execpath.indexOf('yarn') === -1) {
console.error('Please use Yarn instead of NPM to install dependencies. ' +
'See: https://yarnpkg.com/lang/en/docs/install/');
process.exit(1);
}