Merge pull request #2129 from storybooks/haul-platform-option

#2128 Add platform option for haul bundler
This commit is contained in:
Evgeny Zaytsev 2017-10-30 08:58:12 +02:00 committed by GitHub
commit ef7869d9b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -82,7 +82,7 @@ If you are using Android and you get the following error after running the app:
If you want to use haul instead of the react-native packager, modify the storybook npm script to:
```sh
storybook start -p 7007 --haul webpack.haul.storybook.js
storybook start -p 7007 --haul webpack.haul.storybook.js --platform android | ios | all
```
Where webpack.haul.storybook.js should look something like this:

View File

@ -10,6 +10,7 @@ program
.option('-h, --host <host>', 'host to listen on')
.option('-p, --port <port>', 'port to listen on')
.option('--haul <configFile>', 'use haul with config file')
.option('--platform <ios|android|all>', 'build platform-specific build')
.option('-s, --secured', 'whether server is running on https')
.option('-c, --config-dir [dir-name]', 'storybook config directory')
.option('-e, --environment [environment]', 'DEVELOPMENT/PRODUCTION environment for webpack')
@ -76,7 +77,8 @@ if (!program.skipPackager) {
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`;
const platform = program.platform || 'all';
cliCommand = `node node_modules/.bin/haul start --config ${program.haul} --platform ${platform}`;
}
// RN packager
shelljs.exec(