Skip to content

Commit 94eb60a

Browse files
committed
fix fsevents compatibility for build tools
1 parent cd1318c commit 94eb60a

4 files changed

Lines changed: 38 additions & 16 deletions

File tree

build/lib/watch/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
var es = require('event-stream');
6+
const es = require('event-stream');
77

88
/** Ugly hack for gulp-tsb */
99
function handleDeletions() {
10-
return es.mapSync(function (f) {
10+
return es.mapSync(f => {
1111
if (/\.ts$/.test(f.relative) && !f.contents) {
1212
f.contents = new Buffer('');
1313
f.stat = { mtime: new Date() };
@@ -17,9 +17,11 @@ function handleDeletions() {
1717
});
1818
}
1919

20-
var watch = process.platform === 'win32' ? require('./watch-win32') : require('gulp-watch');
20+
const watch = process.platform === 'win32'
21+
? require('./watch-win32')
22+
: require('gulp-watch');
2123

22-
module.exports = function () {
24+
module.exports = () => {
2325
return watch.apply(null, arguments)
2426
.pipe(handleDeletions());
2527
};

build/lib/watch/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "watch",
3-
"version": "1.0.0",
4-
"description": "",
5-
"author": "Microsoft ",
6-
"private": true,
7-
"devDependencies": {
8-
"gulp-watch": "^4.3.5"
9-
}
2+
"name": "watch",
3+
"version": "1.0.0",
4+
"description": "",
5+
"author": "Microsoft ",
6+
"private": true,
7+
"devDependencies": {
8+
"gulp-watch": "^4.3.9"
9+
}
1010
}

build/npm/preinstall.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,32 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
var win = "Please run '.\\scripts\\npm.bat install' instead.";
7-
var nix = "Please run './scripts/npm.sh install' instead.";
6+
const path = require('path');
7+
const cp = require('child_process');
88

99
if (process.env['npm_config_disturl'] !== 'https://atom.io/download/atom-shell') {
1010
console.error("You can't use plain npm to install Code's dependencies.");
11-
console.error(/^win/.test(process.platform) ? win : nix);
11+
console.error(
12+
/^win/.test(process.platform)
13+
? "Please run '.\\scripts\\npm.bat install' instead."
14+
: "Please run './scripts/npm.sh install' instead."
15+
);
16+
1217
process.exit(1);
1318
}
19+
20+
// make sure we install gulp watch for the system installed
21+
// node, since that is the driver of gulp
22+
if (process.platform !== 'win32') {
23+
const env = Object.assign({}, process.env);
24+
25+
delete env['npm_config_disturl'];
26+
delete env['npm_config_target'];
27+
delete env['npm_config_runtime'];
28+
29+
cp.spawnSync('npm', ['install'], {
30+
cwd: path.join(path.dirname(__dirname), 'lib', 'watch'),
31+
stdio: 'inherit',
32+
env
33+
});
34+
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
"gulp-uglify": "^1.4.1",
7070
"gulp-util": "^3.0.6",
7171
"gulp-vinyl-zip": "^1.2.2",
72-
"gulp-watch": "4.3.6",
7372
"innosetup-compiler": "^5.5.60",
7473
"is": "^3.1.0",
7574
"istanbul": "^0.3.17",

0 commit comments

Comments
 (0)