From 98af613df2efbf65d33826230be68646369b69f1 Mon Sep 17 00:00:00 2001 From: task4233 <29667656+task4233@users.noreply.github.com> Date: Sun, 15 Aug 2021 11:13:44 +0900 Subject: [PATCH 1/3] fix: add options for minimist because number argument is treated as number when an user input number-only project name --- packages/create-vite/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-vite/index.js b/packages/create-vite/index.js index 4c5879bdd0bd12..2c9df01e32befe 100755 --- a/packages/create-vite/index.js +++ b/packages/create-vite/index.js @@ -3,7 +3,7 @@ // @ts-check const fs = require('fs') const path = require('path') -const argv = require('minimist')(process.argv.slice(2)) +const argv = require('minimist')(process.argv.slice(2), { string: ['_'] }) // eslint-disable-next-line node/no-restricted-require const prompts = require('prompts') const { From c596a24629e8994a56c9e06d8b69e301bbaac291 Mon Sep 17 00:00:00 2001 From: task4233 <29667656+task4233@users.noreply.github.com> Date: Mon, 16 Aug 2021 10:18:11 +0900 Subject: [PATCH 2/3] feat: add comment for helping an user to understand the second argument of minimist --- packages/create-vite/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/create-vite/index.js b/packages/create-vite/index.js index 2c9df01e32befe..d75de1efb3d515 100755 --- a/packages/create-vite/index.js +++ b/packages/create-vite/index.js @@ -3,6 +3,8 @@ // @ts-check const fs = require('fs') const path = require('path') +// For solving the problem failed to create a project with number-only argument, +// the second argument of "minimist" is added to convert it to string type. const argv = require('minimist')(process.argv.slice(2), { string: ['_'] }) // eslint-disable-next-line node/no-restricted-require const prompts = require('prompts') From d09e8e571878b3daf98ceb52641723e8cd17d974 Mon Sep 17 00:00:00 2001 From: Takashi MIMA <29667656+task4233@users.noreply.github.com> Date: Wed, 18 Aug 2021 09:53:48 +0900 Subject: [PATCH 3/3] change: update message for user understanding a lot The comment before change was not helpful for understanding why option ( _ ) needs. Co-authored-by: patak --- packages/create-vite/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/create-vite/index.js b/packages/create-vite/index.js index d75de1efb3d515..efcf63cb6a8629 100755 --- a/packages/create-vite/index.js +++ b/packages/create-vite/index.js @@ -3,8 +3,8 @@ // @ts-check const fs = require('fs') const path = require('path') -// For solving the problem failed to create a project with number-only argument, -// the second argument of "minimist" is added to convert it to string type. +// Avoids autoconversion to number of the project name by defining that the args +// non associated with an option ( _ ) needs to be parsed as a string. See #4606 const argv = require('minimist')(process.argv.slice(2), { string: ['_'] }) // eslint-disable-next-line node/no-restricted-require const prompts = require('prompts')