diff --git a/.gitignore b/.gitignore index aec866cfeb..69ae1278d9 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ npm-debug.log # ignore build and dist for now /build /dist +/bundles # ignore incline compiling /demo/**/*.js diff --git a/gulpfile.js b/gulpfile.js index 1832603717..be227d2198 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,14 +4,15 @@ gulp.paths = { tssrc: [ '**/*.ts', '!node_modules/**/*', - '!dist/**/*', + '!bundles/**/*', '!typings/**/*', '!**/*.{ts,coffee}.js'], jssrc: [ '*.js', 'gulp-tasks/*.js', + '!bundles/*.js', '!ng2-bootstrap.js', - '!node_modules', + '!node_modules/**/*', '!**/*.{ts,coffee}.js'] }; @@ -19,7 +20,7 @@ require('require-dir')('./gulp-tasks'); var clean = require('gulp-clean'); gulp.task('clean', function () { - return gulp.src('dist', {read: false}) + return gulp.src('bundles', {read: false}) .pipe(clean()); }); diff --git a/make.js b/make.js new file mode 100755 index 0000000000..a5a690b2ca --- /dev/null +++ b/make.js @@ -0,0 +1,47 @@ +#!/usr/bin/env node +/*eslint no-console: 0*/ +var pkg = require('./package.json'); +var path = require('path'); +var Builder = require('systemjs-builder'); +var name = pkg.name; + +var builder = new Builder(); +var config = { + baseURL: '..', + transpiler: 'typescript', + typescriptOptions: { + module: 'cjs' + }, + map: { + typescript: path.resolve('node_modules/typescript/lib/typescript.js'), + angular2: path.resolve('node_modules/angular2'), + rxjs: path.resolve('node_modules/rxjs') + }, + paths: { + '*': '*.js' + }, + meta: {} +}; + +config.meta[path.join(name, 'node_modules/angular2/*')] = {build: false}; +config.meta[path.join(name, 'node_modules/rxjs/*')] = {build: false}; + +builder.config(config); + +builder + .bundle([name, name].join('/'), path.resolve(__dirname, 'bundles/', name + '.js')) + .then(function () { + var prodBuilder = new Builder(); + prodBuilder.config(config); + + prodBuilder + .bundle([name, name].join('/'), path.resolve(__dirname, 'bundles/', name + '.min.js'), { + minify: true, sourceMaps: true + }) + .then(function () { + console.log('Build complete.'); + }); + }) + .catch(function (err) { + console.log('Error', err); + }); diff --git a/package.json b/package.json index 7ea8b5a4f8..8c9b2ade08 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "version": "1.0.1-beta.1", "description": "angular2 bootstrap components", "scripts": { - "prepublish": "gulp clean && tsc", - "deploy": "NODE_ENV=production webpack -p --progress --color --optimize-minimize --optimize-dedupe --optimize-occurence-order", - "dev": "webpack-dev-server --hot --inline --colors --display-error-details --display-cached", + "prepublish": "gulp clean && ./node_modules/.bin/tsc && ./make.js", + "build:prod": "NODE_ENV=production webpack -p --progress --color --optimize-minimize --optimize-dedupe --optimize-occurence-order", + "build:dev": "webpack-dev-server --hot --inline --colors --display-error-details --display-cached", "start": "npm run dev", "test": "gulp lint" }, @@ -33,7 +33,7 @@ "balanced-match": "0.3.0", "bootstrap": "3.3.6", "clean-webpack-plugin": "0.1.6", - "compression-webpack-plugin": "0.2.0", + "compression-webpack-plugin": "0.3.0", "es6-shim": "0.33.3", "eslint": "1.10.3", "exports-loader": "0.6.2", @@ -42,7 +42,6 @@ "gulp-clean": "0.3.1", "gulp-eslint": "1.1.1", "gulp-size": "2.0.0", - "gulp-tsc": "1.1.4", "gulp-tslint": "4.3.1", "html-loader": "0.4.0", "markdown-loader": "0.1.7", @@ -55,10 +54,11 @@ "reflect-metadata": "0.1.2", "require-dir": "0.3.0", "rxjs": "5.0.0-beta.0", + "systemjs-builder": "0.15.4", "ts-loader": "0.8.0", - "tslint": "3.2.2", + "tslint": "3.3.0", "typescript": "1.7.5", - "webpack": "1.12.11", + "webpack": "1.12.12", "webpack-dev-server": "1.14.1", "zone.js": "0.5.10" }