-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
69 lines (55 loc) · 1.65 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
#r @"packages/build/FAKE/tools/FakeLib.dll"
open System
open Fake
let serverPath = "./src/Server" |> FullName
let serverProj = serverPath </> "Server.fsproj"
let clientPath = "./src/Client" |> FullName
let platformTool tool winTool =
let tool = if isUnix then tool else winTool
tool
|> ProcessHelper.tryFindFileOnPath
|> function Some t -> t | _ -> failwithf "%s not found" tool
let nodeTool = platformTool "node" "node.exe"
let yarnTool = platformTool "yarn" "yarn.cmd"
let mutable dotnetCli = "dotnet"
let run cmd args workingDir =
let result =
ExecProcess (fun info ->
info.FileName <- cmd
info.WorkingDirectory <- workingDir
info.Arguments <- args) TimeSpan.MaxValue
if result <> 0 then failwithf "'%s %s' failed" cmd args
Target "Clean" DoNothing
Target "InstallClient" (fun _ ->
printfn "Node version:"
run nodeTool "--version" __SOURCE_DIRECTORY__
printfn "Yarn version:"
run yarnTool "--version" __SOURCE_DIRECTORY__
run yarnTool "install --frozen-lockfile" __SOURCE_DIRECTORY__
)
Target "Build" (fun () ->
run dotnetCli "build" serverPath
run dotnetCli "restore" clientPath
// run dotnetCli "fable webpack -- -p" clientPath
)
Target "Run" (fun () ->
let server = async {
run dotnetCli ("run --project " + serverProj) "."
}
let client = async {
run dotnetCli "fable webpack-dev-server" clientPath
}
let browser = async {
Threading.Thread.Sleep 5000
Diagnostics.Process.Start "http://localhost:8080" |> ignore
}
[ server; client; browser]
|> Async.Parallel
|> Async.RunSynchronously
|> ignore
)
"Clean"
==> "InstallClient"
==> "Build"
==> "Run"
RunTargetOrDefault "Build"