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

CLI command for initializing component boilerplate #109

Merged
merged 8 commits into from
Jul 25, 2024

Conversation

benkates
Copy link
Contributor

What's in this pull request

  • Other

Description

Running npm run create-component will ask for a component name and create 3 boilerplate files (svelte, story, and docs). Checks for PascalCase and uses the inquirer package for JS-based CLI functionality (dev-only dependency).

Future features to consider:

  • Ask if the folder should be in a subdir of src/lib/
  • Ask to use a .docs.mdx template (instead of .docs.md)

Before submitting, please check that you've

  • Formatted your code correctly (i.e., prettier cleaned it up)
  • Documented any new components or features
  • Added any changes in this PR to the CHANGELOG.md Next section

Copy link
Contributor

@rachelmarconi rachelmarconi left a comment

Choose a reason for hiding this comment

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

This is so awesome. I took it for a test run and am definitely going to use this in the future. Very glad for the validation, not only of camel case but also if the directory exists already.

Copy link
Contributor

@mitchthorson mitchthorson left a comment

Choose a reason for hiding this comment

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

This is awesome, I have just 2 things for consideration here:

  • What if we refactored to use the more updated version of the inquirer package here.
  • Could we make it optional to specify the ComponentName as a command line arg so this could run in a single command? Like npm create-component MyNewComponent ? I'd think if the user leaves the argument off, it would prompt for the name as it currently does, but if they do provide it, it just skips the prompt.

Copy link
Contributor

@mitchthorson mitchthorson left a comment

Choose a reason for hiding this comment

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

This is fantastic!

@benkates benkates merged commit cf8e5c9 into main Jul 25, 2024
1 check passed
@benkates benkates deleted the feat-cli-init-component branch July 25, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants