From 8fe8308ec9c40cb357a25fa590cb511d1a8b06f8 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Wed, 12 Oct 2016 08:20:07 +0530 Subject: [PATCH] Try to detect yarn from the install location. --- bin/generate.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/generate.js b/bin/generate.js index aa70842..86ff0d3 100755 --- a/bin/generate.js +++ b/bin/generate.js @@ -25,11 +25,13 @@ var welcomeMessage = 'getstorybook - the simplest way to add a storybook to your project.'; logger.log(chalk.inverse('\n ' + welcomeMessage + ' \n')); +var useYarn = Boolean(program.useYarn) || /\.yarn-cache/.test(__dirname); + var npmOptions = { - useYarn: Boolean(program.useYarn) + useYarn: useYarn }; -var runStorybookCommand = program.useYarn? 'yarn run storybook' : 'npm run storybook'; +var runStorybookCommand = useYarn? 'yarn run storybook' : 'npm run storybook'; // Update notify code. updateNotifier({