-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
81 lines (63 loc) · 1.64 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
// include Fake libs
#r "./packages/build/FAKE/tools/FakeLib.dll"
open System
open Fake.Core
open Fake.IO
open Fake.DotNet
open Fake.IO.Globbing.Operators
open Fake.JavaScript
let gitName = "sample-react-counter"
let gitOwner = "fable-elmish"
let gitHome = sprintf "https://github.com/%s" gitOwner
// Filesets
let projects =
!! "src/**.fsproj"
Target.create "InstallDotNetCore" (fun _ ->
DotNet.Options.Create() |> DotNet.install id |> ignore
)
Target.create "Clean" (fun _ ->
Shell.cleanDir ".fable"
Shell.cleanDir "build"
)
Target.create "Install" (fun _ ->
Yarn.install id
projects
|> Seq.iter (fun s ->
let dir = IO.Path.GetDirectoryName s
DotNet.restore id dir
)
)
Target.create "Build" (fun _ ->
Yarn.exec "build" id
)
Target.create "Watch" (fun _ ->
Yarn.exec "start" id
)
// --------------------------------------------------------------------------------------
// Release Scripts
open Fake.Tools.Git
Target.create "ReleaseSample" (fun _ ->
let tempDocsDir = "temp/gh-pages"
Shell.cleanDir tempDocsDir
Repository.cloneSingleBranch "" (gitHome + "/" + gitName + ".git") "gh-pages" tempDocsDir
Shell.copyRecursive "build" tempDocsDir true |> ignore
Staging.stageAll tempDocsDir
Commit.exec tempDocsDir (sprintf "Update generated sample")
Branches.push tempDocsDir
)
open Fake.Core.TargetOperators
Target.create "Publish" ignore
// Build order
"Clean"
==> "InstallDotNetCore"
==> "Install"
==> "Build"
"Clean"
==> "InstallDotNetCore"
==> "Install"
==> "Watch"
"Publish"
<== [ "Build"
"ReleaseSample" ]
// start build
Target.runOrDefault "Build"