Skip to content

Commit ff55615

Browse files
committed
fix nsfw for gulp watch
1 parent 3fa2784 commit ff55615

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

build/lib/watch/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.yarnrc

build/npm/postinstall.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
const cp = require('child_process');
77
const path = require('path');
8+
const fs = require('fs');
89
const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';
910

1011
function yarnInstall(location, opts) {
@@ -46,15 +47,22 @@ const extensions = [
4647
extensions.forEach(extension => yarnInstall(`extensions/${extension}`));
4748

4849
function yarnInstallBuildDependencies() {
49-
// make sure we install gulp watch for the system installed
50+
// make sure we install the deps of build/lib/watch for the system installed
5051
// node, since that is the driver of gulp
5152
const env = Object.assign({}, process.env);
53+
const watchPath = path.join(path.dirname(__dirname), 'lib', 'watch');
54+
const yarnrcPath = path.join(watchPath, '.yarnrc');
5255

53-
delete env['npm_config_disturl'];
54-
delete env['npm_config_target'];
55-
delete env['npm_config_runtime'];
56+
const disturl = 'https://nodejs.org/download/release';
57+
const target = process.versions.node;
58+
const runtime = 'node';
5659

57-
yarnInstall(path.join(path.dirname(__dirname), 'lib', 'watch'), { env });
60+
const yarnrc = `disturl "${disturl}"
61+
target "${target}"
62+
runtime "${runtime}"`;
63+
64+
fs.writeFileSync(yarnrcPath, yarnrc, 'utf8');
65+
yarnInstall(watchPath, { env });
5866
}
5967

6068
yarnInstall(`build`); // node modules required for build

0 commit comments

Comments
 (0)