diff --git a/.gitignore b/.gitignore index 3aed639190..dbb9a2e2ad 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,8 @@ demos/node_modules demos/polyfills demos/css demos/fonts -demos/src/**/*.js* +demos/src/**/*.js +demos/src/**/*.map demos/src/**/*.ngfactory.ts demos/src/**/*.d.ts demos/src/**/*.metadata.json diff --git a/demos/src/action-sheet/app.module.ts b/demos/src/action-sheet/app.module.ts index e0ecc23020..35a405eb96 100644 --- a/demos/src/action-sheet/app.module.ts +++ b/demos/src/action-sheet/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { ActionSheetController, IonicApp, IonicModule, Platform } from '../'; +import { ActionSheetController, IonicApp, IonicModule, Platform } from '../../ionic-angular'; @Component({ diff --git a/demos/src/alert/app.module.ts b/demos/src/alert/app.module.ts index cfa3752f48..d716e28e16 100644 --- a/demos/src/alert/app.module.ts +++ b/demos/src/alert/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { AlertController, IonicApp, IonicModule } from '../'; +import { AlertController, IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/button/app.module.ts b/demos/src/button/app.module.ts index 14d8c783b5..c521eef899 100644 --- a/demos/src/button/app.module.ts +++ b/demos/src/button/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/checkbox/app.module.ts b/demos/src/checkbox/app.module.ts index a341634d6a..c9d24747a3 100644 --- a/demos/src/checkbox/app.module.ts +++ b/demos/src/checkbox/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/chip/app.module.ts b/demos/src/chip/app.module.ts index 66e91f9aab..2ce291ecd1 100644 --- a/demos/src/chip/app.module.ts +++ b/demos/src/chip/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/config/app.module.ts b/demos/src/config/app.module.ts index 17b5b6802c..ea362ad799 100644 --- a/demos/src/config/app.module.ts +++ b/demos/src/config/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, Platform, NavController } from '../'; +import { IonicApp, IonicModule, Platform, NavController } from '../../ionic-angular'; if (!window.localStorage) { Object.defineProperty(window, 'localStorage', new (function () { diff --git a/demos/src/datetime/app.module.ts b/demos/src/datetime/app.module.ts index f17ce237dc..4b0ff35334 100644 --- a/demos/src/datetime/app.module.ts +++ b/demos/src/datetime/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/events/app.module.ts b/demos/src/events/app.module.ts index 35042ad131..5ab4982779 100644 --- a/demos/src/events/app.module.ts +++ b/demos/src/events/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule, ViewChild } from '@angular/core'; -import { Events, IonicApp, IonicModule, Nav } from '../'; +import { Events, IonicApp, IonicModule, Nav } from '../../ionic-angular'; @Component({ diff --git a/demos/src/fab/app.module.ts b/demos/src/fab/app.module.ts index f7a81004a1..310c71c464 100644 --- a/demos/src/fab/app.module.ts +++ b/demos/src/fab/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { FabContainer, IonicApp, IonicModule } from '../'; +import { FabContainer, IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/icon/app.module.ts b/demos/src/icon/app.module.ts index 14d8c783b5..c521eef899 100644 --- a/demos/src/icon/app.module.ts +++ b/demos/src/icon/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/infinite-scroll/app.module.ts b/demos/src/infinite-scroll/app.module.ts index ce018bb602..0864967977 100644 --- a/demos/src/infinite-scroll/app.module.ts +++ b/demos/src/infinite-scroll/app.module.ts @@ -1,5 +1,5 @@ import { Component, Injectable, NgModule } from '@angular/core'; -import { InfiniteScroll, IonicApp, IonicModule } from '../'; +import { InfiniteScroll, IonicApp, IonicModule } from '../../ionic-angular'; /** diff --git a/demos/src/input/app.module.ts b/demos/src/input/app.module.ts index 6854a76c55..217477890b 100644 --- a/demos/src/input/app.module.ts +++ b/demos/src/input/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/item-reorder/app.module.ts b/demos/src/item-reorder/app.module.ts index 45f7fca68d..0aa6c0f9a1 100644 --- a/demos/src/item-reorder/app.module.ts +++ b/demos/src/item-reorder/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule, ViewEncapsulation } from '@angular/core'; -import { IonicApp, IonicModule, NavController, reorderArray } from '../'; +import { IonicApp, IonicModule, NavController, reorderArray } from '../../ionic-angular'; @Component({ diff --git a/demos/src/item-sliding/app.module.ts b/demos/src/item-sliding/app.module.ts index 167b068af0..47e5ebf608 100644 --- a/demos/src/item-sliding/app.module.ts +++ b/demos/src/item-sliding/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule, ViewEncapsulation } from '@angular/core'; -import { IonicApp, IonicModule, ItemSliding, ToastController } from '../'; +import { IonicApp, IonicModule, ItemSliding, ToastController } from '../../ionic-angular'; @Component({ diff --git a/demos/src/item/app.module.ts b/demos/src/item/app.module.ts index 14d8c783b5..c521eef899 100644 --- a/demos/src/item/app.module.ts +++ b/demos/src/item/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/label/app.module.ts b/demos/src/label/app.module.ts index ed42627f38..d6b841cdf1 100644 --- a/demos/src/label/app.module.ts +++ b/demos/src/label/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/list/app.module.ts b/demos/src/list/app.module.ts index 6854a76c55..217477890b 100644 --- a/demos/src/list/app.module.ts +++ b/demos/src/list/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/loading/app.module.ts b/demos/src/loading/app.module.ts index a78c3da735..024a126bd0 100644 --- a/demos/src/loading/app.module.ts +++ b/demos/src/loading/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, LoadingController, NavController } from '../'; +import { IonicApp, IonicModule, LoadingController, NavController } from '../../ionic-angular'; @Component({ diff --git a/demos/src/menu/app.module.ts b/demos/src/menu/app.module.ts index baf9b7699b..15b12cf183 100644 --- a/demos/src/menu/app.module.ts +++ b/demos/src/menu/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, MenuController } from '../'; +import { IonicApp, IonicModule, MenuController } from '../../ionic-angular'; @Component({ diff --git a/demos/src/modal/app.module.ts b/demos/src/modal/app.module.ts index 3f292db77d..f169229b18 100644 --- a/demos/src/modal/app.module.ts +++ b/demos/src/modal/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, ModalController, NavParams, ViewController } from '../'; +import { IonicApp, IonicModule, ModalController, NavParams, ViewController } from '../../ionic-angular'; @Component({ diff --git a/demos/src/nav-params/app.module.ts b/demos/src/nav-params/app.module.ts index 5590b959ff..4f17f2f72e 100644 --- a/demos/src/nav-params/app.module.ts +++ b/demos/src/nav-params/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, NavController, NavParams } from '../'; +import { IonicApp, IonicModule, NavController, NavParams } from '../../ionic-angular'; @Component({ diff --git a/demos/src/navbar/app.module.ts b/demos/src/navbar/app.module.ts index 35e02be3bf..f59e91fb05 100644 --- a/demos/src/navbar/app.module.ts +++ b/demos/src/navbar/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; // Use the toolbar demo but pass in the demo name to change the title diff --git a/demos/src/navigation/app.module.ts b/demos/src/navigation/app.module.ts index d43fe4a514..9dc7aee31e 100644 --- a/demos/src/navigation/app.module.ts +++ b/demos/src/navigation/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, NavController } from '../'; +import { IonicApp, IonicModule, NavController } from '../../ionic-angular'; let pageNum = 2; diff --git a/demos/src/platform/app.module.ts b/demos/src/platform/app.module.ts index c265b2d617..392ece4627 100644 --- a/demos/src/platform/app.module.ts +++ b/demos/src/platform/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, Platform } from '../'; +import { IonicApp, IonicModule, Platform } from '../../ionic-angular'; @Component({ diff --git a/demos/src/popover/app.module.ts b/demos/src/popover/app.module.ts index ce8dd3dea3..36566f7ad8 100644 --- a/demos/src/popover/app.module.ts +++ b/demos/src/popover/app.module.ts @@ -1,5 +1,5 @@ import { Component, ElementRef, NgModule, ViewChild } from '@angular/core'; -import { IonicApp, IonicModule, NavParams, PopoverController } from '../'; +import { IonicApp, IonicModule, NavParams, PopoverController } from '../../ionic-angular'; @Component({ diff --git a/demos/src/radio/app.module.ts b/demos/src/radio/app.module.ts index 6e8958fffb..b0c3652adb 100644 --- a/demos/src/radio/app.module.ts +++ b/demos/src/radio/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/range/app.module.ts b/demos/src/range/app.module.ts index 14ad535a98..90b60e3a99 100644 --- a/demos/src/range/app.module.ts +++ b/demos/src/range/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/refresher/app.module.ts b/demos/src/refresher/app.module.ts index 6e83d52691..c406bf7291 100644 --- a/demos/src/refresher/app.module.ts +++ b/demos/src/refresher/app.module.ts @@ -1,5 +1,5 @@ import { Component, Injectable, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, Refresher } from '../'; +import { IonicApp, IonicModule, Refresher } from '../../ionic-angular'; /** diff --git a/demos/src/scroll/app.module.ts b/demos/src/scroll/app.module.ts index 6854a76c55..217477890b 100644 --- a/demos/src/scroll/app.module.ts +++ b/demos/src/scroll/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/searchbar/app.module.ts b/demos/src/searchbar/app.module.ts index 92b17b8f64..0813343bfc 100644 --- a/demos/src/searchbar/app.module.ts +++ b/demos/src/searchbar/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/segment/app.module.ts b/demos/src/segment/app.module.ts index 15c7ca41e4..a041c0fa1e 100644 --- a/demos/src/segment/app.module.ts +++ b/demos/src/segment/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/select/app.module.ts b/demos/src/select/app.module.ts index 64472912a4..76da7dafb7 100644 --- a/demos/src/select/app.module.ts +++ b/demos/src/select/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/show-when/app.module.ts b/demos/src/show-when/app.module.ts index 14d8c783b5..c521eef899 100644 --- a/demos/src/show-when/app.module.ts +++ b/demos/src/show-when/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/slides/app.module.ts b/demos/src/slides/app.module.ts index 14d8c783b5..c521eef899 100644 --- a/demos/src/slides/app.module.ts +++ b/demos/src/slides/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/tabs/app.module.ts b/demos/src/tabs/app.module.ts index fff466febf..7b7cd99dfb 100644 --- a/demos/src/tabs/app.module.ts +++ b/demos/src/tabs/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule, ViewEncapsulation } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ diff --git a/demos/src/textarea/app.module.ts b/demos/src/textarea/app.module.ts index 0131529ea6..217477890b 100644 --- a/demos/src/textarea/app.module.ts +++ b/demos/src/textarea/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ @@ -30,4 +30,4 @@ export class ApiDemoApp { ApiDemoPage ] }) -export class AppModule {} \ No newline at end of file +export class AppModule {} diff --git a/demos/src/title/app.module.ts b/demos/src/title/app.module.ts index 1c66c65bee..59e3bf4667 100644 --- a/demos/src/title/app.module.ts +++ b/demos/src/title/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; // Use the toolbar demo but pass in the demo name to change the title @@ -35,4 +35,4 @@ export class ApiDemoApp { ApiDemoPage ] }) -export class AppModule {} \ No newline at end of file +export class AppModule {} diff --git a/demos/src/toast/app.module.ts b/demos/src/toast/app.module.ts index 19f2632cca..399a319932 100644 --- a/demos/src/toast/app.module.ts +++ b/demos/src/toast/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, ToastController } from '../'; +import { IonicApp, IonicModule, ToastController } from '../../ionic-angular'; @Component({ @@ -76,4 +76,4 @@ export class ApiDemoApp { ApiDemoPage ] }) -export class AppModule {} \ No newline at end of file +export class AppModule {} diff --git a/demos/src/toggle/app.module.ts b/demos/src/toggle/app.module.ts index 9c61a43ea8..dd2363aae7 100644 --- a/demos/src/toggle/app.module.ts +++ b/demos/src/toggle/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ @@ -43,4 +43,4 @@ export class ApiDemoApp { ApiDemoPage ] }) -export class AppModule {} \ No newline at end of file +export class AppModule {} diff --git a/demos/src/toolbar/app.module.ts b/demos/src/toolbar/app.module.ts index f50cb7e1fa..7682b29f4b 100644 --- a/demos/src/toolbar/app.module.ts +++ b/demos/src/toolbar/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule } from '../'; +import { IonicApp, IonicModule } from '../../ionic-angular'; @Component({ @@ -32,4 +32,4 @@ export class ApiDemoApp { ApiDemoPage ] }) -export class AppModule {} \ No newline at end of file +export class AppModule {} diff --git a/demos/src/tsconfig.json b/demos/src/tsconfig.json new file mode 100644 index 0000000000..1781ffcd82 --- /dev/null +++ b/demos/src/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "allowUnreachableCode": false, + "declaration": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "lib": [ + "dom", + "es2015" + ], + "module": "es2015", + "moduleResolution": "node", + "noImplicitAny": false, + "removeComments": false, + "sourceMap": true, + "target": "es5", + "types": [ + "jasmine" + ] + }, + "include": [ + "./**/*.ts" + ], + "compileOnSave": false, + "buildOnSave": false, + "atom": { + "rewriteTsconfig": false + } +} \ No newline at end of file diff --git a/package.json b/package.json index 42605b0256..b62b52abca 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "zone.js": "~0.6.26" }, "devDependencies": { + "@ionic/app-scripts": "0.0.48-201612291559", "@ionic/commit-hooks": "1.0.3", "@types/connect": "3.4.30", "@types/del": "2.2.31", @@ -122,17 +123,18 @@ "ts-node": "1.3.0", "tslint": "3.15.1", "tslint-ionic-rules": "0.0.7", - "typescript": "2.0.9", + "typescript": "~2.0.10", "vinyl": "1.2.0", - "webpack": "2.1.0-beta.26", + "webpack": "^2.1.0-beta.27", "yargs": "5.0.0" }, "config": { "commitizen": { "path": "node_modules/ionic-cz-conventional-changelog" - } + }, + "ionic_copy": "./scripts/demos/copy.config.js" }, "pre-push#master": [ "test" ] -} \ No newline at end of file +} diff --git a/scripts/demos/copy.config.js b/scripts/demos/copy.config.js new file mode 100644 index 0000000000..769ba9d6ea --- /dev/null +++ b/scripts/demos/copy.config.js @@ -0,0 +1,7 @@ +// we don't want to run copy for the demos, so just override the config for now +module.exports = { + copyAssets: { }, + copyIndexContent: { }, + copyFonts: { }, + copyPolyfills: { } +} \ No newline at end of file diff --git a/scripts/demos/demos.template.prod.html b/scripts/demos/demos.template.prod.html index a4fb38890b..21bebb8775 100644 --- a/scripts/demos/demos.template.prod.html +++ b/scripts/demos/demos.template.prod.html @@ -6,7 +6,7 @@ - + @@ -14,6 +14,6 @@ - + diff --git a/scripts/demos/entry.ts b/scripts/demos/entry.ts deleted file mode 100644 index 3129863a84..0000000000 --- a/scripts/demos/entry.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { platformBrowser } from '@angular/platform-browser'; -import { enableProdMode } from '@angular/core'; -import { AppModuleNgFactory } from './app.module.ngfactory'; - -enableProdMode(); -platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); diff --git a/scripts/demos/main.ts b/scripts/demos/main.ts new file mode 100644 index 0000000000..6af7a5b2ae --- /dev/null +++ b/scripts/demos/main.ts @@ -0,0 +1,5 @@ +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app.module'; + +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/scripts/demos/sass.config.js b/scripts/demos/sass.config.js new file mode 100644 index 0000000000..e8b89ffed9 --- /dev/null +++ b/scripts/demos/sass.config.js @@ -0,0 +1,103 @@ + +// https://www.npmjs.com/package/node-sass + +module.exports = { + + /** + * outputFilename: The filename of the saved CSS file + * from the sass build. The directory which it is saved in + * is set within the "buildDir" config options. + */ + outputFilename: process.env.IONIC_OUTPUT_CSS_FILE_NAME, + + /** + * sourceMap: If source map should be built or not. + */ + sourceMap: false, + + /** + * outputStyle: How node-sass should output the css file. + */ + outputStyle: 'expanded', + + /** + * autoprefixer: The config options for autoprefixer. + * Excluding this config will skip applying autoprefixer. + * https://www.npmjs.com/package/autoprefixer + */ + autoprefixer: { + browsers: [ + 'last 2 versions', + 'iOS >= 8', + 'Android >= 4.4', + 'Explorer >= 11', + 'ExplorerMobile >= 11' + ], + cascade: false + }, + + /** + * includePaths: Used by node-sass for additional + * paths to search for sass imports by just name. + */ + includePaths: [ + 'src/themes', + 'node_modules/ionicons/dist/scss', + 'src/fonts' + ], + + /** + * includeFiles: An array of regex patterns to search for + * sass files in the same directory as the component module. + * If a file matches both include and exclude patterns, then + * the file will be excluded. + */ + includeFiles: [ + /\.(s(c|a)ss)$/i + ], + + /** + * excludeFiles: An array of regex patterns for files which + * should be excluded. If a file matches both include and exclude + * patterns, then the file will be excluded. + */ + excludeFiles: [ + /* /\.(wp).(scss)$/i */ + ], + + /** + * variableSassFiles: Lists out the files which include + * only sass variables. These variables are the first sass files + * to be imported so their values override default variables. + */ + variableSassFiles: [ + './scripts/demos/variables.scss' + ], + + /** + * directoryMaps: Compiled JS modules may be within a different + * directory than its source file and sibling component sass files. + * For example, NGC places it's files within the .tmp directory + * but doesn't copy over its sass files. This is useful so sass + * also checks the JavaScript's source directory for sass files. + */ + directoryMaps: { + '{{TMP}}': '{{SRC}}' + }, + + /** + * excludeModules: Used just as a way to skip over + * modules which we know wouldn't have any sass to be + * bundled. "excludeModules" isn't necessary, but is a + * good way to speed up build times by skipping modules. + */ + excludeModules: [ + '@angular', + 'commonjs-proxy', + 'core-js', + 'ionic-native', + 'rxjs', + 'zone.js' + ] + +}; \ No newline at end of file diff --git a/scripts/demos/variables.scss b/scripts/demos/variables.scss new file mode 100644 index 0000000000..50029be26c --- /dev/null +++ b/scripts/demos/variables.scss @@ -0,0 +1,77 @@ +// Ionic Variables and Theming. For more info, please see: +// http://ionicframework.com/docs/v2/theming/ + +// Font path is used to include ionicons, +// roboto, and noto sans fonts +$font-path: "../../fonts"; + +@import "ionic.globals"; + + +// Shared Variables +// -------------------------------------------------- +// To customize the look and feel of this app, you can override +// the Sass variables found in Ionic's source scss files. +// To view all the possible Ionic variables, see: +// http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/ + + +// Named Color Variables +// -------------------------------------------------- +// Named colors makes it easy to reuse colors on various components. +// It's highly recommended to change the default colors +// to match your app's branding. Ionic uses a Sass map of +// colors so you can add, rename and remove colors as needed. +// The "primary" color is the only required color in the map. + +$colors: ( + primary: #327eff, + secondary: #32db64, + danger: #f53d3d, + light: #f4f4f4, + dark: #222, +); + + +// App iOS Variables +// -------------------------------------------------- +// iOS only Sass variables can go here + + + +// App Material Design Variables +// -------------------------------------------------- +// Material Design only Sass variables can go here + + +// App Windows Variables +// -------------------------------------------------- +// Windows only Sass variables can go here + + + +// App Theme +// -------------------------------------------------- +// Ionic apps can have different themes applied, which can +// then be future customized. This import comes last +// so that the above variables are used and Ionic's +// default are overridden. + +@import "ionic.theme.default"; + + +// Ionicons +// -------------------------------------------------- +// The premium icon font for Ionic. For more info, please see: +// http://ionicframework.com/docs/v2/ionicons/ + +@import "ionicons"; + + +// Fonts +// -------------------------------------------------- +// Roboto font is used by default for Material Design. Noto sans +// is used by default for Windows. + +@import "roboto"; +@import "noto-sans"; \ No newline at end of file diff --git a/scripts/gulp/tasks/build.ts b/scripts/gulp/tasks/build.ts index 6f4d5b7ba8..7b7a738e9d 100644 --- a/scripts/gulp/tasks/build.ts +++ b/scripts/gulp/tasks/build.ts @@ -1,5 +1,5 @@ import { task } from 'gulp'; -import { DIST_BUILD_ROOT, DIST_BUILD_ES2015_ROOT, DIST_BUILD_UMD_ROOT, ES5, ES_2015, UMD_MODULE } from '../constants'; +import { DIST_BUILD_ROOT, DIST_BUILD_ES2015_ROOT, DIST_BUILD_UMD_ROOT, ES5, ES_2015, PROJECT_ROOT, UMD_MODULE } from '../constants'; import { copySourceToDest, copySwiperToPath, createTempTsConfig, deleteFiles, runNgc } from '../util'; @@ -7,7 +7,7 @@ export function buildIonicAngularUmd(excludeSpec: boolean, stripDebug: boolean, const stream = copySourceToDest(DIST_BUILD_UMD_ROOT, excludeSpec, true, stripDebug); stream.on('end', () => { // the source files are copied, copy over a tsconfig from - createTempTsConfig(['./**/*.ts'], ES5, UMD_MODULE, `${DIST_BUILD_UMD_ROOT}/tsconfig.json`); + createTempTsConfig(['./**/*.ts'], ES5, UMD_MODULE, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_BUILD_UMD_ROOT}/tsconfig.json`); runNgc(`${DIST_BUILD_UMD_ROOT}/tsconfig.json`, (err) => { if (err) { done(err); @@ -28,7 +28,7 @@ export function buildIonicAngularEsm(stripDebug: boolean, done: Function) { const stream = copySourceToDest(DIST_BUILD_ROOT, true, true, stripDebug); stream.on('end', () => { // the source files are copied, copy over a tsconfig from - createTempTsConfig(['./**/*.ts'], ES5, ES_2015, `${DIST_BUILD_ROOT}/tsconfig.json`); + createTempTsConfig(['./**/*.ts'], ES5, ES_2015, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_BUILD_ROOT}/tsconfig.json`); runNgc(`${DIST_BUILD_ROOT}/tsconfig.json`, (err) => { if (err) { done(err); @@ -48,7 +48,7 @@ export function buildIonicPureEs6(stripDebug: boolean, done: Function) { const stream = copySourceToDest(DIST_BUILD_ES2015_ROOT, true, true, stripDebug); stream.on('end', () => { // the source files are copied, copy over a tsconfig from - createTempTsConfig(['./**/*.ts'], ES_2015, ES_2015, `${DIST_BUILD_ES2015_ROOT}/tsconfig.json`); + createTempTsConfig(['./**/*.ts'], ES_2015, ES_2015, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_BUILD_ES2015_ROOT}/tsconfig.json`); runNgc(`${DIST_BUILD_ES2015_ROOT}/tsconfig.json`, (err) => { if (err) { done(err); diff --git a/scripts/gulp/tasks/demos.prod.ts b/scripts/gulp/tasks/demos.prod.ts index bd42a82caa..95aad27fe4 100644 --- a/scripts/gulp/tasks/demos.prod.ts +++ b/scripts/gulp/tasks/demos.prod.ts @@ -1,38 +1,44 @@ -import { accessSync, F_OK, readFileSync, writeFileSync } from 'fs'; +import { spawnSync } from 'child_process'; +import { accessSync, F_OK, readdirSync, readFileSync, stat, statSync } from 'fs'; import { dirname, join } from 'path'; -import * as glob from 'glob'; import { dest, src, start, task } from 'gulp'; import * as gulpif from 'gulp-if'; import * as watch from 'gulp-watch'; -import * as rollup from 'rollup'; -import * as nodeResolve from 'rollup-plugin-node-resolve'; -import * as commonjs from 'rollup-plugin-commonjs'; import * as runSequence from 'run-sequence'; import { obj } from 'through2'; import * as VinylFile from 'vinyl'; -import { argv } from 'yargs'; -import { DEMOS_SRC_ROOT, DIST_DEMOS_COMPONENTS_ROOT, DIST_DEMOS_ROOT, DIST_NAME, DEMOS_NAME, ES5, ES_2015, LOCAL_SERVER_PORT, PROJECT_ROOT, SCRIPTS_ROOT, SRC_COMPONENTS_ROOT, SRC_ROOT } from '../constants'; -import { createTempTsConfig, deleteFiles, runNgc } from '../util'; +import { DEMOS_SRC_ROOT, DIST_DEMOS_ROOT, DIST_NAME, DEMOS_NAME, ES5, ES_2015, LOCAL_SERVER_PORT, SCRIPTS_ROOT } from '../constants'; +import { createTempTsConfig, getFolderInfo } from '../util'; task('demos.prod', demosBuild); function demosBuild(done: (err: any) => void) { runSequence( + 'demos.copyIonic', 'demos.clean', 'demos.polyfill', 'demos.copySource', - 'demos.compileTests', 'demos.copyExternalDependencies', 'demos.sass', 'demos.fonts', - 'demos.bundleProd', + 'demos.compileTests', done); } +task('demos.copyIonic', (done: (err: any) => void) => { + runSequence( + 'compile.release', + 'release.compileSass', + 'release.fonts', + 'release.sass', + 'release.createUmdBundle', + done); +}); + task('demos.copySource', (done: Function) => { - const stream = src([`${SRC_ROOT}/**/*`, `!${SRC_ROOT}/components/*/test{,/**/*}`, `${DEMOS_SRC_ROOT}/**/*`]) + const stream = src([`${DEMOS_SRC_ROOT}/**/*`]) .pipe(gulpif(/app.module.ts$/, createIndexHTML())) .pipe(dest(DIST_DEMOS_ROOT)); @@ -40,7 +46,7 @@ task('demos.copySource', (done: Function) => { function createIndexHTML() { const indexTemplate = readFileSync(`${SCRIPTS_ROOT}/${DEMOS_NAME}/demos.template.prod.html`); - const indexTs = readFileSync(`${SCRIPTS_ROOT}/${DEMOS_NAME}/entry.ts`); + const indexTs = readFileSync(`${SCRIPTS_ROOT}/${DEMOS_NAME}/main.ts`); return obj(function (file, enc, next) { this.push(new VinylFile({ @@ -51,7 +57,7 @@ task('demos.copySource', (done: Function) => { this.push(new VinylFile({ base: file.base, contents: new Buffer(indexTs), - path: join(dirname(file.path), 'entry.ts'), + path: join(dirname(file.path), 'main.ts'), })); next(null, file); }); @@ -60,104 +66,82 @@ task('demos.copySource', (done: Function) => { task('demos.compileTests', (done: Function) => { let folderInfo = getFolderInfo(); - buildDemoTests(folderInfo, done); -}); -function buildDemoTests(folderInfo: any, done: Function) { - let includeGlob = ['./*/app.module.ts', './*/entry.ts']; if (folderInfo.componentName && folderInfo.componentTest) { - includeGlob = [ - `./${folderInfo.componentName}/app.module.ts`, - `./${folderInfo.componentName}/entry.ts`, - ]; - } - - createTempTsConfig(includeGlob, ES5, ES_2015, `${DIST_DEMOS_ROOT}/tsconfig.json`); - runNgc(`${DIST_DEMOS_ROOT}/tsconfig.json`, (err) => { - if (err) { - done(err); - return; - } - // clean up any .ts files that remain - deleteFiles([`${DIST_DEMOS_ROOT}/**/*.ts`, `!${DIST_DEMOS_ROOT}/**/*.ngfactory.ts`, `!${DIST_DEMOS_ROOT}/**/*.d.ts`], done); - }); -} - -task('demos.bundleProd', (done) => { - let includeGlob = `${DIST_DEMOS_ROOT}/*/entry.js`; - let folderInfo = getFolderInfo(); - if (folderInfo.componentName && folderInfo.componentTest) { - includeGlob = `${DIST_DEMOS_ROOT}/${folderInfo.componentName}/entry.js`; - } - glob(includeGlob, {}, function (er, files) { - var directories = files.map(function (file) { - return dirname(file); - }); - - let indexFileContents = directories.map(function (dir) { - let testName = dir.replace(`${DIST_DEMOS_ROOT}/`, ''); - let fileName = dir.replace(`${PROJECT_ROOT}`, ''); - return `

${testName}

`; - }, []); - - writeFileSync(`${DIST_DEMOS_ROOT}/index.html`, - '\n' + - indexFileContents.join('\n') + - '' - ); - - createBundles(files).then(() => { - done(); - }).catch(err => { - done(err); - }); - }); -}); - -function createBundles(files: string[]) { - let start; - if (!files) { - return Promise.reject(new Error('list of files is null')); - } else if (files.length === 0) { - return Promise.resolve(); + buildTest(folderInfo.componentName); } else { - const outputFileName = join(dirname(files[0]), 'app.bundle.js'); - start = Date.now(); - return bundle(files[0], outputFileName).then(() => { - const end = Date.now(); - const seconds = (end - start) / 1000; - console.log(`Took ${seconds} seconds to process ${files[0]}`); - const remainingFiles = files.concat(); - remainingFiles.shift(); - return createBundles(remainingFiles); - }).catch(err => { - return Promise.reject(err); - }); + buildAllTests(done); } +}); + +function buildTest(folderName: string) { + let includeGlob = [`./dist/demos/${folderName}/*.ts`]; + let pathToWriteFile = `${DIST_DEMOS_ROOT}/${folderName}/tsconfig.json`; + + createTempTsConfig(includeGlob, ES5, ES_2015, `${DEMOS_SRC_ROOT}/tsconfig.json`, pathToWriteFile); + return runAppScripts(folderName); } -function bundle(inputFile: string, outputFile: string): Promise { - console.log(`Starting rollup on ${inputFile} ... writing to ${outputFile}`); - return rollup.rollup({ - entry: inputFile, - plugins: [ - commonjs(), - nodeResolve({ - module: true, - jsnext: true, - main: true, - extensions: ['.js'] - }) - ] - }).then(bundle => { - return bundle.write({ - format: 'iife', - dest: outputFile, +function buildAllTests(done: Function) { + let folders = getFolders('./dist/demos/'); + let promises: Promise[] = []; + + folders.forEach(folder => { + stat(`./dist/demos/${folder}/app.module.ts`, function(err, stat) { + if (err == null) { + const promise = buildTest(folder); + promises.push(promise); + } }); }); + + Promise.all(promises).then(() => { + done(); + }).catch(err => { + done(err); + }); } -task('demos.watchProd', ['demos.copyExternalDependencies', 'demos.sass', 'demos.fonts'], (done: Function) => { +function runAppScripts(folderName: string) { + console.log('Running app scripts with', folderName); + + let sassConfigPath = 'scripts/demos/sass.config.js'; + + let appEntryPoint = `dist/demos/${folderName}/main.ts`; + let distDir = `dist/demos/${folderName}/`; + + let tsConfig = distDir + 'tsconfig.json'; + + try { + const scriptsCmd = spawnSync('ionic-app-scripts', + ['build', + '--prod', + '--sass', sassConfigPath, + '--appEntryPoint', appEntryPoint, + '--srcDir', distDir, + '--wwwDir', distDir, + '--tsconfig', tsConfig + ]); + + if (scriptsCmd.status !== 0) { + return Promise.reject(scriptsCmd.stderr.toString()); + } + + console.log(scriptsCmd.output.toString()); + return Promise.resolve(); + } catch (ex) { + return Promise.reject(ex); + } +} + +function getFolders(dir) { + return readdirSync(dir) + .filter(function(file) { + return statSync(join(dir, file)).isDirectory(); + }); +} + +task('demos.watchProd', (done: Function) => { const folderInfo = getFolderInfo(); let demoTestPath = DEMOS_SRC_ROOT; @@ -172,13 +156,13 @@ task('demos.watchProd', ['demos.copyExternalDependencies', 'demos.sass', 'demos. return; } - if (demosComponentsExists()) { + if (demosComponentsExists(folderInfo)) { // already generated the demos directory demosWatch(folderInfo.componentName, folderInfo.componentTest); } else { // generate the demos directory - console.log('Generated demos builds first...'); + console.log('Generate demo builds first...'); demosBuild(() => { demosWatch(folderInfo.componentName, folderInfo.componentTest); }); @@ -212,31 +196,27 @@ function demosWatch(componentName: string, componentTest: string) { start('demos.sass'); }); - console.log(`http://localhost:${LOCAL_SERVER_PORT}/${DIST_NAME}/${DEMOS_NAME}/${componentName}`); + let serverUrl = `http://localhost:${LOCAL_SERVER_PORT}/${DIST_NAME}/${DEMOS_NAME}`; + if (componentName) { + serverUrl += `/${componentName}`; + } + + console.log(serverUrl); start('demos.serve'); } -function demosComponentsExists(): boolean { +function demosComponentsExists(folderInfo: any): boolean { + let componentPath = DIST_DEMOS_ROOT; + + if (folderInfo.componentName && folderInfo.componentTest) { + componentPath += `/${folderInfo.componentName}/build`; + } + try { - accessSync(DIST_DEMOS_COMPONENTS_ROOT, F_OK); + accessSync(componentPath, F_OK); } catch (e) { return false; } return true; } - -function getFolderInfo() { - let componentName: string = null; - let componentTest: string = null; - const folder: string = argv.folder || argv.f; - if (folder && folder.length) { - const folderSplit = folder.split('/'); - componentName = folderSplit[0]; - componentTest = (folderSplit.length > 1 ? folderSplit[1] : 'basic'); - } - return { - componentName: componentName, - componentTest: componentTest - }; -} \ No newline at end of file diff --git a/scripts/gulp/tasks/e2e.prod.ts b/scripts/gulp/tasks/e2e.prod.ts index 170a3bee1b..b335b246f9 100644 --- a/scripts/gulp/tasks/e2e.prod.ts +++ b/scripts/gulp/tasks/e2e.prod.ts @@ -12,10 +12,9 @@ import * as commonjs from 'rollup-plugin-commonjs'; import * as runSequence from 'run-sequence'; import { obj } from 'through2'; import * as VinylFile from 'vinyl'; -import { argv } from 'yargs'; import { DIST_E2E_COMPONENTS_ROOT, DIST_E2E_ROOT, DIST_NAME, E2E_NAME, ES5, ES_2015, LOCAL_SERVER_PORT, PROJECT_ROOT, SCRIPTS_ROOT, SRC_COMPONENTS_ROOT, SRC_ROOT } from '../constants'; -import { createTempTsConfig, deleteFiles, runNgc } from '../util'; +import { createTempTsConfig, deleteFiles, getFolderInfo, runNgc } from '../util'; task('e2e.prod', e2eBuild); @@ -109,7 +108,7 @@ function buildE2ETests(folderInfo: any, done: Function) { `./components/${folderInfo.componentName}/test/${folderInfo.componentTest}/entry.ts`, ]; } - createTempTsConfig(includeGlob, ES5, ES_2015, `${DIST_E2E_ROOT}/tsconfig.json`); + createTempTsConfig(includeGlob, ES5, ES_2015, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_E2E_ROOT}/tsconfig.json`); runNgc(`${DIST_E2E_ROOT}/tsconfig.json`, (err) => { if (err) { done(err); @@ -261,19 +260,4 @@ function e2eComponentsExists(): boolean { return false; } return true; -} - -function getFolderInfo() { - let componentName: string = null; - let componentTest: string = null; - const folder: string = argv.folder || argv.f; - if (folder && folder.length) { - const folderSplit = folder.split('/'); - componentName = folderSplit[0]; - componentTest = (folderSplit.length > 1 ? folderSplit[1] : 'basic'); - } - return { - componentName: componentName, - componentTest: componentTest - }; } \ No newline at end of file diff --git a/scripts/gulp/util.ts b/scripts/gulp/util.ts index c52df9c1eb..a52532db5c 100644 --- a/scripts/gulp/util.ts +++ b/scripts/gulp/util.ts @@ -9,6 +9,7 @@ import * as multiEntry from 'rollup-plugin-multi-entry'; import * as nodeResolve from 'rollup-plugin-node-resolve'; import * as through from 'through2'; import * as uglifyPlugin from 'rollup-plugin-uglify'; +import { argv } from 'yargs'; export function mergeObjects(obj1: any, obj2: any ) { if (! obj1) { @@ -27,15 +28,15 @@ export function mergeObjects(obj1: any, obj2: any ) { return obj3; } -function getRootTsConfig(): any { - const json = fs.readFileSync(`${PROJECT_ROOT}/tsconfig.json`); +function getRootTsConfig(pathToReadFile): any { + const json = fs.readFileSync(pathToReadFile); let tsConfig = JSON.parse(json.toString()); return tsConfig; } -export function createTempTsConfig(includeGlob: string[], target: string, moduleType: string, pathToWriteFile: string): any { - let config = getRootTsConfig(); +export function createTempTsConfig(includeGlob: string[], target: string, moduleType: string, pathToReadFile: string, pathToWriteFile: string): any { + let config = getRootTsConfig(pathToReadFile); if (!config.compilerOptions) { config.compilerOptions = {}; } @@ -272,3 +273,18 @@ function bundlePolyfill(pathsToIncludeInPolyfill: string[], outputPath: string) }); }); } + +export function getFolderInfo() { + let componentName: string = null; + let componentTest: string = null; + const folder: string = argv.folder || argv.f; + if (folder && folder.length) { + const folderSplit = folder.split('/'); + componentName = folderSplit[0]; + componentTest = (folderSplit.length > 1 ? folderSplit[1] : 'basic'); + } + return { + componentName: componentName, + componentTest: componentTest + }; +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index b321904b81..6134d3d982 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,4 +22,4 @@ "atom": { "rewriteTsconfig": false } -} +} \ No newline at end of file