Add monaco-editor-setup script

This commit is contained in:
Alex Dima 2016-10-20 15:49:20 +02:00
parent 89fbdde423
commit fcbe48844e
4 changed files with 63 additions and 6 deletions

View file

@ -130,18 +130,18 @@ export function skipDirectories(): NodeJS.ReadWriteStream {
}
export function cleanNodeModule(name:string, excludes:string[], includes:string[]): NodeJS.ReadWriteStream {
const glob = (path:string) => '**/node_modules/' + name + (path ? '/' + path : '');
const toGlob = (path:string) => '**/node_modules/' + name + (path ? '/' + path : '');
const negate = (str:string) => '!' + str;
const allFilter = _filter(glob('**'), { restore: true });
const globs = [glob('**')].concat(excludes.map(_.compose(negate, glob)));
const allFilter = _filter(toGlob('**'), { restore: true });
const globs = [toGlob('**')].concat(excludes.map(_.compose(negate, toGlob)));
const input = es.through();
const nodeModuleInput = input.pipe(allFilter);
let output:NodeJS.ReadWriteStream = nodeModuleInput.pipe(_filter(globs));
if (includes) {
const includeGlobs = includes.map(glob);
const includeGlobs = includes.map(toGlob);
output = es.merge(output, nodeModuleInput.pipe(_filter(includeGlobs)));
}

View file

@ -11,5 +11,31 @@
},
"bugs": {
"url": "https://github.com/Microsoft/vscode/issues"
},
"devDependencies": {
"debounce": "^1.0.0",
"event-stream": "^3.1.7",
"gulp": "^3.8.9",
"gulp-bom": "^1.0.0",
"gulp-concat": "^2.6.0",
"gulp-cssnano": "^2.1.0",
"gulp-filter": "^3.0.0",
"gulp-flatmap": "^1.0.0",
"gulp-rename": "^1.2.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-tsb": "^2.0.1",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.6",
"gulp-watch": "^4.3.9",
"is": "^3.1.0",
"lazy.js": "^0.4.2",
"object-assign": "^4.0.1",
"pump": "^1.0.1",
"rimraf": "^2.2.8",
"source-map": "^0.4.4",
"typescript": "^2.0.3",
"underscore": "^1.8.2",
"vinyl": "^0.4.5",
"vscode-nls-dev": "^2.0.1"
}
}

View file

@ -11,7 +11,6 @@ require('events').EventEmitter.defaultMaxListeners = 100;
const gulp = require('gulp');
const util = require('./build/lib/util');
const path = require('path');
const glob = require('glob');
const compilation = require('./build/lib/compilation');
// Fast compile for development time
@ -62,6 +61,6 @@ if (runningEditorTasks) {
} else {
// Load all the gulpfiles only if running tasks other than the editor tasks
const build = path.join(__dirname, 'build');
glob.sync('gulpfile.*.js', { cwd: build })
require('glob').sync('gulpfile.*.js', { cwd: build })
.forEach(f => require(`./build/${ f }`));
}

View file

@ -0,0 +1,32 @@
var fs = require('fs');
var cp = require('child_process');
var path = require('path');
var ROOT = path.join(__dirname, '..');
var ROOT_NODE_MODULES_PATH = path.join(ROOT, 'node_modules');
var EDITOR_ROOT = path.join(ROOT, 'build/monaco')
var EDITOR_NODE_MODULES_PATH = path.join(EDITOR_ROOT, 'node_modules')
var cmd = `npm install`;
cp.execSync(cmd, {
cwd: EDITOR_ROOT,
stdio:[0,1,2]
});
if (!fs.existsSync(ROOT_NODE_MODULES_PATH)) {
fs.mkdirSync(ROOT_NODE_MODULES_PATH);
}
// Move deps over
var modules = fs.readdirSync(EDITOR_NODE_MODULES_PATH);
modules.forEach(function(module) {
var src = path.join(EDITOR_NODE_MODULES_PATH, module);
var dst = path.join(ROOT_NODE_MODULES_PATH, module);
if (!fs.existsSync(dst)) {
console.log('Moving ' + module + '...');
fs.renameSync(src, dst);
} else {
console.log('Skipping moving ' + module + '.');
}
});