forked from leanote/desktop-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (63 loc) · 2.45 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
var gulp = require('gulp');
var rename = require("gulp-rename");
var runSequence = require('run-sequence');
var clean = require('gulp-clean');
var zip = require('gulp-zip');
//-----------
// mac
//-----------
// 清理
gulp.task('clMac', function () {
return gulp.src('dist/mac').pipe(clean({force: true}));
});
gulp.task('cpMacNw', function () {
gulp.src('nw/mac/nw.app/**/*').pipe(gulp.dest('dist/mac/leanote.app'));
});
// 复制源文件
gulp.task('cpMacSrc', function () {
// mac
gulp.src('src/public/**/*').pipe(gulp.dest('dist/mac/leanote.app/Contents/Resources/app.nw/public'));
gulp.src('src/node_modules/**/*').pipe(gulp.dest('dist/mac/leanote.app/Contents/Resources/app.nw/node_modules'));
gulp.src('LICENSE').pipe(gulp.dest('dist/mac/leanote.app/Contents/Resources/app.nw/'));
gulp.src('src/data/version').pipe(gulp.dest('dist/mac/leanote.app/Contents/Resources/app.nw/data/'));
gulp.src('src/package_mac.json').pipe(rename("package.json")).pipe(gulp.dest('dist/mac/leanote.app/Contents/Resources/app.nw/'));
gulp.src(['src/note.html', 'src/login.html']).pipe(gulp.dest('dist/mac/leanote.app/Contents/Resources/app.nw/'));
});
gulp.task('zipMac', function () {
return gulp.src('dist/mac/*')
.pipe(zip('leanote-mac.zip'))
.pipe(gulp.dest('dist'));
});
//------------
// windows
//------------
gulp.task('clWindows', function () {
return gulp.src('dist/windows').pipe(clean({force: true}));
});
gulp.task('cpWindowsNw', function () {
gulp.src('nw/windows/**/*').pipe(gulp.dest('dist/windows/'));
});
gulp.task('cpWindowsSrc', function () {
// windows
gulp.src('src/public/**/*').pipe(gulp.dest('dist/windows/public'));
gulp.src('src/node_modules/**/*').pipe(gulp.dest('dist/windows/node_modules'));
gulp.src('LICENSE').pipe(gulp.dest('dist/windows/'));
gulp.src('src/data/version').pipe(gulp.dest('dist/windows/data/'));
gulp.src('src/package_windows.json').pipe(rename("package.json")).pipe(gulp.dest('dist/windows/'));
gulp.src(['src/note.html', 'src/login.html']).pipe(gulp.dest('dist/windows/'));
});
gulp.task('zipWindows', function () {
return gulp.src('dist/windows/*')
.pipe(zip('leanote-windows.zip'))
.pipe(gulp.dest('dist'));
});
// mac & windows
gulp.task('mac', function(cb) {
runSequence('clMac', 'cpMacNw', 'cpMacSrc', cb);
});
gulp.task('windows', function(cb) {
runSequence('clWindows', 'cpWindowsNw', 'cpWindowsSrc', cb);
});
gulp.task('default', function(cb) {
runSequence('mac', 'windows', cb);
});