-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.fs
79 lines (64 loc) · 1.86 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
open Fake
open Fake.Core
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.TargetOperators
open System
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.Tailwind"
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 "Npm version:"
Tools.npm "--version" clientSrcPath
Tools.npm "install" clientSrcPath
)
let createNuget proj =
clean proj
Tools.npm "install" proj
Tools.dotnet "restore --no-cache" proj
Tools.dotnet "pack -c Release" proj
let getBuildParam = Environment.environVar
let isNullOrWhiteSpace = String.IsNullOrWhiteSpace
let publishNuget proj =
createNuget proj
let nugetKey =
match getBuildParam "nugetkey" with
| s when not (isNullOrWhiteSpace s) -> s
| _ -> UserInput.getUserPassword "NuGet Key: "
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.npm "run build" ""
)
Target.create "RunDocs" (fun _ ->
Tools.npm "run startdocs" "")
Target.create "Run" (fun _ ->
Tools.npm "run start" ""
)
let dependencies = [
"InstallClient" ==> "PublishDocs"
"InstallClient" ==> "Publish"
"InstallClient" ==> "Pack"
"InstallClient" ==> "Run"
]
[<EntryPoint>]
let main args = runOrDefault "Run" args