fix fsevents compatibility for build tools

This commit is contained in:
Joao Moreno 2016-09-14 17:00:08 +02:00
parent cd1318c7b8
commit 94eb60a292
4 changed files with 38 additions and 16 deletions

View file

@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var es = require('event-stream');
const es = require('event-stream');
/** Ugly hack for gulp-tsb */
function handleDeletions() {
return es.mapSync(function (f) {
return es.mapSync(f => {
if (/\.ts$/.test(f.relative) && !f.contents) {
f.contents = new Buffer('');
f.stat = { mtime: new Date() };
@ -17,9 +17,11 @@ function handleDeletions() {
});
}
var watch = process.platform === 'win32' ? require('./watch-win32') : require('gulp-watch');
const watch = process.platform === 'win32'
? require('./watch-win32')
: require('gulp-watch');
module.exports = function () {
module.exports = () => {
return watch.apply(null, arguments)
.pipe(handleDeletions());
};

View file

@ -1,10 +1,10 @@
{
"name": "watch",
"version": "1.0.0",
"description": "",
"author": "Microsoft ",
"private": true,
"devDependencies": {
"gulp-watch": "^4.3.5"
}
"name": "watch",
"version": "1.0.0",
"description": "",
"author": "Microsoft ",
"private": true,
"devDependencies": {
"gulp-watch": "^4.3.9"
}
}

View file

@ -3,11 +3,32 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var win = "Please run '.\\scripts\\npm.bat install' instead.";
var nix = "Please run './scripts/npm.sh install' instead.";
const path = require('path');
const cp = require('child_process');
if (process.env['npm_config_disturl'] !== 'https://atom.io/download/atom-shell') {
console.error("You can't use plain npm to install Code's dependencies.");
console.error(/^win/.test(process.platform) ? win : nix);
console.error(
/^win/.test(process.platform)
? "Please run '.\\scripts\\npm.bat install' instead."
: "Please run './scripts/npm.sh install' instead."
);
process.exit(1);
}
// make sure we install gulp watch for the system installed
// node, since that is the driver of gulp
if (process.platform !== 'win32') {
const env = Object.assign({}, process.env);
delete env['npm_config_disturl'];
delete env['npm_config_target'];
delete env['npm_config_runtime'];
cp.spawnSync('npm', ['install'], {
cwd: path.join(path.dirname(__dirname), 'lib', 'watch'),
stdio: 'inherit',
env
});
}

View file

@ -69,7 +69,6 @@
"gulp-uglify": "^1.4.1",
"gulp-util": "^3.0.6",
"gulp-vinyl-zip": "^1.2.2",
"gulp-watch": "4.3.6",
"innosetup-compiler": "^5.5.60",
"is": "^3.1.0",
"istanbul": "^0.3.17",