diff --git a/.gitignore b/.gitignore index 99b5582a3a..4a87ee74a9 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ bower_components/ tmp temp dist +angular2 .idea /src/components/split-view/test/settings/main.js diff --git a/config.js b/config.js index b2669e0f2c..24ed2a4a78 100644 --- a/config.js +++ b/config.js @@ -10,16 +10,17 @@ System.config({ "ionic/*": "dist/ionic/*.js", "github:*": "jspm_packages/github/*.js", "npm:*": "jspm_packages/npm/*.js", + "angular2/*": "angular2/dist/js/dev/es6/angular2/*.es6", "*": "*.js" } }); System.config({ "map": { - "angular2": "npm:angular2@2.0.0-alpha.25", "babel": "npm:babel-core@5.4.7", "babel-runtime": "npm:babel-runtime@5.4.7", "core-js": "npm:core-js@0.9.13", + "rx": "npm:rx@2.5.3", "github:jspm/nodelibs-assert@0.1.0": { "assert": "npm:assert@1.3.0" }, @@ -154,6 +155,9 @@ System.config({ "npm:rx@2.5.1": { "process": "github:jspm/nodelibs-process@0.1.1" }, + "npm:rx@2.5.3": { + "process": "github:jspm/nodelibs-process@0.1.1" + }, "npm:semver@2.3.2": { "process": "github:jspm/nodelibs-process@0.1.1" }, diff --git a/gulpfile.js b/gulpfile.js index 7f8b9add95..79e3c07d81 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -23,11 +23,12 @@ var webpack = require('gulp-webpack'); var lazypipe = require('lazypipe'); - gulp.task('build', function() { runSequence( 'clean', - 'ionic.copy.js', + 'ionic.traceur', + 'ionic.bundle.deps', + 'ionic.bundle.js', 'ionic.examples', 'sass', 'fonts', @@ -38,6 +39,7 @@ gulp.task('watch', function() { runSequence( 'clean', + 'link.angular', 'ionic.copy.js', 'ionic.examples', 'sass', @@ -80,37 +82,53 @@ function doubleCheckDistFiles() { } gulp.task('clean', function(done) { - del(['../angular-ionic/modules/ionic, ./angular-ionic/modules/examples/src/ionic, dist/'], done); + del(['dist/'], done); }); -//gulp.task('ionic.copy.js', function(done) { -// return gulp.src(['ionic/**/*.js', '!ionic/components/*/test/**/*']) -// .pipe(gulp.dest('../angular-ionic/modules/ionic')); -//}); -// - var traceurOptions = { - annotations: true, - types: true, - outputLanguage: 'es6' - } +var traceurOptions = { + annotations: true, + types: true, + outputLanguage: 'es6' +} - var babelOptions = { - optional: ['es7.decorators'], - /*plugins: [ - './transformers/disable-define', - 'angular2-annotations', - 'type-assertion:after' - ],*/ - modules: "system" - }; +var babelOptions = { + optional: ['es7.decorators'], + /*plugins: [ + './transformers/disable-define', + 'angular2-annotations', + 'type-assertion:after' + ],*/ + modules: "system" +}; -gulp.task('ionic.traceur.es6', function(done) { +gulp.task('ionic.traceur', function(done) { return gulp.src(['ionic/**/*.js', '!ionic/components/*/test/**/*']) .pipe(traceur(traceurOptions)) - //.pipe(concat('ionic.bundle.js')) .pipe(gulp.dest('dist/ionic')); }); +gulp.task('ionic.bundle.js', function() { + var Builder = require('systemjs-builder'); + var builder = new Builder(); + return builder.loadConfig('config.js').then(function(){ + builder.config({ baseURL: 'file:' + process.cwd() }); + return builder.build('dist/ionic/ionic - dist/js/dependencies', 'dist/js/ionic.bundle.js'); + }, function(error){ + throw new Error(error); + }) +}); + +gulp.task('ionic.bundle.deps', function() { + var Builder = require('systemjs-builder'); + var builder = new Builder(); + return builder.loadConfig('config.js').then(function(){ + builder.config({ baseURL: 'file:' + process.cwd() }); + return builder.build('dist/ionic/ionic - [dist/ionic/ionic]', 'dist/js/dependencies.js'); + }, function(error){ + throw new Error(error); + }) +}); + gulp.task('ionic.examples', function() { var buildTest = lazypipe() .pipe(traceur, traceurOptions) @@ -119,13 +137,13 @@ gulp.task('ionic.examples', function() { // Get each test folder with gulp.src return gulp.src('ionic/components/*/test/*/**/*') .pipe(gulpif(/.js$/, buildTest())) - .pipe(gulpif(/index.js$/, createTest())) + .pipe(gulpif(/index.js$/, createIndexHTML())) .pipe(rename(function(file) { file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep) })) .pipe(gulp.dest('dist/examples/')) - function createTest() { + function createIndexHTML() { var indexContents = _.template( fs.readFileSync('scripts/e2e/ionic.template.html') )({ @@ -133,36 +151,17 @@ gulp.task('ionic.examples', function() { }); return through2.obj(function(file, enc, next) { - // debugger; - //var Builder = require('systemjs-builder'); - //var builder = new Builder(); - //builder.loadConfig('config.js').then(function(){ - //builder.config(systemjsConfig); - // builder.build('index'/*, path.join(path.dirname(file.path), 'index.js')*/).then(function(){ - var self = this; - self.push(new VinylFile({ - base: file.base, - contents: new Buffer(indexContents), - path: path.join(path.dirname(file.path), 'index.html'), - })); - next(null, file); - //}); - //}) + var self = this; + self.push(new VinylFile({ + base: file.base, + contents: new Buffer(indexContents), + path: path.join(path.dirname(file.path), 'index.html'), + })); + next(null, file); }); } }); - -gulp.task('build.system.js', function() { - var Builder = require('systemjs-builder'); - var builder = new Builder(); - builder.loadConfig('config.js').then(function(){ - //builder.config(systemjsConfig); - return builder.build('index', 'index.js'); - }) -}); - - gulp.task('sass', function() { return gulp.src('ionic/ionic.scss') .pipe(sass({ @@ -171,29 +170,34 @@ gulp.task('sass', function() { } })) .pipe(autoprefixer(buildConfig.autoprefixer)) - .pipe(gulp.dest('../angular-ionic/dist/js/dev/es5/css')); + .pipe(gulp.dest('dist/css/')); }); - gulp.task('fonts', function() { return gulp.src('ionic/components/icon/fonts/**/*') - .pipe(gulp.dest('../angular-ionic/dist/js/dev/es5/fonts')); + .pipe(gulp.dest('dist/fonts')); }); gulp.task('polyfills', function() { return gulp.src('ionic/animations/web-animations*') - .pipe(gulp.dest('../angular-ionic/dist/js/dev/es5/polyfills')); + .pipe(gulp.dest('dist/polyfills')); }); +gulp.task('link.angular', function() { + if (!fs.existsSync('../angular-ionic')) { + throw new Error("../angular-ionic doesn't exist. Run gulp update.angular first"); + } + linkAngular(); +}); + gulp.task('update.angular', function(done) { if (!fs.existsSync('../angular-ionic')) { - fs.mkdirSync('../angular-ionic'); - console.log('cloning angular master...'); exec('git clone git@github.com:angular/angular ../angular-ionic', function() { + linkAngular(); npmInstall(); }); @@ -222,6 +226,13 @@ gulp.task('update.angular', function(done) { }); +function linkAngular() { + if (!fs.existsSync('angular2')) { + console.log("Symlinking ../angular-ionic to angular2"); + fs.symlinkSync('../angular-ionic', 'angular2'); + } +} + require('./scripts/snapshot/snapshot.task')(gulp, argv, buildConfig); diff --git a/package.json b/package.json index 5f595ddb2c..1edd6fd109 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,8 @@ "jspm": { "directories": {}, "dependencies": { - "angular2": "npm:angular2@^2.0.0-alpha.25" + "angular2": "npm:angular2@^2.0.0-alpha.25", + "rx": "npm:rx@^2.5.3" }, "devDependencies": { "babel": "npm:babel-core@^5.1.13", diff --git a/scripts/e2e/ionic.template.html b/scripts/e2e/ionic.template.html index 610f9ef197..e4158299bf 100644 --- a/scripts/e2e/ionic.template.html +++ b/scripts/e2e/ionic.template.html @@ -3,7 +3,7 @@
- +