This repository has been archived by the owner on Sep 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
gulpfile.js
75 lines (66 loc) · 1.86 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 gulpwebpack= require('gulp-webpack');
var webpack = require('webpack');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var del = require('del');
var bump = require('gulp-bump');
var pkg = require('./package.json');
var DEST = './build';
//clear out the build directory
gulp.task('clean', function(cb) {
del(['build'], cb);
});
gulp.task('build', function(callback) {
webpack({
cache: true,
entry: './src/index.js',
output: {
library: 'rippleVaultClient',
path: './build/',
filename: [ 'ripple-vault-client-', '.js' ].join(pkg.version)
},
externals: {'ripple-lib': 'ripple'}
}, callback);
});
// Bower Build Steps
gulp.task('bower-build', function(callback) {
gulp.src('src/index.js')
.pipe(gulpwebpack({
cache: true,
output: {
library: 'rippleVaultClient'
},
externals: {'ripple-lib': 'ripple'}
}))
.pipe(rename('ripple-vault-client.js'))
.pipe(gulp.dest('./dist'))
.pipe(uglify())
.pipe(rename('ripple-vault-client-min.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('bower-build-debug', function(callback) {
gulp.src('src/index.js')
.pipe(gulpwebpack({
cache: true,
debug: true,
output: {
library: 'rippleVaultClient'
},
externals: {'ripple-lib': 'ripple'}
}))
.pipe(rename('ripple-vault-client-debug.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('bower-version', function() {
gulp.src('./dist/bower.json')
.pipe(bump({ version: pkg.version }))
.pipe(gulp.dest('./dist/'));
});
gulp.task('bower', ['bower-build', 'bower-build-debug', 'bower-version']);
// Watch files For Changes
gulp.task('delta', function() {
gulp.watch('src/*.js', ['build']);
});
gulp.task('default', ['build']);
gulp.task('watch', ['delta', 'build']);