This repository has been archived by the owner on May 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGulpfile.js
99 lines (89 loc) · 3.2 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
var gulp = require('gulp');
var NwBuilder = require('nw-builder');
var del = require('del');
var zip = require('gulp-zip');
var release = require('gulp-github-release');
var size = require('gulp-filesize');
var merge = require('merge-stream');
var rename = require('gulp-rename');
var vinylPaths = require('vinyl-paths');
var BUILD_PLATFORMS = ['osx64', 'win64'];
var SRC_GLOB = [
'**/*',
'!chrome.sh',
'!basicauth.json',
'!githubtoken.json',
'!{cache,cache/**}',
'!{screenshots,screenshots/**}'
];
var nw = new NwBuilder({
// use the glob format
files: SRC_GLOB,
platforms: BUILD_PLATFORMS,
version: 'latest',
buildDir: './build/nw/',
zip: false
});
//Log stuff you want
nw.on('log', console.log);
gulp.task('clean', function () {
return del([
'build/**/*',
// we don't want to clean this file though so we negate the pattern
//'!build/config/deploy.json'
]);
});
// test: gulp nw && ls build/nw/scrumpoker/osx64/scrumpoker.app/Contents/Resources/app.nw/
gulp.task('nw', ['clean'], function(done) {
// Build returns a promise
nw.build().then(function () {
done();
}).catch(function (error) {
console.error(error);
done();
});
})
/**
* Rename scrumpoker.exe to nw.exe
* on windows7, file crashed when not name nw.exe
*/
gulp.task('nw:rename:win', ['nw'], function() {
return gulp.src("./build/nw/**/scrumpoker.exe")
//we use vinylPaths to get the paths for our files
// and handover to del to delete them
.pipe(vinylPaths(del))
//after delete pipeline we create the rename pipe
.pipe(rename(function (path) {
path.basename = "nw";
return path;
}))
.pipe(gulp.dest("./build/nw/"));
})
gulp.task('release:zip', ["nw:rename:win"], (done) => {
var tasks = BUILD_PLATFORMS.map(function(element){
return gulp.src('./build/nw/scrumpoker/'+element+'/**')
.pipe(zip( element+'.zip'))
.pipe(gulp.dest('./build/zip/'));
});
return merge(tasks);
});
gulp.task('release:size', ['release:zip'], function() {
return gulp.src('./build/zip/*')
.pipe(size())
});
gulp.task('release', ['release:zip'], function() {
return gulp.src('./build/zip/*')
.pipe(size())
.pipe(release({
// or you can set an env var called GITHUB_TOKEN instead
token: require('./githubtoken.json').githubtoken,
owner: 'SBejga', // if missing, it will be extracted from manifest (the repository.url field)
repo: 'scrumpoker-rt.js', // if missing, it will be extracted from manifest (the repository.url field)
// tag: 'v1.0.0', // if missing, the version will be extracted from manifest and prepended by a 'v'
// name: 'publish-release v1.0.0', // if missing, it will be the same as the tag
draft: true, // if missing it's false
prerelease: true, // if missing it's false
manifest: require('./package.json') // package.json from which default values will be extracted if they're missing
}));
});
gulp.task('default', ['release']);