Skip to content

Commit 9bdc47d

Browse files
committed
update codemirror
1 parent 50746af commit 9bdc47d

File tree

3 files changed

+62
-38
lines changed

3 files changed

+62
-38
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ module.exports = function (grunt) {
354354
// task: build - build stuff into dist folder
355355
grunt.registerTask('build', [
356356
'npm-install-dist',
357-
'copy:thirdparty',
358357
'npm-install-extensions-dist',
358+
'copy:thirdparty',
359359
'webpack-browser-dependencies'
360360
]);
361361

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "brackets-src",
33
"dependencies": {
4-
"codemirror": "5.25.0",
4+
"codemirror": "https://github.com/codemirror/CodeMirror.git#d8a95221775d22cee7656e55abd4a84a47bea122",
55
"less": "2.7.2"
66
}
77
}

tasks/npm-install.js

Lines changed: 60 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,20 @@ module.exports = function (grunt) {
6060
child.stdin.end();
6161
}
6262

63-
function runNpmInstall(where, callback) {
64-
grunt.log.writeln("running npm install --production in " + where);
65-
exec('npm install --production', { cwd: './' + where }, function (err, stdout, stderr) {
63+
function runNpmInstall(where, productionMode, callback) {
64+
if (typeof productionMode === "function") {
65+
callback = productionMode;
66+
productionMode = true;
67+
}
68+
69+
var cmd = 'npm install';
70+
if (productionMode) {
71+
cmd += ' --production';
72+
}
73+
74+
grunt.log.writeln("running " + cmd + " in " + where);
75+
76+
exec(cmd, { cwd: './' + where }, function (err, stdout, stderr) {
6677
if (err) {
6778
grunt.log.error(stderr);
6879
return callback(stderr);
@@ -157,50 +168,63 @@ module.exports = function (grunt) {
157168
});
158169
});
159170

160-
function npmInstallExtensions(globs) {
161-
var doneWithTask = this.async();
162-
var globs = [
163-
"dist/www/+(extensibility|extensions|LiveDevelopment)/**/package.json"
164-
];
165-
var result;
166-
var doneWithGlob = _.after(globs.length, () => {
167-
doneWithTask(result);
168-
});
169-
globs.forEach(g => {
170-
glob(g, function (err, files) {
171-
if (err) {
172-
grunt.log.error(err);
173-
result = false;
174-
return doneWithGlob();
175-
}
176-
files = files.filter(function (path) {
177-
return path.indexOf("node_modules") === -1;
178-
});
179-
var doneWithFile = _.after(files.length, doneWithGlob);
180-
files.forEach(function (file) {
181-
runNpmInstall(path.dirname(file), function (err) {
182-
if (err) {
183-
result = false;
184-
}
185-
return doneWithFile();
171+
function npmInstallExtensions(globs, filterOutNodeModules = true, runProduction = true) {
172+
return new Promise(function (resolve) {
173+
var result;
174+
var doneWithGlob = _.after(globs.length, () => {
175+
resolve(result);
176+
});
177+
globs.forEach(g => {
178+
glob(g, function (err, files) {
179+
if (err) {
180+
grunt.log.error(err);
181+
result = false;
182+
return doneWithGlob();
183+
}
184+
if (filterOutNodeModules) {
185+
files = files.filter(function (path) {
186+
return path.indexOf("node_modules") === -1;
187+
});
188+
}
189+
var doneWithFile = _.after(files.length, doneWithGlob);
190+
files.forEach(function (file) {
191+
runNpmInstall(path.dirname(file), runProduction, function (err) {
192+
if (err) {
193+
result = false;
194+
}
195+
return doneWithFile();
196+
});
186197
});
187198
});
188199
});
189200
});
190201
}
191202

192203
grunt.registerTask("npm-install-extensions-src", "Install node_modules for default extensions which have package.json defined", function () {
193-
var globs = [
204+
var doneWithTask = this.async();
205+
npmInstallExtensions([
194206
"src/www/+(extensibility|extensions|LiveDevelopment)/**/package.json"
195-
];
196-
return npmInstallExtensions.call(this, globs);
207+
]).then(function (result) {
208+
doneWithTask(result);
209+
});
197210
});
198211

199212
grunt.registerTask("npm-install-extensions-dist", "Install node_modules for default extensions which have package.json defined", function () {
200-
var globs = [
201-
"dist/www/+(extensibility|extensions|LiveDevelopment)/**/package.json"
202-
];
203-
return npmInstallExtensions.call(this, globs);
213+
var doneWithTask = this.async();
214+
Promise.all([
215+
npmInstallExtensions([
216+
"dist/www/node_modules/codemirror/package.json" // make sure codemirror builds
217+
], false, false),
218+
npmInstallExtensions([
219+
"dist/www/+(extensibility|extensions|LiveDevelopment)/**/package.json"
220+
])
221+
]).then(function (results) {
222+
var result = !results.some(x => x != null);
223+
doneWithTask(result);
224+
}).catch(function (err) {
225+
grunt.log.error('err ' + err);
226+
doneWithTask(false);
227+
});
204228
});
205229

206230
};

0 commit comments

Comments
 (0)