diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/.angular-cli.json b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/.angular-cli.json index 6994b2a0e6..182d207e2e 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/.angular-cli.json +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/.angular-cli.json @@ -6,6 +6,7 @@ "apps": [ { "root": "src", + "outDir": "dist", "assets": [ "assets" ], @@ -26,24 +27,6 @@ "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" } - }, - { - "name": "ssr", - "root": "src", - "outDir": "dist-server", - "assets": [ - "assets" - ], - "main": "main.server.ts", - "tsconfig": "tsconfig.app-ssr.json", - "prefix": "app", - "scripts": [], - "environmentSource": "environments/environment.ts", - "environments": { - "dev": "environments/environment.ts", - "prod": "environments/environment.prod.ts" - }, - "platform": "server" } ], "e2e": { @@ -72,6 +55,9 @@ }, "defaults": { "styleExt": "css", - "component": {} + "component": {}, + "build": { + "progress": true + } } } diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/app.server.module.ts b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/app.server.module.ts deleted file mode 100644 index cfb0e021a9..0000000000 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/app.server.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NgModule } from '@angular/core'; -import { ServerModule } from '@angular/platform-server'; -import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader'; -import { AppComponent } from './app.component'; -import { AppModule } from './app.module'; - -@NgModule({ - imports: [AppModule, ServerModule, ModuleMapLoaderModule], - bootstrap: [AppComponent] -}) -export class AppServerModule { } diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/main.server.ts b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/main.server.ts deleted file mode 100644 index 4b9070961b..0000000000 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/main.server.ts +++ /dev/null @@ -1,29 +0,0 @@ -import 'zone.js/dist/zone-node'; -import 'reflect-metadata'; -import { renderModule, renderModuleFactory } from '@angular/platform-server'; -import { APP_BASE_HREF } from '@angular/common'; -import { enableProdMode } from '@angular/core'; -import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader'; -import { createServerRenderer } from 'aspnet-prerendering'; -export { AppServerModule } from './app/app.server.module'; -const { AppServerModule, AppServerModuleNgFactory, LAZY_MODULE_MAP } = (module as any).exports; - -enableProdMode(); - -export default createServerRenderer(params => { - const options = { - document: params.data.originalHtml, - url: params.url, - extraProviders: [ - provideModuleMap(LAZY_MODULE_MAP), - { provide: APP_BASE_HREF, useValue: params.baseUrl }, - { provide: 'BASE_URL', useValue: params.origin + params.baseUrl } - ] - }; - - const renderPromise = AppServerModuleNgFactory - ? /* AoT */ renderModuleFactory(AppServerModuleNgFactory, options) - : /* dev */ renderModule(AppServerModule, options); - - return renderPromise.then(html => ({ html })); -}); diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/polyfills.ts b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/polyfills.ts index 20d40751a6..d68672ffe4 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/polyfills.ts +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/polyfills.ts @@ -55,7 +55,7 @@ import 'core-js/es7/reflect'; /*************************************************************************************************** - * Zone JS is required by Angular itself. + * Zone JS is required by default for Angular itself. */ import 'zone.js/dist/zone'; // Included with Angular CLI. @@ -64,13 +64,3 @@ import 'zone.js/dist/zone'; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS */ - -/** - * Date, currency, decimal and percent pipes. - * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 - */ -// import 'intl'; // Run `npm install --save intl`. -/** - * Need to import at least one locale-data with intl. - */ -// import 'intl/locale-data/jsonp/en'; diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/tsconfig.app-ssr.json b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/tsconfig.app-ssr.json deleted file mode 100644 index 8e63ba74c1..0000000000 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/tsconfig.app-ssr.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": "./", - "module": "commonjs" - }, - "angularCompilerOptions": { - "entryModule": "app/app.server.module#AppServerModule" - } -} diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/tslint.json b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/tslint.json index 1c7b38bf2e..a2e30eff29 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/tslint.json +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/tslint.json @@ -11,6 +11,9 @@ "check-space" ], "curly": true, + "deprecation": { + "severity": "warn" + }, "eofline": true, "forin": true, "import-blacklist": [ @@ -127,7 +130,6 @@ "app", "kebab-case" ], - "angular-whitespace": [true, "check-interpolation"], "no-output-on-prefix": true, "use-input-property-decorator": true, "use-output-property-decorator": true, diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index 425636a1c2..33d79cd7e2 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -53,20 +53,10 @@ namespace AngularSpa app.UseSpa(spa => { - spa.Options.SourcePath = "ClientApp"; + // To learn more about options for serving an Angular SPA from ASP.NET Core, + // see https://go.microsoft.com/fwlink/?linkid=864501 - /* - // If you want to enable server-side rendering (SSR), - // [1] In AngularSpa.csproj, change the property - // value to 'true', so that the SSR bundle is built during publish - // [2] Uncomment this code block - spa.UseSpaPrerendering(options => - { - options.BootModulePath = $"{spa.Options.SourcePath}/dist-server/main.bundle.js"; - options.BootModuleBuilder = env.IsDevelopment() ? new AngularCliBuilder(npmScript: "build:ssr") : null; - options.ExcludeUrls = new[] { "/sockjs-node" }; - }); - */ + spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) {