This repository has been archived by the owner on Sep 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild.fs
91 lines (69 loc) · 2.14 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
open Fake.Core
open Fake.IO
open Helpers
initializeContext()
open Fake.Core.TargetOperators
let (</>) = Path.combine
let libPath = "./src/Feliz.ReactSpectrum"
let docsPath = "./docs"
let docsSrcPath = docsPath </> "src"
let docsPublishPath = docsSrcPath </> "dist"
let cleanCacheDirs () =
[ libPath </> "bin"
libPath </> "obj"
docsSrcPath </> "bin"
docsSrcPath </> "obj" ]
|> Shell.cleanDirs
let cleanFableFiles () =
// Delete *.fs.js files created by Fable
run dotnet "fable clean --yes" libPath
run dotnet "fable clean --yes" docsSrcPath
let validateFemto projectPath =
run dotnet "femto --validate" projectPath
let publish projectPath =
[ projectPath </> "bin"
projectPath </> "obj" ] |> Shell.cleanDirs
validateFemto projectPath
run dotnet "restore --no-cache" projectPath
run dotnet "pack -c Release" projectPath
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 =
projectPath </> "bin" </> "Release"
|> DirectoryInfo.ofPath
|> DirectoryInfo.getFiles
|> Seq.head
|> (fun x -> x.FullName)
let pushCmd = sprintf "nuget push %s -s nuget.org -k %s" nupkg nugetKey
run dotnet pushCmd projectPath
Target.create "Clean" <| fun _ ->
cleanFableFiles()
cleanCacheDirs()
Target.create "InstallNpmPackages" <| fun _ ->
run npm "install" docsPath
Target.create "BuildDocs" <| fun _ ->
run npm "run build" docsPath
Target.create "RunDocs" <| fun _ ->
run npm "run start" docsPath
Target.create "PublishDocs" <| fun _ ->
run npm "run publish-docs" docsPath
Target.create "PublishNuget" <| fun _ ->
publish libPath
open Fake.Core.TargetOperators
let dependencies = [
"Clean"
==> "InstallNpmPackages"
==> "BuildDocs"
"InstallNpmPackages"
==> "RunDocs"
"Clean"
==> "InstallNpmPackages"
==> "BuildDocs"
==> "PublishDocs"
"Clean"
==> "PublishNuget"
]
[<EntryPoint>]
let main args = runOrDefault args