Show HN: Generate React components by replicating your own(github.com)
github.com
Show HN: Generate React components by replicating your own
https://github.com/diegohaz/generact
16 comments
I am genuinely surprised that people find this improves their productivity by any significant margin...
All generators have always baffled me in this way. But this might because I'm always looking at the next shiny thing.
These generators are probably best suited to people with specific repetitive workflow's, like writing React Components everyday.
These generators are probably best suited to people with specific repetitive workflow's, like writing React Components everyday.
Would be useful if you could set fixed component path and boilerplate component and then only run 'generact ComponentName' and with a sub folder path 'generact Subfolder/ComponentName'. The sell here is really how easy it is to tailor the boilerplate component to your project.
I actually built this a few weeks ago: https://github.com/qrohlf/bones
You define boilerplate components in `~/yourproject/.bones` and it does what you just described. I've been using it in several projects at work, it's been a nice standardization/productivity bump for my team.
You define boilerplate components in `~/yourproject/.bones` and it does what you just described. I've been using it in several projects at work, it's been a nice standardization/productivity bump for my team.
Bones is a great name for a project which uses 'skeleton' templates. Love it!
This can be easily done by creating a npm script "generact path/to/boilerplate/component.js" and just running `npm run generact`.
The difference though is that you'll still be prompted for component path and name, but I'd gladly accept a PR adding options to CLI (maybe --path, --name?) to skip that part.
The difference though is that you'll still be prompted for component path and name, but I'd gladly accept a PR adding options to CLI (maybe --path, --name?) to skip that part.
This is interesting, but I believe a better solution will be to use something like hygen[1] to maintain a set of generators for your project.
[1] https://github.com/jondot/hygen
[1] https://github.com/jondot/hygen
I used to copy and paste then I invested time and effort into writing some sublime snippets for components, tests, and such. It was probably the best time saving investment I have ever made in basically anything.
I'd done that too. But I found some problems with that approach:
- you can't automatically create files (AFAIK);
- it doesn't help your team mates, only works for you and with that specific editor;
- if you start working on a different project with different standard, you'll need to update the snippets or create new ones.
Turned out that I was always copying and pasting, so I decided to create this tool.
- you can't automatically create files (AFAIK);
- it doesn't help your team mates, only works for you and with that specific editor;
- if you start working on a different project with different standard, you'll need to update the snippets or create new ones.
Turned out that I was always copying and pasting, so I decided to create this tool.
True points, very cool tool though and thanks for sharing.
This looks great. Can’t wait to try it out.
Bravo for pushing helping people reinvent the wheel less but this just emphasizes how badly React needs uniformity in the community.
How can a link be placed?