-
Notifications
You must be signed in to change notification settings - Fork 19
/
Build.fs
124 lines (98 loc) · 4.62 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
open Fake
open Fake.Core
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.TargetOperators
open System.IO
open BuildHelpers
open BuildTools
initializeContext()
let docsSrcPath = "src" </> "Docs"
let docsPublishPath = "publish" </> "docs"
let fableBuildPath = ".fable-build" //docsSrcPath </> ".fable-build"
// Targets
let clean proj = [ proj </> "bin"; proj </> "obj" ] |> Shell.cleanDirs
let validateFemto proj = Tools.dotnet $"femto --validate {proj}" "."
let createNuget proj =
clean proj
validateFemto proj
Tools.yarn "install" proj
Tools.dotnet "restore --no-cache" proj
Tools.dotnet "pack -c Release" proj
let publishNuget proj =
createNuget proj
let nugetKey =
match Environment.environVarOrNone "NUGET_KEY" with
| Some nugetKey -> nugetKey
| None -> failwith "The Nuget API key must be set in a NUGET_KEY environmental variable"
let nupkg =
Directory.GetFiles(proj </> "bin" </> "Release")
|> Seq.head
|> Path.GetFullPath
Tools.dotnet (sprintf "nuget push %s -s nuget.org -k %s" nupkg nugetKey) proj
Target.create "PackBulma" (fun _ -> "src" </> "Feliz.Bulma" |> createNuget)
Target.create "PublishBulma" (fun _ -> "src" </> "Feliz.Bulma" |> publishNuget)
Target.create "PackQuickView" (fun _ -> "src" </> "Feliz.Bulma.QuickView" |> createNuget)
Target.create "PublishQuickView" (fun _ -> "src" </> "Feliz.Bulma.QuickView" |> publishNuget)
Target.create "PackTooltip" (fun _ -> "src" </> "Feliz.Bulma.Tooltip" |> createNuget)
Target.create "PublishTooltip" (fun _ -> "src" </> "Feliz.Bulma.Tooltip" |> publishNuget)
Target.create "PackCheckradio" (fun _ -> "src" </> "Feliz.Bulma.Checkradio" |> createNuget)
Target.create "PublishCheckradio" (fun _ -> "src" </> "Feliz.Bulma.Checkradio" |> publishNuget)
Target.create "PackSwitch" (fun _ -> "src" </> "Feliz.Bulma.Switch" |> createNuget)
Target.create "PublishSwitch" (fun _ -> "src" </> "Feliz.Bulma.Switch" |> publishNuget)
Target.create "PackPopover" (fun _ -> "src" </> "Feliz.Bulma.Popover" |> createNuget)
Target.create "PublishPopover" (fun _ -> "src" </> "Feliz.Bulma.Popover" |> publishNuget)
Target.create "PackPageLoader" (fun _ -> "src" </> "Feliz.Bulma.PageLoader" |> createNuget)
Target.create "PublishPageLoader" (fun _ -> "src" </> "Feliz.Bulma.PageLoader" |> publishNuget)
Target.create "PackDateTimePicker" (fun _ -> "src" </> "Feliz.Bulma.DateTimePicker" |> createNuget)
Target.create "PublishDateTimePicker" (fun _ -> "src" </> "Feliz.Bulma.DateTimePicker" |> publishNuget)
Target.create "PackDivider" (fun _ -> "src" </> "Feliz.Bulma.Divider" |> createNuget)
Target.create "PublishDivider" (fun _ -> "src" </> "Feliz.Bulma.Divider" |> publishNuget)
Target.create "PackBadge" (fun _ -> "src" </> "Feliz.Bulma.Badge" |> createNuget)
Target.create "PublishBadge" (fun _ -> "src" </> "Feliz.Bulma.Badge" |> publishNuget)
Target.create "PackSlider" (fun _ -> "src" </> "Feliz.Bulma.Slider" |> createNuget)
Target.create "PublishSlider" (fun _ -> "src" </> "Feliz.Bulma.Slider" |> publishNuget)
Target.create "PackTimeline" (fun _ -> "src" </> "Feliz.Bulma.Timeline" |> createNuget)
Target.create "PublishTimeline" (fun _ -> "src" </> "Feliz.Bulma.Timeline" |> publishNuget)
Target.create "PackTagsInput" (fun _ -> "src" </> "Feliz.Bulma.TagsInput" |> createNuget)
Target.create "PublishTagsInput" (fun _ -> "src" </> "Feliz.Bulma.TagsInput" |> publishNuget)
Target.create "InstallDocs" (fun _ ->
printfn "Node version:"
Tools.node "--version" docsSrcPath
printfn "Yarn version:"
Tools.yarn "--version" docsSrcPath
Tools.yarn "install --frozen-lockfile" docsSrcPath
)
Target.create "PublishDocs" (fun _ ->
[ docsPublishPath] |> Shell.cleanDirs
Environment.setEnvironVar "NODE_OPTIONS" "--openssl-legacy-provider"
Tools.dotnet (sprintf "fable --outDir %s --run webpack-cli" fableBuildPath) docsSrcPath
)
Target.create "RunDocs" (fun _ ->
Environment.setEnvironVar "NODE_OPTIONS" "--openssl-legacy-provider"
Tools.dotnet (sprintf "fable watch --outDir %s --run webpack-dev-server" fableBuildPath) docsSrcPath
)
Target.create "PublishAll" (fun _ ->
[
"PublishBulma"
"PublishQuickView"
"PublishTooltip"
"PublishCheckradio"
"PublishSwitch"
"PublishPopover"
"PublishPageLoader"
"PublishDateTimePicker"
"PublishDivider"
"PublishBadge"
"PublishSlider"
"PublishTimeline"
"PublishTagsInput"
]
|> List.iter (fun x -> Target.run 1 x [])
)
let dependencies = [
"InstallDocs" ==> "RunDocs"
"InstallDocs" ==> "PublishDocs"
]
[<EntryPoint>]
let main args = runOrDefault "RunDocs" args