This repository has been archived by the owner on Jan 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.fsx
81 lines (66 loc) · 2.06 KB
/
build.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#r "packages/build/FAKE/tools/FakeLib.dll"
open System
open Fake
let run fileName args workingDir =
printfn "CWD: %s" workingDir
let fileName, args =
if EnvironmentHelper.isUnix
then fileName, args else "cmd", ("/C " + fileName + " " + args)
let ok =
execProcess (fun info ->
info.FileName <- fileName
info.WorkingDirectory <- workingDir
info.Arguments <- args) TimeSpan.MaxValue
if not ok then failwith (sprintf "'%s> %s %s' task failed" workingDir fileName args)
let dotnet = "dotnet"
let npm = "npm"
let projects = [ "Server"; "Server.Tests"; "Client" </> "src" ]
Target "Clean" <| fun _ ->
projects
|> List.collect (fun proj -> [ proj </> "bin"; proj </> "obj" ])
|> List.iter CleanDir
Target "DotnetRestore" <| fun _ ->
projects
|> List.iter (run dotnet "restore --no-cache")
Target "ServerTests" <| fun _ ->
run dotnet "run" "Server.Tests"
Target "NpmInstall" <| fun _ ->
run "yarn" "install" "Client"
Target "Watch" <| fun () ->
[ async { run dotnet "watch run" "Server" };
async { run dotnet "fable npm-run start" ("Client" </> "src") } ]
|> Async.Parallel
|> Async.RunSynchronously
|> ignore
Target "WatchInMemory" <| fun () ->
[ async { run dotnet "watch run --store in-memory" "Server" };
async { run dotnet "fable npm-run start" ("Client" </> "src") } ]
|> Async.Parallel
|> Async.RunSynchronously
|> ignore
Target "Release" <| fun _ ->
CleanDir "dist"
[ async { run dotnet "build --configuration Release --output ../dist" "Server" }
async {
run dotnet "fable npm-run build" ("Client" </> "src")
CopyRecursive ("Client" </> "public") ("dist" </> "client") true |> ignore
} ]
|> Async.Parallel
|> Async.RunSynchronously
|> ignore
"Clean"
==> "DotnetRestore"
==> "ServerTests"
"Clean"
==> "NpmInstall"
==> "DotnetRestore"
==> "Watch"
"Clean"
==> "NpmInstall"
==> "DotnetRestore"
==> "WatchInMemory"
"Clean"
==> "NpmInstall"
==> "DotnetRestore"
==> "Release"
RunTargetOrDefault "Release"