Skip to content

Latest commit

 

History

History
51 lines (30 loc) · 1.88 KB

CONTRIBUTING.md

File metadata and controls

51 lines (30 loc) · 1.88 KB

Contributing to y

  1. Fork this repository to your own GitHub account and then clone it to your local environment
  2. Install the dependencies with npm install
  3. Write your changes into lib/
  4. Add your tests into test/
  5. Run npm test and make sure you have 100% of coverage

Testing into your Mono project:

  1. Run npm link to link the local repo to NPM.
  2. Then run npm link y inside any Mono app
  3. Follow the README to see how to use this module

lib/

A Mono module can have multiple files inside lib/:

index.js

Should export a method (can be async) and receives as argument: { log, conf, server, app }

init.js

File loaded when Mono init all files, same parameter as Mono init files. Should export a method (can be async) and receives as argument: { log, conf, server, app }

routes.js

Same as Mono files so a module can add custom routes, see example

acl.js

File loaded to define Imperium roles/actions (same as Mono project files)

test/*.js

Files where are written AVA tests, it uses mono-test-utils to make API tests easy.

Feel free to check mono-mongodb tests how tests can be made.

test/fixtures/

This is where you can add files that won't be run by AVA, it's usully small Mono projects where you can test your module.

You can easily start your Mono project inside fixtures/ by running:

NODE_ENV=test npx mono dev test/fixtures/ok/

Where test/fixtures/ok/ is a simple Mono project using the module.