This generator is a NodeJS module acting as a standalone Generate generator or as a Generate plugin, written in ESNext (Futur-proff Javascript, ie. EcmaScript 2018+).
See:
$ yarn gobal add generate-swap-rest-apior
$ npm install --global generate-swap-rest-apiYou should first visit the generator framework, generate to understand how generators, subgenerators and plugins work. See also related projects
$ yarn add generate-swap-rest-apior
$ npm install --save generate-swap-rest-apigenerate-swap-rest-api generates a complete project with a working NodeJS REST API server based on the KoaJS framework, compliant with the Open API Specification (aka Swagger Spec).
The source code is compliant with the StandardJS Code Style.
See:
[] An clean architecture of modules, directories and files
[] All the needed dotfiles and other configuration files to support the common open source and nodejs best practices
[ ] Unit testing (UT)
[ ] End-to-end testing (e2e)
[ ] Test Driven Development (TDD)
[ ] Development dockerfile (devbox)
[ ] Production dockerfile
[ ] Test coverage
[ ] CI/CD configurations (Travis, Gitlab-CI)
[*] A Core module that contains all the under-the-hoods server mecanics
$ gen swap-rest-apiShould @TODO: describe generator default action
@TODO: generated files tree
.
├─┬ dir/
| └─┬ subdir/
| ├─ example1.txt
| └─ example2.txt
└── .travis.yml
You should first visit the generator framework, generate to understand how generators, subgenerators and plugins work.
import generateSwapRestApi from 'generate-swap-rest-api'
import isValid from 'is-valid-app'
export default function (app) {
if (!isValid(app, 'generate-my-generator')) return
app.use(generateSwapRestApi)
// ... your generator's stuff
}Then you can use directly any 'generate-swap-rest-api' tasks as a generate-my-generator task.
$ gen my-generator:example-task
Should run generate-swap-rest-api:example-task on your own generator instance.
You should first visit the generator framework, generate to understand how generators, subgenerators and plugins work.
import generateSwapRestApi from 'generate-swap-rest-api'
import isValid from 'is-valid-app'
export default function (app) {
if (!isValid(app, 'generate-my-generator')) return
app.register('swap-rest-api', generateSwapRestApi)
// ... your generator's stuff
}Then you can acces easily any generate-swap-rest-api tasks as a generate-my-generator sub-generator task.
$ gen my-generator.swap-rest-api:example-task
Should run generate-swap-rest-api:example-task on your own generator instance.
@TODO: document the API here
The codebase is written using the ESNext Specification (ECMAScript Stage 0), following the StandardJS Code Style
We use:
- Yarn to handle npm dependencies,
- ESNext CLI to transform ESx code to ESNext,
- Babel CLI to transpile ESNext code to node/browser compatible javascript,
- And Standard CLI + ESLint to lint or format ESNext codebase.
See the contribution guide in a separated document.
Get the latest node engine (example with nvm):
$ nvm install lts/carbonInstall yarn from npm (for development only):
$ npm install --global yarnAll the rest of the development dependencies are local.
Clone the repo and install dependencies:
$ git clone [email protected]:sirap-group/generate-swap-rest-api.git
$ cd generate-swap-rest-api
$ yarn installFinally, run the test pipeline:
$ yarn pipeline:test| Task Command | Task description |
|---|---|
yarn clear |
Delete the ./build/ and ./dist repositories |
yarn lint |
Lint source files |
yarn lint:esnext |
Lint ESNext source files |
yarn build |
Build the whole distribution |
yarn build:assets |
Build all the assets |
yarn build:assets:img |
Build the images assets |
yarn build:assets:templates |
Build the generator's templates |
yarn build:lib |
Build only the lib |
yarn build:tests |
Build only the tests |
yarn build:docs |
[TODO] Build only the docs |
yarn test |
Run the tests in ./dist/tests/ |
yarn tests |
An alias for yarn test |
yarn travis |
Run the travis script |
yarn docs |
[TODO] Serve the docs |
yarn pipeline |
Run the complete pipeline |
yarn pipeline:test |
Run the required jobs to run the tests, then run the tests |
yarn pipeline:build |
Run the required jobs to build the dist, then build the dist |
yarn pipeline:docs |
[TODO] Run the required jobs to serve the docs, then serve the docs |
yarn pipeline:build:tests |
Run the required jobs to build the docs, then build the docs |
yarn pipeline:build:lib |
Run the required jobs to build the docs, then build the docs |
yarn pipeline:build:docs |
[TODO] Run the required jobs to build the docs, then build the docs |
yarn release |
An alias to yarn release:patch |
yarn release:prerelease |
Release and publish a new semver version (x.y.z-rc+1) |
yarn release:patch |
Release and publish a new patch semver version (x.y.z+1) |
yarn release:minor |
Release and publish a new minor semver version (x.y+1.z=0) |
yarn release:major |
Release and publish a new major semver version (x+1.y=0.z=0) |
B.D.D. means Behavior-Driven-Development
The project is ready to code in BDD mode. Just run the bdd yarn command:
$ yarn bdd
The project will be lint, built, the BDD unit tests will be run, and the process will watch for any file changes to loop over the previous tasks (lint, build, test, watch).
The task yarn pipeline:build generate a ./dist folder in the repository's root directory but this folder is not part of the git repository (there is an entry in the .gitignore file). However the dist folder is included in the package.json#files field.
Thus to release a new, lets say, "patch" version, just run:
$ yarn release:patchThe whole build pipeline is run locally (lint, transpile, test) and then a new git tag and a new npm tag are pushed up.
- generate-swap-generator Generate your own ESNext/StandardJS/UnitTest Ready Generators − A generator for SWAP generators github | homepage
- generate-swap-project Generate An ES.Next/StandardJS/UnitTest Ready, Github or Gitlab Project in Seconds! − A generator for SWAP projects github | homepage
- generate A new command line tool and developer framework for scaffolding out GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either github | homepage
- base: Framework for rapidly creating high quality node.js applications, using plugins like building blocks | homepage
- update: Be scalable! Update is a new, open source developer framework and CLI for automating updates… more | homepage
- verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage
- composer: API-first task runner with three methods: task, run and watch. | homepage
- engine: Template engine based on Lo-Dash template, but adds features like the ability to register helpers… more | homepage
- template: Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… more | homepage
Rémi Becheras
Copyright © 2018 sirap-group
This software is open source software under the terms of the MIT license.
See LICENSE
This generator was generated by
generate-swap-generator
, a project by
SIRAP Group






