Starting to rework the build process

This commit is contained in:
Zoe Roux 2020-03-01 02:28:36 +01:00
parent d5925f386b
commit 77cac3afec
77 changed files with 24 additions and 1429 deletions

2
.gitmodules vendored
View File

@ -3,6 +3,6 @@
url = https://github.com/AnonymusRaccoon/Kyoo.Transcoder
branch = master
[submodule "WebApp"]
path = Kyoo/ClientApp
path = Kyoo/Views/WebClient
url = https://github.com/AnonymusRaccoon/Kyoo.WebApp
branch = master

1
Kyoo/.gitignore vendored
View File

@ -1,5 +1,6 @@
## PROJECT CUSTOM IGNORES
libtranscoder.so
wwwroot/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

View File

@ -5,8 +5,8 @@
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
<SpaRoot>Views/WebClient/</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules/**</DefaultItemExcludes>
<!-- Set this to true if you enable server-side prerendering -->
<BuildServerSideRenderer>false</BuildServerSideRenderer>
@ -16,11 +16,9 @@
<StartupObject>Kyoo.Program</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin/Release/</OutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../Kyoo.Common/Kyoo.Common.csproj" />
<PackageReference Include="IdentityServer4" Version="3.1.2" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
@ -39,59 +37,37 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list -->
<Content Remove="$(SpaRoot)**" />
<None Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="ClientApp\e2e\tsconfig.json" />
</ItemGroup>
<ItemGroup>
<None Remove="libtranscoder.so" />
<EmbeddedResource Include="libtranscoder.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<None Remove="kyoo.sh" />
<EmbeddedResource Include="kyoo.sh">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Kyoo.Common\Kyoo.Common.csproj" />
<StaticFiles Include="$(SpaRoot)static/**" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- 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." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
<DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
<DistFiles Include="$(SpaRoot)dist/**; $(SpaRoot)dist-server/**" />
<DistFiles Include="$(SpaRoot)node_modules/**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
<RelativePath>wwwroot/%(DistFiles.Filename)%(DistFiles.Extension)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</ResolvedFileToPublish>
<!-- <ResolvedFileToPublish Include="@(StaticFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">-->
<!-- <RelativePath>wwwroot/%(StaticFiles.RecursiveDir)%(StaticFiles.Filename)%(StaticFiles.Extension)</RelativePath>-->
<!-- <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>-->
<!-- <ExcludeFromSingleFile>true</ExcludeFromSingleFile>-->
<!-- </ResolvedFileToPublish>-->
</ItemGroup>
</Target>
<Target Name="Prepare the web app" AfterTargets="Build" Condition="$(Configuration) == 'Debug'">
<Copy SourceFiles="@(StaticFiles)" DestinationFolder="$(OutputPath)/wwwroot/%(RecursiveDir)" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>
</Project>

View File

@ -7,8 +7,6 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Kyoo
{
@ -27,7 +25,7 @@ namespace Kyoo
// In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp/dist";
configuration.RootPath = "wwwroot";
});
services.AddControllers().AddNewtonsoftJson();
@ -90,7 +88,7 @@ namespace Kyoo
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
spa.Options.SourcePath = "Views/WebClient";
if (env.IsDevelopment())
{

1
Kyoo/Views/WebClient Submodule

@ -0,0 +1 @@
Subproject commit 86409d02221bc750609d212aea912a2e90758a59

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(MaterialIcons-Regular.woff2) format('woff2'),
url(MaterialIcons-Regular.woff) format('woff'),
url(MaterialIcons-Regular.ttf) format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(100, italic);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(100, normal);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(300, italic);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(300, normal);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(400, italic);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(400, normal);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(500, italic);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(500, normal);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(700, italic);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(700, normal);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(900, italic);

View File

@ -1,3 +0,0 @@
@import "roboto-mixin";
@include roboto-font(900, normal);

View File

@ -1,14 +0,0 @@
$font: 'roboto';
@mixin roboto-font($weight, $style) {
@font-face {
font-family: 'Roboto';
src: url(/roboto/fonts/#{$font}-#{$weight}-#{$style}.woff2) format('woff2'),
url(/roboto/fonts/#{$font}-#{$weight}-#{$style}.woff) format('woff'),
url(/roboto/fonts/#{$font}-#{$weight}-#{$style}.ttf) format('truetype');
font-weight: $weight;
font-style: $style;
};
};

View File

@ -1,15 +0,0 @@
// import all fonts
@import "roboto-100-normal";
@import "roboto-100-italic";
@import "roboto-300-normal";
@import "roboto-300-italic";
@import "roboto-400-normal";
@import "roboto-400-italic";
@import "roboto-500-normal";
@import "roboto-500-italic";
@import "roboto-700-normal";
@import "roboto-700-italic";
@import "roboto-900-normal";
@import "roboto-900-italic";