6 ms·
Show HN: Generate React components by replicating your own
- swyx 9y agook so this is a CLI for copy-pasting?
- gracehaz 9y agoKinda, but not really. XD It copies files, renames them and replaces their names in the contents.
- deleted 9y ago[deleted]
- n0us 9y agoI 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.
- gracehaz 9y agoI'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.
- n0us 9y agoTrue points, very cool tool though and thanks for sharing.
- dharness 9y agoI am genuinely surprised that people find this improves their productivity by any significant margin...
- gitgud 9y agoAll 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.
- senoroink 9y agoBravo for pushing helping people reinvent the wheel less but this just emphasizes how badly React needs uniformity in the community.
- arikfr 9y agoThis 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 https://github.com/jondot/hygen
- l5870uoo9y 9y agoWould 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.
- gracehaz 9y agoThis 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.
- qrohlf 9y agoI actually built this a few weeks ago: https://github.com/qrohlf/bones 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.
- gitgud 9y agoBones is a great name for a project which uses 'skeleton' templates. Love it!
- scottmf 9y agoThis looks great. Can’t wait to try it out.
- Aleena-James 8y agoHow can a link be placed?