fix build task when yarn is not installed

Original commit: elastic/kibana-plugin-helpers@d48808f8d8
This commit is contained in:
spalger 2017-03-29 12:23:51 -07:00
parent 3a2a636da0
commit 6611bc4c8f
2 changed files with 3 additions and 6 deletions

View file

@ -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);
}
});
};

View file

@ -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]
});