Skip to content
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

Update nuget packages to latest and removed know vulnerabilities #635

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
997 changes: 500 additions & 497 deletions .paket/Paket.Restore.targets

Large diffs are not rendered by default.

112 changes: 74 additions & 38 deletions Build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Fake.DotNet
open Fake.IO
open Fake.Tools

let execContext = Context.FakeExecutionContext.Create false "build.fsx" [ ]
let execContext = Context.FakeExecutionContext.Create false "build.fsx" []
Context.setExecutionContext (Context.RuntimeContext.Fake execContext)

let skipTests = Environment.hasEnvironVar "yolo"
Expand All @@ -19,54 +19,59 @@ let version = Environment.environVarOrDefault "VERSION" ""
let nupkgDir = Path.getFullName "./nupkg"
let nupkgPath = System.IO.Path.Combine(nupkgDir, $"SAFE.Template.%s{version}.nupkg")

let result = DotNet.exec (fun x -> { x with DotNetCliPath = "dotnet" }) "tool" "restore"
let result =
DotNet.exec (fun x -> { x with DotNetCliPath = "dotnet" }) "tool" "restore"

if not result.OK then failwithf "`dotnet %s %s` failed" "tool" "restore"
if not result.OK then
failwithf "`dotnet %s %s` failed" "tool" "restore"

let formattedRN =
release.Notes
|> List.map (sprintf "* %s")
|> String.concat "\n"

Target.create "Clean" (fun _ ->
Shell.cleanDirs [ nupkgDir ]
)
Target.create "Clean" (fun _ -> Shell.cleanDirs [ nupkgDir ])

let msBuildParams msBuildParameter: MSBuild.CliArguments = { msBuildParameter with DisableInternalBinLog = true }
let msBuildParams msBuildParameter : MSBuild.CliArguments =
{ msBuildParameter with DisableInternalBinLog = true }

Target.create "Pack" (fun _ ->
Shell.regexReplaceInFileWithEncoding
" \"name\": .+,"
(" \"name\": \"" + templateName + " v" + version + "\",")
(" \"name\": \""
+ templateName
+ " v"
+ version
+ "\",")
Text.Encoding.UTF8
templatePath

let releaseNotesUrl = Environment.environVarOrDefault "RELEASE_NOTES_URL" ""

DotNet.pack
(fun args ->
{ args with
Configuration = DotNet.BuildConfiguration.Release
OutputPath = Some nupkgDir
MSBuildParams = msBuildParams args.MSBuildParams
Common =
{ args.Common with
CustomParams =
Some (sprintf "/p:PackageVersion=%s /p:PackageReleaseNotes=\"%s\""
version
releaseNotesUrl) }
})
templateProj
)
Configuration = DotNet.BuildConfiguration.Release
OutputPath = Some nupkgDir
MSBuildParams = msBuildParams args.MSBuildParams
Common =
{ args.Common with
CustomParams =
Some(sprintf "/p:PackageVersion=%s /p:PackageReleaseNotes=\"%s\"" version releaseNotesUrl) } })
templateProj)

Target.create "Install" (fun _ ->
let unInstallArgs = $"uninstall SAFE.Template"

DotNet.exec (fun x -> { x with DotNetCliPath = "dotnet" }) "new" unInstallArgs
|> ignore // Allow this to fail as the template might not be installed

let installArgs = $"install \"%s{nupkgPath}\""

DotNet.exec (fun x -> { x with DotNetCliPath = "dotnet" }) "new" installArgs
|> fun result -> if not result.OK then failwith $"`dotnet new %s{installArgs}` failed with %O{result}"
)
|> fun result ->
if not result.OK then
failwith $"`dotnet new %s{installArgs}` failed with %O{result}")

let psi exe arg dir (x: ProcStartInfo) : ProcStartInfo =
{ x with
Expand All @@ -75,37 +80,66 @@ let psi exe arg dir (x: ProcStartInfo) : ProcStartInfo =
WorkingDirectory = dir }

let run exe arg dir =
let result = Process.execWithResult (psi exe arg dir) TimeSpan.MaxValue
if not result.OK then (failwithf "`%s %s` failed: %A" exe arg result.Errors)
let result =
CreateProcess.fromRawCommandLine exe arg
|> CreateProcess.withWorkingDirectory dir
|> CreateProcess.withTimeout System.TimeSpan.MaxValue
|> Proc.run

if result.ExitCode <> 0 then
(failwithf "`%s %s` failed: %A" exe arg result.ExitCode)


Target.create "TemplateExecutionTests" (fun _ ->
let cmd = "run"
let args = "--project tests/Tests.fsproj"
let result = DotNet.exec (fun x -> { x with DotNetCliPath = "dotnet" }) cmd args
if not result.OK then failwithf "`dotnet %s %s` failed" cmd args
)

if not result.OK then
failwithf "`dotnet %s %s` failed" cmd args)

Target.create "DefaultTemplateTests" (fun _ ->
let cmd = "run"
let args = "RunTestsHeadless --project Build.fsproj"
let result = DotNet.exec (fun x -> { x with DotNetCliPath = "dotnet"; WorkingDirectory = defaultTemplatePath}) cmd args
if not result.OK then failwithf "`dotnet %s %s` failed" cmd args
)

let result =
DotNet.exec
(fun x ->
{ x with
DotNetCliPath = "dotnet"
WorkingDirectory = defaultTemplatePath })
cmd
args

if not result.OK then
failwithf "`dotnet %s %s` failed" cmd args)

Target.create "Release" (fun _ ->
let nugetApiKey = Environment.environVarOrFail "NUGET_API_KEY"
let nugetArgs = $"""push "*.nupkg" --api-key {nugetApiKey} --source https://api.nuget.org/v3/index.json"""
let result = DotNet.exec (fun x -> { x with DotNetCliPath = "dotnet"; WorkingDirectory = nupkgDir }) "nuget" nugetArgs
if not result.OK then failwithf "`dotnet %s` failed" "nuget push")

let nugetArgs =
$"""push "*.nupkg" --api-key {nugetApiKey} --source https://api.nuget.org/v3/index.json"""

let result =
DotNet.exec
(fun x ->
{ x with
DotNetCliPath = "dotnet"
WorkingDirectory = nupkgDir })
"nuget"
nugetArgs

if not result.OK then
failwithf "`dotnet %s` failed" "nuget push")

open Fake.Core.TargetOperators

"Clean"
=?> ("TemplateExecutionTests", not skipTests)
=?> ("DefaultTemplateTests", not skipTests)
==> "Pack"
==> "Install"
==> "Release"
=?> ("TemplateExecutionTests", not skipTests)
=?> ("DefaultTemplateTests", not skipTests)
==> "Pack"
==> "Install"
==> "Release"
|> ignore

[<EntryPoint>]
Expand All @@ -114,7 +148,9 @@ let main args =
match args with
| [| target |] -> Target.runOrDefault target
| _ -> Target.runOrDefault "Install"

0
with e ->
with
| e ->
printfn "%A" e
1
14 changes: 6 additions & 8 deletions Build.fsproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="Build.fs" />
<None Include="paket.dependencies" />
<None Include="paket.references" />
<None Include="paket.dependencies" />
<None Include="paket.references" />
</ItemGroup>

<Import Project=".paket\Paket.Restore.targets" />
<Target Name="DotNetToolRestore" BeforeTargets="PaketRestore">
<Exec Command="dotnet tool restore" />
</Target>
</Project>
<Import Project=".paket\Paket.Restore.targets" />
</Project>
2 changes: 1 addition & 1 deletion Content/default/Build.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<None Include="paket.dependencies" />
<None Include="paket.references" />
</ItemGroup>
<Import Project=".paket\Paket.Restore.targets" />
<Target Name="DotNetToolRestore" BeforeTargets="PaketRestore">
<Exec Command="dotnet tool restore" />
</Target>
<Import Project=".paket\Paket.Restore.targets" />
</Project>
92 changes: 48 additions & 44 deletions Content/default/paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ NUGET
Fable.Browser.Blob (1.4)
Fable.Core (>= 3.2.8)
FSharp.Core (>= 4.7.2)
Fable.Browser.Dom (2.17)
Fable.Browser.Dom (2.18)
Fable.Browser.Blob (>= 1.4)
Fable.Browser.Event (>= 1.6)
Fable.Browser.Event (>= 1.7)
Fable.Browser.WebStorage (>= 1.3)
Fable.Core (>= 3.2.8)
FSharp.Core (>= 4.7.2)
Fable.Browser.Event (1.6)
Fable.Browser.Event (1.7)
Fable.Browser.Gamepad (>= 1.3)
Fable.Core (>= 3.2.8)
FSharp.Core (>= 4.7.2)
Expand Down Expand Up @@ -81,16 +81,16 @@ NUGET
Fable.Core (>= 3.1.5)
Fable.Parsimmon (>= 4.0)
FSharp.Core (>= 4.7)
Fake.Core.CommandLineParsing (6.0)
Fake.Core.CommandLineParsing (6.1.3)
FParsec (>= 1.1.1)
FSharp.Core (>= 6.0.3)
Fake.Core.Context (6.0)
FSharp.Core (>= 6.0.3)
Fake.Core.Environment (6.0)
FSharp.Core (>= 6.0.3)
Fake.Core.FakeVar (6.0)
Fake.Core.Context (>= 6.0)
FSharp.Core (>= 6.0.3)
FSharp.Core (>= 8.0.301)
Fake.Core.Context (6.1.3)
FSharp.Core (>= 8.0.301)
Fake.Core.Environment (6.1.3)
FSharp.Core (>= 8.0.301)
Fake.Core.FakeVar (6.1.3)
Fake.Core.Context (>= 6.1.3)
FSharp.Core (>= 8.0.301)
Fake.Core.Process (5.23.1)
Fake.Core.Environment (>= 5.23.1)
Fake.Core.FakeVar (>= 5.23.1)
Expand All @@ -99,8 +99,8 @@ NUGET
Fake.IO.FileSystem (>= 5.23.1)
FSharp.Core (>= 6.0)
System.Collections.Immutable (>= 5.0)
Fake.Core.String (6.0)
FSharp.Core (>= 6.0.3)
Fake.Core.String (6.1.3)
FSharp.Core (>= 8.0.301)
Fake.Core.Target (5.23.1)
Fake.Core.CommandLineParsing (>= 5.23.1)
Fake.Core.Context (>= 5.23.1)
Expand All @@ -111,17 +111,17 @@ NUGET
Fake.Core.Trace (>= 5.23.1)
FSharp.Control.Reactive (>= 5.0.2)
FSharp.Core (>= 6.0)
Fake.Core.Trace (6.0)
Fake.Core.Environment (>= 6.0)
Fake.Core.FakeVar (>= 6.0)
FSharp.Core (>= 6.0.3)
Fake.Core.Trace (6.1.3)
Fake.Core.Environment (>= 6.1.3)
Fake.Core.FakeVar (>= 6.1.3)
FSharp.Core (>= 8.0.301)
Fake.IO.FileSystem (5.23.1)
Fake.Core.String (>= 5.23.1)
FSharp.Core (>= 6.0)
Farmer (1.8.13)
Farmer (1.9.2)
FSharp.Core (>= 5.0)
System.Text.Json (>= 5.0)
Feliz (2.8)
Feliz (2.9)
Fable.ReactDom.Types (>= 18.2)
Feliz.CompilerPlugins (>= 2.2)
FSharp.Core (>= 4.7.2)
Expand All @@ -137,30 +137,36 @@ NUGET
FSharp.Core (>= 6.0)
Microsoft.IO.RecyclableMemoryStream (>= 3.0)
FSharp.Core (8.0.401)
Giraffe (6.4)
FSharp.SystemTextJson (1.3.13)
FSharp.Core (>= 4.7)
System.Text.Json (>= 6.0)
Giraffe (7.0.2)
FSharp.Core (>= 6.0)
FSharp.SystemTextJson (>= 1.3.13)
Giraffe.ViewEngine (>= 1.4)
Microsoft.IO.RecyclableMemoryStream (>= 3.0)
Newtonsoft.Json (>= 13.0.3)
System.Text.Json (>= 8.0.3)
Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
System.Text.Json (>= 8.0.5)
Giraffe.ViewEngine (1.4)
FSharp.Core (>= 5.0)
Microsoft.AspNetCore.Authentication.JwtBearer (8.0.6)
Microsoft.AspNetCore.Authentication.JwtBearer (8.0.10)
Microsoft.IdentityModel.Protocols.OpenIdConnect (>= 7.1.2)
Microsoft.IdentityModel.Abstractions (7.6.2)
Microsoft.IdentityModel.JsonWebTokens (7.6.2)
Microsoft.IdentityModel.Tokens (>= 7.6.2)
Microsoft.IdentityModel.Logging (7.6.2)
Microsoft.IdentityModel.Abstractions (>= 7.6.2)
Microsoft.IdentityModel.Protocols (7.6.2)
Microsoft.IdentityModel.Tokens (>= 7.6.2)
Microsoft.IdentityModel.Protocols.OpenIdConnect (7.6.2)
Microsoft.IdentityModel.Protocols (>= 7.6.2)
System.IdentityModel.Tokens.Jwt (>= 7.6.2)
Microsoft.IdentityModel.Tokens (7.6.2)
Microsoft.IdentityModel.Logging (>= 7.6.2)
Microsoft.Bcl.TimeProvider (8.0.1)
Microsoft.IdentityModel.Abstractions (8.1.2)
Microsoft.IdentityModel.JsonWebTokens (8.1.2)
Microsoft.Bcl.TimeProvider (>= 8.0.1)
Microsoft.IdentityModel.Tokens (>= 8.1.2)
Microsoft.IdentityModel.Logging (8.1.2)
Microsoft.IdentityModel.Abstractions (>= 8.1.2)
Microsoft.IdentityModel.Protocols (8.1.2)
Microsoft.IdentityModel.Tokens (>= 8.1.2)
Microsoft.IdentityModel.Protocols.OpenIdConnect (8.1.2)
Microsoft.IdentityModel.Protocols (>= 8.1.2)
System.IdentityModel.Tokens.Jwt (>= 8.1.2)
Microsoft.IdentityModel.Tokens (8.1.2)
Microsoft.Bcl.TimeProvider (>= 8.0.1)
Microsoft.IdentityModel.Logging (>= 8.1.2)
Microsoft.IO.RecyclableMemoryStream (3.0.1)
Mono.Cecil (0.11.5)
Mono.Cecil (0.11.6)
Newtonsoft.Json (13.0.3)
SAFE.Client (5.1)
Fable.Core (>= 4.3 < 5.0)
Expand All @@ -181,10 +187,8 @@ NUGET
Giraffe (>= 6.4)
Microsoft.AspNetCore.Authentication.JwtBearer (>= 6.0.3)
System.Collections.Immutable (8.0)
System.IdentityModel.Tokens.Jwt (7.6.2)
Microsoft.IdentityModel.JsonWebTokens (>= 7.6.2)
Microsoft.IdentityModel.Tokens (>= 7.6.2)
System.IdentityModel.Tokens.Jwt (8.1.2)
Microsoft.IdentityModel.JsonWebTokens (>= 8.1.2)
Microsoft.IdentityModel.Tokens (>= 8.1.2)
System.Reactive (5.0)
System.Text.Encodings.Web (8.0)
System.Text.Json (8.0.3)
System.Text.Encodings.Web (>= 8.0)
System.Text.Json (8.0.5)
Loading
Loading