forked from microsoft/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
monaco-editor-setup.js
38 lines (32 loc) · 1.2 KB
/
monaco-editor-setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
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 + '.');
}
});