From 2cf31fba8085ebaea2747ebe39edb5ab5c3e2b38 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Thu, 4 Feb 2021 12:41:12 +0530 Subject: [PATCH 1/2] fix: do not prompt on supplying template as an argument. --- packages/cli/lib/commands/create.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/lib/commands/create.js b/packages/cli/lib/commands/create.js index e8f6cc5d7..3079723f4 100644 --- a/packages/cli/lib/commands/create.js +++ b/packages/cli/lib/commands/create.js @@ -78,13 +78,13 @@ const options = [ ]; // Formulate Questions if `create` args are missing -function requestParams(argv, templates) { +function requestParams(repo, dest, argv, templates) { const cwd = resolve(argv.cwd); return [ // Required data { - type: argv.template ? null : 'select', + type: repo ? null : 'select', name: 'template', message: 'Pick a template', choices: templates, @@ -96,12 +96,12 @@ function requestParams(argv, templates) { message: 'Remote template to clone (user/repo#tag)', }, { - type: argv.dest ? null : 'text', + type: dest ? null : 'text', name: 'dest', message: 'Directory to create the app', }, { - type: prev => (!dirExists(cwd, prev || argv.dest) ? null : 'confirm'), + type: prev => (!dirExists(cwd, prev || dest) ? null : 'confirm'), name: 'force', message: 'The destination directory exists. Overwrite?', initial: false, @@ -211,7 +211,7 @@ async function command(repo, dest, argv) { // Prompt if incomplete data if (!repo || !dest) { const templates = await fetchTemplates(); - const questions = requestParams(argv, templates); + const questions = requestParams(repo, dest, argv, templates); const onCancel = () => { info('Aborting execution'); process.exit(); From 2d237bec2d4a4873d95f91ae3267cdc6da19ce04 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Thu, 4 Feb 2021 15:42:32 +0530 Subject: [PATCH 2/2] chore: add changeset --- .changeset/tame-ravens-own.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tame-ravens-own.md diff --git a/.changeset/tame-ravens-own.md b/.changeset/tame-ravens-own.md new file mode 100644 index 000000000..2e74c23e6 --- /dev/null +++ b/.changeset/tame-ravens-own.md @@ -0,0 +1,5 @@ +--- +'preact-cli': patch +--- + +Do not prompt on supplying the template as an argument