Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const browserify = require('browserify');
const gulp = require('gulp');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const rename = require('gulp-rename');
const ts = require('gulp-typescript');
const runSequence = require('run-sequence');
const del = require('del');
const p = require('./package.json');

Expand All @@ -20,7 +20,9 @@ function getBrowserify(tinyify) {
const b = browserify({
entries: config.src + '/index.ts',
standalone: config.pkgname
}).plugin('tsify');
}).plugin('tsify', {
project: 'tsconfig.browser.json'
});

return tinyify === true ? b.plugin('tinyify').bundle() : b.bundle();
}
Expand All @@ -32,28 +34,21 @@ gulp.task('clean', () => del([config.dst]));
gulp.task('browserify', () => {
return getBrowserify()
.pipe(source(config.filename))
.pipe(buffer())
.pipe(gulp.dest(config.dst + '/browser'));
});

// Bundle the project and tinify (flatPack, treeShake) it for the browser
gulp.task('tinyify', () => {
return getBrowserify(true)
.pipe(source(config.filename))
.pipe(buffer())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(config.dst + '/browser'));
});

// Compile the project for Node and Typescript
gulp.task('tsc', () => {
return gulp.src([config.src + '/**/*.ts'])
.pipe(tsProject())
.pipe(gulp.dest(config.dst + '/node'));
});

// Build step: build JS, tiny JS and TS declaration in parallel
gulp.task('build', (cb) => {
return runSequence('clean', ['browserify', 'tinyify', 'tsc'], cb);
});
// Build step: build JS and tiny JS for browser (Node build is done via tsc)
gulp.task('build:browser', gulp.parallel('browserify', 'tinyify'));

// default task
gulp.task('default', ['browserify']);
gulp.task('default', gulp.series('browserify'));
10 changes: 10 additions & 0 deletions jasmine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"spec_dir": "dist/test",
"spec_files": [
"**/*.spec.js"
],
"helpers": [],
"stopSpecOnExpectationFailure": false,
"random": false
}

12 changes: 0 additions & 12 deletions karma.conf.js

This file was deleted.

Loading