forked from stkevintan/Cube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (55 loc) · 1.79 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
/**
* Created by kevin on 15-6-23.
*/
var gulp = require('gulp');
var jade = require('gulp-jade');
var stylus = require('gulp-stylus');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var del = require('del');
var zip = require('gulp-zip');
var NwBuilder = require('nw-builder');
var info = require('./package');
gulp.task('html', function () {
return gulp.src('./src/index.jade').pipe(jade({
locals: {}
})).pipe(gulp.dest('./dist/'));
});
gulp.task('css', function () {
return gulp.src('./src/my.styl').pipe(stylus({
compress: true
})).pipe(gulp.dest('./dist/assets/css/'));
});
gulp.task('js', function () {
return gulp.src(['./src/controller/*.js', './src/my.js'])
.pipe(concat('my.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist/assets/js/'))
});
gulp.task('clean', function (cb) {
del(['./dist/libs/*'], cb);
});
gulp.task('node', ['clean'], function () {
//glob : https://github.com/isaacs/node-glob#glob-primer
return gulp.src('./src/model/!(*Test*)')
.pipe(uglify())
.pipe(gulp.dest('./dist/libs/'))
});
gulp.task('default', ['html', 'css', 'js', 'node']);
gulp.task('build', ['default'], function (cb) {
//get no-dev node_modules
var depends = Object.keys(info.dependencies).join(',');
var nw = new NwBuilder({
files: './{package.json,dist/**,node_modules/{' + depends + '}/**}', // use the glob format
platforms: ['linux64'],
//buildType: 'versioned',
version: '0.12.1'
});
nw.on('log', console.log);
nw.build(cb);
});
gulp.task('release', ['build'], function () {
return gulp.src(['./src/shell/*', './build/nwMusicBox/linux64/**'])
.pipe(zip(info.version + 'linux64.zip'))
.pipe(gulp.dest('./release/' + info.version));
});