Remove NPM dependency
This commit is contained in:
parent
9e7545e729
commit
9c1314cd97
8 changed files with 36 additions and 63 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -55,3 +55,5 @@ _NCrunch_Website
|
||||||
*.DotSettings
|
*.DotSettings
|
||||||
|
|
||||||
.nuke/temp
|
.nuke/temp
|
||||||
|
|
||||||
|
fontawesome
|
|
@ -1,8 +1,6 @@
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
|
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
|
|
||||||
RUN apt-get install -y nodejs
|
|
||||||
RUN chmod +x ./build.sh
|
RUN chmod +x ./build.sh
|
||||||
RUN ./build.sh
|
RUN ./build.sh
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.Media;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Nuke.Common;
|
using Nuke.Common;
|
||||||
using Nuke.Common.Execution;
|
using Nuke.Common.Execution;
|
||||||
using Nuke.Common.IO;
|
using Nuke.Common.IO;
|
||||||
|
@ -19,17 +24,39 @@ class Build : NukeBuild
|
||||||
|
|
||||||
AbsolutePath OutputDirectory => RootDirectory / "output";
|
AbsolutePath OutputDirectory => RootDirectory / "output";
|
||||||
AbsolutePath SourceDirectory => RootDirectory / "src";
|
AbsolutePath SourceDirectory => RootDirectory / "src";
|
||||||
|
AbsolutePath LibPath => SourceDirectory / "Website/wwwroot/lib";
|
||||||
|
AbsolutePath FontAwesomePath => SourceDirectory / "Website/wwwroot/lib/fontawesome";
|
||||||
|
|
||||||
|
private void DeleteExistingFontAwesome()
|
||||||
|
{
|
||||||
|
if (Directory.Exists(FontAwesomePath))
|
||||||
|
Directory.Delete(FontAwesomePath, true);
|
||||||
|
}
|
||||||
|
|
||||||
Target Clean => _ => _
|
Target Clean => _ => _
|
||||||
.Before(Restore)
|
.Before(Restore)
|
||||||
.Executes(() =>
|
.Executes(() =>
|
||||||
{
|
{
|
||||||
|
DeleteExistingFontAwesome();
|
||||||
EnsureCleanDirectory(OutputDirectory);
|
EnsureCleanDirectory(OutputDirectory);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private async Task DownloadFontAwesome() {
|
||||||
|
const string fontAwesomeVersion = "6.4.0";
|
||||||
|
const string zipName = $"fontawesome-free-{fontAwesomeVersion}-web";
|
||||||
|
var client = new HttpClient();
|
||||||
|
var response = await client.GetAsync($"https://use.fontawesome.com/releases/v{fontAwesomeVersion}/{zipName}.zip");
|
||||||
|
var memory = new MemoryStream();
|
||||||
|
await response.Content.CopyToAsync(memory);
|
||||||
|
var zip = new ZipArchive(memory);
|
||||||
|
zip.ExtractToDirectory(LibPath);
|
||||||
|
Directory.Move(LibPath / zipName, FontAwesomePath);
|
||||||
|
}
|
||||||
|
|
||||||
Target Restore => _ => _
|
Target Restore => _ => _
|
||||||
.Executes(() =>
|
.DependsOn(Clean)
|
||||||
{
|
.Executes(() => {
|
||||||
|
DownloadFontAwesome().Wait();
|
||||||
DotNetRestore(s => s
|
DotNetRestore(s => s
|
||||||
.SetProjectFile(Solution));
|
.SetProjectFile(Solution));
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,8 +23,4 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Website.Markdig.Extensions\Website.Markdig.Extensions.csproj" />
|
<ProjectReference Include="..\Website.Markdig.Extensions\Website.Markdig.Extensions.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="BuildCss" BeforeTargets="Build">
|
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" Command="npm install" />
|
|
||||||
</Target>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
33
src/Website/package-lock.json
generated
33
src/Website/package-lock.json
generated
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
"name": "website",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"lockfileVersion": 2,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"name": "website",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"@fortawesome/fontawesome-free": "^6.2.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {}
|
|
||||||
},
|
|
||||||
"node_modules/@fortawesome/fontawesome-free": {
|
|
||||||
"version": "6.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz",
|
|
||||||
"integrity": "sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A==",
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@fortawesome/fontawesome-free": {
|
|
||||||
"version": "6.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz",
|
|
||||||
"integrity": "sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"name": "website",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"devDependencies": {
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@fortawesome/fontawesome-free": "^6.2.1"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
},
|
|
||||||
"author": "Robert Marshall",
|
|
||||||
"license": "ISC",
|
|
||||||
"private": true
|
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
@import url("https://fonts.googleapis.com/css?family=Public+Sans&display=swap");
|
@import url("https://fonts.googleapis.com/css?family=Public+Sans&display=swap");
|
||||||
@import "colours.scss";
|
@import "colours.scss";
|
||||||
$fa-font-path: "../webfonts";
|
$fa-font-path: "../lib/fontawesome/webfonts";
|
||||||
@import "../../node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss";
|
@import "../lib/fontawesome/scss/fontawesome.scss";
|
||||||
@import "../../node_modules/@fortawesome/fontawesome-free/scss/solid.scss";
|
@import "../lib/fontawesome/scss/solid.scss";
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
../node_modules/@fortawesome/fontawesome-free/webfonts
|
|
Loading…
Add table
Add a link
Reference in a new issue