/web_kav_app

Primary LanguageTypeScript

Setup

Cloning the GitHub Repository

Clone this repository to your local machine:

git clone git@github.com:slovak-egov/web_kav_app.git

Formatting

Run automatic code formatting (prettier) with this command:

npm run format

Testing

Run linting and unit tests with this command:

npm run test-all

UI Translations

To download from Drupal CMS and create (or update) common.json files for UI translations run

npm run fetch-locales

locales.json in root directory and common.json files in public/locales directory will be created (or updated) Note, by running npm run build, npm run fetch-locales runs followed by next build.

After adding new phrase or editing its key run

npm run export-locales

translations.svksk_ui_translation.yml file will be created in root directory to be copied to Drupal CMS project.

Local development setup

Save gl access token to NPM_TOKEN

export NPM_TOKEN=<gitlab token>

Installing Dependencies

Use npm (min node 18) to install the dependencies:

npm install

Running

We can start the next.js server in development mode:

npm run dev

or in production mode:

npm run build
npm run start

The next.js server runs at http://localhost:3000

Run develpment server with SSL support

Modern browsers prevent the storage of cookies from non-secure (non-SSL) sites, so the preview mode for unpublished content on the CMS side is not functional. The following section contains commands to create a certificate for the Node.js development server.

create certs directory

mkdir ./certs

generate certificate and key for server

openssl req -x509 -out ./certs/localhost.crt -keyout ./certs/localhost.key \
  -days 365 \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\
   \nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\
   \nextendedKeyUsage=serverAuth")

Start HTTPs server

npm run dev:ssl

The next.js server runs at https://localhost:3000


Environments

DEV

http://www.portal.kav.skit.zone/

Notes

If you are connecting to your local Drupal instance, use 0.0.0.0 instead of localhost or 127.0.0.1