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

Add node_module symlink support #1530

Merged
merged 9 commits into from
Aug 12, 2017
11 changes: 10 additions & 1 deletion app/react-native/src/bin/storybook-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,17 @@ server.listen(...listenAddr, err => {
});

if (!program.skipPackager) {
const projectRoots = configDir === projectDir ? [configDir] : [configDir, projectDir];
let symlinks = []

try{
const findSymlinksPaths = require('react-native/local-cli/util/findSymlinksPaths'); // eslint-disable-line global-require
symlinks = findSymlinksPaths(path.join(projectDir, 'node_modules'), [projectDir]);
}catch(e){
console.warn(`Unable to load findSymlinksPaths: ${e.message}`);
}

const projectRoots = (configDir === projectDir ? [configDir] : [configDir, projectDir]).concat(symlinks);
Copy link
Member

@danielduan danielduan Aug 8, 2017

Choose a reason for hiding this comment

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

I think it'd be a good option somewhere to be able to specify a different project root through storybook-start for those who have components and assets that need to be included from outside of the storybook root project.

It's definitely out of scope of this PR though so don't feel obligated to add this by any means. If it's a feature we want, I think a separate issue is an appropriate place to start.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, it would be nice to have, but probably belongs in a different PR


let cliCommand = 'node node_modules/react-native/local-cli/cli.js start';
if (program.haul) {
cliCommand = `node node_modules/.bin/haul start --config ${program.haul} --platform all`;
Expand Down