👷 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
gulp.task('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) => {
$.runSequence('clean', 'styles', 'ext', cb)
@ -64,8 +71,8 @@ gulp.task('ext', ['manifest', 'js'], () => {
// COMMON
// -----------------
gulp.task('js', () => {
return buildJS(target)
})
return buildJS(target);
});
gulp.task('styles', () => {
return gulp.src('src/styles/**/*.scss')
@ -99,18 +106,18 @@ gulp.task("manifest", () => {
// DIST
// -----------------
gulp.task('dist', (cb) => {
$.runSequence('build', 'zip', cb)
$.runSequence('build', 'zip', cb);
});
gulp.task('zip', () => {
return pipe(`./build/${target}/**/*`, $.zip(`${target}.zip`), './dist')
})
return pipe(`./build/${target}/**/*`, $.zip(`${target}.zip`), './dist');
});
// Helpers
function pipe(src, ...transforms) {
return transforms.reduce((stream, transform) => {
const isDest = typeof transform === 'string'
const isDest = typeof transform === 'string';
return stream.pipe(isDest ? gulp.dest(transform) : transform)
}, gulp.src(src))
}
@ -132,7 +139,7 @@ function buildJS(target) {
'options.js',
'popup.js',
'livereload.js'
]
];
let tasks = files.map( file => {
return browserify({

View File

@ -13,7 +13,8 @@
"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",
"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": {
"type": "git",