Genr8 is a DIY generator written in Bash. Use it to help you generate boilerplate for your applications.
- Clone the repo anywhere on your machine
- Note If you want to be able to create your own generators and merge upstream updates, fork and clone the repo.
- Create a symlink with
ln -s /path/to/genr8/index.sh /usr/local/bin/genr8
- Make the linked file executable with
chmod +x /usr/local/bin/genr8
Genr8 comes with a single generator for Express applications.
=====
Genr8
=====
Please specify a generator from the list:
express
Running $ genr8 express
will start the generator. It will create boilerplate files and folders for an Express application with Handlebars as the view engine.
Here is a quick outline of what the generator creates and the purpose in mind for each file and folder.
config/
- A place to put config files for connecting to databases etc...helpers/
- A directory in which files suffixed with_helper.js
will be automatically loaded. Helper functions in these files will be available in views. Comes with some common helpers out of the boxlib/
- Put your own libraries heremodels/
- Model files and folderspublic/
- Express uses this folder to serve static assetsrouters/
- Router files go hereviews/
- A place to put view templates. Comes populated with a default layout, welcome page and 500 error page.gitignore
- Ignoresnode_modules/
andnpm-debug.log
by default. Add files for Git to ignore hereapp.js
- The main Express application filerepl.js
- A REPL for you to test drive your code. Require modules, libraries etc... here to play around and test them out
If you wish to create a generator:
- Create a folder in the
genr8/
directory - Add an
index.sh
file in which to put the commands/script for your generator - Run
$ genr8
and you should see the name of that folder added to the list of available generators
Open the express/
folder to see an example of how a generator is created.
=====
Genr8
=====
Please specify a generator from the list:
express
my_awesome_generator
NOTE when creating your own generators with a symlinked executable you'll need to get the path to the original genr8/
folder to access your boilerplate. You can do so with:
# /usr/local/bin/genr8
DIR=$(dirname $(readlink $(which genr8)))
#=> /path/to/cloned/genr8/repo/
- Add Express JSON API generator for API only back-end
- Add helpers similar to Rails http://api.rubyonrails.org/ for the following:
- Asset tag/URL helpers
- Date
- Debug
- Number
- Sanitize
- Text
- Tests for generated application (Mocha or Jasmine)
- Add AngularJS 1.x generator
Copyright 2017 Chris Scavello [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.