Port the publish target to Gulp

This commit is contained in:
Tim van der Meij 2016-04-26 23:28:36 +02:00
parent 97b3a70df8
commit 5166b46a1c
3 changed files with 24 additions and 10 deletions

View File

@ -24,6 +24,7 @@ var rimraf = require('rimraf');
var stream = require('stream');
var exec = require('child_process').exec;
var streamqueue = require('streamqueue');
var zip = require('gulp-zip');
var BUILD_DIR = 'build/';
var L10N_DIR = 'l10n/';
@ -337,6 +338,27 @@ gulp.task('bundle', ['buildnumber'], function () {
return createBundle(DEFINES).pipe(gulp.dest(BUILD_DIR));
});
gulp.task('publish', ['generic'], function (done) {
var version = JSON.parse(
fs.readFileSync(BUILD_DIR + 'version.json').toString()).version;
config.stableVersion = config.betaVersion;
config.betaVersion = version;
createStringSource(CONFIG_FILE, JSON.stringify(config, null, 2))
.pipe(gulp.dest('.'))
.on('end', function () {
var targetName = 'pdfjs-' + version + '-dist.zip';
gulp.src(BUILD_DIR + 'generic/**')
.pipe(zip(targetName))
.pipe(gulp.dest(BUILD_DIR))
.on('end', function () {
console.log('Built distribution file: ' + targetName);
done();
});
});
});
gulp.task('server', function (done) {
console.log();
console.log('### Starting local server');

11
make.js
View File

@ -385,16 +385,7 @@ target.dist = function() {
};
target.publish = function() {
target.generic();
var VERSION = getCurrentVersion();
config.stableVersion = config.betaVersion;
config.betaVersion = VERSION;
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
cd(GENERIC_DIR);
var distFilename = 'pdfjs-' + VERSION + '-dist.zip';
exec('zip -r ' + ROOT_DIR + BUILD_DIR + distFilename + ' *');
echo('Built distribution file: ' + distFilename);
cd(ROOT_DIR);
exec('gulp publish');
};
//

View File

@ -4,6 +4,7 @@
"devDependencies": {
"gulp": "^3.9.1",
"gulp-util": "^3.0.7",
"gulp-zip": "^3.2.0",
"jasmine-core": "^2.4.1",
"jsdoc": "^3.3.0-alpha9",
"jshint": "~2.8.0",