Skip to content

Commit e8bf209

Browse files
committed
Updated to Angular 4.0.0 + other fixes.
1 parent bd0f237 commit e8bf209

File tree

8 files changed

+43
-48
lines changed

8 files changed

+43
-48
lines changed

WebApp/ClientApp/app/components/app/app.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export class AppComponent extends Localization implements OnChanges, OnInit, DoC
1818
public translation: TranslationService) {
1919
super(locale, translation);
2020

21-
this.locale.AddConfiguration()
22-
.AddLanguages(['de', 'en'])
23-
.DefineDefaultLocale('de', 'CH')
24-
.DefineCurrency('CHF')
25-
.SetCookieExpiration(30);
21+
this.locale.addConfiguration()
22+
.addLanguages(['de', 'en'])
23+
.defineDefaultLocale('de', 'CH')
24+
.defineCurrency('CHF')
25+
.setCookieExpiration(30);
2626
this.locale.init();
2727

28-
this.translation.AddConfiguration().AddWebAPIProvider('/api/localisations/json/', 'json');
28+
this.translation.addConfiguration().addWebAPIProvider('/api/localisations/json/', 'json');
2929
this.translation.translationError.subscribe((error: any) => console.log(error));
3030
this.translation.init();
3131
}

WebApp/ClientApp/app/components/home/home.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class HomeComponent extends Localization implements OnChanges, OnInit, D
2323
this.authService.loggedInUpdated.subscribe(
2424
(isLoggedIn) => {
2525
if (!isLoggedIn) {
26-
this.fullName = '';
26+
this.fullName = 'Guest';
2727
}
2828
}
2929
);

WebApp/Startup.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
141141
env.ConfigureNLog("nlog.config");
142142
LogManager.Configuration.Variables["connectionString"] = this.Configuration.GetConnectionString("DefaultLogConnection");
143143
LogManager.Configuration.Variables["configDir"] = "C:\\temp\\";
144+
var logger = LogManager.GetCurrentClassLogger();
144145

145146
if (env.IsDevelopment())
146147
{
148+
logger.Trace($"Environment in WebApp isDevelopment: {env.EnvironmentName}");
147149
app.UseDeveloperExceptionPage();
148150
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
149151
{
@@ -152,6 +154,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
152154
}
153155
else
154156
{
157+
logger.Trace($"Environment in WebApp !isDevelopment: {env.EnvironmentName}");
155158
app.UseExceptionHandler("/Home/Error");
156159
}
157160

@@ -197,9 +200,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
197200
defaults: new { controller = "Home", action = "Index" });
198201
});
199202

200-
var logger = LogManager.GetCurrentClassLogger();
201-
logger.Trace($"Environment in WebApp is {env.EnvironmentName}");
202-
203203
this.InitializeAsync(app.ApplicationServices, CancellationToken.None).GetAwaiter().GetResult();
204204
}
205205

WebApp/WebApp.csproj

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,21 @@
99
<OutputType>Exe</OutputType>
1010
<PackageId>WebApp</PackageId>
1111
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
12+
<PreBuildEvent />
1213
</PropertyGroup>
14+
15+
<Target Name="PrecompileScript" BeforeTargets="Build" Condition="'$(Configuration)'=='Debug'">
16+
<Exec Command="echo pre-compile $(Configuration)" />
17+
<Exec Command="node node_modules/webpack/bin/webpack.js --env.dev --config webpack.config.vendor.js" />
18+
<Exec Command="node node_modules/webpack/bin/webpack.js --env.dev --config webpack.config.js" />
19+
</Target>
20+
21+
<Target Name="PrepublishScript" BeforeTargets="Publish">
22+
<Exec Command="echo pre-publish $(Configuration)" />
23+
<Exec Command="npm install" />
24+
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod --config webpack.config.vendor.js" />
25+
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod --config webpack.config.js" />
26+
</Target>
1327

1428
<ItemGroup>
1529
<None Update="ClientApp\dist\**\*;node_modules\**\*;Views\**\*;wwwroot\**\*;nlog.config">
@@ -19,7 +33,7 @@
1933

2034
<ItemGroup>
2135
<ProjectReference Include="..\WebApp.DataAccessLayer\WebApp.DataAccessLayer.csproj" />
22-
</ItemGroup>
36+
</ItemGroup>
2337

2438
<ItemGroup>
2539
<PackageReference Include="AspNet.Security.OAuth.Validation" Version="1.0.0-*" />
@@ -62,32 +76,9 @@
6276
<PackageReference Include="System.Data.SqlClient" Version="4.3.0" />
6377
</ItemGroup>
6478

65-
<Target Name="PrecompileScript" BeforeTargets="BeforeBuild">
66-
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js" />
67-
<Exec Command="node node_modules/webpack/bin/webpack.js" />
68-
</Target>
69-
70-
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
71-
<Exec Command="npm install" />
72-
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" />
73-
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" />
74-
</Target>
75-
7679
<ItemGroup>
7780
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
7881
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
7982
</ItemGroup>
8083

81-
<ItemGroup>
82-
<Content Update="appsettings.development.json">
83-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
84-
</Content>
85-
<Content Update="appsettings.production.json">
86-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
87-
</Content>
88-
<Content Update="appsettings.staging.json">
89-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
90-
</Content>
91-
</ItemGroup>
92-
9384
</Project>

WebApp/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
"license": "UNLICENSED",
55
"repository": "https://github.com/damirkusar/AngularMeetsNetCore",
66
"dependencies": {
7-
"@angular/animations": "4.0.0-rc.6",
8-
"@angular/common": "4.0.0-rc.6",
9-
"@angular/compiler": "4.0.0-rc.6",
10-
"@angular/compiler-cli": "4.0.0-rc.6",
11-
"@angular/core": "4.0.0-rc.6",
12-
"@angular/forms": "4.0.0-rc.6",
13-
"@angular/http": "4.0.0-rc.6",
14-
"@angular/platform-browser": "4.0.0-rc.6",
15-
"@angular/platform-browser-dynamic": "4.0.0-rc.6",
16-
"@angular/platform-server": "4.0.0-rc.6",
17-
"@angular/router": "4.0.0-rc.6",
7+
"@angular/animations": "4.0.0",
8+
"@angular/common": "4.0.0",
9+
"@angular/compiler": "4.0.0",
10+
"@angular/compiler-cli": "4.0.0",
11+
"@angular/core": "4.0.0",
12+
"@angular/forms": "4.0.0",
13+
"@angular/http": "4.0.0",
14+
"@angular/platform-browser": "4.0.0",
15+
"@angular/platform-browser-dynamic": "4.0.0",
16+
"@angular/platform-server": "4.0.0",
17+
"@angular/router": "4.0.0",
1818
"@types/node": "^6.0.38",
1919
"@types/file-saver": "0.0.0",
2020
"angular-2-local-storage": "^1.0.0",
21-
"angular-l10n": "^2.0.4",
21+
"angular-l10n": "^3.0.0",
2222
"angular-router-loader": "^0.5.0",
2323
"angular2-template-loader": "^0.6.2",
2424
"aspnet-prerendering": "^2.0.3",
File renamed without changes.

WebApp/webpack.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var isDevBuild = process.argv.indexOf('--env.prod') < 0;
2+
console.log("webpack.config isDevBuild", isDevBuild);
3+
24
var path = require('path');
35
var webpack = require('webpack');
46
var nodeExternals = require('webpack-node-externals');
@@ -46,7 +48,7 @@ var sharedConfig = {
4648
var clientBundleConfig = merge(sharedConfig, {
4749
entry: { 'main-client': './ClientApp/boot-client.ts' },
4850
output: { path: path.join(__dirname, './wwwroot/dist') },
49-
devtool: isDevBuild ? 'inline-source-map' : null,
51+
devtool: isDevBuild ? 'eval' : 'source-map',
5052
plugins: [
5153
new webpack.DllReferencePlugin({
5254
context: __dirname,
@@ -67,7 +69,7 @@ var serverBundleConfig = merge(sharedConfig, {
6769
path: path.join(__dirname, './ClientApp/dist')
6870
},
6971
target: 'node',
70-
devtool: 'inline-source-map',
72+
devtool: isDevBuild ? 'eval' : 'source-map',
7173
externals: [nodeExternals({ whitelist: [allFilenamesExceptJavaScript] })] // Don't bundle .js files from node_modules
7274
});
7375

WebApp/webpack.config.vendor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var isDevBuild = process.argv.indexOf('--env.prod') < 0;
2+
console.log("webpack.config.vendor isDevBuild", isDevBuild);
3+
24
var path = require('path');
35
var webpack = require('webpack');
46
var ExtractTextPlugin = require('extract-text-webpack-plugin');

0 commit comments

Comments
 (0)