Updated with Release 4.0
Running the application requires the following tools to be installed in your environment:
Install dependencies by executing the following command:
$ yarn installBundle:
$ yarn webpackRun:
$ yarn startThe applications's home page will be available at https://localhost:3001
The application can be run so it works in a local development environment that uses CFTLib to provide the backend services.
$ yarn start:cftlibThe applications's home page will be available at https://localhost:3005
Create docker image:
docker-compose buildRun the application by executing the following command:
docker-compose upThis will start the frontend container exposing the application's port
(set to 3001 in this template app).
In order to test if the application is up, you can visit https://localhost:3001 in your browser. You should get a very basic home page (no styles, etc.).
We use ESLint alongside sass-lint
Running the linting with auto fix:
$ yarn lint --fixThis template app uses Jest as the test engine. You can run unit tests by executing the following command:
$ yarn testFunctional end-to-end (E2E) tests are hosted in the prl-e2e-tests repository.
Smoke tests from this repository are executed by triggering a build job in Jenkins.
To run E2E tests on your PR build, add the label enable-prl-e2e-tests. This will initiate a Playwright smoke test. Developers should add this label when their changes are ready for code review.
The smoke test is run against AAT in the master build.
How to single jest test and see details : jest src/main/steps/tasklistresponse/summary/postController.test.ts --detectOpenHandles
Cross-Site Request Forgery prevention has already been
set up in this template, at the application level. However, you need to make sure that CSRF token
is present in every HTML form that requires it. For that purpose you can use the csrfProtection macro,
included in this template app. Your njk file would look like this:
{% from "macros/csrf.njk" import csrfProtection %}
...
<form ...>
...
{{ csrfProtection(csrfToken) }}
...
</form>
...
This application uses Helmet, which adds various security-related HTTP headers to the responses. Apart from default Helmet functions, following headers are set:
There is a configuration section related with those headers, where you can specify:
referrerPolicy- value of theReferrer-Policyheader
Here's an example setup:
"security": {
"referrerPolicy": "origin",
}Make sure you have those values set correctly for your application.
Make sure you have added the label 'enable_keep_helm' while creating the PR. Otherwise, add the label and re-trigger the build.
The application exposes a health endpoint (https://localhost:3001/health), created with the use of Nodejs Healthcheck library. This endpoint is defined in health.ts file. Make sure you adjust it correctly in your application. In particular, remember to replace the sample check with checks specific to your frontend app, e.g. the ones verifying the state of each service it depends on.
This project is licensed under the MIT License - see the LICENSE file for details
Luxon is a time/date library for parsing, validating, manipulating and formatting dates in JavaScript. https://moment.github.io/luxon/#/formatting?id=table-of-tokens