-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
47 lines (40 loc) · 1.34 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
var gulp = require("gulp"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
buffer = require("vinyl-buffer"),
//tslint = require("gulp-tslint"),
tsc = require("gulp-typescript"),
sourcemaps = require("gulp-sourcemaps"),
uglify = require("gulp-uglify");
// runSequence = require("run-sequence"),
// mocha = require("gulp-mocha"),
// istanbul = require("gulp-istanbul"),
// browserSync = require('browser-sync').create();
var tsProject = tsc.createProject("tsconfig.json");
// Build Typescript
gulp.task("build", function() {
return gulp.src([
"src/**/**.ts"
])
.pipe(tsc(tsProject))
.js.pipe(gulp.dest("dist/"));
});
// Build webbrowser bundle
gulp.task("bundle", function() {
var libraryName = "gs1.js";
var mainTsFilePath = "src/index.js";
var outputFolder = "dist/";
var outputFileName = libraryName + ".js";
var bundler = browserify({
debug: true,
standalone : libraryName
});
return bundler.add(mainTsFilePath)
.bundle()
.pipe(source(outputFileName))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
//.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(outputFolder));
});