diff --git a/gulpfile.js b/gulpfile.js index a99478d..724be76 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,147 +1,147 @@ var gulp = require('gulp-help')(require('gulp')); var del = require('del'), - ghPages = require('gulp-gh-pages'), - header = require('gulp-header'), - fs = require('fs'), - moment = require('moment'), - rename = require('gulp-rename'), - replace = require('gulp-replace'), - tslint = require('gulp-tslint'), - typedoc = require("gulp-typedoc"), - uglify = require('gulp-uglify'), - karma = require('karma'), - webpack = require('webpack'), - webpackStream = require('webpack-stream'), - webpackConfig = require('./webpack.config'), - webpackTestConfig = require('./webpack.test.config'), - runSequence = require('run-sequence'), - argv = require('yargs').argv - ; + ghPages = require('gulp-gh-pages'), + header = require('gulp-header'), + fs = require('fs'), + moment = require('moment'), + rename = require('gulp-rename'), + replace = require('gulp-replace'), + tslint = require('gulp-tslint'), + typedoc = require("gulp-typedoc"), + uglify = require('gulp-uglify'), + karma = require('karma'), + webpack = require('webpack'), + webpackStream = require('webpack-stream'), + webpackConfig = require('./webpack.config'), + webpackTestConfig = require('./webpack.test.config'), + runSequence = require('run-sequence'), + argv = require('yargs').argv + ; var package = require('./package.json'); var webpackBanner = package.name + " v" + package.version + " | (c) 2016 Microsoft Corporation " + package.license; var gulpBanner = "/*! " + webpackBanner + " */\n"; gulp.task('build', 'Build for release', function (done) { - return runSequence( - 'tslint:build', - 'clean:dist', - 'compile:ts', - 'min', - 'generatecustomdts', - 'header', - done - ) + return runSequence( + 'tslint:build', + 'clean:dist', + 'compile:ts', + 'min', + 'generatecustomdts', + 'header', + done + ) }); gulp.task('test', 'Run unit tests', function (done) { - return runSequence( - 'tslint:test', - 'clean:tmp', - 'compile:spec', - 'test:spec', - done - ) + return runSequence( + 'tslint:test', + 'clean:tmp', + 'compile:spec', + 'test:spec', + done + ) }); gulp.task('ghpages', 'Deploy documentation to gh-pages', ['nojekyll'], function () { - return gulp.src(['./docs/**/*'], { - dot: true - }) - .pipe(ghPages({ - force: true, - message: 'Update ' + moment().format('LLL') - })); + return gulp.src(['./docs/**/*'], { + dot: true + }) + .pipe(ghPages({ + force: true, + message: 'Update ' + moment().format('LLL') + })); }); gulp.task("docs", 'Compile documentation from src code', function () { - return gulp - .src(["src/**/*.ts"]) - .pipe(typedoc({ - mode: 'modules', - includeDeclarations: true, + return gulp + .src(["src/**/*.ts"]) + .pipe(typedoc({ + mode: 'modules', + includeDeclarations: true, - // Output options (see typedoc docs) - out: "./docs", - json: "./docs/json/" + package.name + ".json", + // Output options (see typedoc docs) + out: "./docs", + json: "./docs/json/" + package.name + ".json", - // TypeDoc options (see typedoc docs) - ignoreCompilerErrors: true, - version: true - })) - ; + // TypeDoc options (see typedoc docs) + ignoreCompilerErrors: true, + version: true + })) + ; }); gulp.task('nojekyll', 'Add .nojekyll file to docs directory', function (done) { - fs.writeFile('./docs/.nojekyll', '', function (error) { - if (error) { - throw error; - } + fs.writeFile('./docs/.nojekyll', '', function (error) { + if (error) { + throw error; + } - done(); - }); + done(); + }); }); gulp.task('compile:ts', 'Compile source files', function () { - webpackConfig.plugins = [ - new webpack.BannerPlugin(webpackBanner) - ]; + webpackConfig.plugins = [ + new webpack.BannerPlugin(webpackBanner) + ]; - return gulp.src(['typings/**/*.d.ts', './src/**/*.ts']) - .pipe(webpackStream(webpackConfig)) - .pipe(gulp.dest('./dist')); + return gulp.src(['typings/**/*.d.ts', './src/**/*.ts']) + .pipe(webpackStream(webpackConfig)) + .pipe(gulp.dest('./dist')); }); gulp.task('header', 'Add header to distributed files', function () { - return gulp.src(['./dist/*.d.ts']) - .pipe(header(gulpBanner)) - .pipe(gulp.dest('./dist')); + return gulp.src(['./dist/*.d.ts']) + .pipe(header(gulpBanner)) + .pipe(gulp.dest('./dist')); }); gulp.task('min', 'Minify build files', function () { - return gulp.src(['!./dist/*.min.js', './dist/*.js']) - .pipe(uglify({ - preserveComments: 'license' - })) - .pipe(rename({ - suffix: '.min' - })) - .pipe(gulp.dest('./dist/')); + return gulp.src(['!./dist/*.min.js', './dist/*.js']) + .pipe(uglify({ + preserveComments: 'license' + })) + .pipe(rename({ + suffix: '.min' + })) + .pipe(gulp.dest('./dist/')); }); gulp.task('clean:dist', 'Clean dist folder', function () { - return del([ - './dist/**/*' - ]); + return del([ + './dist/**/*' + ]); }); gulp.task('clean:tmp', 'Clean dist folder', function () { - return del([ - './tmp/**/*' - ]); + return del([ + './tmp/**/*' + ]); }); gulp.task('compile:spec', 'Compile typescript for tests', function () { - return gulp.src(['./test/*.spec.ts']) - .pipe(webpackStream(webpackTestConfig)) - .pipe(gulp.dest('./tmp')); + return gulp.src(['./test/*.spec.ts']) + .pipe(webpackStream(webpackTestConfig)) + .pipe(gulp.dest('./tmp')); }); gulp.task('generatecustomdts', 'Generate dts with no exports', function (done) { - return gulp.src(['./dist/*.d.ts']) - .pipe(replace(/export\s/g, '')) - .pipe(rename(function (path) { - path.basename = "router-noexports.d"; - })) - .pipe(gulp.dest('dist/')); + return gulp.src(['./dist/*.d.ts']) + .pipe(replace(/export\s/g, '')) + .pipe(rename(function (path) { + path.basename = "router-noexports.d"; + })) + .pipe(gulp.dest('dist/')); }); -gulp.task('test:spec', 'Runs spec tests', function(done) { - new karma.Server.start({ - configFile: __dirname + '/karma.conf.js', - singleRun: argv.watch ? false : true, - captureTimeout: argv.timeout || 20000 - }, done); +gulp.task('test:spec', 'Runs spec tests', function (done) { + new karma.Server.start({ + configFile: __dirname + '/karma.conf.js', + singleRun: argv.watch ? false : true, + captureTimeout: argv.timeout || 20000 + }, done); }); gulp.task('tslint:build', 'Run TSLint on src', function () { diff --git a/karma.conf.js b/karma.conf.js index 03d614f..78ae442 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,34 +1,34 @@ var argv = require('yargs').argv; module.exports = function (config) { - config.set({ - frameworks: ['jasmine'], - files: [ - './node_modules/es6-promise/dist/es6-promise.js', - './node_modules/route-recognizer/dist/route-recognizer.js', - './tmp/**/*.js' - ], - exclude: [], - reporters: argv.debug ? ['spec'] : ['spec', 'coverage'], - autoWatch: true, - browsers: [argv.chrome ? 'Chrome' : 'PhantomJS'], - plugins: [ - 'karma-chrome-launcher', - 'karma-jasmine', - 'karma-spec-reporter', - 'karma-sourcemap-loader', - 'karma-phantomjs-launcher', - 'karma-coverage' - ], - preprocessors: { - './tmp/**/*.js': ['coverage', 'sourcemap'] - }, - coverageReporter: { - reporters: [ - { type: 'html' }, - { type: 'text-summary' } - ] - }, - logLevel: argv.debug ? config.LOG_DEBUG : config.LOG_INFO - }); + config.set({ + frameworks: ['jasmine'], + files: [ + './node_modules/es6-promise/dist/es6-promise.js', + './node_modules/route-recognizer/dist/route-recognizer.js', + './tmp/**/*.js' + ], + exclude: [], + reporters: argv.debug ? ['spec'] : ['spec', 'coverage'], + autoWatch: true, + browsers: [argv.chrome ? 'Chrome' : 'PhantomJS'], + plugins: [ + 'karma-chrome-launcher', + 'karma-jasmine', + 'karma-spec-reporter', + 'karma-sourcemap-loader', + 'karma-phantomjs-launcher', + 'karma-coverage' + ], + preprocessors: { + './tmp/**/*.js': ['coverage', 'sourcemap'] + }, + coverageReporter: { + reporters: [ + { type: 'html' }, + { type: 'text-summary' } + ] + }, + logLevel: argv.debug ? config.LOG_DEBUG : config.LOG_INFO + }); }; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index b105e70..6019b40 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,16 @@ { - "compilerOptions": { - "target": "es5", - "declaration": true, - "noImplicitAny": true, - "sourceMap": true, - "outDir": "dist" - }, - "exclude": [ - "node_modules", - "typings/index.d.ts", - "dist", - "test", - "tmp" - ] + "compilerOptions": { + "target": "es5", + "declaration": true, + "noImplicitAny": true, + "sourceMap": true, + "outDir": "dist" + }, + "exclude": [ + "node_modules", + "typings/index.d.ts", + "dist", + "test", + "tmp" + ] } \ No newline at end of file diff --git a/webpack.test.tsconfig.json b/webpack.test.tsconfig.json index ffeb3b5..de19cce 100644 --- a/webpack.test.tsconfig.json +++ b/webpack.test.tsconfig.json @@ -1,15 +1,15 @@ { - "compilerOptions": { - "target": "es5", - "declaration": false, - "noImplicitAny": true, - "sourceMap": true - }, - "exclude": [ - "node_modules", - "typings/index.d.ts", - "dist", - "test", - "tmp" - ] + "compilerOptions": { + "target": "es5", + "declaration": false, + "noImplicitAny": true, + "sourceMap": true + }, + "exclude": [ + "node_modules", + "typings/index.d.ts", + "dist", + "test", + "tmp" + ] } \ No newline at end of file