Skip to content

Commit

Permalink
fix fsevents compatibility for build tools
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Sep 14, 2016
1 parent cd1318c commit 94eb60a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
10 changes: 6 additions & 4 deletions build/lib/watch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() };
Expand All @@ -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());
};
16 changes: 8 additions & 8 deletions build/lib/watch/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
27 changes: 24 additions & 3 deletions build/npm/preinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 94eb60a

Please sign in to comment.