-
Notifications
You must be signed in to change notification settings - Fork 10
/
Build.fs
72 lines (59 loc) · 1.75 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
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 publishPath = Path.getFullName "publish"
let srcPath = Path.getFullName "src"
let clientSrcPath = srcPath </> "Docs"
let librarySrcPath = srcPath </> "Feliz.DaisyUI"
let appPublishPath = publishPath </> "app"
// Targets
let clean proj = [ proj </> "bin"; proj </> "obj" ] |> Shell.cleanDirs
Target.create "InstallClient" (fun _ ->
printfn "Node version:"
Tools.node "--version" clientSrcPath
printfn "Yarn version:"
Tools.yarn "--version" clientSrcPath
Tools.yarn "install --frozen-lockfile" clientSrcPath
)
let createNuget proj =
clean 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 "Pack" (fun _ ->
createNuget librarySrcPath
)
Target.create "Publish" (fun _ ->
publishNuget librarySrcPath
)
Target.create "PublishDocs" (fun _ ->
Tools.yarn "build" ""
)
Target.create "Run" (fun _ ->
Tools.yarn "start" ""
)
let dependencies = [
"InstallClient" ==> "PublishDocs"
"InstallClient" ==> "Publish"
"InstallClient" ==> "Pack"
"InstallClient" ==> "Run"
]
[<EntryPoint>]
let main args = runOrDefault "Run" args