mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-21 05:02:39 +08:00
Fix bug in RN gestorybook
- replace APP_NAME in the correct file - add a warning if APP_NAME cannot be found
This commit is contained in:
parent
36d7ec2668
commit
222ca3c0e3
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user