1.0.6 • Published 6 years ago

generator-stack-node v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Generator Stack NodeJs

Build Status Coverage Status Dependencies Status DevDependencies Status

NPM

Stack boilerplate personal from API NodeJs.

Overview

Generator using Yeoman.

The generator creates an express API model compiling the code with Babel, comes with integration with PostgreSql database, token authentication with Passport using JWT and possibility of reporting errors by Sentry. It has a documentation generator using apiDoc. Contains lint tests using esLint, TDD tests using Mocha and code coverage using nyc.

Generated Project Dependencies

Dependencies Status DevDependencies Status

Installation

Commands to install the tools to run the generator.

# tools
$ npm install npm -g
$ npm install yo -g

# generator
$ npm install -g generator-stack-node

Usage

Commands to run the generator.

$ yo stack-node <options>

Options

The options that are not informed will be requested by the generator when initiating project.

  -h,     --help          # Print the generator's options and usage
          --skip-cache    # Do not remember prompt answers                                  Default: false
          --skip-install  # Do not automatically install dependencies                       Default: false
  -n,     --name          # What is the project name?
  -d,     --description   # What is a short description for this project?
  -a,     --author        # Who is the author of this project?
  -e,     --email         # What is the email of the author of this project?
  -h,     --homepage      # What is the project homepage?
  -dbu,   --dbuser        # What is the connection user with postgres?
  -dbp,   --dbpassword    # What is the access password for connection to postgres?
  -dbh,   --dbhost        # What is the host of the database?
  -dbp,   --dbport        # What is the database port?
  -s,     --sentry        # If you have report sentry DNS to monitor errors in production.

Directory

|-- name-project                                 # Project name
    |-- .editorconfig                            # Maintain consistent coding styles
    |-- .gitignore                               # Contains files to be ignored when pushing to git
    |-- gulpfile.js                              # Link all splittered gulp tasks
    |-- package.json                             # Holds various metadata relevant to the project
    |-- README.md                                # Contains the details of the generated project
    |-- src                                      # The source code of the application
    |   |-- index.js                             # Application main file
    |   |-- api                                  # Main project folder
    |       |-- app.js                           # Module that starts the server
    |       |-- config                           # General settings folder
    |       |   |-- config.js                    # File that loads the settings according to the environment
    |       |   |-- auth                         # Authentication settings folder
    |       |   |   |-- passport.js              # Authentication configuration module using passport
    |       |   |-- db                           # Database module folder
    |       |   |   |-- database.js              # PostgreSql database module
    |       |   |-- env                          # Project settings folder
    |       |   |   |-- development.env          # Development environment settings
    |       |   |   |-- production.env           # Production environment settings
    |       |   |   |-- test.env                 # Test environment settings
    |       |   |-- validator                    # Express validation folder
    |       |       |-- sanitizers.js            # Sanitizers of express
    |       |-- models                           # Templates folder
    |       |   |-- user.model.js                # User model manipulation of data with the database
    |       |-- routes                           # Application routes
    |           |-- routes.js                    # Standard and custom route file
    |           |-- auth                         # Authentication routes folder
    |           |   |-- auth.js                  # Token request route
    |           |-- exposed                      # Folder of other routes
    |           |   |-- users.js                 # User registration routes
    |           |-- responses                    # Responses definitions folder
    |               |-- handlers.js              # Standard responses to requests
    |-- test                                     # The source code of the tests
        |-- mocha.opts                           # Mocha options and parameters
        |-- data                                 # Fictitious data folder
        |   |-- user.json                        # User registration data
        |-- integration                          # Integration testing folder
        |   |-- index.spec.js                    # Main integration testing file
        |   |-- modules                          # Integration test modules
        |       |-- authentication.spec.js       # Authentication test file
        |       |-- routes.spec.js               # Standard route test file
        |       |-- user.spec.js                 # User test file
        |-- loader                               # Folder files that are required by the tests
        |   |-- globals.js                       # Loads modules and global settings
        |-- unitary                              # Unitary testing folder
            |-- index.spec.js                    # Main unitary testing file
            |-- modules                          # Unitary test modules
                |-- authentication.spec.js       # Authentication test file
                |-- database.spec.js             # Database connection test file
                |-- user.spec.js                 # User test file

Generator Development

Procedures in the development of the generator.

Run

Run project in development mode.

# start submodules
$ git submodule init

# populating the submodule
$ git submodule update

# link package npm
$ npm link

# create a tarball from a package
$ npm pack

# run generator
$ yo stack-node <options>

Tests

Run test to ensure generator functionality.

$ npm test

Authors

Guilherme Alves
Guilherme Alves

License

License MIT

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago