From ba1cd4b46fa891917c95d363c07e3da629b7c824 Mon Sep 17 00:00:00 2001
From: develar <develar@gmail.com>
Date: Mon, 31 Oct 2016 07:26:43 +0100
Subject: [PATCH] feat: initial yarn support (avoid --cache-min)

Closes #861
---
 src/util/util.ts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/util/util.ts b/src/util/util.ts
index eb401387e41..214e0d7d3ca 100644
--- a/src/util/util.ts
+++ b/src/util/util.ts
@@ -34,7 +34,12 @@ export function getGypEnv(electronVersion: string, arch: string): any {
 
 export function spawnNpmProduction(command: string, appDir: string, forceBuildFromSource: boolean, env?: any): Promise<any> {
   let npmExecPath = process.env.npm_execpath || process.env.NPM_CLI_JS
-  const npmExecArgs = [command, "--production", "--cache-min", "999999999"]
+  const npmExecArgs = [command, "--production"]
+
+  if (npmExecPath == null || !npmExecPath.includes("yarn")) {
+    npmExecArgs.push("--cache-min", "999999999")
+  }
+
   if (npmExecPath == null) {
     npmExecPath = process.platform === "win32" ? "npm.cmd" : "npm"
   }