CLI (React Native): ensure having an explicit dependency on prop-types

This commit is contained in:
hypnos 2017-08-23 02:43:52 +03:00
parent 70d8829e5d
commit cfc8bf070a
2 changed files with 12 additions and 2 deletions

View File

@ -9,7 +9,8 @@ module.exports = Promise.all([
latestVersion('@storybook/react'),
latestVersion('@storybook/addon-actions'),
latestVersion('@storybook/addon-links'),
]).then(([storybookVersion, actionsVersion, linksVersion]) => {
latestVersion('prop-types'),
]).then(([storybookVersion, actionsVersion, linksVersion, propTypesVersion]) => {
// copy all files from the template directory to project directory
mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite');
@ -41,6 +42,10 @@ module.exports = Promise.all([
packageJson.devDependencies['react-dom'] = reactVersion;
}
if (!packageJson.dependencies['prop-types'] && !packageJson.devDependencies['prop-types']) {
packageJson.devDependencies['prop-types'] = `^${propTypesVersion}`;
}
packageJson.scripts = packageJson.scripts || {};
packageJson.scripts.storybook = 'storybook start -p 7007';

View File

@ -7,7 +7,8 @@ module.exports = Promise.all([
latestVersion('@storybook/react'),
latestVersion('@storybook/addon-actions'),
latestVersion('@storybook/addon-links'),
]).then(([storybookVersion, actionsVersion, linksVersion]) => {
latestVersion('prop-types'),
]).then(([storybookVersion, actionsVersion, linksVersion, propTypesVersion]) => {
// copy all files from the template directory to project directory
mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite');
@ -25,6 +26,10 @@ module.exports = Promise.all([
packageJson.devDependencies['react-dom'] = reactVersion;
}
if (!packageJson.dependencies['prop-types'] && !packageJson.devDependencies['prop-types']) {
packageJson.devDependencies['prop-types'] = `^${propTypesVersion}`;
}
packageJson.scripts = packageJson.scripts || {};
packageJson.scripts.storybook = 'storybook start -p 7007';