diff --git a/src/Squidex/Startup.cs b/src/Squidex/Startup.cs index 0f34095de..6cab95e64 100644 --- a/src/Squidex/Startup.cs +++ b/src/Squidex/Startup.cs @@ -150,7 +150,7 @@ namespace Squidex private void MapAndUseFrontend(IApplicationBuilder app) { - if (Environment.IsDevelopment()) + if (!Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseWebpackProxy(); diff --git a/src/Squidex/app-config/webpack.config.js b/src/Squidex/app-config/webpack.config.js index 7efee6811..35bf88e71 100644 --- a/src/Squidex/app-config/webpack.config.js +++ b/src/Squidex/app-config/webpack.config.js @@ -48,7 +48,7 @@ module.exports = { loaders: ['awesome-typescript', 'angular2-router-loader', 'angular2-template-loader', 'tslint'] }, { test: /\.html$/, - loader: 'html' + loader: 'raw' }, { test: /\.(woff|woff2|ttf|eot)(\?.*$|$)/, loader: 'file?name=assets/[name].[hash].[ext]' diff --git a/src/Squidex/app-config/webpack.run.prod.js b/src/Squidex/app-config/webpack.run.prod.js index 5c65d3884..b4365c48f 100644 --- a/src/Squidex/app-config/webpack.run.prod.js +++ b/src/Squidex/app-config/webpack.run.prod.js @@ -1,12 +1,13 @@  var webpack = require('webpack'), webpackMerge = require('webpack-merge'), ExtractTextPlugin = require('extract-text-webpack-plugin'), + AotPlugin = require('@ngtools/webpack').AotPlugin, runConfig = require('./webpack.run.base.js'), helpers = require('./helpers'); var ENV = process.env.NODE_ENV = process.env.ENV = 'production'; -helpers.removeLoaders(runConfig, ['scss', 'png']); +helpers.removeLoaders(runConfig, ['scss', 'ts']); module.exports = webpackMerge(runConfig, { devtool: 'source-map', @@ -61,9 +62,9 @@ module.exports = webpackMerge(runConfig, { test: /\.scss$/, exclude: helpers.root('app', 'theme'), loaders: ['raw', helpers.root('app-config', 'clean-css-loader'), 'sass'] - }, { - test: /\.(png|jpe?g|gif|svg|ico)(\?.*$|$)/, - loaders: ['file?hash=sha512&digest=hex&name=assets/[name].[hash].[ext]', 'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'] + }, { + test: /\.ts/, + loaders: ['@ngtools/webpack'] } ] }, @@ -79,10 +80,22 @@ module.exports = webpackMerge(runConfig, { */ new ExtractTextPlugin('[name].[hash].css'), - new webpack.optimize.UglifyJsPlugin({ - mangle: { - screw_ie8: true, keep_fnames: true - } + new webpack.optimize.UglifyJsPlugin({ + beautify: false, + mangle: { + screw_ie8: true, + keep_fnames: true + }, + compress: { + warnings: false, + screw_ie8: true + }, + comments: false + }), + + new AotPlugin({ + tsConfigPath: './tsconfig.json', + entryModule: 'app/app.module#AppModule' }), ] }); \ No newline at end of file diff --git a/src/Squidex/app/app.routes.ts b/src/Squidex/app/app.routes.ts index d1f8334f3..b8d5bbf3a 100644 --- a/src/Squidex/app/app.routes.ts +++ b/src/Squidex/app/app.routes.ts @@ -22,8 +22,6 @@ import { MustBeNotAuthenticatedGuard } from './shared'; -import { SqxFeatureAppsModule } from './features/apps'; - export const routes: Routes = [ { path: '', @@ -36,7 +34,7 @@ export const routes: Routes = [ children: [ { path: '', - loadChildren: () => SqxFeatureAppsModule + loadChildren: './features/apps/module#SqxFeatureAppsModule' }, { path: ':appName', component: AppAreaComponent, @@ -53,7 +51,7 @@ export const routes: Routes = [ loadChildren: './features/media/module#SqxFeatureMediaModule' }, { path: 'schemas', - loadChildren: './features/schemas/module#SqxFeatureSchemaModule' + loadChildren: './features/schemas/module#SqxFeatureSchemasModule' }, { path: 'settings', loadChildren: './features/settings/module#SqxFeatureSettingsModule' diff --git a/src/Squidex/app/features/settings/pages/clients/client.component.ts b/src/Squidex/app/features/settings/pages/clients/client.component.ts index 74eb0af45..5a8eb3f51 100644 --- a/src/Squidex/app/features/settings/pages/clients/client.component.ts +++ b/src/Squidex/app/features/settings/pages/clients/client.component.ts @@ -6,7 +6,7 @@ */ import { Component, EventEmitter, Input, Output } from '@angular/core'; -import { FormBuilder } from '@angular/forms'; +import { FormBuilder, FormGroup } from '@angular/forms'; import { AccessTokenDto, @@ -56,7 +56,7 @@ export class ClientComponent { return this.client.secret; } - public renameForm = + public renameForm: FormGroup = this.formBuilder.group({ name: [''] }); diff --git a/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts b/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts index f47d5c6ed..313ff77a9 100644 --- a/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts +++ b/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts @@ -6,7 +6,7 @@ */ import { Component, OnInit } from '@angular/core'; -import { FormBuilder, Validators } from '@angular/forms'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { AppClientDto, @@ -32,7 +32,7 @@ function rename(client: AppClientDto, name: string) { export class ClientsPageComponent extends AppComponentBase implements OnInit { public appClients: ImmutableArray; - public createForm = + public createForm: FormGroup = this.formBuilder.group({ name: ['', [ diff --git a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts index c2057eab0..3ce695750 100644 --- a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts +++ b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts @@ -23,7 +23,7 @@ import { UsersService } from 'shared'; -class UsersDataSource implements AutocompleteSource { +export class UsersDataSource implements AutocompleteSource { constructor( private readonly usersService: UsersService, private readonly component: ContributorsPageComponent diff --git a/src/Squidex/app/framework/angular/autocomplete.component.ts b/src/Squidex/app/framework/angular/autocomplete.component.ts index 714b2053a..f3310cb2a 100644 --- a/src/Squidex/app/framework/angular/autocomplete.component.ts +++ b/src/Squidex/app/framework/angular/autocomplete.component.ts @@ -33,9 +33,7 @@ const NOOP = () => { }; export const SQX_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => { - return AutocompleteComponent; - }), + useExisting: forwardRef(() => AutocompleteComponent), multi: true }; diff --git a/src/Squidex/app/framework/angular/http-utils.ts b/src/Squidex/app/framework/angular/http-utils.ts index 637692353..dbf127a13 100644 --- a/src/Squidex/app/framework/angular/http-utils.ts +++ b/src/Squidex/app/framework/angular/http-utils.ts @@ -49,7 +49,7 @@ export class ErrorDto { } } -export function handleError(message: string, error: Response | any) { +export function handleError(message: string, error: Response | any): Observable { let result = new ErrorDto(500, message); if (error instanceof Response && error.status !== 500) { diff --git a/src/Squidex/app/framework/angular/image-drop.directive.ts b/src/Squidex/app/framework/angular/image-drop.directive.ts index 447252c6d..b974cb5ae 100644 --- a/src/Squidex/app/framework/angular/image-drop.directive.ts +++ b/src/Squidex/app/framework/angular/image-drop.directive.ts @@ -124,6 +124,6 @@ function isFunction(obj: any): boolean { return !!(obj && obj.constructor && obj.call && obj.apply); }; -interface DragDropEvent extends MouseEvent { +export interface DragDropEvent extends MouseEvent { readonly dataTransfer: DataTransfer; } \ No newline at end of file diff --git a/src/Squidex/app/shared/components/app-form.component.ts b/src/Squidex/app/shared/components/app-form.component.ts index 0657cf4b5..01110eb29 100644 --- a/src/Squidex/app/shared/components/app-form.component.ts +++ b/src/Squidex/app/shared/components/app-form.component.ts @@ -6,7 +6,7 @@ */ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { FormBuilder, Validators } from '@angular/forms'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { fadeAnimation } from 'framework'; @@ -34,7 +34,7 @@ export class AppFormComponent implements OnInit { public cancelled = new EventEmitter(); public creationError = ''; - public createForm = + public createForm: FormGroup = this.formBuilder.group({ name: ['', [ diff --git a/src/Squidex/app/shell/pages/home/home-page.component.html b/src/Squidex/app/shell/pages/home/home-page.component.html index 12604b098..2e769ac67 100644 --- a/src/Squidex/app/shell/pages/home/home-page.component.html +++ b/src/Squidex/app/shell/pages/home/home-page.component.html @@ -1,5 +1,5 @@
- + diff --git a/src/Squidex/app/vendor.ts b/src/Squidex/app/vendor.ts index 458ac1155..59e747af5 100644 --- a/src/Squidex/app/vendor.ts +++ b/src/Squidex/app/vendor.ts @@ -5,21 +5,5 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -/* tslint:disable ordered-imports */ - -// Angular 2 -import '@angular/platform-browser'; -import '@angular/platform-browser-dynamic'; -import '@angular/core'; -import '@angular/common'; -import '@angular/http'; -import '@angular/forms'; -import '@angular/router'; - -// Additional libs -import 'rxjs'; -import 'moment'; -import 'oidc-client'; - // Bootstrap import 'theme/vendor.scss'; \ No newline at end of file diff --git a/src/Squidex/package.json b/src/Squidex/package.json index 9fdc68792..74c4364a8 100644 --- a/src/Squidex/package.json +++ b/src/Squidex/package.json @@ -9,33 +9,31 @@ "test:coverage": "karma start karma.coverage.conf.js", "test:clean": "rimraf _test-output", "dev": "cpx node_modules/oidc-client/dist/oidc-client.min.js wwwroot/scripts/ & webpack-dev-server --config app-config/webpack.run.dev.js --inline --hot --port 3000", - "build": "webpack --config app-config/webpack.run.prod.js --bail", + "build": "webpack --config app-config/webpack.run.prod.js --display-error-details", "build:copy": "cpx node_modules/oidc-client/dist/oidc-client.min.js wwwroot/scripts/", "build:clean": "rimraf wwwroot/build" }, "dependencies": { - "@angular/common": "^2", - "@angular/compiler": "^2", - "@angular/core": "^2", - "@angular/forms": "^2", - "@angular/http": "^2", - "@angular/platform-browser": "^2", - "@angular/platform-browser-dynamic": "^2", - "@angular/router": "^3", - "babel-polyfill": "^6.16.0", + "@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/router": "3.2.3", "bootstrap": "^4.0.0-alpha.2", "core-js": "^2.4.1", - "moment": "^2.17.0", + "moment": "^2.17.1", "mousetrap": "^1.6.0", "oidc-client": "^1.2.2", - "reflect-metadata": "^0.1.8", "rxjs": "5.0.0-beta.12", "zone.js": "^0.6.23" }, "devDependencies": { - "@angular/compiler-cli": "^2.2.3", - "@ngtools/webpack": "^1.1.6", - "@types/core-js": "^0.9.34", + "@angular/compiler-cli": "2.2.3", + "@ngtools/webpack": "^1.1.9", + "@types/core-js": "^0.9.35", "@types/jasmine": "^2.5.38", "@types/mousetrap": "^1.5.32", "@types/node": "^6.0.51", @@ -43,13 +41,12 @@ "angular2-template-loader": "^0.6.0", "awesome-typescript-loader": "^2.2.4", "cpx": "^1.5.0", - "css-loader": "^0.26.0", + "css-loader": "^0.26.1", "exports-loader": "^0.6.3", "extract-text-webpack-plugin": "^2.0.0-beta.4", "file-loader": "^0.9.0", "html-loader": "^0.4.4", "html-webpack-plugin": "^2.24.1", - "image-webpack-loader": "^3.0.0", "istanbul-instrumenter-loader": "^0.2.0", "jasmine-core": "^2.5.2", "karma": "^1.3.0", @@ -62,7 +59,7 @@ "karma-phantomjs-launcher": "^1.0.2", "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^1.8.0", - "node-sass": "^3.13.0", + "node-sass": "^3.4.2", "null-loader": "^0.1.1", "phantomjs-prebuilt": "^2.1.13", "raw-loader": "^0.5.1", diff --git a/src/Squidex/tsconfig.json b/src/Squidex/tsconfig.json index 84b9ce9b1..c5fec859d 100644 --- a/src/Squidex/tsconfig.json +++ b/src/Squidex/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "es5", - "module": "commonjs", + "module": "es2015", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, @@ -14,7 +14,9 @@ "suppressImplicitAnyIndexErrors": true, "baseUrl": ".", "paths": { - "*": ["*", "app/*"] + "framework": ["app/framework"], + "features": ["app/features"], + "shared": ["app/shared"] } } } \ No newline at end of file diff --git a/src/Squidex/app/images/loader.gif b/src/Squidex/wwwroot/images/loader.gif similarity index 100% rename from src/Squidex/app/images/loader.gif rename to src/Squidex/wwwroot/images/loader.gif diff --git a/src/Squidex/app/images/logo.png b/src/Squidex/wwwroot/images/logo.png similarity index 100% rename from src/Squidex/app/images/logo.png rename to src/Squidex/wwwroot/images/logo.png diff --git a/src/Squidex/wwwroot/index.html b/src/Squidex/wwwroot/index.html index b35ff0ddf..b7d53ffbe 100644 --- a/src/Squidex/wwwroot/index.html +++ b/src/Squidex/wwwroot/index.html @@ -36,7 +36,7 @@
- +
Loading awesomeness
diff --git a/src/Squidex/wwwroot/loader.gif b/src/Squidex/wwwroot/loader.gif deleted file mode 100644 index 0a8226a3b..000000000 Binary files a/src/Squidex/wwwroot/loader.gif and /dev/null differ