-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGulpfile.js
44 lines (38 loc) · 1.23 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
var gulp = require("gulp");
var uglify = require('gulp-uglify');
var sourcemaps = require("gulp-sourcemaps");
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var release = require('gulp-github-release');
gulp.task("buildBrowser", function () {
var b = browserify({
entries: 'lib/index_browser.js',
debug: true
});
b.bundle()
.pipe(source('metaco.api.client.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/'));
b.bundle()
.pipe(source('metaco.api.client.min.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/'));
});
gulp.task("github-releases", function () {
gulp.src('./dist/*')
.pipe(release({
repo: "metaco-javascript-client",
owner: "MetacoSA",
manifest: require('./package.json')
}));
});
gulp.task("publish", ["buildBrowser", "github-releases"]);