Skip to content
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

Merged
merged 5 commits into from
Feb 17, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/create-waku/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ const { values } = parseArgs({
example: {
type: 'string',
},
'project-name': {
type: 'string',
},
help: {
type: 'boolean',
short: 'h',
Expand Down Expand Up @@ -98,14 +101,14 @@ async function doPrompts() {
const templateNames = await getTemplateNames(templateRoot);

const defaultProjectName = 'waku-project';
let targetDir = '';
let targetDir = values['project-name'] || '';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let targetDir = values['project-name'] || '';
let targetDir = values['project-name'] || defaultProjectName;

and the change L119

- message: `${targetDir || defaultProjectName} is not empty. Remove existing files and continue?`,
+ message: `${targetDir} is not empty. Remove existing files and continue?`,

work?

Copy link
Contributor Author

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.


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()),
Expand Down Expand Up @@ -169,6 +172,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
`);
}
Expand Down
Loading