This repository has been archived by the owner on May 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
68 lines (50 loc) · 1.96 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
#r "nuget: Fake.Core.Process,5.20.3"
#r "nuget: Fake.IO.FileSystem,5.20.3"
#r "nuget: Fake.DotNet.Cli,5.20.3"
#r "nuget: Fake.JavaScript.Yarn,5.20.3"
#r "nuget: BlackFox.Fake.BuildTask,0.1.3"
#load "./scripts/WebClient.fsx"
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.DotNet
open Fake.JavaScript
open BlackFox.Fake
let editorProjectDir = "Fun.I18n.Editor"
let demoProjectDir = "Fun.I18n.Provider.FableDemo"
let testProjectDir = "Fun.I18n.Provider.Tests"
let publishDir = __SOURCE_DIRECTORY__ </> "publish"
let githubDocs = __SOURCE_DIRECTORY__ </> "docs"
fsi.CommandLineArgs
|> Array.skip 1
|> BuildTask.setupContextFromArgv
let checkEnv =
BuildTask.create "CheckEnv" [] {
Yarn.exec "--version" id
Yarn.install (fun x -> { x with WorkingDirectory = demoProjectDir </> "www" })
Yarn.install (fun x -> { x with WorkingDirectory = editorProjectDir </> "www" })
DotNet.exec id "tool restore" "" |> ignore
}
let startDemoDev =
BuildTask.create "StartDemoDev" [ checkEnv ] {
WebClient.startDev "--exclude Fun.I18n.Provider.fsproj" demoProjectDir 8080
}
let bundleDemo =
BuildTask.create "BundleDemo" [ checkEnv ] {
WebClient.bundle "--exclude Fun.I18n.Provider.fsproj" demoProjectDir (publishDir </> "client")
}
let startEditorDev =
BuildTask.create "StartEditorDev" [ checkEnv ] {
WebClient.startDev "--exclude Fun.I18n.Provider.fsproj" editorProjectDir 8081
}
let bundleEditor =
BuildTask.create "BundleEditor" [ checkEnv ] {
Shell.cleanDir githubDocs
WebClient.bundle "--exclude Fun.I18n.Provider.fsproj" editorProjectDir githubDocs
}
let test =
BuildTask.create "Test" [] {
DotNet.exec (fun op -> { op with WorkingDirectory = testProjectDir }) "run" "" |> ignore
Yarn.install (fun op -> { op with WorkingDirectory = testProjectDir })
Yarn.exec "test" (fun op -> { op with WorkingDirectory = testProjectDir })
}
BuildTask.runOrDefault test