Skip to content

Commit 9e1b35b

Browse files
committed
Add monaco-editor-setup script
1 parent 37c04d7 commit 9e1b35b

3 files changed

Lines changed: 70 additions & 15 deletions

File tree

gulpfile.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
require('events').EventEmitter.defaultMaxListeners = 100;
1010

1111
const gulp = require('gulp');
12+
// Record all defined tasks to determine later in this file (at the bottom)
13+
// if further gulpfiles need to be included or not
14+
var ALL_KNOWN_TASKS = [], originalGulpTask = gulp.task;
15+
gulp.task = function() {
16+
ALL_KNOWN_TASKS.push(arguments[0]);
17+
return originalGulpTask.apply(gulp, Array.prototype.slice.call(arguments, 0));
18+
};
19+
1220
const json = require('gulp-json-editor');
1321
const buffer = require('gulp-buffer');
1422
const tsb = require('gulp-tsb');
@@ -258,22 +266,13 @@ gulp.task('mixin', function () {
258266
.pipe(gulp.dest('.'));
259267
});
260268

261-
var ALL_EDITOR_TASKS = [
262-
'clean-optimized-editor',
263-
'optimize-editor',
264-
'clean-minified-editor',
265-
'minify-editor',
266-
'clean-editor-distro',
267-
'editor-distro',
268-
'analyze-editor-distro'
269-
];
270-
var runningEditorTasks = process.argv.slice(2).every(function(arg) {
271-
return (ALL_EDITOR_TASKS.indexOf(arg) !== -1);
269+
require(`./build/gulpfile.editor`);
270+
271+
var runningKnownTasks = process.argv.slice(2).every(function(arg) {
272+
return (ALL_KNOWN_TASKS.indexOf(arg) !== -1);
272273
});
273274

274-
if (runningEditorTasks) {
275-
require(`./build/gulpfile.editor`);
276-
} else {
275+
if (!runningKnownTasks) {
277276
// Load all the gulpfiles only if running tasks other than the editor tasks
278277
const build = path.join(__dirname, 'build');
279278
glob.sync('gulpfile.*.js', { cwd: build })

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"test": "mocha",
1313
"preinstall": "node build/npm/preinstall.js",
1414
"postinstall": "node build/npm/postinstall.js",
15-
"watch": "gulp watch"
15+
"watch": "gulp watch",
16+
"monaco-editor-setup": "node scripts/monaco-editor-setup.js"
1617
},
1718
"dependencies": {
1819
"applicationinsights": "0.15.6",

scripts/monaco-editor-setup.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
var fs = require('fs');
3+
var cp = require('child_process');
4+
var path = require('path');
5+
6+
var keep = [
7+
'azure-storage',
8+
'clone',
9+
'debounce',
10+
'event-stream',
11+
'glob',
12+
'gulp-azure-storage',
13+
'gulp-bom',
14+
'gulp-buffer',
15+
'gulp-concat',
16+
'gulp-cssnano',
17+
'gulp-filter',
18+
'gulp-flatmap',
19+
'gulp-json-editor',
20+
'gulp-mocha',
21+
'gulp-remote-src',
22+
'gulp-rename',
23+
'gulp-sourcemaps',
24+
'gulp-tsb',
25+
'gulp-uglify',
26+
'gulp-util',
27+
'gulp-vinyl-zip',
28+
'gulp-watch',
29+
'gulp',
30+
'lazy.js',
31+
'object-assign',
32+
'pump',
33+
'rimraf',
34+
'source-map',
35+
'typescript',
36+
'underscore',
37+
'vinyl',
38+
'vscode-nls-dev',
39+
];
40+
41+
var packageJSON = require('../package.json');
42+
var modules = keep.map(function(module) {
43+
var version = packageJSON.devDependencies[module];
44+
if (version) {
45+
return module + '@' + version.replace(/^\^/, '');
46+
} else {
47+
return module;
48+
}
49+
});
50+
51+
var cmd = `npm install ${modules.join(' ')}`;
52+
console.log(cmd);
53+
cp.execSync(cmd, {
54+
cwd: path.join(__dirname, '..')
55+
});

0 commit comments

Comments
 (0)