-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.fs
60 lines (50 loc) · 1.47 KB
/
Build.fs
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
open Fake
open Fake.Core
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.TargetOperators
open BuildHelpers
open BuildTools
initializeContext()
let publishPath = Path.getFullName "publish"
let srcPath = Path.getFullName "src"
let clientSrcPath = srcPath </> "FuncasterStudio.Client"
let serverSrcPath = srcPath </> "FuncasterStudio.Server"
let appPublishPath = publishPath </> "app"
// Targets
let clean proj = [ proj </> "bin"; proj </> "obj" ] |> Shell.cleanDirs
Target.create "InstallClient" (fun _ ->
printfn "Node version:"
Tools.node "--version" clientSrcPath
printfn "Yarn version:"
Tools.yarn "--version" clientSrcPath
Tools.yarn "install --frozen-lockfile" clientSrcPath
)
Target.create "Publish" (fun _ ->
[ appPublishPath ] |> Shell.cleanDirs
let publishArgs = sprintf "publish -c Release -o \"%s\"" appPublishPath
Tools.dotnet publishArgs serverSrcPath
[ appPublishPath </> "appsettings.Development.json" ] |> File.deleteAll
Tools.yarn "build" ""
)
Target.create "Run" (fun _ ->
let server = async {
Environment.setEnvironVar "ASPNETCORE_ENVIRONMENT" "Development"
Tools.dotnet "watch run" serverSrcPath
}
let client = async {
Tools.yarn "start" ""
}
[server;client]
|> Async.Parallel
|> Async.RunSynchronously
|> ignore
)
let dependencies = [
"InstallClient"
==> "Publish"
"InstallClient"
==> "Run"
]
[<EntryPoint>]
let main args = runOrDefault "Run" args