Skip to content

Commit 3d88a9e

Browse files
committed
(maint) Automatically download vendored items on watch
Previously you had to remember to vendor the editor services before running the extension during development. This commit changes the npm watch task, to first run the new npm intial task, which downloads vendored assets, if they don't already exist.
1 parent 75552d2 commit 3d88a9e

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

gulpfile.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Include gulp
2+
var es = require('event-stream');
23
var gulp = require('gulp');
34
var del = require('del');
45
var runSequence = require('run-sequence');
@@ -38,9 +39,23 @@ function getEditorServicesReleaseURL(config) {
3839
// The default task (called when you run `gulp` from cli)
3940
gulp.task('default', ['build']);
4041

42+
gulp.task('initial', function (callback) {
43+
var fs = require('fs');
44+
var sequence = [];
45+
46+
editorServicesPath = path.join(__dirname, 'vendor', 'languageserver');
47+
if (!fs.existsSync(editorServicesPath)) { sequence.push('vendor_editor_services'); }
48+
49+
if (sequence.length > 0) {
50+
return runSequence(sequence, callback);
51+
} else {
52+
return es.merge([]);
53+
}
54+
});
55+
4156
gulp.task('clean', function () {
4257
return del(['vendor'])
43-
})
58+
});
4459

4560
gulp.task('vendor_editor_services', function (callback) {
4661
var config = getEditorServicesConfig();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@
393393
"scripts": {
394394
"vscode:prepublish": "node node_modules/gulp/bin/gulp.js build",
395395
"compile": "tsc -p ./",
396-
"watch": "tsc -watch -p ./",
396+
"watch": "node node_modules/gulp/bin/gulp.js initial && tsc -watch -p ./",
397397
"postinstall": "node ./node_modules/vscode/bin/install",
398398
"test": "npm run compile && node ./node_modules/vscode/bin/test"
399399
},

0 commit comments

Comments
 (0)