mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
ADD --yes option to CLI init command && USE --yes command to skip question where possible
This commit is contained in:
parent
c7c49c8b46
commit
1c1b22817b
@ -22,6 +22,7 @@ if (process.argv[1].includes('getstorybook')) {
|
|||||||
.option('-N --use-npm', 'Use npm to install deps')
|
.option('-N --use-npm', 'Use npm to install deps')
|
||||||
.option('-p --parser <babel | babylon | flow>', 'jscodeshift parser')
|
.option('-p --parser <babel | babylon | flow>', 'jscodeshift parser')
|
||||||
.option('-t --type <type>', 'Add Storybook for a specific project type')
|
.option('-t --type <type>', 'Add Storybook for a specific project type')
|
||||||
|
.option('-y --yes', 'Answer yes to all prompts')
|
||||||
.action(options => initiate(options, pkg));
|
.action(options => initiate(options, pkg));
|
||||||
|
|
||||||
program
|
program
|
||||||
|
@ -78,8 +78,9 @@ const installStorybook = (projectType, options) => {
|
|||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.REACT_NATIVE: {
|
case types.REACT_NATIVE: {
|
||||||
return inquirer
|
return (options.yes
|
||||||
.prompt([
|
? Promise.resolve()
|
||||||
|
: inquirer.prompt([
|
||||||
{
|
{
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
name: 'server',
|
name: 'server',
|
||||||
@ -88,6 +89,7 @@ const installStorybook = (projectType, options) => {
|
|||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
)
|
||||||
.then(({ server }) => reactNativeGenerator(npmOptions, server))
|
.then(({ server }) => reactNativeGenerator(npmOptions, server))
|
||||||
.then(commandLog('Adding storybook support to your "React Native" app'))
|
.then(commandLog('Adding storybook support to your "React Native" app'))
|
||||||
.then(end)
|
.then(end)
|
||||||
@ -186,7 +188,9 @@ const installStorybook = (projectType, options) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const projectTypeInquirer = async options => {
|
const projectTypeInquirer = async options => {
|
||||||
const manualAnswer = await inquirer.prompt([
|
const manualAnswer = options.yes
|
||||||
|
? true
|
||||||
|
: await inquirer.prompt([
|
||||||
{
|
{
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
name: 'manual',
|
name: 'manual',
|
||||||
|
@ -38,7 +38,7 @@ do
|
|||||||
cd $dir
|
cd $dir
|
||||||
|
|
||||||
# run @storybook/cli
|
# run @storybook/cli
|
||||||
../../../bin/index.js init --skip-install
|
../../../bin/index.js init --skip-install --yes
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user