diff --git a/src/app/Fake.JavaScript.Yarn/Yarn.fs b/src/app/Fake.JavaScript.Yarn/Yarn.fs index 54d3057f487..752c4e52f34 100644 --- a/src/app/Fake.JavaScript.Yarn/Yarn.fs +++ b/src/app/Fake.JavaScript.Yarn/Yarn.fs @@ -18,7 +18,7 @@ module Yarn = /// Default paths to Yarn let private yarnFileName = - Process.tryFindFileOnPath "yarn" + ProcessUtils.tryFindFileOnPath "yarn" |> function | Some yarn when File.Exists yarn -> yarn | _ -> @@ -35,6 +35,7 @@ module Yarn = | NoLockFile | Production | PureLockFile + | FrozenLockFile /// The list of supported Yarn commands. The `Custom` alternative /// can be used for other commands not in the list until they are @@ -65,6 +66,7 @@ module Yarn = | NoLockFile -> " --no-lockfile" | Production -> " --production" | PureLockFile -> " --pure-lockfile" + | FrozenLockFile -> " --frozen-lockfile" let private parse = function | Install installArgs -> sprintf "install%s" (installArgs |> parseInstallArgs) @@ -73,20 +75,16 @@ module Yarn = let private run yarnParams command = let yarnPath = Path.GetFullPath(yarnParams.YarnFilePath) let arguments = command |> parse - let exitCode = - Process.execSimple (fun info -> - { info with - FileName = yarnPath - WorkingDirectory = yarnParams.WorkingDirectory - Arguments = arguments - } - ) yarnParams.Timeout - - if exitCode <> 0 then failwith (sprintf "'yarn %s' task failed" arguments) + arguments + |> CreateProcess.fromRawCommandLine yarnPath + |> CreateProcess.withWorkingDirectory yarnParams.WorkingDirectory + |> CreateProcess.withTimeout yarnParams.Timeout + |> CreateProcess.ensureExitCodeWithMessage (sprintf "'yarn %s' task failed" arguments) + |> Proc.run + |> ignore let private yarn setParams = defaultYarnParams |> setParams |> run - /// Run `yarn install` /// ## Parameters /// - 'setParams' - set command parameters @@ -107,9 +105,8 @@ module Yarn = /// { o with /// WorkingDirectory = "./src/FAKESimple.Web/" /// }) - - let installProduction setParams = yarn setParams <| Install Production + let installProduction setParams = yarn setParams <| Install Production /// Run `yarn install --force` /// ## Parameters /// - 'setParams' - set command parameters @@ -132,7 +129,6 @@ module Yarn = /// }) let installFlat setParams = yarn setParams <| Install Flat - /// Run `yarn install --har` /// ## Parameters /// - 'setParams' - set command parameters @@ -166,6 +162,17 @@ module Yarn = /// }) let installPureLock setParams = yarn setParams <| Install PureLockFile + /// Run `yarn install --frozen-lockfile` + /// ## Parameters + /// - 'setParams' - set command parameters + /// ## Sample + /// + /// Yarn.installFrozenLockFile (fun o -> + /// { o with + /// WorkingDirectory = "./src/FAKESimple.Web/" + /// }) + let installFrozenLockFile setParams = yarn setParams <| Install FrozenLockFile + /// Run `yarn ` /// ## Parameters /// - 'setParams' - set command parameters @@ -175,4 +182,4 @@ module Yarn = /// { o with /// WorkingDirectory = "./src/FAKESimple.Web/" /// }) - let exec command setParams = yarn setParams <| Custom command \ No newline at end of file + let exec command setParams = yarn setParams <| Custom command