-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(create-waku): --project-name option #1232
Changes from 1 commit
cf912b3
1c43faf
5826d06
03ba0a8
68be762
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,9 @@ const { values } = parseArgs({ | |
example: { | ||
type: 'string', | ||
}, | ||
'project-name': { | ||
type: 'string', | ||
}, | ||
help: { | ||
type: 'boolean', | ||
short: 'h', | ||
|
@@ -98,17 +101,20 @@ async function doPrompts() { | |
const templateNames = await getTemplateNames(templateRoot); | ||
|
||
const defaultProjectName = 'waku-project'; | ||
let targetDir = ''; | ||
let targetDir = values['project-name'] || ''; | ||
|
||
try { | ||
const result = await prompts( | ||
[ | ||
{ | ||
name: 'projectName', | ||
type: 'text', | ||
type: values['project-name'] ? null : 'text', | ||
message: 'Project Name', | ||
initial: defaultProjectName, | ||
onState: (state: any) => (targetDir = String(state.value).trim()), | ||
onState: (state: any) => | ||
(targetDir = | ||
String(values['project-name']).trim() || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be unnecessary... checking... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, removed the change from there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need this? let targetDir = values['project-name'] || ''; Or, let targetDir = ''; works? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we still need that. Otherwise, it prompts for package name because |
||
String(state.value).trim()), | ||
}, | ||
{ | ||
name: 'shouldOverwrite', | ||
|
@@ -169,6 +175,7 @@ Usage: ${commands.create} [options] | |
Options: | ||
--choose Choose from the template list | ||
--example Specify an example use as a template | ||
--project-name Specify a project name | ||
-h, --help Display this help message | ||
`); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the change L119
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I made this update and tested it. Looks good.