TMJ Mean Stack Module Generator
Mean Stack Module Generator using Yeoman
Table of Contents
Getting Started
You will need to install yeoman
using npm
. Be sure to have NodeJS installed before doing it so.
npm install yo -g
Locally
You need to download or clone this to a new project locally name it generator-tmj-module
. Then run it in git shell.
git clone https://github.com/TMJPEngineering/generator-tmj-module.git > generator-tmj-module
Go to the root directory of this project, then type:
npm link
That will install this generator dependencies and symlink a global module to your local file. After npm
is done your good to go to your project.
Globally
Or if you don't want to download or clone this, you can install it using npm
:
npm install -g generator-tmj-module
List of Commands
Note:
[name]
- Required[module]
- Required[--option]
- Optional[--kind]
- Optional[--module]
- Required
Creating a Module
To create a new module, you can simply run:
yo tmj-module:make [name] [--kind=value]
To create multiples modules, you can simply run by example:
yo tmj-module:make Blog Chat Post
Kinds
server
client
Creating an Angular Sub Module
To create a new sub module, you can simply run:
yo tmj-module:make-angular-submodule [name] [--module=value]
To create multiples modules, you can simply run by example:
yo tmj-module:make-angular-submodule Blog Chat Post --module=App
Creating an Angular Config
Create new angular config for the specified module.
yo tmj-module:make-angular-config [name] [module]
Creating an Angular Controller
Create new angular controller for the specified module.
yo tmj-module:make-angular-controller [name] [module]
Creating an Angular Directive
Create new angular directive for the specified module.
yo tmj-module:make-angular-directive [name] [module]
Creating an Angular Factory
Create new angular factory for the specified module.
yo tmj-module:make-angular-factory [name] [module] [--option=value]
Options:
plain
Creating an Angular Module
Create new angular module for the specified module.
yo tmj-module:make-angular-module [name] [module]
Creating an Angular Provider
Create new angular provider for the specified module.
yo tmj-module:make-angular-provider [name] [module]
Creating an Angular Service
Create new angular service for the specified module.
yo tmj-module:make-angular-service [name] [module]
Creating an Auth Module
Scaffold basic login and registration views.
yo tmj-module:make-auth --force
Creating a Controller
Create new controller for the specified module.
yo tmj-module:make-controller [name] [module] [--option=value]
Options:
rest
plain
Creating a Entity
Create new entity for the specified module.
yo tmj-module:make-entity [name] [module]
Creating a Job
Create new job for the specified module.
yo tmj-module:make-job [name] [module]
To dispatch a job, you need to require dispatch
in a controller. For example in a controller:
var path = root = path dispatch = ; module { var methods = ... ; return methodsmethod; { return { ; } } };
Creating a Middleware
Create new middleware for the specified module.
yo tmj-module:make-middleware [name] [module]
Creating a Routes
Create new routes for the specified module.
yo tmj-module:make-routes [name] [module] [--option=value]
Options
plain
Creating a Schema
Create new schema for the specified module.
yo tmj-module:make-schema [name] [module]
Creating a Test
Create new test for the specified module.
yo tmj-module:make-test [name] [module] [--kind=value]
Kinds
server
client
Creating a View
Create new html file for the specified module in views folder
yo tmj-module:make-view [name] [module]
To use view, you need to require view
in a controller. For example in controller:
var path = root = path view = ; module { var methods = ... ; return methodsmethod; { return { ; } }};
Folder Structure
Example:
Chat Module
yo tmj-module:make MyChat
or
yo tmj-module:make My-Chat
...
├── modules/
│ └── MyChat/
│ ├── Client/
│ │ ├── Config
| │ │ └── mychat.config.js
│ │ ├── Controllers
| │ │ └── mychat.controller.js
│ │ ├── Factories
| │ │ ├── chat-manager.factory.js
| │ │ └── chat-resource.factory.js
│ │ ├── Jobs
| │ │ └── mychat.job.js
│ │ ├── Providers
| │ │ └── mychat.provider.js
│ │ ├── Services
| │ │ └── mychat.service.js
│ │ ├── Tests
| │ │ └── mychat.test.js
│ │ └── user.module.js
│ └── Server/
│ ├── Controllers
| │ └── mychat.controller.js
│ ├── Entities
| │ └── mychat.entity.js
│ ├── Middlewares
| │ └── mychat.middleware.js
│ ├── Routes
| │ └── mychat.routes.js
│ ├── Schemas
| │ └── mychat.schema.js
│ └── Tests
| └── mychat.test.js
└── resources/
└── views/
└── mychat/
└── index.html
...
Credits
License
This project is licensed under the MIT License - see the LICENSE for details
Copyright (c) 2017 TMJ Philippines