From f135b9742379cb48307088172b320ef6871c15d5 Mon Sep 17 00:00:00 2001 From: Hagen Date: Thu, 17 Mar 2022 21:53:12 +0000 Subject: [PATCH] tweak(yarn): ignore dev deps --- resources/[system]/[builders]/yarn/yarn_builder.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/[system]/[builders]/yarn/yarn_builder.js b/resources/[system]/[builders]/yarn/yarn_builder.js index 5e85d839a..476f87086 100644 --- a/resources/[system]/[builders]/yarn/yarn_builder.js +++ b/resources/[system]/[builders]/yarn/yarn_builder.js @@ -13,6 +13,10 @@ const yarnBuildTask = { const packageJson = path.resolve(resourcePath, 'package.json'); const yarnLock = path.resolve(resourcePath, '.yarn.installed'); + const packageData = JSON.parse(fs.readFileSync(packageJson, 'utf8')); + if (!packageData.dependencies || !Object.keys(packageData.dependencies).length) { + return false; + } const packageStat = fs.statSync(packageJson); @@ -43,7 +47,7 @@ const yarnBuildTask = { currentBuildingModule = resourceName; const proc = child_process.fork( require.resolve('./yarn_cli.js'), - ['install', '--ignore-scripts', '--cache-folder', path.join(initCwd, 'cache', 'yarn-cache'), '--mutex', 'file:' + path.join(initCwd, 'cache', 'yarn-mutex')], + ['install', '--production', '--ignore-scripts', '--cache-folder', path.join(initCwd, 'cache', 'yarn-cache'), '--mutex', 'file:' + path.join(initCwd, 'cache', 'yarn-mutex')], { cwd: path.resolve(GetResourcePath(resourceName)), stdio: 'pipe',