forked from BreeeZe/rpos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
73 lines (67 loc) · 2.63 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
var gulp = require('gulp'),
rename = require('gulp-rename'),
zip = require('gulp-zip'),
pkg = require('./package.json'),
ts = require('gulp-typescript'),
typings = require('typings'),
runSequence = require('run-sequence'),
sourcemaps = require('gulp-sourcemaps')
var version = 'rpos-' + pkg.version;
var releaseDir = 'release/' + version;
//Default task: runs the typings and compile task, started when running "gulp" without any parameters.
gulp.task('default', function (cb) {
runSequence('typings', 'compile', cb);
});
//Compile task: compiles all .ts files to .js and generates sourcemaps to aid in debugging.
gulp.task('compile', function () {
return gulp.src(["**/*.ts", "!./node_modules/**/*", "!./typings/**/*"])
.pipe(sourcemaps.init())
.pipe(ts('tsconfig.json'))
.js
.pipe(sourcemaps.write("./"))
.pipe(gulp.dest("./"));
});
//Typings task: Downloads all type definitions used for development.
gulp.task('typings', function (done) {
var cwd = process.cwd();
typings.install({ cwd: cwd, production: false }).then(function (result) {
done();
})
});
//Release task: generates a release package.
gulp.task('release', ['copy-release-js', 'copy-release-bin', 'copy-release-modules', 'copy-release-views',
'copy-release-web', 'copy-release-wsdl', 'copy-release-config'], function () {
return gulp.src([releaseDir + '/**/*', releaseDir + '/*.zip'])
.pipe(zip(version + '.zip'))
.pipe(gulp.dest('release'));
});
// --- all partial taks to generate a release.
gulp.task('copy-release-js', function () {
return gulp.src(['**/*.js', '!release/**', '!gulpfile.js', 'README.md', 'package.json', '!node_modules/gulp*/**'])
.pipe(gulp.dest(releaseDir));
});
gulp.task('copy-release-config', function () {
return gulp.src('rposConfig.release.json')
.pipe(rename("rposConfig.json"))
.pipe(gulp.dest(releaseDir));
});
gulp.task('copy-release-bin', function () {
return gulp.src('bin/*')
.pipe(gulp.dest(releaseDir + '/bin'));
});
gulp.task('copy-release-modules', function () {
return gulp.src(['node_modules/**/*', '!node_modules/gulp*/**', '!node_modules/gulp**'])
.pipe(gulp.dest(releaseDir + '/node_modules'));
});
gulp.task('copy-release-views', function () {
return gulp.src('views/**/*')
.pipe(gulp.dest(releaseDir + '/views'));
});
gulp.task('copy-release-web', function () {
return gulp.src('web/**/*')
.pipe(gulp.dest(releaseDir + '/web'));
});
gulp.task('copy-release-wsdl', function () {
return gulp.src('wsdl/**/*')
.pipe(gulp.dest(releaseDir + '/wsdl'));
});