Skip to content

Commit 4727065

Browse files
committed
prevent plain npm
#22
1 parent 5dbc95b commit 4727065

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

build/npm/preinstall.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
var win = "Please run '.\\scripts\\npm.bat install' instead."
7+
var nix = "Please run './scripts/npm.sh install' instead."
8+
9+
if (process.env['npm_config_disturl'] !== 'https://atom.io/download/atom-shell') {
10+
console.error("You can't use plain npm to install Code's dependencies.");
11+
console.error(/^win/.test(process.platform) ? win : nix);
12+
process.exit(1);
13+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"scripts": {
1414
"test": "node node_modules/mocha/bin/_mocha",
15+
"preinstall": "node build/npm/preinstall.js",
1516
"postinstall": "npm --prefix extensions/csharp-o/ install extensions/csharp-o/ && npm --prefix extensions/vscode-api-tests/ install extensions/vscode-api-tests/"
1617
},
1718
"dependencies": {

0 commit comments

Comments
 (0)