Skip to content

Commit

Permalink
chore(build): added systemjs bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
valorkin committed Jan 25, 2016
1 parent 63f4618 commit 132e645
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ npm-debug.log
# ignore build and dist for now
/build
/dist
/bundles

# ignore incline compiling
/demo/**/*.js
Expand Down
7 changes: 4 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ 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']
};

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());
});

Expand Down
47 changes: 47 additions & 0 deletions make.js
Original file line number Diff line number Diff line change
@@ -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);
});
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
}
Expand Down

0 comments on commit 132e645

Please sign in to comment.