I've been thinking about creating a scaffolding tool for existing projects for a while. Something like rails has, such as
rails g model user name age:number role:references , but for the frontend, that works well with ReactJS, which I've been working with quite a lot.
To be honest, I'm trying to "railsify" the frontend toolkit so that it can be more productive. Type less, do more. This has been the center of all the libraries I've published in the last two years, such as Premiere and Form-for.
On this post, I'll talk about my most recent library, designed to be one of the steps towards a package of libraries that combined aims to put React development on the fast lane.
All in one function for transforming word casings
I wanted to create a command that looks like:
generate controller john-doe and this command would create a folder called
john-doe , and inside this folder the following files:
If you're creating this manually it would be pretty easy to do a
JohnDoeController and others
Creating a tool that only works for one project is definitely not what I'm looking for. So, I want the project to have a set of definitions that can be easily replicated. Let's assume there's a
templates folder and inside this folder we'll have another folder called
name ; inside of it we'll have:
I think that's simple enough, don't you? If you want to do camelCase instead, you could call them
naMeController.js instead. The same would be true for class names inside the file and anywhere else you want to have names.
I created a demo to show the most common patterns applied using
The code and documentation are available at https://github.com/pedsmoreira/casex
This library by itself is pretty cool, but I believe it will be even nicer as part of the scaffolding tool that's coming.