From 6611bc4c8ff441b00a6009760e4abda2fe850de5 Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 29 Mar 2017 12:23:51 -0700 Subject: [PATCH] fix `build` task when yarn is not installed Original commit: elastic/kibana-plugin-helpers@d48808f8d832bda1dd11f84724958ad78e08aa0e --- packages/kbn-plugin-helpers/tasks/build/create_build.js | 6 ++---- .../tasks/test/browser/test_browser_action.js | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/kbn-plugin-helpers/tasks/build/create_build.js b/packages/kbn-plugin-helpers/tasks/build/create_build.js index 1bf2f2b37f62..c50fcf495c13 100644 --- a/packages/kbn-plugin-helpers/tasks/build/create_build.js +++ b/packages/kbn-plugin-helpers/tasks/build/create_build.js @@ -35,7 +35,6 @@ module.exports = function createBuild(plugin, buildTarget, buildVersion, kibanaV }) .then(function () { // install packages in build - var cmd = winCmd('npm'); var options = { cwd: buildRoot, stdio: ['ignore', 'ignore', 'pipe'], @@ -43,12 +42,11 @@ module.exports = function createBuild(plugin, buildTarget, buildVersion, kibanaV try { // use yarn if yarn lockfile is found in the build - cmd = winCmd('yarn'); statSync(join(buildRoot, 'yarn.lock')); - execFileSync(cmd, ['install', '--production'], options); + execFileSync(winCmd('yarn'), ['install', '--production'], options); } catch (e) { // use npm if there is no yarn lockfile in the build - execFileSync(cmd, ['install', '--production', '--no-bin-links'], options); + execFileSync(winCmd('npm'), ['install', '--production', '--no-bin-links'], options); } }); }; diff --git a/packages/kbn-plugin-helpers/tasks/test/browser/test_browser_action.js b/packages/kbn-plugin-helpers/tasks/test/browser/test_browser_action.js index 0c27e4088126..800b4413f601 100644 --- a/packages/kbn-plugin-helpers/tasks/test/browser/test_browser_action.js +++ b/packages/kbn-plugin-helpers/tasks/test/browser/test_browser_action.js @@ -14,10 +14,9 @@ module.exports = function testBrowserAction(plugin, run, options) { kbnServerArgs.push('--kbnServer.tests_bundle.pluginId=' + plugin.id); } - var cmd = winCmd('npm'); var task = (options.dev) ? 'test:dev' : 'test:browser'; var args = ['run', task, '--'].concat(kbnServerArgs); - execFileSync(cmd, args, { + execFileSync(winCmd('npm'), args, { cwd: plugin.kibanaRoot, stdio: ['ignore', 1, 2] });