👷 Add source zip for Firefox extensions

This commit is contained in:
Clement Desmidt 2018-11-10 23:58:48 +01:00
parent 394f4af8c8
commit 6e7ae26202
2 changed files with 17 additions and 9 deletions

View File

@ -39,7 +39,14 @@ var manifest = {
// Tasks // Tasks
gulp.task('clean', () => { gulp.task('clean', () => {
return pipe(`./build/${target}`, $.clean()) return pipe(`./build/${target}`, $.clean())
}) });
gulp.task('sourcezip', () => {
gulp
.src(['src/**', 'config/**', 'package.json', 'gulpfile.babel.js', '.babelrc'])
.pipe($.zip('source.zip'))
.pipe(gulp.dest('dist/'));
});
gulp.task('build', (cb) => { gulp.task('build', (cb) => {
$.runSequence('clean', 'styles', 'ext', cb) $.runSequence('clean', 'styles', 'ext', cb)
@ -64,8 +71,8 @@ gulp.task('ext', ['manifest', 'js'], () => {
// COMMON // COMMON
// ----------------- // -----------------
gulp.task('js', () => { gulp.task('js', () => {
return buildJS(target) return buildJS(target);
}) });
gulp.task('styles', () => { gulp.task('styles', () => {
return gulp.src('src/styles/**/*.scss') return gulp.src('src/styles/**/*.scss')
@ -99,18 +106,18 @@ gulp.task("manifest", () => {
// DIST // DIST
// ----------------- // -----------------
gulp.task('dist', (cb) => { gulp.task('dist', (cb) => {
$.runSequence('build', 'zip', cb) $.runSequence('build', 'zip', cb);
}); });
gulp.task('zip', () => { gulp.task('zip', () => {
return pipe(`./build/${target}/**/*`, $.zip(`${target}.zip`), './dist') return pipe(`./build/${target}/**/*`, $.zip(`${target}.zip`), './dist');
}) });
// Helpers // Helpers
function pipe(src, ...transforms) { function pipe(src, ...transforms) {
return transforms.reduce((stream, transform) => { return transforms.reduce((stream, transform) => {
const isDest = typeof transform === 'string' const isDest = typeof transform === 'string';
return stream.pipe(isDest ? gulp.dest(transform) : transform) return stream.pipe(isDest ? gulp.dest(transform) : transform)
}, gulp.src(src)) }, gulp.src(src))
} }
@ -132,7 +139,7 @@ function buildJS(target) {
'options.js', 'options.js',
'popup.js', 'popup.js',
'livereload.js' 'livereload.js'
] ];
let tasks = files.map( file => { let tasks = files.map( file => {
return browserify({ return browserify({

View File

@ -13,7 +13,8 @@
"chrome-dist": "cross-env NODE_ENV=production cross-env TARGET=chrome gulp dist", "chrome-dist": "cross-env NODE_ENV=production cross-env TARGET=chrome gulp dist",
"opera-dist": "cross-env NODE_ENV=production cross-env TARGET=opera gulp dist", "opera-dist": "cross-env NODE_ENV=production cross-env TARGET=opera gulp dist",
"firefox-dist": "cross-env NODE_ENV=production cross-env TARGET=firefox gulp dist", "firefox-dist": "cross-env NODE_ENV=production cross-env TARGET=firefox gulp dist",
"dist": "npm run chrome-dist && npm run opera-dist && npm run firefox-dist" "dist": "npm run chrome-dist && npm run opera-dist && npm run firefox-dist",
"sourcezip": "gulp sourcezip"
}, },
"repository": { "repository": {
"type": "git", "type": "git",