Browse Source

AOT

pull/1/head
Sebastian 9 years ago
parent
commit
abec1f733e
  1. 2
      src/Squidex/Startup.cs
  2. 2
      src/Squidex/app-config/webpack.config.js
  3. 29
      src/Squidex/app-config/webpack.run.prod.js
  4. 6
      src/Squidex/app/app.routes.ts
  5. 4
      src/Squidex/app/features/settings/pages/clients/client.component.ts
  6. 4
      src/Squidex/app/features/settings/pages/clients/clients-page.component.ts
  7. 2
      src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts
  8. 4
      src/Squidex/app/framework/angular/autocomplete.component.ts
  9. 2
      src/Squidex/app/framework/angular/http-utils.ts
  10. 2
      src/Squidex/app/framework/angular/image-drop.directive.ts
  11. 4
      src/Squidex/app/shared/components/app-form.component.ts
  12. 2
      src/Squidex/app/shell/pages/home/home-page.component.html
  13. 16
      src/Squidex/app/vendor.ts
  14. 33
      src/Squidex/package.json
  15. 6
      src/Squidex/tsconfig.json
  16. 0
      src/Squidex/wwwroot/images/loader.gif
  17. 0
      src/Squidex/wwwroot/images/logo.png
  18. 2
      src/Squidex/wwwroot/index.html
  19. BIN
      src/Squidex/wwwroot/loader.gif

2
src/Squidex/Startup.cs

@ -150,7 +150,7 @@ namespace Squidex
private void MapAndUseFrontend(IApplicationBuilder app) private void MapAndUseFrontend(IApplicationBuilder app)
{ {
if (Environment.IsDevelopment()) if (!Environment.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
app.UseWebpackProxy(); app.UseWebpackProxy();

2
src/Squidex/app-config/webpack.config.js

@ -48,7 +48,7 @@ module.exports = {
loaders: ['awesome-typescript', 'angular2-router-loader', 'angular2-template-loader', 'tslint'] loaders: ['awesome-typescript', 'angular2-router-loader', 'angular2-template-loader', 'tslint']
}, { }, {
test: /\.html$/, test: /\.html$/,
loader: 'html' loader: 'raw'
}, { }, {
test: /\.(woff|woff2|ttf|eot)(\?.*$|$)/, test: /\.(woff|woff2|ttf|eot)(\?.*$|$)/,
loader: 'file?name=assets/[name].[hash].[ext]' loader: 'file?name=assets/[name].[hash].[ext]'

29
src/Squidex/app-config/webpack.run.prod.js

@ -1,12 +1,13 @@
 var webpack = require('webpack'),  var webpack = require('webpack'),
webpackMerge = require('webpack-merge'), webpackMerge = require('webpack-merge'),
ExtractTextPlugin = require('extract-text-webpack-plugin'), ExtractTextPlugin = require('extract-text-webpack-plugin'),
AotPlugin = require('@ngtools/webpack').AotPlugin,
runConfig = require('./webpack.run.base.js'), runConfig = require('./webpack.run.base.js'),
helpers = require('./helpers'); helpers = require('./helpers');
var ENV = process.env.NODE_ENV = process.env.ENV = 'production'; var ENV = process.env.NODE_ENV = process.env.ENV = 'production';
helpers.removeLoaders(runConfig, ['scss', 'png']); helpers.removeLoaders(runConfig, ['scss', 'ts']);
module.exports = webpackMerge(runConfig, { module.exports = webpackMerge(runConfig, {
devtool: 'source-map', devtool: 'source-map',
@ -61,9 +62,9 @@ module.exports = webpackMerge(runConfig, {
test: /\.scss$/, test: /\.scss$/,
exclude: helpers.root('app', 'theme'), exclude: helpers.root('app', 'theme'),
loaders: ['raw', helpers.root('app-config', 'clean-css-loader'), 'sass'] loaders: ['raw', helpers.root('app-config', 'clean-css-loader'), 'sass']
}, { }, {
test: /\.(png|jpe?g|gif|svg|ico)(\?.*$|$)/, test: /\.ts/,
loaders: ['file?hash=sha512&digest=hex&name=assets/[name].[hash].[ext]', 'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'] loaders: ['@ngtools/webpack']
} }
] ]
}, },
@ -79,10 +80,22 @@ module.exports = webpackMerge(runConfig, {
*/ */
new ExtractTextPlugin('[name].[hash].css'), new ExtractTextPlugin('[name].[hash].css'),
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({
mangle: { beautify: false,
screw_ie8: true, keep_fnames: true 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'
}), }),
] ]
}); });

6
src/Squidex/app/app.routes.ts

@ -22,8 +22,6 @@ import {
MustBeNotAuthenticatedGuard MustBeNotAuthenticatedGuard
} from './shared'; } from './shared';
import { SqxFeatureAppsModule } from './features/apps';
export const routes: Routes = [ export const routes: Routes = [
{ {
path: '', path: '',
@ -36,7 +34,7 @@ export const routes: Routes = [
children: [ children: [
{ {
path: '', path: '',
loadChildren: () => SqxFeatureAppsModule loadChildren: './features/apps/module#SqxFeatureAppsModule'
}, { }, {
path: ':appName', path: ':appName',
component: AppAreaComponent, component: AppAreaComponent,
@ -53,7 +51,7 @@ export const routes: Routes = [
loadChildren: './features/media/module#SqxFeatureMediaModule' loadChildren: './features/media/module#SqxFeatureMediaModule'
}, { }, {
path: 'schemas', path: 'schemas',
loadChildren: './features/schemas/module#SqxFeatureSchemaModule' loadChildren: './features/schemas/module#SqxFeatureSchemasModule'
}, { }, {
path: 'settings', path: 'settings',
loadChildren: './features/settings/module#SqxFeatureSettingsModule' loadChildren: './features/settings/module#SqxFeatureSettingsModule'

4
src/Squidex/app/features/settings/pages/clients/client.component.ts

@ -6,7 +6,7 @@
*/ */
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder } from '@angular/forms'; import { FormBuilder, FormGroup } from '@angular/forms';
import { import {
AccessTokenDto, AccessTokenDto,
@ -56,7 +56,7 @@ export class ClientComponent {
return this.client.secret; return this.client.secret;
} }
public renameForm = public renameForm: FormGroup =
this.formBuilder.group({ this.formBuilder.group({
name: [''] name: ['']
}); });

4
src/Squidex/app/features/settings/pages/clients/clients-page.component.ts

@ -6,7 +6,7 @@
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { import {
AppClientDto, AppClientDto,
@ -32,7 +32,7 @@ function rename(client: AppClientDto, name: string) {
export class ClientsPageComponent extends AppComponentBase implements OnInit { export class ClientsPageComponent extends AppComponentBase implements OnInit {
public appClients: ImmutableArray<AppClientDto>; public appClients: ImmutableArray<AppClientDto>;
public createForm = public createForm: FormGroup =
this.formBuilder.group({ this.formBuilder.group({
name: ['', name: ['',
[ [

2
src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts

@ -23,7 +23,7 @@ import {
UsersService UsersService
} from 'shared'; } from 'shared';
class UsersDataSource implements AutocompleteSource { export class UsersDataSource implements AutocompleteSource {
constructor( constructor(
private readonly usersService: UsersService, private readonly usersService: UsersService,
private readonly component: ContributorsPageComponent private readonly component: ContributorsPageComponent

4
src/Squidex/app/framework/angular/autocomplete.component.ts

@ -33,9 +33,7 @@ const NOOP = () => { };
export const SQX_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR: any = { export const SQX_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR, provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => { useExisting: forwardRef(() => AutocompleteComponent),
return AutocompleteComponent;
}),
multi: true multi: true
}; };

2
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<any> {
let result = new ErrorDto(500, message); let result = new ErrorDto(500, message);
if (error instanceof Response && error.status !== 500) { if (error instanceof Response && error.status !== 500) {

2
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); return !!(obj && obj.constructor && obj.call && obj.apply);
}; };
interface DragDropEvent extends MouseEvent { export interface DragDropEvent extends MouseEvent {
readonly dataTransfer: DataTransfer; readonly dataTransfer: DataTransfer;
} }

4
src/Squidex/app/shared/components/app-form.component.ts

@ -6,7 +6,7 @@
*/ */
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; 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'; import { fadeAnimation } from 'framework';
@ -34,7 +34,7 @@ export class AppFormComponent implements OnInit {
public cancelled = new EventEmitter(); public cancelled = new EventEmitter();
public creationError = ''; public creationError = '';
public createForm = public createForm: FormGroup =
this.formBuilder.group({ this.formBuilder.group({
name: ['', name: ['',
[ [

2
src/Squidex/app/shell/pages/home/home-page.component.html

@ -1,5 +1,5 @@
<div class="content"> <div class="content">
<img class="logo" src="/logo.png" /> <img class="logo" src="/images/logo.png" />
<button class="btn btn-primary btn-lg login-button" (click)="login()">Login to Squidex</button> <button class="btn btn-primary btn-lg login-button" (click)="login()">Login to Squidex</button>

16
src/Squidex/app/vendor.ts

@ -5,21 +5,5 @@
* Copyright (c) Sebastian Stehle. All rights reserved * 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 // Bootstrap
import 'theme/vendor.scss'; import 'theme/vendor.scss';

33
src/Squidex/package.json

@ -9,33 +9,31 @@
"test:coverage": "karma start karma.coverage.conf.js", "test:coverage": "karma start karma.coverage.conf.js",
"test:clean": "rimraf _test-output", "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", "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:copy": "cpx node_modules/oidc-client/dist/oidc-client.min.js wwwroot/scripts/",
"build:clean": "rimraf wwwroot/build" "build:clean": "rimraf wwwroot/build"
}, },
"dependencies": { "dependencies": {
"@angular/common": "^2", "@angular/common": "2.2.3",
"@angular/compiler": "^2", "@angular/compiler": "2.2.3",
"@angular/core": "^2", "@angular/core": "2.2.3",
"@angular/forms": "^2", "@angular/forms": "2.2.3",
"@angular/http": "^2", "@angular/http": "2.2.3",
"@angular/platform-browser": "^2", "@angular/platform-browser": "2.2.3",
"@angular/platform-browser-dynamic": "^2", "@angular/platform-browser-dynamic": "2.2.3",
"@angular/router": "^3", "@angular/router": "3.2.3",
"babel-polyfill": "^6.16.0",
"bootstrap": "^4.0.0-alpha.2", "bootstrap": "^4.0.0-alpha.2",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"moment": "^2.17.0", "moment": "^2.17.1",
"mousetrap": "^1.6.0", "mousetrap": "^1.6.0",
"oidc-client": "^1.2.2", "oidc-client": "^1.2.2",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12", "rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.23" "zone.js": "^0.6.23"
}, },
"devDependencies": { "devDependencies": {
"@angular/compiler-cli": "^2.2.3", "@angular/compiler-cli": "2.2.3",
"@ngtools/webpack": "^1.1.6", "@ngtools/webpack": "^1.1.9",
"@types/core-js": "^0.9.34", "@types/core-js": "^0.9.35",
"@types/jasmine": "^2.5.38", "@types/jasmine": "^2.5.38",
"@types/mousetrap": "^1.5.32", "@types/mousetrap": "^1.5.32",
"@types/node": "^6.0.51", "@types/node": "^6.0.51",
@ -43,13 +41,12 @@
"angular2-template-loader": "^0.6.0", "angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^2.2.4", "awesome-typescript-loader": "^2.2.4",
"cpx": "^1.5.0", "cpx": "^1.5.0",
"css-loader": "^0.26.0", "css-loader": "^0.26.1",
"exports-loader": "^0.6.3", "exports-loader": "^0.6.3",
"extract-text-webpack-plugin": "^2.0.0-beta.4", "extract-text-webpack-plugin": "^2.0.0-beta.4",
"file-loader": "^0.9.0", "file-loader": "^0.9.0",
"html-loader": "^0.4.4", "html-loader": "^0.4.4",
"html-webpack-plugin": "^2.24.1", "html-webpack-plugin": "^2.24.1",
"image-webpack-loader": "^3.0.0",
"istanbul-instrumenter-loader": "^0.2.0", "istanbul-instrumenter-loader": "^0.2.0",
"jasmine-core": "^2.5.2", "jasmine-core": "^2.5.2",
"karma": "^1.3.0", "karma": "^1.3.0",
@ -62,7 +59,7 @@
"karma-phantomjs-launcher": "^1.0.2", "karma-phantomjs-launcher": "^1.0.2",
"karma-sourcemap-loader": "^0.3.7", "karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.0", "karma-webpack": "^1.8.0",
"node-sass": "^3.13.0", "node-sass": "^3.4.2",
"null-loader": "^0.1.1", "null-loader": "^0.1.1",
"phantomjs-prebuilt": "^2.1.13", "phantomjs-prebuilt": "^2.1.13",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",

6
src/Squidex/tsconfig.json

@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"module": "commonjs", "module": "es2015",
"moduleResolution": "node", "moduleResolution": "node",
"sourceMap": true, "sourceMap": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
@ -14,7 +14,9 @@
"suppressImplicitAnyIndexErrors": true, "suppressImplicitAnyIndexErrors": true,
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"*": ["*", "app/*"] "framework": ["app/framework"],
"features": ["app/features"],
"shared": ["app/shared"]
} }
} }
} }

0
src/Squidex/app/images/loader.gif → src/Squidex/wwwroot/images/loader.gif

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

0
src/Squidex/app/images/logo.png → src/Squidex/wwwroot/images/logo.png

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

2
src/Squidex/wwwroot/index.html

@ -36,7 +36,7 @@
<body> <body>
<sqx-app> <sqx-app>
<div class="loading"> <div class="loading">
<img src="/loader.gif" /> <img src="/images/loader.gif" />
<div>Loading awesomeness</div> <div>Loading awesomeness</div>
</div> </div>

BIN
src/Squidex/wwwroot/loader.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Loading…
Cancel
Save