feat(aot) - updated aot build

feat(aot) - fixed build

fix(aot) - fixed buttons and modals providers

fix(changes ) - remove unused changes
This commit is contained in:
ESadouski 2017-01-10 11:32:26 +03:00 committed by Alexander Zhukov
parent d89d176e54
commit 4112676ae9
19 changed files with 167 additions and 66 deletions

View file

@ -3,6 +3,8 @@
*/
var path = require('path');
const EVENT = process.env.npm_lifecycle_event || '';
// Helper functions
var ROOT = path.resolve(__dirname, '..');
@ -10,6 +12,10 @@ function hasProcessFlag(flag) {
return process.argv.join('').indexOf(flag) > -1;
}
function hasNpmFlag(flag) {
return EVENT.includes(flag);
}
function isWebpackDevServer() {
return process.argv[1] && !! (/webpack-dev-server/.exec(process.argv[1]));
}
@ -20,5 +26,6 @@ function root(args) {
}
exports.hasProcessFlag = hasProcessFlag;
exports.hasNpmFlag = hasNpmFlag;
exports.isWebpackDevServer = isWebpackDevServer;
exports.root = root;

View file

@ -10,18 +10,21 @@ const AssetsPlugin = require('assets-webpack-plugin');
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
const HtmlElementsPlugin = require('./html-elements-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const ngcWebpack = require('ngc-webpack');
/*
* Webpack Constants
*/
const HMR = helpers.hasProcessFlag('hot');
const AOT = helpers.hasNpmFlag('aot');
const METADATA = {
title: 'ng2-admin - Angular 2 Admin Template',
description: 'Free Angular 2 and Bootstrap 4 Admin Template',
@ -57,8 +60,7 @@ module.exports = function (options) {
'polyfills': './src/polyfills.browser.ts',
'vendor': './src/vendor.browser.ts',
'main': './src/main.browser.ts'
'main': AOT ? './src/main.browser.aot.ts' : './src/main.browser.ts'
},
/*
@ -110,9 +112,9 @@ module.exports = function (options) {
test: /\.ts$/,
use: [
'@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd,
'awesome-typescript-loader',
'awesome-typescript-loader?{configFileName: "tsconfig.webpack.json"}',
'angular2-template-loader',
'angular2-router-loader'
'angular-router-loader?loader=system&genDir=compiled/src/app&aot=' + AOT
],
exclude: [/\.(spec|e2e)\.ts$/]
},
@ -210,7 +212,7 @@ module.exports = function (options) {
*
* See: https://github.com/s-panferov/awesome-typescript-loader#forkchecker-boolean-defaultfalse
*/
new ForkCheckerPlugin(),
new CheckerPlugin(),
/*
* Plugin: CommonsChunkPlugin
* Description: Shares common code between the pages.
@ -219,6 +221,17 @@ module.exports = function (options) {
* See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin
* See: https://github.com/webpack/docs/wiki/optimization#multi-page-app
*/
new CommonsChunkPlugin({
name: 'polyfills',
chunks: ['polyfills']
}),
// This enables tree shaking of the vendor modules
new CommonsChunkPlugin({
name: 'vendor',
chunks: ['main'],
minChunks: module => /node_modules\//.test(module.resource)
}),
// Specify the correct order the scripts will be injected in
new CommonsChunkPlugin({
name: ['polyfills', 'vendor'].reverse()
}),
@ -350,7 +363,13 @@ module.exports = function (options) {
new NormalModuleReplacementPlugin(
/facade(\\|\/)math/,
helpers.root('node_modules/@angular/core/src/facade/math.js')
)
),
new ngcWebpack.NgcWebpackPlugin({
disabled: !AOT,
tsConfig: helpers.root('tsconfig.webpack.json'),
resourceOverride: helpers.root('config/resource-override.js')
})
],
/*

View file

@ -7,6 +7,7 @@ const commonConfig = require('./webpack.common.js'); // the settings that are co
*/
const DedupePlugin = require('webpack/lib/optimize/DedupePlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const IgnorePlugin = require('webpack/lib/IgnorePlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');

View file

@ -7,15 +7,15 @@
"license": "MIT",
"dependencies": {
"@angular/common": "2.2.3",
"@angular/compiler": "2.2.3",
"@angular/core": "2.2.3",
"@angular/forms": "2.2.3",
"@angular/http": "2.2.3",
"@angular/platform-browser": "2.2.3",
"@angular/platform-browser-dynamic": "2.2.3",
"@angular/platform-server": "2.2.3",
"@angular/router": "3.2.3",
"@angular/common": "~2.4.1",
"@angular/compiler": "~2.4.1",
"@angular/core": "~2.4.1",
"@angular/forms": "~2.4.1",
"@angular/http": "~2.4.1",
"@angular/platform-browser": "~2.4.1",
"@angular/platform-browser-dynamic": "~2.4.1",
"@angular/platform-server": "~2.4.1",
"@angular/router": "~3.4.1",
"@angularclass/conventions-loader": "^1.0.2",
"@angularclass/hmr": "~1.2.2",
@ -26,13 +26,13 @@
"animate.css": "^3.5.1",
"assets-webpack-plugin": "^3.4.0",
"bootstrap": "4.0.0-alpha.4",
"bootstrap-loader": "2.0.0-beta.12",
"bootstrap-loader": "2.0.0-beta.18",
"chart.js": "^1.1.1",
"chartist": "^0.9.7",
"ckeditor": "4.6.0",
"core-js": "^2.4.1",
"easy-pie-chart": "^2.1.7",
"extract-text-webpack-plugin": "2.0.0-beta.3",
"extract-text-webpack-plugin": "~2.0.0-beta.4",
"font-awesome": "^4.6.3",
"font-awesome-sass-loader": "^1.0.2",
"fullcalendar": "^2.7.2",
@ -46,20 +46,22 @@
"leaflet": "^0.7.7",
"leaflet-map": "^0.2.1",
"lodash": "^4.12.0",
"ng2-bootstrap": "1.1.16",
"ng2-bootstrap": "1.1.16-11",
"ng2-ckeditor": "1.1.4",
"ng2-smart-table": "^0.3.2",
"ng2-tree": "^0.0.2-7",
"ng2-uploader": "1.6.1",
"normalize.css": "^4.1.1",
"postcss-loader": "^1.0.0",
"rxjs": "5.0.0-beta.12",
"rxjs": "~5.0.2",
"tether": "^1.2.4",
"zone.js": "~0.7.1"
"zone.js": "~0.7.4",
"reflect-metadata": "^0.1.9"
},
"devDependencies": {
"@ngtools/webpack": "1.1.9",
"@angular/compiler-cli": "2.2.3",
"@angular/compiler-cli": "~2.4.1",
"angular-router-loader": "^0.4.0",
"angular2-router-loader": "^0.3.4",
"angular2-template-loader": "^0.6.0",
"@types/electron": "^1.3.20",
@ -68,45 +70,48 @@
"@types/node": "^6.0.38",
"@types/source-map": "^0.1.27",
"@types/uglify-js": "^2.0.27",
"@types/webpack": "2.0.0",
"@types/webpack": "^2.0.0",
"@types/lodash": "0.0.28",
"@types/jquery ": "^2.0.33",
"@types/fullcalendar": "^2.7.35",
"@types/jquery.slimscroll": "^1.3.30",
"gh-pages": "^0.11.0",
"parse5": "^2.2.2",
"ngc-webpack": "1.1.0",
"npm-run-all": "^4.0.0",
"parse5": "^3.0.1",
"rimraf": "~2.5.4",
"script-ext-html-webpack-plugin": "^1.3.2",
"codelyzer": "~1.0.0-beta.4",
"tslint": "3.15.1",
"ts-helpers": "1.1.2",
"ts-node": "^1.7.0",
"ts-node": "^2.0.0",
"typedoc": "^0.5.0",
"typescript": "2.0.3",
"awesome-typescript-loader": "^2.2.1",
"typescript": "2.0.10",
"awesome-typescript-loader": "~3.0.0-beta.17",
"tslint-loader": "^2.1.3",
"url-loader": "^0.5.7",
"style-loader": "^0.13.1",
"raw-loader": "0.5.1",
"source-map-loader": "^0.1.5",
"string-replace-loader": "1.0.5",
"imports-loader": "^0.6.5",
"imports-loader": "^0.7.0",
"json-loader": "^0.5.4",
"css-loader": "^0.25.0",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"file-loader": "^0.9.0",
"to-string-loader": "^1.1.4",
"sass-loader": "^4.0.2",
"sass-loader": "^4.1.1",
"resolve-url-loader": "^1.4.3",
"node-sass": "^3.5.3",
"ng-router-loader": "^1.0.2",
"node-sass": "^4.1.1",
"html-webpack-plugin": "^2.21.0",
"copy-webpack-plugin": "^3.0.1",
"v8-lazy-parse-webpack-plugin": "^0.3.0",
"webpack": "2.1.0-beta.27",
"webpack": "2.2.0-rc.3",
"webpack-dashboard": "^0.1.8",
"webpack-dev-middleware": "^1.6.1",
"webpack-dev-server": "2.1.0-beta.11",
"webpack-dev-server": "2.2.0-rc.0",
"webpack-md5-hash": "^0.0.5",
"webpack-merge": "^0.17.0",
"compression-webpack-plugin": "^0.3.1",
@ -122,7 +127,7 @@
"webpack": "webpack --progress --profile --bail",
"webpack-dev-server": "webpack-dev-server",
"webdriver-manager": "webdriver-manager",
"clean": "npm cache clean && npm run rimraf -- node_modules doc coverage dist",
"clean": "npm cache clean && npm run rimraf -- node_modules doc coverage dist compiled",
"clean:dist": "npm run rimraf -- dist",
"clean:electron": "npm run rimraf -- build",
"preclean:install": "npm run clean",
@ -135,13 +140,15 @@
"watch:prod": "npm run build:prod -- --watch",
"build": "npm run build:dev",
"prebuild:dev": "npm run clean:dist",
"build:dev": "npm run webpack -- --config config/webpack.dev.js",
"build:dev": " npm run clean:dist && npm run webpack -- --config config/webpack.dev.js",
"prebuild:prod": "npm run clean:dist",
"build:prod": "npm run webpack -- --config config/webpack.prod.js",
"build:prod": "npm run clean:dist && webpack --config config/webpack.prod.js --progress --profile --bail",
"server": "npm run server:dev",
"server:dev": "webpack-dev-server --config config/webpack.dev.js --progress --profile --watch --content-base src/",
"server:dev:hmr": "npm run server:dev -- --inline --hot",
"server:prod": "http-server dist --cors",
"server:prod": "http-server dist -c-1 --cors",
"server:test": "http-server dist-demo -c-1 --cors",
"server:prod:ci": "http-server dist -p 3000 -c-1 --cors",
"webdriver:update": "npm run webdriver-manager update",
"webdriver:start": "npm run webdriver-manager start",
"lint": "npm run tslint \"src/**/*.ts\" --force",
@ -160,8 +167,17 @@
"build:electron.renderer": "npm run webpack -- --config config/electron/webpack.renderer.prod.js",
"build:electron.main": "npm run webpack -- --config config/electron/webpack.electron.prod.js",
"electron:start": "electron build",
"prebuild:aot": "npm run clean:dist",
"build:aot": "webpack --config config/webpack.aot.js --progress --profile"
"build:aot:prod": "npm run clean:dist && npm run clean:aot && webpack --config config/webpack.prod.js --progress --profile",
"build:aot": "npm run build:aot:prod",
"ci:aot": "npm run lint && npm run test && npm run build:aot && npm run e2e",
"ci:jit": "npm run lint && npm run test && npm run build:prod && npm run e2e",
"ci:nobuild": "npm run lint && npm test && npm run e2e",
"ci:testall": "npm run lint && npm run test && npm run build:prod && npm run e2e && npm run build:aot && npm run e2e",
"ci": "npm run ci:testall",
"clean:aot": "npm run rimraf -- compiled",
"e2e": "npm-run-all -p -r server:prod:ci e2e:only",
"e2e:only": "npm run protractor"
},
"repository": {
"type": "git",

View file

@ -57,4 +57,5 @@ export class App {
// register some loaders
BaThemePreloader.registerLoader(this._imageLoader.load(layoutPaths.images.root + 'sky-bg.jpg'));
}
}

View file

@ -19,6 +19,8 @@ export class CheckboxInputs {
class: 'col-md-4'
}];
isDisabled: boolean = false;
public checkboxPropertiesMapping = {
model: 'checked',
value: 'name',

View file

@ -6,11 +6,11 @@ import { Component } from '@angular/core';
})
export class Rating {
private _rate1:number = 3;
private _rate2:number = 4;
public _rate1:number = 3;
public _rate2:number = 4;
private _max1:number = 5;
private _max2:number = 10;
public _max1:number = 5;
public _max2:number = 10;
constructor() {
}

View file

@ -8,4 +8,6 @@ export class BasicForm {
constructor() {
}
isChecked: boolean = false;
}

View file

@ -8,4 +8,6 @@ export class HorizontalForm {
constructor() {
}
isRemember: boolean = false;
}

View file

@ -9,4 +9,6 @@ export class InlineForm {
constructor() {
}
isRemember: boolean = false;
}

View file

@ -8,25 +8,25 @@ import { ModuleWithProviders } from '@angular/core';
export const routes: Routes = [
{
path: 'login',
loadChildren: 'app/pages/login/login.module#LoginModule'
loadChildren: './pages/login/login.module#LoginModule'
},
{
path: 'register',
loadChildren: 'app/pages/register/register.module#RegisterModule'
loadChildren: './pages/register/register.module#RegisterModule'
},
{
path: 'pages',
component: Pages,
children: [
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
{ path: 'dashboard', loadChildren: 'app/pages/dashboard/dashboard.module#DashboardModule' },
{ path: 'editors', loadChildren: 'app/pages/editors/editors.module#EditorsModule' },
// //{ path: 'components', loadChildren: 'app/pages/components/components.module') }
{ path: 'charts', loadChildren: 'app/pages/charts/charts.module#ChartsModule' },
{ path: 'ui', loadChildren: 'app/pages/ui/ui.module#UiModule' },
{ path: 'forms', loadChildren: 'app/pages/forms/forms.module#FormsModule' },
{ path: 'tables', loadChildren: 'app/pages/tables/tables.module#TablesModule' },
{ path: 'maps', loadChildren: 'app/pages/maps/maps.module#MapsModule' }
{ path: 'dashboard', loadChildren: './pages/dashboard/dashboard.module#DashboardModule' },
{ path: 'editors', loadChildren: './pages/editors/editors.module#EditorsModule' },
// //{ path: 'components', loadChildren: './pages/components/components.module') }
{ path: 'charts', loadChildren: './pages/charts/charts.module#ChartsModule' },
{ path: 'ui', loadChildren: './pages/ui/ui.module#UiModule' },
{ path: 'forms', loadChildren: './pages/forms/forms.module#FormsModule' },
{ path: 'tables', loadChildren: './pages/tables/tables.module#TablesModule' },
{ path: 'maps', loadChildren: './pages/maps/maps.module#MapsModule' }
]
}
];

View file

@ -18,7 +18,7 @@ export class BaAmChart {
@Input() baAmChartClass:string;
@Output() onChartReady = new EventEmitter<any>();
@ViewChild('baAmChart') private _selector:ElementRef;
@ViewChild('baAmChart') public _selector:ElementRef;
constructor (private _baAmChartThemeService:BaAmChartThemeService) {
this._loadChartsLib();

View file

@ -24,7 +24,7 @@ export class BaChartistChart {
@Input() baChartistChartClass:string;
@Output() onChartReady = new EventEmitter<any>();
@ViewChild('baChartistChart') private _selector:ElementRef;
@ViewChild('baChartistChart') public _selector:ElementRef;
private chart;
@ -33,7 +33,7 @@ export class BaChartistChart {
this.onChartReady.emit(this.chart);
}
ngOnChanges() {
ngOnChanges(changes) {
if (this.chart) {
(<any>this.chart).update(this.baChartistChartData, this.baChartistChartOptions);
}

View file

@ -13,7 +13,7 @@ export class BaFullCalendar {
@Input() baFullCalendarClass:string;
@Output() onCalendarReady = new EventEmitter<any>();
@ViewChild('baFullCalendar') private _selector:ElementRef;
@ViewChild('baFullCalendar') public _selector:ElementRef;
ngAfterViewInit() {
let calendar = jQuery(this._selector.nativeElement).fullCalendar(this.baFullCalendarConfiguration);

View file

@ -18,7 +18,7 @@ export class BaPictureUploader {
onUpload:EventEmitter<any> = new EventEmitter();
onUploadCompleted:EventEmitter<any> = new EventEmitter();
@ViewChild('fileUpload') protected _fileUpload:ElementRef;
@ViewChild('fileUpload') public _fileUpload:ElementRef;
public uploadInProgress:boolean = false;

View file

@ -1,7 +1,7 @@
<div class="picture-group" [ngClass]="{uploading: uploadInProgress}">
<div class="picture-wrapper" (click)="bringFileSelector();">
<img src="{{ picture }}" *ngIf="picture">
<img src="{{ defaultPicture }}" *ngIf="!picture && defaultPicture">
<img src="{{ defaultPicture }}" ngIf="{{!picture && defaultPicture}}">
<div class="loading" *ngIf="uploadInProgress">
<div class="spinner">

View file

@ -3,12 +3,12 @@
*/
import { platformBrowser } from '@angular/platform-browser';
import { decorateModuleRef } from './app/environment';
import { bootloader } from '@angularclass/hmr';
/*
* App Module
* our top level module that holds all of our components
*/
import { AppModuleNgFactory } from './app/app.module.ngfactory';
import { AppModuleNgFactory } from '../compiled/src/app/app.module.ngfactory';
/*
* Bootstrap our Angular app with a top level NgModule
*/
@ -17,8 +17,10 @@ export function main(): Promise<any> {
.bootstrapModuleFactory(AppModuleNgFactory)
.then(decorateModuleRef)
.catch(err => console.error(err));
}
export function bootstrapDomReady() {
document.addEventListener('DOMContentLoaded', main);
}
bootloader(main);
bootstrapDomReady();

View file

@ -7,6 +7,7 @@
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"strictNullChecks": false,
"baseUrl": "./src",
@ -18,12 +19,12 @@
],
"types": [
"hammerjs",
"jasmine",
"node",
"selenium-webdriver",
"source-map",
"uglify-js",
"webpack",
"fullcalendar",
"jquery.slimscroll"
"webpack"
]
},
"exclude": [

46
tsconfig.webpack.json Normal file
View file

@ -0,0 +1,46 @@
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"strictNullChecks": false,
"baseUrl": "./src",
"paths": {
},
"lib": [
"es2015",
"dom"
],
"types": [
"hammerjs",
"node",
"source-map",
"webpack",
"fullcalendar",
"jquery.slimscroll"
]
},
"exclude": [
"node_modules",
"dist",
"src/**/*.spec.ts",
"src/**/*.e2e.ts"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"angularCompilerOptions": {
"genDir": "./compiled",
"skipMetadataEmit": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
}