-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.fsx
81 lines (64 loc) · 1.72 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 "paket:
nuget FSharp.Core 4.7
nuget Fake.IO.FileSystem
nuget Fake.DotNet.Cli
nuget Fake.JavaScript.Yarn
nuget Fake.Core.Target
nuget Fake.Tools.Git //"
#load ".fake/build.fsx/intellisense.fsx"
open Fake.Core
open Fake.DotNet
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.Core.TargetOperators
open System
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 "Clean" (fun _ ->
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 _ ->
DotNet.exec id "fable" "src -o src/out --run webpack" |> ignore
)
Target.create "Watch" (fun _ ->
DotNet.exec id "fable" "watch src -o src/out -s --run webpack serve" |> ignore
)
// --------------------------------------------------------------------------------------
// 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
)
Target.create "Publish" ignore
// Build order
"Clean"
==> "Install"
==> "Build"
"Clean"
==> "Install"
==> "Watch"
"Publish"
<== [ "Build"
"ReleaseSample" ]
// start build
Target.runOrDefault "Build"