Gulp: port the all
, extension
and jsdoc
targets
This requires the `run-sequence` dependency because Gulp does not have a way to run sequences of tasks inside a Gulp task. Gulp 4.0 will have support for this, but until that is released this is the recommended way to implement it.
This commit is contained in:
parent
2e20000b71
commit
224e3a42a2
32
gulpfile.js
32
gulpfile.js
@ -20,7 +20,9 @@
|
||||
var fs = require('fs');
|
||||
var gulp = require('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var mkdirp = require('mkdirp');
|
||||
var rimraf = require('rimraf');
|
||||
var runSequence = require('run-sequence');
|
||||
var stream = require('stream');
|
||||
var exec = require('child_process').exec;
|
||||
var spawn = require('child_process').spawn;
|
||||
@ -28,6 +30,7 @@ var streamqueue = require('streamqueue');
|
||||
var zip = require('gulp-zip');
|
||||
|
||||
var BUILD_DIR = 'build/';
|
||||
var JSDOC_DIR = 'jsdoc/';
|
||||
var L10N_DIR = 'l10n/';
|
||||
var TEST_DIR = 'test/';
|
||||
|
||||
@ -339,6 +342,13 @@ gulp.task('default', function() {
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('extension', function (done) {
|
||||
console.log();
|
||||
console.log('### Building extensions');
|
||||
|
||||
runSequence('locale', ['firefox', 'chromium'], done);
|
||||
});
|
||||
|
||||
gulp.task('buildnumber', function (done) {
|
||||
console.log();
|
||||
console.log('### Getting extension build number');
|
||||
@ -421,6 +431,28 @@ gulp.task('bundle', ['buildnumber'], function () {
|
||||
return createBundle(DEFINES).pipe(gulp.dest(BUILD_DIR));
|
||||
});
|
||||
|
||||
gulp.task('jsdoc', function (done) {
|
||||
console.log();
|
||||
console.log('### Generating documentation (JSDoc)');
|
||||
|
||||
var JSDOC_FILES = [
|
||||
'src/doc_helper.js',
|
||||
'src/display/api.js',
|
||||
'src/display/global.js',
|
||||
'src/shared/util.js',
|
||||
'src/core/annotation.js'
|
||||
];
|
||||
|
||||
var directory = BUILD_DIR + JSDOC_DIR;
|
||||
rimraf(directory, function () {
|
||||
mkdirp(directory, function () {
|
||||
var command = '"node_modules/.bin/jsdoc" -d ' + directory + ' ' +
|
||||
JSDOC_FILES.join(' ');
|
||||
exec(command, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('publish', ['generic'], function (done) {
|
||||
var version = JSON.parse(
|
||||
fs.readFileSync(BUILD_DIR + 'version.json').toString()).version;
|
||||
|
38
make.js
38
make.js
@ -79,13 +79,7 @@ function getCurrentVersion() {
|
||||
// make all
|
||||
//
|
||||
target.all = function() {
|
||||
// Don't do anything by default
|
||||
echo('Please specify a target. Available targets:');
|
||||
for (var t in target) {
|
||||
if (t !== 'all') {
|
||||
echo(' ' + t);
|
||||
}
|
||||
}
|
||||
exit(exec('gulp default'));
|
||||
};
|
||||
|
||||
|
||||
@ -194,27 +188,7 @@ target.components = function() {
|
||||
};
|
||||
|
||||
target.jsdoc = function() {
|
||||
echo();
|
||||
echo('### Generating jsdoc');
|
||||
|
||||
var JSDOC_FILES = [
|
||||
'src/doc_helper.js',
|
||||
'src/display/api.js',
|
||||
'src/display/global.js',
|
||||
'src/shared/util.js',
|
||||
'src/core/annotation.js'
|
||||
];
|
||||
|
||||
if (test('-d', JSDOC_DIR)) {
|
||||
rm('-rf', JSDOC_DIR);
|
||||
}
|
||||
|
||||
mkdir('-p',JSDOC_DIR);
|
||||
|
||||
exec('"node_modules/.bin/jsdoc" -d "' + JSDOC_DIR + '" ' +
|
||||
JSDOC_FILES.join(' '));
|
||||
|
||||
echo();
|
||||
exit(exec('gulp jsdoc'));
|
||||
};
|
||||
|
||||
//
|
||||
@ -617,13 +591,7 @@ target.minified = function() {
|
||||
// make extension
|
||||
//
|
||||
target.extension = function() {
|
||||
cd(ROOT_DIR);
|
||||
echo();
|
||||
echo('### Building extensions');
|
||||
|
||||
target.locale();
|
||||
target.firefox();
|
||||
target.chromium();
|
||||
exit(exec('gulp extension'));
|
||||
};
|
||||
|
||||
target.buildnumber = function() {
|
||||
|
@ -10,9 +10,11 @@
|
||||
"jasmine-core": "^2.4.1",
|
||||
"jsdoc": "^3.3.0-alpha9",
|
||||
"jshint": "~2.8.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"node-ensure": "^0.0.0",
|
||||
"requirejs": "^2.1.22",
|
||||
"rimraf": "^2.4.1",
|
||||
"run-sequence": "^1.2.2",
|
||||
"shelljs": "~0.4.0",
|
||||
"streamqueue": "^1.1.1",
|
||||
"typogr": "~0.6.5",
|
||||
|
Loading…
Reference in New Issue
Block a user