Skip to content

Commit fcbe488

Browse files
committed
Add monaco-editor-setup script
1 parent 89fbdde commit fcbe488

4 files changed

Lines changed: 63 additions & 6 deletions

File tree

build/lib/util.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,18 @@ export function skipDirectories(): NodeJS.ReadWriteStream {
130130
}
131131

132132
export function cleanNodeModule(name:string, excludes:string[], includes:string[]): NodeJS.ReadWriteStream {
133-
const glob = (path:string) => '**/node_modules/' + name + (path ? '/' + path : '');
133+
const toGlob = (path:string) => '**/node_modules/' + name + (path ? '/' + path : '');
134134
const negate = (str:string) => '!' + str;
135135

136-
const allFilter = _filter(glob('**'), { restore: true });
137-
const globs = [glob('**')].concat(excludes.map(_.compose(negate, glob)));
136+
const allFilter = _filter(toGlob('**'), { restore: true });
137+
const globs = [toGlob('**')].concat(excludes.map(_.compose(negate, toGlob)));
138138

139139
const input = es.through();
140140
const nodeModuleInput = input.pipe(allFilter);
141141
let output:NodeJS.ReadWriteStream = nodeModuleInput.pipe(_filter(globs));
142142

143143
if (includes) {
144-
const includeGlobs = includes.map(glob);
144+
const includeGlobs = includes.map(toGlob);
145145
output = es.merge(output, nodeModuleInput.pipe(_filter(includeGlobs)));
146146
}
147147

build/monaco/package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,31 @@
1111
},
1212
"bugs": {
1313
"url": "https://github.com/Microsoft/vscode/issues"
14+
},
15+
"devDependencies": {
16+
"debounce": "^1.0.0",
17+
"event-stream": "^3.1.7",
18+
"gulp": "^3.8.9",
19+
"gulp-bom": "^1.0.0",
20+
"gulp-concat": "^2.6.0",
21+
"gulp-cssnano": "^2.1.0",
22+
"gulp-filter": "^3.0.0",
23+
"gulp-flatmap": "^1.0.0",
24+
"gulp-rename": "^1.2.0",
25+
"gulp-sourcemaps": "^1.6.0",
26+
"gulp-tsb": "^2.0.1",
27+
"gulp-uglify": "^2.0.0",
28+
"gulp-util": "^3.0.6",
29+
"gulp-watch": "^4.3.9",
30+
"is": "^3.1.0",
31+
"lazy.js": "^0.4.2",
32+
"object-assign": "^4.0.1",
33+
"pump": "^1.0.1",
34+
"rimraf": "^2.2.8",
35+
"source-map": "^0.4.4",
36+
"typescript": "^2.0.3",
37+
"underscore": "^1.8.2",
38+
"vinyl": "^0.4.5",
39+
"vscode-nls-dev": "^2.0.1"
1440
}
1541
}

gulpfile.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ require('events').EventEmitter.defaultMaxListeners = 100;
1111
const gulp = require('gulp');
1212
const util = require('./build/lib/util');
1313
const path = require('path');
14-
const glob = require('glob');
1514
const compilation = require('./build/lib/compilation');
1615

1716
// Fast compile for development time
@@ -62,6 +61,6 @@ if (runningEditorTasks) {
6261
} else {
6362
// Load all the gulpfiles only if running tasks other than the editor tasks
6463
const build = path.join(__dirname, 'build');
65-
glob.sync('gulpfile.*.js', { cwd: build })
64+
require('glob').sync('gulpfile.*.js', { cwd: build })
6665
.forEach(f => require(`./build/${ f }`));
6766
}

scripts/monaco-editor-setup.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
var fs = require('fs');
3+
var cp = require('child_process');
4+
var path = require('path');
5+
6+
var ROOT = path.join(__dirname, '..');
7+
var ROOT_NODE_MODULES_PATH = path.join(ROOT, 'node_modules');
8+
var EDITOR_ROOT = path.join(ROOT, 'build/monaco')
9+
var EDITOR_NODE_MODULES_PATH = path.join(EDITOR_ROOT, 'node_modules')
10+
11+
var cmd = `npm install`;
12+
cp.execSync(cmd, {
13+
cwd: EDITOR_ROOT,
14+
stdio:[0,1,2]
15+
});
16+
17+
if (!fs.existsSync(ROOT_NODE_MODULES_PATH)) {
18+
fs.mkdirSync(ROOT_NODE_MODULES_PATH);
19+
}
20+
21+
// Move deps over
22+
var modules = fs.readdirSync(EDITOR_NODE_MODULES_PATH);
23+
modules.forEach(function(module) {
24+
var src = path.join(EDITOR_NODE_MODULES_PATH, module);
25+
var dst = path.join(ROOT_NODE_MODULES_PATH, module);
26+
if (!fs.existsSync(dst)) {
27+
console.log('Moving ' + module + '...');
28+
fs.renameSync(src, dst);
29+
} else {
30+
console.log('Skipping moving ' + module + '.');
31+
}
32+
});

0 commit comments

Comments
 (0)