diff --git a/packages/create-block/lib/index.js b/packages/create-block/lib/index.js index 88e1973c8c012..51c8d56755f3e 100644 --- a/packages/create-block/lib/index.js +++ b/packages/create-block/lib/index.js @@ -32,7 +32,7 @@ program .version( version ) .arguments( '[slug]' ) .option( '-t, --template ', 'template type name, allowed values: "es5", "esnext"', 'esnext' ) - .action( ( slug, { template } ) => { + .action( async ( slug, { template } ) => { try { const defaultAnswers = getDefaultAnswers( template ); if ( slug ) { @@ -44,19 +44,13 @@ program slug, title, }; - Promise.resolve() - .then( async () => { - await scaffold( template, answers ); - } ); + await scaffold( template, answers ); } else { - inquirer - .prompt( getPrompts( template ) ) - .then( async ( answers ) => { - await scaffold( template, { - ...defaultAnswers, - ...answers, - } ); - } ); + const answers = await inquirer.prompt( getPrompts( template ) ); + await scaffold( template, { + ...defaultAnswers, + ...answers, + } ); } } catch ( e ) { if ( e instanceof CLIError ) {