Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Add run-ios command #27

Merged
merged 1 commit into from
Jun 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions dist/bin/storybook.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env node
'use strict';

var _shelljs = require('shelljs');

var _shelljs2 = _interopRequireDefault(_shelljs);

var _commander = require('commander');

var _commander2 = _interopRequireDefault(_commander);
Expand All @@ -26,4 +30,10 @@ _commander2.default.command('start [platform]').option('-h, --host <host>', 'hos
});
});

_commander2.default.command('run-ios').option('-a, --appname <appname>', 'storybook application name eg. "MyAppStorybook"').option('-i, --identifier <identifier>', 'storybook application identifier eg. "org.mycompany.MyAppStorybook"').description('starts react native storybook ios simulator').action(function (env) {
_shelljs2.default.exec('react-native run-ios --scheme=' + env.appname);
_shelljs2.default.exec('xcrun simctl install booted ios/build/Build/Products/Debug-iphonesimulator/' + env.appname + '.app');
_shelljs2.default.exec('xcrun simctl launch booted ' + env.identifier);
});

_commander2.default.parse(process.argv);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"events": "^1.1.0",
"express": "^4.14.0",
"react-dom": "^15.1.0",
"shelljs": "^0.7.0",
"ws": "^1.1.0"
}
}
12 changes: 12 additions & 0 deletions src/bin/storybook.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node

import shell from 'shelljs';
import program from 'commander';
import server from '../server';

Expand All @@ -24,5 +25,16 @@ program
})
});

program
.command('run-ios')
.option('-a, --appname <appname>', 'storybook application name eg. "MyAppStorybook"')
.option('-i, --identifier <identifier>', 'storybook application identifier eg. "org.mycompany.MyAppStorybook"')
.description('starts react native storybook ios simulator')
.action(function(env) {
shell.exec(`react-native run-ios --scheme=${env.appname}`);
shell.exec(`xcrun simctl install booted ios/build/Build/Products/Debug-iphonesimulator/${env.appname}.app`);
shell.exec(`xcrun simctl launch booted ${env.identifier}`);
});

program
.parse(process.argv);