make e2e build faster

This commit is contained in:
Andrew
2015-04-25 14:45:21 -05:00
parent 8f4b406831
commit 61eb9b06c7
24 changed files with 114 additions and 111 deletions

View File

@ -13,7 +13,7 @@
- Follow the structure found in src/components/aside/examples/basic - Follow the structure found in src/components/aside/examples/basic
to create more examples. to create more examples.
* The biggest thing to remember: your app has to import its dependencies with the `app/` prefix. * The biggest thing to remember: your app has to import its dependencies with the `app/` prefix.
For example `import {Apple} from 'app/apple';` would import apple.js in your example app. For example `import {Apple} from 'apple';` would import apple.js in your example app.
#### Build #### Build

View File

@ -87,17 +87,13 @@ gulp.task('e2e', ['ionic-js', 'sass', 'ng2-copy'], function() {
'ios', 'ios',
] ]
function testPathToDistPath(path) {
return ;
}
// Get each test folder with gulp.src // Get each test folder with gulp.src
return gulp.src(buildConfig.src.e2e) return gulp.src(buildConfig.src.e2e)
.pipe(cached('e2e')) .pipe(cached('e2e'))
.pipe(gulpif(/main.js$/, processMain()))
.pipe(rename(function(file) { .pipe(rename(function(file) {
file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep) file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep)
})) }))
.pipe(gulpif(/main.js$/, processMain()))
.pipe(gulpif(/e2e.js$/, createPlatformTests())) .pipe(gulpif(/e2e.js$/, createPlatformTests()))
.pipe(gulp.dest(buildConfig.dist + '/e2e')) .pipe(gulp.dest(buildConfig.dist + '/e2e'))
@ -109,35 +105,36 @@ gulp.task('e2e', ['ionic-js', 'sass', 'ng2-copy'], function() {
contents: new Buffer(indexContents), contents: new Buffer(indexContents),
path: path.join(path.dirname(file.path), 'index.html'), path: path.join(path.dirname(file.path), 'index.html'),
})); }));
next(null, file);
var builder = new SystemJsBuilder({ // var builder = new SystemJsBuilder({
baseURL: __dirname, // baseURL: __dirname,
traceurOptions: { annotations: true, types: true }, // traceurOptions: { annotations: true, types: true },
meta: { // meta: {
'angular2/angular2': { build: false }, // 'angular2/angular2': { build: false },
'ionic/ionic': { build: false }, // 'ionic/ionic': { build: false },
}, // },
map: { // map: {
hammer: 'node_modules/hammerjs/hammer', // hammer: 'node_modules/hammerjs/hammer',
rx: 'node_modules/rx' // rx: 'node_modules/rx'
}, // },
paths: { // paths: {
'angular2/*': 'dist/lib/angular2/*.js', // 'angular2/*': 'dist/lib/angular2/*.js',
'app/*': path.dirname(file.path) + '/*.js' // 'app/*': path.dirname(file.path) + '/*.js'
}, // },
}); // });
builder.build('app/main').then(function(output) { // builder.build('app/main').then(function(output) {
self.push(new VinylFile({ // self.push(new VinylFile({
base: file.base, // base: file.base,
contents: new Buffer(output.source), // contents: new Buffer(output.source),
path: file.path, // path: file.path,
})); // }));
next(); // next();
}) // })
.catch(function(err) { // .catch(function(err) {
console.log('error', err); // console.log('error', err);
throw new Error(err); // throw new Error(err);
}); // });
}) })
} }
function createPlatformTests(file) { function createPlatformTests(file) {
@ -176,7 +173,11 @@ gulp.task('ng2', ['lib', 'ng2-copy'], function() {
"rx/*": "node_modules/angular2/node_modules/rx/*.js" "rx/*": "node_modules/angular2/node_modules/rx/*.js"
} }
}); });
return builder.build('angular2/angular2', path.join(buildConfig.distLib, 'angular2.js')); return builder.build('angular2/angular2', path.join(buildConfig.distLib, 'angular2.js')).then(function() {
return builder.build('angular2/di', path.join(buildConfig.distLib, 'angular2-di.js'));
});
});
gulp.task('ng2-di', ['ng2'], function() {
}); });
gulp.task('ionic-js', function() { gulp.task('ionic-js', function() {
@ -187,7 +188,7 @@ gulp.task('ionic-js', function() {
}, },
meta: { meta: {
'angular2/angular2': { build: false }, 'angular2/angular2': { build: false },
'angular2/src/di/annotations': { build: false } 'angular2/di': { build: false },
}, },
paths: { paths: {
"hammer": 'node_modules/hammerjs/*.js', "hammer": 'node_modules/hammerjs/*.js',

View File

@ -12,7 +12,7 @@ export * from 'ionic/components/input/input'
export * from 'ionic/components/layout/layout' export * from 'ionic/components/layout/layout'
export * from 'ionic/components/list/list' export * from 'ionic/components/list/list'
export * from 'ionic/components/nav-pane/nav-pane' export * from 'ionic/components/nav-pane/nav-pane'
export * from 'ionic/components/nav-viewport/nav-viewport' export * from 'ionic/components/nav/nav'
export * from 'ionic/components/radio/radio-button' export * from 'ionic/components/radio/radio-button'
export * from 'ionic/components/radio/radio-group' export * from 'ionic/components/radio/radio-group'
export * from 'ionic/components/search-bar/search-bar' export * from 'ionic/components/search-bar/search-bar'

View File

@ -13,7 +13,7 @@ html {
margin: 0; margin: 0;
padding: 0; padding: 0;
.nav-viewport { .nav {
// container of many .nav-views, each .nav-view contains one view // container of many .nav-views, each .nav-view contains one view
position: absolute; position: absolute;
top: 0; top: 0;
@ -28,7 +28,7 @@ html {
} }
.toolbar-container { .toolbar-container {
// container of many toolbars for each view in the .nav-viewport // container of many toolbars for each view in the .nav
position: relative; position: relative;
width: 100%; width: 100%;
min-height: 50px; min-height: 50px;

View File

@ -1,2 +1,2 @@
<ion-nav-viewport #viewport [initial]="firstPage"> <ion-nav #viewport [initial]="firstPage">
</ion-nav-viewport> </ion-nav>

View File

@ -2,7 +2,7 @@ import {Router} from 'ionic/routing/router'
import {For, Component, View as NgView, Parent, bootstrap} from 'angular2/angular2' import {For, Component, View as NgView, Parent, bootstrap} from 'angular2/angular2'
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms'; import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
import {Log} from 'ionic/util' import {Log} from 'ionic/util'
import {List, Item, NavViewport, View, Button, Input, Tabs, Tab, Content, NavPane, Aside} from 'ionic/ionic' import {List, Item, Nav, View, Button, Input, Tabs, Tab, Content, NavPane, Aside} from 'ionic/ionic'
@Component({ @Component({
selector: 'login-page' selector: 'login-page'
@ -12,7 +12,7 @@ import {List, Item, NavViewport, View, Button, Input, Tabs, Tab, Content, NavPan
directives: [View, FormDirectives, Button, Input] directives: [View, FormDirectives, Button, Input]
}) })
export class LoginPage { export class LoginPage {
constructor( @Parent() viewport: NavViewport ) { //, fb: FormBuilder ) { constructor( @Parent() viewport: Nav ) { //, fb: FormBuilder ) {
this.viewport = viewport this.viewport = viewport
Log.log('LOGIN PAGE') Log.log('LOGIN PAGE')
@ -45,7 +45,7 @@ export class LoginPage {
directives: [View, FormDirectives, Button, Input] directives: [View, FormDirectives, Button, Input]
}) })
export class SignupPage { export class SignupPage {
constructor( @Parent() viewport: NavViewport ) { //, fb: FormBuilder ) { constructor( @Parent() viewport: Nav ) { //, fb: FormBuilder ) {
this.viewport = viewport this.viewport = viewport
Log.log('SIGNUP PAGE') Log.log('SIGNUP PAGE')
@ -82,7 +82,7 @@ export class SignupPage {
directives: [View, FormDirectives, Button, Input, Tabs, Tab] directives: [View, FormDirectives, Button, Input, Tabs, Tab]
}) })
export class AppPage { export class AppPage {
constructor( @Parent() viewport: NavViewport ) { //, fb: FormBuilder ) { constructor( @Parent() viewport: Nav ) { //, fb: FormBuilder ) {
this.viewport = viewport this.viewport = viewport
this.streamTab = StreamTab this.streamTab = StreamTab
} }
@ -143,7 +143,7 @@ class SplashPage {
*/ */
@Component({ selector: '[ion-app]' }) @Component({ selector: '[ion-app]' })
@NgView({ @NgView({
directives: [NavViewport], directives: [Nav],
templateUrl: 'main.html' templateUrl: 'main.html'
}) })
class IonicApp { class IonicApp {

View File

@ -5,12 +5,10 @@ import {
DynamicComponentLoader, DynamicComponentLoader,
ElementRef ElementRef
} from 'angular2/angular2' } from 'angular2/angular2'
import {Optional} from 'angular2/src/di/annotations' import {Optional} from 'angular2/di'
import {NavViewport} from 'ionic/components/nav-viewport/nav-viewport' import {Nav} from 'ionic/components/nav/nav'
import {Tab} from 'ionic/components/tabs/tab' import {Tab} from 'ionic/components/tabs/tab'
console.log('names',DynamicComponent.name, Parent.name, NgElement.name, DynamicComponentLoader.name, ElementRef, Optional)
@DynamicComponent({ @DynamicComponent({
selector: '.nav-pane', selector: '.nav-pane',
properties: { properties: {
@ -23,8 +21,8 @@ export class NavPane {
location: ElementRef, location: ElementRef,
@NgElement() element: NgElement, @NgElement() element: NgElement,
// FIXME: this is temporary until ng2 lets us inject tabs as a NavViewport // FIXME: this is temporary until ng2 lets us inject tabs as a Nav
@Optional() @Parent() viewportNav: NavViewport, @Optional() @Parent() viewportNav: Nav,
@Optional() @Parent() viewportTab: Tab @Optional() @Parent() viewportTab: Tab
) { ) {
this._loader = loader this._loader = loader

View File

@ -1,2 +0,0 @@
<ion-nav-viewport [initial-component]="initial">
</ion-nav-viewport>

View File

@ -1,32 +1,31 @@
import {Component, View as NgView, For, NgElement, bind} from 'angular2/angular2' import {
import {NavPane} from 'ionic/components/nav-pane/nav-pane' Component,
import * as util from 'ionic/util' View as NgView,
For,
NgElement,
ComponentInjector
} from 'angular2/angular2';
import {bind} from 'angular2/di';
import {NavPane} from 'ionic/components/nav-pane/nav-pane';
import * as util from 'ionic/util';
class NavStack { export class TestNav {
constructor(navViewport: NavViewport) { constructor(v) {
this._viewport = navViewport this.value = v;
} }
push(Class, opts = {}) { };
return this._viewport.push(Class, opts)
}
pop(opts = {}) {
return this._viewport.pop(Class, opts)
}
popTo(index, opts = {}) {
return this._viewport.popTo(index, opts)
}
size() {
return this._viewport._stack.length
}
}
console.log(ComponentInjector)
@Component({ @Component({
selector: 'ion-nav-viewport', selector: 'ion-nav',
properties: { properties: {
initial: 'initial' initial: 'initial'
}, },
services: [ injectables: [
NavStack bind(TestNav).toFactory((e) => {
debugger;
return e;
}, [Nav])
] ]
}) })
@NgView({ @NgView({
@ -44,12 +43,12 @@ class NavStack {
`, `,
directives: [NavPane, For] directives: [NavPane, For]
}) })
export class NavViewport { export class Nav {
constructor( constructor(
element: NgElement element: NgElement
) { ) {
this.domElement = element.domElement this.domElement = element.domElement
this.domElement.classList.add('nav-viewport') this.domElement.classList.add('nav')
// this is our sane stack of items. This is synchronous and says an item // this is our sane stack of items. This is synchronous and says an item
// is removed even if it's still animating out. // is removed even if it's still animating out.

View File

@ -0,0 +1,2 @@
<ion-nav [initial-component]="initial">
</ion-nav>

View File

@ -1,11 +1,11 @@
import {Component, View as NgView, bootstrap} from 'angular2/angular2' import {Component, View as NgView, bootstrap} from 'angular2/angular2'
import {NavViewport} from 'ionic/components/nav-viewport/nav-viewport' import {Nav} from 'ionic/components/nav/nav'
import {Log} from 'ionic/util' import {Log} from 'ionic/util'
import {FirstPage} from 'app/pages/first-page' import {FirstPage} from 'pages/first-page'
@Component({ selector: '[ion-app]' }) @Component({ selector: '[ion-app]' })
@NgView({ @NgView({
directives: [NavViewport], directives: [Nav],
templateUrl: 'main.html' templateUrl: 'main.html'
}) })
class IonicApp { class IonicApp {

View File

@ -1,6 +1,6 @@
import {Component, View as NgView, Parent} from 'angular2/angular2' import {Component, View as NgView, Parent} from 'angular2/angular2'
import {NavViewport, View} from 'ionic/ionic' import {Nav, View} from 'ionic/ionic'
import {SecondPage} from 'app/pages/second-page' import {SecondPage} from 'pages/second-page'
@Component({ @Component({
selector: 'first-page' selector: 'first-page'
@ -11,7 +11,7 @@ import {SecondPage} from 'app/pages/second-page'
}) })
export class FirstPage { export class FirstPage {
constructor( constructor(
@Parent() viewport: NavViewport @Parent() viewport: Nav
) { ) {
this.viewport = viewport this.viewport = viewport
} }

View File

@ -1,5 +1,5 @@
import {Component, View as NgView, Parent} from 'angular2/angular2' import {Component, View as NgView, Parent} from 'angular2/angular2'
import {NavViewport} from 'ionic/components' import {Nav} from 'ionic/components'
import {View} from 'ionic/components/view/view' import {View} from 'ionic/components/view/view'
@Component({ @Component({
@ -11,7 +11,7 @@ import {View} from 'ionic/components/view/view'
}) })
export class SecondPage { export class SecondPage {
constructor( constructor(
@Parent() viewport: NavViewport @Parent() viewport: Nav
) { ) {
this.viewport = viewport this.viewport = viewport
} }

View File

@ -1,5 +1,5 @@
import {Component, Parent, Decorator, View as NgView, NgElement} from 'angular2/angular2' import {Component, Parent, Decorator, View as NgView, NgElement} from 'angular2/angular2'
import {NavViewport} from 'ionic/components/nav-viewport/nav-viewport' import {Nav} from 'ionic/components/nav/nav'
import {View} from 'ionic/components/view/view' import {View} from 'ionic/components/view/view'
import {NavPane} from 'ionic/components/nav-pane/nav-pane' import {NavPane} from 'ionic/components/nav-pane/nav-pane'
import * as util from 'ionic/util' import * as util from 'ionic/util'
@ -11,14 +11,14 @@ import * as util from 'ionic/util'
* its children for viewports. * its children for viewports.
*/ */
@Decorator({ @Decorator({
selector: 'ion-nav-viewport[split-viewport]' selector: 'ion-nav[split-viewport]'
}) })
class SplitViewportDecorator { class SplitViewportDecorator {
constructor( constructor(
@Parent() splitView: SplitView, @Parent() splitView: SplitView,
navViewport: NavViewport navViewport: Nav
) { ) {
splitView.setNavViewport(navViewport) splitView.setNav(navViewport)
} }
} }
@ -36,8 +36,8 @@ class SplitViewportDecorator {
<content></content> <content></content>
</div> </div>
</ion-view> </ion-view>
<ion-nav-viewport split-viewport> <ion-nav split-viewport>
</ion-nav-viewport> </ion-nav>
<style> <style>
ion-split-view { ion-split-view {
width: 100%; width: 100%;
@ -57,7 +57,7 @@ ion-split-view > [split-viewport] {
</style> </style>
`, `,
directives: [SplitViewportDecorator, NavViewport, View] directives: [SplitViewportDecorator, Nav, View]
}) })
export class SplitView { export class SplitView {
constructor( constructor(
@ -89,7 +89,7 @@ export class SplitView {
return false return false
} }
setNavViewport(viewport) { setNav(viewport) {
this.splitViewport = viewport this.splitViewport = viewport
this.navPane.__$push = this.navPane.push this.navPane.__$push = this.navPane.push

View File

@ -1,2 +1,2 @@
<ion-nav-viewport [initial]="initial"> <ion-nav [initial]="initial">
</ion-nav-viewport> </ion-nav>

View File

@ -6,7 +6,7 @@ import {
PropertySetter, PropertySetter,
For For
} from 'angular2/angular2'; } from 'angular2/angular2';
import {NavViewport} from 'ionic/components/nav-viewport/nav-viewport' import {Nav} from 'ionic/components/nav/nav'
import {NavPane} from 'ionic/components/nav-pane/nav-pane' import {NavPane} from 'ionic/components/nav-pane/nav-pane'
import {Tabs} from 'ionic/components/tabs/tabs' import {Tabs} from 'ionic/components/tabs/tabs'
import * as util from 'ionic/util' import * as util from 'ionic/util'
@ -31,7 +31,7 @@ import {IonicComponent} from 'ionic/config/component'
`, `,
directives: [For, NavPane] directives: [For, NavPane]
}) })
export class Tab extends NavViewport { export class Tab extends Nav {
constructor( constructor(
element: NgElement, element: NgElement,
@Ancestor() tabs: Tabs, @Ancestor() tabs: Tabs,

View File

@ -3,8 +3,8 @@
Hello! I'm a side menu in the root. Hello! I'm a side menu in the root.
</ion-aside> </ion-aside>
<ion-nav-viewport #viewport [initial]="initial"> <ion-nav #viewport [initial]="initial">
</ion-nav-viewport> </ion-nav>
<style> <style>

View File

@ -1,6 +1,6 @@
import {Component, View as NgView, bootstrap} from 'angular2/angular2' import {Component, View as NgView, bootstrap} from 'angular2/angular2'
import {NavViewport, Aside} from 'ionic/ionic' import {Nav, Aside} from 'ionic/ionic'
import {SignInPage} from 'app/pages/sign-in' import {SignInPage} from 'pages/sign-in'
@Component({ @Component({
@ -8,7 +8,7 @@ import {SignInPage} from 'app/pages/sign-in'
}) })
@NgView({ @NgView({
templateUrl: 'main.html', templateUrl: 'main.html',
directives: [NavViewport, Aside] directives: [Nav, Aside]
}) })
class App { class App {
constructor() { constructor() {

View File

@ -1,6 +1,6 @@
import {Component, View as NgView} from 'angular2/angular2' import {Component, View as NgView, Ancestor} from 'angular2/angular2'
import {View, NavPane, Content} from 'ionic/ionic' import {View, NavPane, Content, TestNav, Nav} from 'ionic/ionic'
import {TabsPage} from 'app/pages/tabs' import {TabsPage} from 'pages/tabs'
@Component({ @Component({
selector: 'sign-in-page' selector: 'sign-in-page'
@ -11,13 +11,15 @@ import {TabsPage} from 'app/pages/tabs'
}) })
export class SignInPage { export class SignInPage {
constructor( constructor(
navPane: NavPane nav: Nav,
t: TestNav
) { ) {
this.navPane = navPane debugger;
this.nav = nav;
this.instanceVal = Math.random() this.instanceVal = Math.random()
} }
signIn() { signIn() {
this.navPane.push(TabsPage) this.nav.push(TabsPage)
} }
instanceCheck() { instanceCheck() {
window.alert("Instance: " + this.instanceVal) window.alert("Instance: " + this.instanceVal)

View File

@ -32,6 +32,7 @@ module.exports = {
to: 'long-stack-trace-zone.js' to: 'long-stack-trace-zone.js'
}, },
'angular2.js', 'angular2.js',
'angular2-di.js',
'ionic2.js', 'ionic2.js',
], ],

View File

@ -9,11 +9,13 @@
<% buildConfig.scripts.forEach(function(script) { <% buildConfig.scripts.forEach(function(script) {
var src = script.to || script; %><script src="<%= PREFIX %>/lib/<%= src %>"></script> var src = script.to || script; %><script src="<%= PREFIX %>/lib/<%= src %>"></script>
<% }); %> <% }); %>
<script src="main.js"></script>
</head> </head>
<body ion-app> <body ion-app>
</body> </body>
<script> <script>
System.import('app/main').catch(console.error.bind(console)); System.config({
traceurOptions: {annotations: true, types: true}
});
System.import('main').catch(console.error.bind(console));
</script> </script>
</html> </html>