-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBuild.fs
More file actions
81 lines (68 loc) · 1.9 KB
/
Build.fs
File metadata and controls
81 lines (68 loc) · 1.9 KB
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
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 </> "Shopfoo.Client"
let serverSrcPath = srcPath </> "Shopfoo.Server"
let appPublishPath = publishPath </> "app"
// Targets
let clean proj =
[
proj </> "bin"
proj </> "obj"
proj </> ".fable-build"
]
|> Shell.cleanDirs
Target.create
"Clean"
(fun _ ->
serverSrcPath |> clean
clientSrcPath |> clean
)
Target.create
"InstallClient"
(fun _ ->
printfn "Node version:"
run Tools.node "--version" clientSrcPath
printfn "Yarn version:"
run Tools.yarn "--version" clientSrcPath
run Tools.yarn "install --frozen-lockfile" clientSrcPath
)
Target.create
"Publish"
(fun _ ->
[ appPublishPath ] |> Shell.cleanDirs
let publishArgs = $"publish -c Release -o \"%s{appPublishPath}\""
run Tools.dotnet publishArgs serverSrcPath
[ appPublishPath </> "appsettings.Development.json" ] |> File.deleteAll
run Tools.dotnet "fable clean --yes" ""
run Tools.yarn "build" ""
)
Target.create
"Run"
(fun _ ->
Environment.setEnvironVar "ASPNETCORE_ENVIRONMENT" "Development"
runParallel [
"server", Tools.dotnet "watch run" serverSrcPath // ↩
"client", Tools.yarn "start" ""
]
)
Target.create
"Server"
(fun _ ->
Environment.setEnvironVar "ASPNETCORE_ENVIRONMENT" "Development"
runParallel [ "server", Tools.dotnet "watch run --no-restore" serverSrcPath ]
)
let dependencies = [
"InstallClient" ==> "Clean" ==> "Publish"
"InstallClient" ==> "Clean" ==> "Run"
"Server"
]
[<EntryPoint>]
let main args = // ↩
runOrDefault "Run" args