Skip to content

Commit

Permalink
feat: update dependencies & new fantomas integration
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-tihon committed Apr 3, 2022
1 parent 103fc3d commit 02256b4
Show file tree
Hide file tree
Showing 6 changed files with 635 additions and 221 deletions.
10 changes: 8 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"isRoot": true,
"tools": {
"paket": {
"version": "6.2.1",
"version": "7.1.3",
"commands": [
"paket"
]
},
"fake-cli": {
"version": "5.20.4",
"version": "5.22.0",
"commands": [
"fake"
]
Expand All @@ -19,6 +19,12 @@
"commands": [
"fsdocs"
]
},
"fantomas-tool": {
"version": "4.7.5",
"commands": [
"fantomas"
]
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
dotnet: [6.0.100]
dotnet: [6.0.201]
runs-on: ${{ matrix.os }}

steps:
Expand Down
51 changes: 33 additions & 18 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#r @"paket:
source https://nuget.org/api/v2
framework netstandard2.0
nuget FSharp.Core 5.0.0
nuget Fantomas
nuget Fantomas.Extras
source https://api.nuget.org/v3/index.json
framework: net6.0
storage: none
nuget FSharp.Core
nuget Fake.Core.Target
nuget Fake.Core.Trace
nuget Fake.Core.ReleaseNotes
Expand All @@ -16,23 +15,16 @@ nuget Fake.DotNet.Fsi
nuget Fake.Tools.Git
nuget Fake.Api.GitHub //"

#if !FAKE
#load "./.fake/build.fsx/intellisense.fsx"
#r "netstandard" // Temp fix for https://github.com/fsharp/FAKE/issues/1985
#endif

open Fake
open Fake.Core.TargetOperators
open Fake.Core
open Fake.Core.TargetOperators
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.DotNet
open Fake.Tools.Git
open System.IO
open Fantomas
open Fantomas.Extras
open Fantomas.FormatConfig

Target.initEnvironment()

Expand Down Expand Up @@ -142,13 +134,36 @@ Target.create "CleanDocs" (fun _ ->
// --------------------------------------------------------------------------------------
// Check code format & format code using Fantomas

Target.create "Format" (fun _ ->
let sourceFiles =
!! "src/**/*.fs"
++ "tests/**/*.fs"
-- "./**/*AssemblyInfo.fs"
|> FakeHelpers.checkCode
|> Async.RunSynchronously
|> printfn "Formatted files: %A"

Target.create "CheckFormat" (fun _ ->
let result =
sourceFiles
|> Seq.map (sprintf "\"%s\"")
|> String.concat " "
|> sprintf "%s --check"
|> DotNet.exec id "fantomas"

if result.ExitCode = 0 then
Trace.log "No files need formatting"
elif result.ExitCode = 99 then
failwith "Some files need formatting, check output for more info"
else
Trace.logf "Errors while formatting: %A" result.Errors
)

Target.create "Format" (fun _ ->
let result =
sourceFiles
|> Seq.map (sprintf "\"%s\"")
|> String.concat " "
|> DotNet.exec id "fantomas"

if not result.OK then
printfn "Errors while formatting all files: %A" result.Messages
)

// --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -227,7 +242,7 @@ Target.create "Release" ignore

"Clean"
==> "AssemblyInfo"
==> "Format"
==> "CheckFormat"
==> "Build"
==> "CopyBinaries"
==> "RunTests"
Expand Down
Loading

0 comments on commit 02256b4

Please sign in to comment.