-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
75 lines (63 loc) · 1.86 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
69
70
71
72
73
74
75
#r @"tools/FAKE/tools/FakeLib.dll"
open Fake
open Fake.ProcessHelper
open Fake.Git
let npmVersion = "3.3.4"
let nugetVersion = "3.3.4"
let pkgDir = "./pkg/"
let publish = (getBuildParamOrDefault "publish" "false") = "true"
Target "CleanNpm" (fun _ ->
CleanDir "node_modules"
)
Target "CleanPkg" (fun _ ->
CleanDir pkgDir
)
Target "NpmInstall" (fun _ ->
let npm64 = @"C:\Program Files\nodejs\npm.cmd"
let npm86 = combinePaths ProgramFilesX86 @"nodejs\npm.cmd"
let npm = if fileExists npm64 then npm64 else npm86
if (fileExists npm <> true) then failwith "NPM not found"
let result = ExecProcess (fun info ->
info.FileName <- npm
info.Arguments <- "install bootstrap-switch@"+npmVersion) (System.TimeSpan(0, 2, 0))
match result with
| OK -> trace "Done building installing node modules"
| _ -> failwith "Failed to build install node modules"
)
Target "NuGetCss" (fun _ ->
ensureDirectory pkgDir
"Bootstrap.Switch.nuspec"
|> NuGet (fun p ->
{p with
Project = "Bootstrap.Switch"
WorkingDir = "./"
OutputPath = pkgDir
Version = nugetVersion
Publish = publish
})
)
Target "NuGetLess" (fun _ ->
ensureDirectory pkgDir
"Bootstrap.Switch.Less.nuspec"
|> NuGet (fun p ->
{p with
Project = "Bootstrap.Switch.Less"
WorkingDir = "./"
OutputPath = pkgDir
Version = nugetVersion
Publish = publish
})
)
Target "GitTag" (fun _ ->
Branches.tag "./" ("v"+nugetVersion)
)
Target "Clean" DoNothing
Target "Default" DoNothing
"Clean"
==> "NpmInstall"
==> "NuGetCss"
==> "NuGetLess"
=?> ("GitTag", publish)
==> "Default"
"CleanNpm" ==> "CleanPkg" ==> "Clean"
RunTargetOrDefault "Default"