@r2d2bzh/js-backend-rules

enforce r2d2bzh rules for backends developed in javascript

Usage no npm install needed!

<script type="module">
  import r2d2bzhJsBackendRules from 'https://cdn.skypack.dev/@r2d2bzh/js-backend-rules';
</script>

README

:source-highlighter: highlightjs ifdef::env-github[] :status: :outfilesuffix: .adoc :caution-caption: :fire: :important-caption: :exclamation: :note-caption: :paperclip: :tip-caption: :bulb: :warning-caption: :warning: endif::[]

= js-backend-rules

[WARNING]

This project requires the following minimal engines versions:

[source,json]

include::package.json[tag=engines,indent=0]

====

The r2d2bzh product stack is composed of multiple NodeJS micro-services. The projects hosting these micro-services need to be structured with the same rules. As anyone can easily forget these many rules, js-backend-rules comes to the rescue.

[NOTE]

Some of these rules are already taken care of by https://github.com/r2d2bzh/js-rules[@r2d2bzh/js-rules] on which js-backend-rules relies. It is strongly advised to read the https://github.com/r2d2bzh/js-rules/blob/master/README.adoc[README of @r2d2bzh/js-rules].

== Install

You need to add the following NPM development dependency to the project that needs to be ruled (which means here scaffolded/structured/checked/...):

npm install --save-dev @r2d2bzh/js-backend-rules

Once installed, @r2d2bzh/js-rules provides the r2d2bzh-js-backend-rules executable from the https://docs.npmjs.com/cli/v7/configuring-npm/folders#executables[node_modules executables]. To ensure that the rules are enforced, call this executable by issuing npx r2d2bzh-js-backend-rules, this will:

  • ensure that the rules are enforced over time by launching r2d2bzh-js-backend-rules during the postinstall step of npm
  • immediately apply all the rules to the whole project

CAUTION: You should preferably commit your project's current content to ensure nothing is loss in the process.

== Adding a new service

Once installed, js-backend-rules provides the r2d2 npm script.

To add a new service to the project, issue the following command from the project's root directory: + npm run r2d2 add <newServiceName>