mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
Merge pull request #4213 from Keraito/cli-gestorybook-fix
Cli gestorybook fix
This commit is contained in:
commit
dd1953c953
@ -12,39 +12,38 @@ if (process.argv[1].includes('getstorybook')) {
|
||||
logger.log(chalk.yellow('The official command to install Storybook from now on is:\n'));
|
||||
codeLog(['storybook init']);
|
||||
logger.log();
|
||||
initiate({}, pkg);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
program
|
||||
.command('init')
|
||||
.description('Initialize Storybook into your project.')
|
||||
.option('-f --force', 'Forcely add storybook')
|
||||
.option('-s --skip-install', 'Skip installing deps')
|
||||
.option('-N --use-npm', 'Use npm to install deps')
|
||||
.option('-p --parser <babel | babylon | flow>', 'jscodeshift parser')
|
||||
.option('-h --html', 'Add storybook for HTML')
|
||||
.action(options => initiate(options, pkg));
|
||||
|
||||
program
|
||||
.command('start')
|
||||
.description('Start the local Storybook server')
|
||||
.option('-N --use-npm', 'Use NPM to start the Storybook server')
|
||||
.action(options => yarnSpawnSync(options, ['run', 'storybook']));
|
||||
|
||||
program
|
||||
.command('build')
|
||||
.description('Build the Storybook static application')
|
||||
.option('-N --use-npm', 'Use NPM to build the Storybook server')
|
||||
.action(options => yarnSpawnSync(options, ['build', 'storybook']));
|
||||
|
||||
program.command('*', { noHelp: true }).action(cmd => {
|
||||
logger.error('Invalid command: %s.\nSee --help for a list of available commands.', cmd);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
program.version(pkg.version).parse(process.argv);
|
||||
|
||||
if (!program.args.length) {
|
||||
program.help();
|
||||
initiate({}, pkg).then(() => process.exit(0));
|
||||
} else {
|
||||
program
|
||||
.command('init')
|
||||
.description('Initialize Storybook into your project.')
|
||||
.option('-f --force', 'Forcely add storybook')
|
||||
.option('-s --skip-install', 'Skip installing deps')
|
||||
.option('-N --use-npm', 'Use npm to install deps')
|
||||
.option('-p --parser <babel | babylon | flow>', 'jscodeshift parser')
|
||||
.option('-h --html', 'Add storybook for HTML')
|
||||
.action(options => initiate(options, pkg));
|
||||
|
||||
program
|
||||
.command('start')
|
||||
.description('Start the local Storybook server')
|
||||
.option('-N --use-npm', 'Use NPM to start the Storybook server')
|
||||
.action(options => yarnSpawnSync(options, ['run', 'storybook']));
|
||||
|
||||
program
|
||||
.command('build')
|
||||
.description('Build the Storybook static application')
|
||||
.option('-N --use-npm', 'Use NPM to build the Storybook server')
|
||||
.action(options => yarnSpawnSync(options, ['build', 'storybook']));
|
||||
|
||||
program.command('*', { noHelp: true }).action(cmd => {
|
||||
logger.error('Invalid command: %s.\nSee --help for a list of available commands.', cmd);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
program.version(pkg.version).parse(process.argv);
|
||||
|
||||
if (!program.args.length) {
|
||||
program.help();
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ export default function(options, pkg) {
|
||||
}
|
||||
};
|
||||
|
||||
runGenerator().catch(ex => {
|
||||
return runGenerator().catch(ex => {
|
||||
logger.error(`\n ${chalk.red(ex.stack)}`);
|
||||
process.exit(1);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user