diff --git a/lib/cli/generators/REACT_NATIVE/index.js b/lib/cli/generators/REACT_NATIVE/index.js index 6e68458ddac..a1c03a50da3 100644 --- a/lib/cli/generators/REACT_NATIVE/index.js +++ b/lib/cli/generators/REACT_NATIVE/index.js @@ -1,8 +1,9 @@ const mergeDirs = require('merge-dirs').default; -const helpers = require('../../lib/helpers'); const path = require('path'); const shell = require('shelljs'); const latestVersion = require('latest-version'); +const chalk = require('chalk'); +const helpers = require('../../lib/helpers'); module.exports = latestVersion('@storybook/react-native').then(version => { // copy all files from the template directory to project directory @@ -12,8 +13,14 @@ module.exports = latestVersion('@storybook/react-native').then(version => { const dirname = shell.ls('-d', 'ios/*.xcodeproj').stdout; const projectName = dirname && dirname.slice('ios/'.length, dirname.length - '.xcodeproj'.length - 1); - if (projectName) { - shell.sed('-i', '%APP_NAME%', projectName, 'storybook/index.js'); + if (!projectName) { + shell.sed('-i', '%APP_NAME%', projectName, 'storybook/storybook.js'); + } else { + helpers.paddedLog( + chalk.red( + 'ERR: Could not determine project name, see: https://github.com/storybooks/storybook/issues/1277' + ) + ); } const packageJson = helpers.getPackageJson();