Skip to content

Commit 1fd3d3a

Browse files
authored
Merge pull request #101 from zzdtri/master
Support overriding npm and gulp working directories
2 parents 929094d + fc3bde2 commit 1fd3d3a

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

Gulp.fsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ let run (config : Map<string, string>) _ =
2121
| Some x -> x
2222
| _ -> "0.0.0"
2323

24+
let workingdir =
25+
match config.TryFind "gulp:dir" with
26+
| Some x when String.IsNullOrEmpty x = false -> x
27+
| _ -> ".\\build"
28+
2429
let args = sprintf "\"%s\" --env=%s --build=%s" gulp env build
2530

2631
let result =
2732
ExecProcess (fun info ->
2833
info.FileName <- Npm.node
29-
info.WorkingDirectory <- ".\\build"
34+
info.WorkingDirectory <- workingdir
3035
info.Arguments <- args) (TimeSpan.FromMinutes 5.)
3136

3237
if result <> 0 then failwith (sprintf "Gulp has exited with a non-zero error code: %d" result)
@@ -36,10 +41,15 @@ let run (config : Map<string, string>) _ =
3641
let target (config : Map<string, string>) name _ =
3742
let args = "\"" + gulp + "\" " + name
3843

44+
let workingdir =
45+
match config.TryFind "gulp:dir" with
46+
| Some x when String.IsNullOrEmpty x = false -> x
47+
| _ -> ".\\build"
48+
3949
let result =
4050
ExecProcess(fun info ->
4151
info.FileName <- Npm.node
42-
info.WorkingDirectory <- ".\\build"
52+
info.WorkingDirectory <- workingdir
4353
info.Arguments <- args) (TimeSpan.FromMinutes 15.)
4454

4555
if result <> 0 then failwith (sprintf "Gulp has exited with a non-zero error code: %d" result)

Npm.fsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ let install (config : Map<string, string>) _ =
1616

1717
let args = "install"
1818

19+
let workingdir =
20+
match config.TryFind "npm:dir" with
21+
| Some x when String.IsNullOrEmpty x = false -> x
22+
| _ -> ".\\build"
23+
1924
let result =
2025
ExecProcess (fun info ->
2126
info.FileName <- npm
22-
info.WorkingDirectory <- ".\\build"
27+
info.WorkingDirectory <- workingdir
2328
info.Arguments <- args) (TimeSpan.FromMinutes 5.)
2429

2530
()

0 commit comments

Comments
 (0)