mns-fe-server
This module is a wrapper around the node Express.js server. It takes a single configuration object with the following properties:
Name | Type | Description |
---|
assetsDir | string | Dir to serve static files such as images, CSS files, and JavaScript files |
jsonLogging | function | Function used for logging events, can be used with @mands/mns-fe-foundation/src/components/logger |
logger | boolean | Enable or Disable logging |
routesDir | function | A function that returns the path to the routes directory |
handlebars | object | Handlebars view engine object |
pageNotFoundHandler | function | A mapping to a handler for 404 status events |
errorPageHandler | function | A mapping to a handler for 500 status events |
ExposeRoutes | function | Function which returns a dir with the exposed routes |
Install the server:
npm install --save @mands/mns-fe-server
Include the module and start:
const config = require('./configuration/server')
let server = require('@mands/mns-fe-server')(config)
server.start()
Here's an example configuration object to get you started.
Automatic publishing with Semantic Release
The pipeline is configured to use the semantic release tool with the eslint default rules.
Commits Must be in a specific format: <Keyword>: <Your commit message>.
Note keyword is case sensitive.
The following keywords are allowed:
ESLint Rules:
Breaking = Major Release
Fix = Patch Release
Update = Minor Release
New = Minor Release
- When a PR is merged to master the commit messages are analysed and the npm version number is automatically incremented
- This allows better control over the release process
- Commits can be made without necessarily publishing a package to npm
- When we do publish to npm, the version of the published package now accurately reflects the changes made
- When a merge contains multiple commits the highest rule will be used
Manual semantic release
There may be times when you would like to publish a version manually as shown below:
export GH_TOKEN=<String>
export NPM_TOKEN=<String>
npm run semantic-release
These tokens can be retrieved from the vault:
gh-token = mns-fe-server.git_token (GitHub auth token)
npm-token = mns-fe-server.npm_token (NPM token)
If you would like to test the commit analyser without actually releasing a new version use the --dry-run flag
npm run semantic-release -- --dry-run