mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-05 08:01:20 +08:00
1. detect CRNA projects 2. simplify RN and CRNA templates by consolidating app into single `index.js` instead of `index.ios.js` and `index.android.js` 3. notify user of extra setup steps in CLI 4. document CRNA idiosyncrasies in README
27 lines
994 B
JavaScript
27 lines
994 B
JavaScript
const mergeDirs = require('merge-dirs').default;
|
|
const helpers = require('../../lib/helpers');
|
|
const path = require('path');
|
|
const shell = require('shelljs');
|
|
const latestVersion = require('latest-version');
|
|
|
|
module.exports = latestVersion('@storybook/react-native').then(version => {
|
|
// copy all files from the template directory to project directory
|
|
mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite');
|
|
|
|
const packageJson = helpers.getPackageJson();
|
|
|
|
packageJson.dependencies = packageJson.dependencies || {};
|
|
packageJson.devDependencies = packageJson.devDependencies || {};
|
|
|
|
packageJson.devDependencies['@storybook/react-native'] = `^${version}`;
|
|
|
|
if (!packageJson.dependencies['react-dom'] && !packageJson.devDependencies['react-dom']) {
|
|
packageJson.devDependencies['react-dom'] = '^15.5.4';
|
|
}
|
|
|
|
packageJson.scripts = packageJson.scripts || {};
|
|
packageJson.scripts['storybook'] = 'storybook start -p 7007';
|
|
|
|
helpers.writePackageJson(packageJson);
|
|
});
|