mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-28 05:10:17 +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 mergeDirs = require('merge-dirs').default;
|
||||||
const helpers = require('../../lib/helpers');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const shell = require('shelljs');
|
const shell = require('shelljs');
|
||||||
const latestVersion = require('latest-version');
|
const latestVersion = require('latest-version');
|
||||||
|
const chalk = require('chalk');
|
||||||
|
const helpers = require('../../lib/helpers');
|
||||||
|
|
||||||
module.exports = latestVersion('@storybook/react-native').then(version => {
|
module.exports = latestVersion('@storybook/react-native').then(version => {
|
||||||
// copy all files from the template directory to project directory
|
// 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 dirname = shell.ls('-d', 'ios/*.xcodeproj').stdout;
|
||||||
const projectName =
|
const projectName =
|
||||||
dirname && dirname.slice('ios/'.length, dirname.length - '.xcodeproj'.length - 1);
|
dirname && dirname.slice('ios/'.length, dirname.length - '.xcodeproj'.length - 1);
|
||||||
if (projectName) {
|
if (!projectName) {
|
||||||
shell.sed('-i', '%APP_NAME%', projectName, 'storybook/index.js');
|
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();
|
const packageJson = helpers.getPackageJson();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user