From 7212311dcae52ea0a33087d95bfe2549fde553e6 Mon Sep 17 00:00:00 2001 From: Daniel Lebu Date: Fri, 18 Mar 2016 11:30:38 -0700 Subject: [PATCH] Added package gulp task. --- gulpfile.js | 8 +++++++- tools/gulp-extras.js | 20 +++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index d8bbd9c7..a42cb340 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for details. -var child_process = require('child_process'); var gulp = require('gulp'); var log = require('gulp-util').log; var sourcemaps = require('gulp-sourcemaps'); @@ -13,6 +12,7 @@ var mocha = require('gulp-mocha'); var GulpExtras = require("./tools/gulp-extras"); var copyright = GulpExtras.checkCopyright; var imports = GulpExtras.checkImports; +var executeCommand = GulpExtras.executeCommand; var srcPath = 'src'; var outPath = 'out'; @@ -106,3 +106,9 @@ gulp.task("clean", function () { }); return del(pathsToDelete, { force: true }); }); + +gulp.task("package", function (callback) { + var command = path.join(__dirname, "node_modules", ".bin", "vsce"); + var args = ["package"]; + executeCommand(command, args, callback); +}); \ No newline at end of file diff --git a/tools/gulp-extras.js b/tools/gulp-extras.js index 4ed2aa9c..89dd21ff 100644 --- a/tools/gulp-extras.js +++ b/tools/gulp-extras.js @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. "use strict"; +var child_process = require("child_process"); var fs = require("fs"); var gutil = require("gulp-util"); var path = require("path"); @@ -99,7 +100,24 @@ var checkImports = function() { }); }; +var executeCommand = function(command, args, callback) { + var process = child_process.spawn(command, args); + + process.stdout.on('data', function(data) { + console.log("" + data); + }); + + process.stderr.on('data', function(data) { + console.error("" + data); + }); + + process.on('exit', function(code) { + callback(code === 0 ? undefined : "Error code: " + code); + }); +}; + module.exports = { checkCopyright: checkCopyright, - checkImports: checkImports + checkImports: checkImports, + executeCommand: executeCommand } \ No newline at end of file