Remove NPM dependency
This commit is contained in:
parent
9e7545e729
commit
5f0ef7bbc7
8 changed files with 30 additions and 62 deletions
|
@ -1,4 +1,9 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Media;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Nuke.Common;
|
||||
using Nuke.Common.Execution;
|
||||
using Nuke.Common.IO;
|
||||
|
@ -19,17 +24,34 @@ class Build : NukeBuild
|
|||
|
||||
AbsolutePath OutputDirectory => RootDirectory / "output";
|
||||
AbsolutePath SourceDirectory => RootDirectory / "src";
|
||||
AbsolutePath LibPath => SourceDirectory / "Website/wwwroot/lib";
|
||||
|
||||
private void DeleteExistingFontAwesome() => Directory.Delete(LibPath / "fontawesome", true);
|
||||
|
||||
Target Clean => _ => _
|
||||
.Before(Restore)
|
||||
.Executes(() =>
|
||||
{
|
||||
DeleteExistingFontAwesome();
|
||||
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, LibPath / "fontawesome");
|
||||
}
|
||||
|
||||
Target Restore => _ => _
|
||||
.Executes(() =>
|
||||
{
|
||||
.DependsOn(Clean)
|
||||
.Executes(() => {
|
||||
DownloadFontAwesome().Wait();
|
||||
DotNetRestore(s => s
|
||||
.SetProjectFile(Solution));
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue