generator-wilbur
v0.0.7
Published
Yeoman generator to quick-start NodeJS + ExpressJS+ MongoDB application development with loads of features (written in TypeScript 3.x)
Downloads
4
Maintainers
Readme
wilbur-generator
Yeoman generator to quickstart NodeJS + ExpressJS + MongoDB application development (written in TypeScript 3.x)
wilbur allows you to easily define an application and its associated typescript classes and in return you get a full featured NodeJS application server. It is intended to be used with its dedicated desktop application (coming soon).
By simply defining a class (class name, its member variables and their types & constraints, etc) you are provided with the code for a TypeScript class with strong field validation which by default interfaces with MongoDB, a MongoDB service, request controllers/validators/routers, and Swagger documentation. You get all of these features from writing absolutely zero code.
Features
When you generate an app with wilbur you will enjoy a fully features api server without having to write a single line of code Features include:
- NodeJS + ExpressJS API server written entirely in TypeScript 3.x generated in just seconds
- Built-in MongoDB functionality (uses TypeGoose to create Mongoose models from typescript classes)
- Strong request validation using express-validator and class-validator
- Pretty logging with Pino logger
- Interactive Swagger documentation
- Production building with backpack
- Built-in Mocha testing framework
- Beautiful automated HTML testing reports with mochawesome
- Extensive code coverage reports with istanbul
- Ability to continuously add, update, and remove classes from your app after generation
Prerequisites
- NodeJS and NPM installed (also works with Yarn)
- Yeoman
- MongoDB (required to run generated app, not required for generator)
Installation
$ npm install -g generator-wilbur
or
$ yarn install -g generator-wilbur
Highly Recomennded - install the desktop client
Without using the desktop client, you will be limited only to using the boilerplate generator. The desktop app will allow you to create configuration files that will allow you to define applications & classes, add classes to your app after you've generated it, and remove classes from your app after you've generated it.
Generators
Available generators:
Available flags:
install --> will install dependencies with npm post app generation
$ yo wilbur --install
$ yo wilbur:boilerplate --install
yarn-install --> will install dependencies with yarn post app generation
$ yo wilbur --yarn-install
$ yo wilbur:boilerplate --yarn install
help --> will display instructions for available generators
$ yo wilbur --help
Usage
Use with Desktop application
When using the generator with the dedicated desktop application, there is no more use for running the generator in the terminal. The desktop client takes care of everything for you. It is highly reccomended to use the generator with the desktop application.
Generate a boilerplate app
You can generate a boilerplate app with absolutely no configuration in just seconds. Included in the boilerplate app is a simple TodoItem class which demonstrates features like the MongoDB interface with TypeScript classes, strong request validation, GET/PUT/POST/DELETE HTTP endpoints, and Interactive Swagger documentation.
$ yo wilbur:boilerplate
Use the --install or --yarn-install flags to install the dependencies for your app post gneration.
Generate a defined app
Generate a defined app by supplying the generator with an app configuration file (generated by desktop client). This app configuration file contains information about your app and its typescript classes. Be sure to have this file handy when running the app generator.
$ yo wilbur:boilerplate
Use the --install or --yarn-install flags to install the dependencies for your app post gneration.
Generate a class
Generate a defined class by supplying the generator with a class configuration file (generated by desktop client). This app configuration file contains information about your class to be generated. Be sure to have this file handy when running the class generator.
$ yo wilbur:add-class
Note : This generator must be ran in the directory of an existing application generated by wilbur.
Remove a class
Removed a defined class by running this generator in the directory of an existing application generated by wilbur. After running this generator, you'll be provided with a list of classes that you've already generated using wilbur and selecting a class will remove all files and references to those files from the filesystem. Warning : deleting these files cannot be undone.
$ yo wilbur:remove-class
Note : This generator must be ran in the directory of an existing application generated by wilbur.
Running the app
Run MongoDB server
$ mongod
NPM Run/Build Tasks
Task automation is based on NPM scripts.
Task | Description
--------------------------------|---------------------------------------------------------------------------------------
npm run serve
| Run dev server with hot reloads
npm start
| Build the app and run on build completion
npm run start:server
| Run server without building the app
npm test
| Run unit tests via Mocha
npm run test:watch
| Run unit tests in watch mode
npm run test:report
| Generate unit test report using Mochawesome
npm run test:coverage
| Generate unit test coverage report using Istanbul
npm run compile:env
| Build project for specified environment
Resources
Inspiration
License
MIT © Alex Batis