mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
chore(gulpfile): debug and typecheck flags
This commit is contained in:
19
gulpfile.js
19
gulpfile.js
@ -16,12 +16,14 @@ var docsConfig = require('./scripts/config.json');
|
|||||||
|
|
||||||
var flagConfig = {
|
var flagConfig = {
|
||||||
string: ['port', 'animations'],
|
string: ['port', 'animations'],
|
||||||
|
boolean: ['debug', 'typecheck'],
|
||||||
alias: {'p': 'port'},
|
alias: {'p': 'port'},
|
||||||
default: { 'port': 8000 }
|
default: { 'port': 8000, 'debug': true, 'typecheck': false }
|
||||||
};
|
};
|
||||||
var flags = minimist(process.argv.slice(2), flagConfig);
|
var flags = minimist(process.argv.slice(2), flagConfig);
|
||||||
|
|
||||||
var IS_RELEASE = false;
|
var DEBUG = flags.debug;
|
||||||
|
var TYPECHECK = flags.typecheck;
|
||||||
|
|
||||||
function getTscOptions(name) {
|
function getTscOptions(name) {
|
||||||
var opts = {
|
var opts = {
|
||||||
@ -192,7 +194,7 @@ gulp.task('bundle.system', function(){
|
|||||||
|
|
||||||
return merge([tsResult, swiper])
|
return merge([tsResult, swiper])
|
||||||
.pipe(remember('system'))
|
.pipe(remember('system'))
|
||||||
.pipe(gulpif(IS_RELEASE, stripDebug()))
|
.pipe(gulpif(!DEBUG, stripDebug()))
|
||||||
.pipe(concat('ionic.system.js'))
|
.pipe(concat('ionic.system.js'))
|
||||||
.pipe(gulp.dest('dist/bundles'))
|
.pipe(gulp.dest('dist/bundles'))
|
||||||
.pipe(connect.reload())
|
.pipe(connect.reload())
|
||||||
@ -202,18 +204,20 @@ gulp.task('transpile', function(){
|
|||||||
var gulpif = require('gulp-if');
|
var gulpif = require('gulp-if');
|
||||||
var stripDebug = require('gulp-strip-debug');
|
var stripDebug = require('gulp-strip-debug');
|
||||||
|
|
||||||
var tscOpts = getTscOptions(IS_RELEASE ? 'typecheck' : undefined);
|
var tscOpts = getTscOptions(TYPECHECK ? 'typecheck' : undefined);
|
||||||
var tsResult = tsCompile(tscOpts, 'transpile')
|
var tsResult = tsCompile(tscOpts, 'transpile')
|
||||||
|
|
||||||
if (IS_RELEASE) {
|
if (TYPECHECK) {
|
||||||
var merge = require('merge2');
|
var merge = require('merge2');
|
||||||
var js = tsResult.js.pipe(stripDebug());
|
var js = tsResult.js;
|
||||||
var dts = tsResult.dts;
|
var dts = tsResult.dts;
|
||||||
|
if (!DEBUG) js = js.pipe(stripDebug());
|
||||||
// merge definition and source streams
|
// merge definition and source streams
|
||||||
return merge([js, dts])
|
return merge([js, dts])
|
||||||
.pipe(gulp.dest('dist'));
|
.pipe(gulp.dest('dist'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!DEBUG) tsResult = tsResult.pipe(stripDebug());
|
||||||
return tsResult.pipe(gulp.dest('dist'));
|
return tsResult.pipe(gulp.dest('dist'));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -677,7 +681,8 @@ gulp.task('publish.npm', function(done) {
|
|||||||
* Build Ionic sources, with typechecking and debug statements removed
|
* Build Ionic sources, with typechecking and debug statements removed
|
||||||
*/
|
*/
|
||||||
gulp.task('build.release', function(done){
|
gulp.task('build.release', function(done){
|
||||||
IS_RELEASE = true;
|
DEBUG = false;
|
||||||
|
TYPECHECK = true;
|
||||||
runSequence(
|
runSequence(
|
||||||
'clean',
|
'clean',
|
||||||
'copy.libs',
|
'copy.libs',
|
||||||
|
Reference in New Issue
Block a user