0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-27 09:50:52 -05:00

added derequire to build

This commit is contained in:
liabru 2016-11-09 20:44:33 +00:00
parent 5a12f56067
commit ded796c93f
2 changed files with 8 additions and 4 deletions

View file

@ -14,6 +14,7 @@ var webserver = require('gulp-webserver');
var concat = require('gulp-concat'); var concat = require('gulp-concat');
var preprocess = require('gulp-preprocess'); var preprocess = require('gulp-preprocess');
var browserify = require('browserify'); var browserify = require('browserify');
var derequire = require('gulp-derequire');
var transform = require('vinyl-transform'); var transform = require('vinyl-transform');
var through2 = require('through2'); var through2 = require('through2');
var pkg = require('./package.json'); var pkg = require('./package.json');
@ -42,7 +43,7 @@ gulp.task('release', function(callback) {
message: 'cannot build release as there are uncomitted changes' message: 'cannot build release as there are uncomitted changes'
}); });
} else { } else {
sequence('build:dev', 'build:examples', 'test', 'bump', 'reload', 'build:release', 'doc', 'changelog', callback); sequence('build:examples', 'test', 'bump', 'reload', 'build:release', 'doc', 'changelog', callback);
} }
}); });
}); });
@ -166,7 +167,7 @@ gulp.task('serve:stop', function() {
}); });
gulp.task('test', function(callback) { gulp.task('test', function(callback) {
sequence('serve:test', 'lint', 'test:browser', 'test:node', 'serve:stop', callback); sequence('serve:test', 'lint', 'build:dev', 'test:browser', 'test:node', 'serve:stop', callback);
}); });
gulp.task('test:browser', function(callback) { gulp.task('test:browser', function(callback) {
@ -236,7 +237,8 @@ var serve = function(isTest) {
}; };
var build = function(options) { var build = function(options) {
var filename = buildDirectory + '/matter', var isDev = options.version.indexOf('-dev'),
filename = buildDirectory + (isDev ? '/matter-dev' : '/matter'),
dest = filename + '.js', dest = filename + '.js',
destMin = filename + '.min.js'; destMin = filename + '.min.js';
@ -253,9 +255,10 @@ var build = function(options) {
next(null, file); next(null, file);
}); });
})) }))
.pipe(derequire())
.pipe(replace('@@VERSION@@', options.version)); .pipe(replace('@@VERSION@@', options.version));
if (options.version.indexOf('-dev') === -1) { if (isDev === -1) {
compiled.pipe(preprocess({ context: { DEBUG: false } })); compiled.pipe(preprocess({ context: { DEBUG: false } }));
} }

View file

@ -30,6 +30,7 @@
"gulp-clone": "^1.0.0", "gulp-clone": "^1.0.0",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
"gulp-conventional-changelog": "^0.7.0", "gulp-conventional-changelog": "^0.7.0",
"gulp-derequire": "^2.1.0",
"gulp-eslint": "^1.0.0", "gulp-eslint": "^1.0.0",
"gulp-github-release": "^1.1.0", "gulp-github-release": "^1.1.0",
"gulp-header": "^1.7.1", "gulp-header": "^1.7.1",