Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added create-react-native-app support #1117

Merged
merged 6 commits into from
May 25, 2017
Merged

Added create-react-native-app support #1117

merged 6 commits into from
May 25, 2017

Conversation

shilman
Copy link
Member

@shilman shilman commented May 24, 2017

Issue: #1115

What I did

  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

Many thanks to @orta @tmeasday for helping me learn RN/CRNA basics!
And @inyono for rocking the post that inspired this PR.

How to test

yarn create react-native-app myapp
cd myapp
../path/to/storybook/lib/cli/bin/generate.js
# follow CLI / README instructions

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
@codecov
Copy link

codecov bot commented May 24, 2017

Codecov Report

Merging #1117 into master will decrease coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1117      +/-   ##
==========================================
- Coverage   12.73%   12.69%   -0.05%     
==========================================
  Files         199      199              
  Lines        4475     4491      +16     
  Branches      711      714       +3     
==========================================
  Hits          570      570              
- Misses       3275     3288      +13     
- Partials      630      633       +3
Impacted Files Coverage Δ
lib/cli/lib/project_types.js 0% <ø> (ø) ⬆️
lib/cli/bin/generate.js 0% <0%> (ø) ⬆️
lib/cli/lib/detect.js 0% <0%> (ø) ⬆️
addons/storyshots/src/test-bodies.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f908535...b7df231. Read the comment docs.

module.exports = __DEV__ ? StorybookUI : App;
```

Alternatively, `StorybookUI` is simply a RN `View` component that can be embedded anywhere in your RN application, e.g. on a tab or within an admin screen.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good coverage of options, nice work


if (!packageJson.dependencies['react-dom'] && !packageJson.devDependencies['react-dom']) {
packageJson.devDependencies['react-dom'] = '^15.5.4';
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 👍

@shilman
Copy link
Member Author

shilman commented May 24, 2017

@inyono Mind reviewing this PR? I actually came up with the __DEV__ trick independently, but simply added it in the README docs. Let me know what you think. Happy to make changes!

@inyono
Copy link

inyono commented May 24, 2017

Nice one! Will look over the PR at latest tomorrow :)

Copy link
Member

@danielduan danielduan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a native environment to test but it looks good!

@shilman
Copy link
Member Author

shilman commented May 25, 2017

@danielduan if you're curious to test it out, it takes just 3 minutes using the test instructions above -- super easy setup!

@codecov
Copy link

codecov bot commented May 25, 2017

Codecov Report

Merging #1117 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1117      +/-   ##
==========================================
- Coverage   12.89%   12.86%   -0.04%     
==========================================
  Files         199      199              
  Lines        4489     4501      +12     
  Branches      714      715       +1     
==========================================
  Hits          579      579              
- Misses       3278     3289      +11     
- Partials      632      633       +1
Impacted Files Coverage Δ
lib/cli/lib/project_types.js 0% <ø> (ø) ⬆️
lib/cli/lib/detect.js 0% <0%> (ø) ⬆️
lib/cli/bin/generate.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93f17b2...d7ab0c2. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants