Skip to content

Commit fd1916f

Browse files
committed
build: add a warning in the package.json of each subpackages
To avoid people going in those directories and running npm install. Fixes #172.
1 parent 6d97bd2 commit fd1916f

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

lib/packages.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,24 @@ function loadPackageJson(p: string) {
7474

7575
for (const key of Object.keys(root)) {
7676
switch (key) {
77+
// Keep the following keys from the package.json of the package itself.
7778
case 'bin':
7879
case 'description':
7980
case 'dependencies':
80-
case 'devDependencies':
8181
case 'name':
8282
case 'main':
8383
case 'peerDependencies':
84-
case 'scripts':
8584
case 'typings':
8685
case 'version':
8786
continue;
8887

88+
// Remove the following keys from the package.json.
89+
case 'devDependencies':
90+
case 'scripts':
91+
delete pkg[key];
92+
continue;
93+
94+
// Merge the following keys with the root package.json.
8995
case 'keywords':
9096
const a = pkg[key] || [];
9197
const b = Object.keys(
@@ -97,6 +103,7 @@ function loadPackageJson(p: string) {
97103
pkg[key] = b;
98104
break;
99105

106+
// Overwrite the package's key with to root one.
100107
default:
101108
pkg[key] = root[key];
102109
}

packages/_/benchmark/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
"description": "CLI tool for Angular",
55
"main": "src/index.js",
66
"typings": "src/index.d.ts",
7+
"scripts": {
8+
"preinstall": "echo DO NOT INSTALL THIS PROJECT, ONLY THE ROOT PROJECT. && exit 1"
9+
},
710
"private": true
811
}

packages/angular_devkit/build_optimizer/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"build-optimizer": "./src/build-optimizer/cli.js",
99
"purify": "./src/purify/cli.js"
1010
},
11+
"scripts": {
12+
"preinstall": "echo DO NOT INSTALL THIS PROJECT, ONLY THE ROOT PROJECT. && exit 1"
13+
},
1114
"dependencies": {
1215
"loader-utils": "^1.1.0",
1316
"source-map": "^0.5.6",

packages/angular_devkit/core/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"description": "Angular DevKit - Core Utility Library",
55
"main": "src/index.js",
66
"typings": "src/index.d.ts",
7+
"scripts": {
8+
"preinstall": "echo DO NOT INSTALL THIS PROJECT, ONLY THE ROOT PROJECT. && exit 1"
9+
},
710
"keywords": [
811
"core"
912
],

packages/angular_devkit/schematics/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"bin": {
66
"schematics": "./bin/schematics.js"
77
},
8+
"scripts": {
9+
"preinstall": "echo DO NOT INSTALL THIS PROJECT, ONLY THE ROOT PROJECT. && exit 1"
10+
},
811
"main": "src/index.js",
912
"typings": "src/index.d.ts",
1013
"keywords": [

packages/schematics/angular/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"code generation",
88
"schematics"
99
],
10+
"scripts": {
11+
"preinstall": "echo DO NOT INSTALL THIS PROJECT, ONLY THE ROOT PROJECT. && exit 1"
12+
},
1013
"schematics": "./collection.json",
1114
"peerDependencies": {
1215
"@angular-devkit/schematics": "0.0.0"

0 commit comments

Comments
 (0)