Skip to content

WIP - Re-sync with JavaScriptServices #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Obj/
.vs/

/wwwroot/dist/
/Client/dist/
/ClientApp/dist/

# MSTest test Results
[Tt]est[Rr]esult*/
Expand Down Expand Up @@ -187,6 +187,7 @@ BundleArtifacts/
!*.[Cc]ache/

# Others
*.db
ClientBin/
~$*
*~
Expand Down Expand Up @@ -259,3 +260,6 @@ _Pvt_Extensions

# Jest Code Coverage report
coverage/

.DS_Store
package-lock.json
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.1/Asp2017.dll",
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.0/Asp2017.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
Expand Down Expand Up @@ -51,7 +51,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.1/Asp2017.dll",
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.0/Asp2017.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
Expand Down Expand Up @@ -82,7 +82,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.1/Asp2017.dll",
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.0/Asp2017.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
Expand Down
67 changes: 42 additions & 25 deletions Asp2017.csproj
Original file line number Diff line number Diff line change
@@ -1,51 +1,68 @@
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">netcoreapp2.0</TargetFramework>
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<!-- New Meta Package has SpaServices in It -->

<ItemGroup Condition="'$(TargetFrameworkOverride)' == ''">
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkOverride)' != ''">
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<!-- Files not to show in IDE -->
<None Remove="yarn.lock" />
<Content Remove="wwwroot\dist\**" />
<None Remove="Client\dist\**" />
<Content Remove="coverage\**" />

<!-- Files not to publish (note that the 'dist' subfolders are re-added below) -->
<Content Remove="Client\**" />
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<Content Include="Client\tsconfig.browser.json" />
<Content Include="Client\tsconfig.server.aot.json" />
<Content Include="Client\tsconfig.server.json" />
<!-- Files not to publish (note that the 'dist' subfolders are re-added below) -->
<Content Remove="ClientApp\**" />
</ItemGroup>
<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish">

<!--/-:cnd:noEmit -->
<Target Name="DebugRunWebpack" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('wwwroot\dist') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />

<!-- In development, the dist files won't exist on the first run or when cloning to
a different machine, so rebuild them if not already present. -->
<Message Importance="high" Text="Performing first-run Webpack build..." />
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js" />
<Exec Command="node node_modules/webpack/bin/webpack.js" />
</Target>
<!--/+:cnd:noEmit -->

<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec Command="npm install" />
<Exec Command="node node_modules/webpack/bin/webpack.js --env.aot --env.client" />
<Exec Command="node node_modules/webpack/bin/webpack.js --env.aot --env.server" />
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" />
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" />

<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<DistFiles Include="wwwroot\dist\**; Client\dist\**" />
<DistFiles Include="wwwroot\dist\**; ClientApp\dist\**" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
<Target Name="CleanDist" AfterTargets="Clean">
<ItemGroup>
<FilesToDelete Include="Client\dist\**; wwwroot\dist\**" />
</ItemGroup>
<Delete Files="@(FilesToDelete)" />
<RemoveDir Directories="Client\dist; wwwroot\dist" />
</Target>

</Project>
41 changes: 0 additions & 41 deletions Client/main.server.aot.ts

This file was deleted.

9 changes: 0 additions & 9 deletions Client/tsconfig.browser.json

This file was deleted.

8 changes: 0 additions & 8 deletions Client/tsconfig.server.aot.json

This file was deleted.

9 changes: 0 additions & 9 deletions Client/tsconfig.server.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
</div>
<div class="col-sm-9 body-content">
<router-outlet></router-outlet>
</div>
</div>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { SignalRModule, SignalRConfiguration } from 'ng2-signalr';

import { ORIGIN_URL } from './shared/constants/baseurl.constants';
import { AppModule } from './app.module';
import { AppModuleShared } from './app.module';
import { AppComponent } from './app.component';
import { REQUEST } from './shared/constants/request';
import { BrowserTransferStateModule } from '../modules/transfer-state/browser-transfer-state.module';
Expand Down Expand Up @@ -41,7 +41,7 @@ export function getRequest() {
BrowserTransferStateModule,

// Our Common AppModule
AppModule,
AppModuleShared,

SignalRModule.forRoot(createConfig)
],
Expand All @@ -58,5 +58,4 @@ export function getRequest() {
}
]
})
export class BrowserAppModule {
}
export class AppModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ServerModule } from '@angular/platform-server';
import { BrowserModule } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';

import { AppModule } from './app.module';
import { AppModuleShared } from './app.module';
import { AppComponent } from './app.component';
import { ServerTransferStateModule } from '../modules/transfer-state/server-transfer-state.module';
import { TransferState } from '../modules/transfer-state/transfer-state';
Expand All @@ -20,10 +20,10 @@ import { TransferState } from '../modules/transfer-state/transfer-state';
ServerTransferStateModule,

// Our Common AppModule
AppModule
AppModuleShared
]
})
export class ServerAppModule {
export class AppModule {

constructor(private transferState: TransferState) { }

Expand Down
15 changes: 10 additions & 5 deletions Client/app/app.module.ts → ClientApp/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NgModule, Inject } from '@angular/core';
import { RouterModule } from '@angular/router';
import { RouterModule, PreloadAllModules } from '@angular/router';
import { CommonModule, APP_BASE_HREF } from '@angular/common';
import { HttpModule, Http } from '@angular/http';
import { FormsModule } from '@angular/forms';
Expand Down Expand Up @@ -134,9 +134,9 @@ export function createTranslateLoader(http: Http, baseHref) {
]
}
},

{ path: 'lazy', loadChildren: './containers/lazy/lazy.module#LazyModule'},

{
path: '**', component: NotFoundComponent,
data: {
Expand All @@ -148,7 +148,12 @@ export function createTranslateLoader(http: Http, baseHref) {
]
}
}
])
], {
// Router options
useHash: false,
preloadingStrategy: PreloadAllModules,
initialNavigation: 'enabled'
})
],
providers: [
LinkService,
Expand All @@ -157,5 +162,5 @@ export function createTranslateLoader(http: Http, baseHref) {
TranslateModule
]
})
export class AppModule {
export class AppModuleShared {
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ChatMessage {
@Component({
selector: 'chat',
templateUrl: './chat.component.html',
styleUrls: ['./chat.component.css']
styleUrls: ['./chat.component.scss']
})
export class ChatComponent implements OnInit {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
<h1>
{{ title }}</h1>
<h1>{{ title }}</h1>

<blockquote>
<strong>Enjoy the latest features from .NET Core & Angular 4.0!</strong>
<br> For more info check the repo here: <a href="https://github.com/MarkPieszak/aspnetcore-angular2-universal">AspNetCore-Angular2-Universal repo</a>

<br><br>
</blockquote>


<div class="row">
<div class="col-lg-6">
<h2>{{ 'HOME_FEATURE_LIST_TITLE' | translate }} </h2>
<ul>
<li>ASP.NET Core 1.1 :: ( Visual Studio 2017 )</li>
<li>ASP.NET Core 2.0 :: ( Visual Studio 2017 )</li>
<li>
Angular 4.* front-end UI framework
<ul>
<li>Angular **platform-server** (Universal moved into Core here) - server-side rendering for SEO, deep-linking, and
<li>Angular **platform-server** (aka: Universal) - server-side rendering for SEO, deep-linking, and
incredible performance.</li>
<!--<li>HMR State Management - Don't lose your applications state during HMR!</li>-->
<li>AoT (Ahead-of-time) production compilation for even faster Prod builds.</li>
Expand All @@ -33,7 +30,7 @@ <h2>{{ 'HOME_FEATURE_LIST_TITLE' | translate }} </h2>
</ul>-->
</li>
<li>
Webpack 2
Webpack
<ul>
<!--<li>TS2 aware path support</li>-->
<li>Hot Module Reloading/Replacement for an amazing development experience.</li>
Expand Down Expand Up @@ -65,11 +62,11 @@ <h2>{{ 'HOME_ISSUES_TITLE' | translate }}</h2>
<h2> {{ 'SWITCH_LANGUAGE' | translate }}</h2>

<button class="btn btn-default" (click)="setLanguage('en')">
<span class="flag-icon flag-icon-us"></span> {{ 'ENGLISH' | translate }}
<span class="flag-icon flag-icon-us"></span> {{ 'ENGLISH' | translate }}
</button>

<button class="btn btn-default" (click)="setLanguage('no')">
<span class="flag-icon flag-icon-no"></span> {{ 'NORWEGIAN' | translate }}
<span class="flag-icon flag-icon-no"></span> {{ 'NORWEGIAN' | translate }}
</button>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import { TranslateService } from '@ngx-translate/core';
})
export class HomeComponent implements OnInit {

title: string = 'Angular 4.0 Universal & ASP.NET Core advanced starter-kit';
title: string = 'Angular 4.0 Universal & ASP.NET Core 2.0 advanced starter-kit';

// Use "constructor"s only for dependency injection
constructor(public translate: TranslateService) { }
constructor(
public translate: TranslateService
) { }

// Here you want to handle anything with @Input()'s @Output()'s
// Data retrieval / etc - this is when the Component is "ready" and wired up
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions Client/main.browser.ts → ClientApp/boot.browser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './polyfills/browser.polyfills';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { BrowserAppModule } from './app/browser-app.module';
import { AppModule } from './app/app.module.browser';

const rootElemTagName = 'app'; // Update this if you change your root component selector

Expand All @@ -15,4 +15,4 @@ if (module['hot']) {
enableProdMode();
}

const modulePromise = platformBrowserDynamic().bootstrapModule(BrowserAppModule);
const modulePromise = platformBrowserDynamic().bootstrapModule(AppModule);
Loading