forked from toolbox-team/reddit-moderator-toolbox-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
39 lines (30 loc) · 1.04 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var gulp = require('gulp');
var zip = require('gulp-zip');
var exec = require('child_process').exec;
var argv = require('yargs').argv;
var src_dir = "extension";
var dest_dir = "build";
// Used when the --post parameter is given to gulp in order to push the xpi to firefox.
var postUrl = "http://localhost:8888/";
gulp.task('zip', function() {
console.log(process.cwd());
return gulp.src([src_dir+'/**',
'!'+src_dir+'/*.plist',
'!'+src_dir+'/*.zip',
'!'+src_dir+'/*.xpi',
'!'+src_dir+'/.jpmignore',
'!'+src_dir+'/data/background/',
'!'+src_dir+'/data/Icon.png'
])
.pipe(zip('chrome-moderator-toolbox.zip'))
.pipe(gulp.dest(dest_dir));
});
gulp.task('xpi', function(cb) {
exec('jpm '+(argv.post === undefined ? "xpi" : "post --post-url "+postUrl), {cwd: src_dir}, function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
gulp.src(src_dir+'/*.xpi')
.pipe(gulp.dest(dest_dir));
});
});
gulp.task('default', ['zip', 'xpi']);