Skip to content

helsenorge/core-frontend-packages

Repository files navigation

Helsenorge Core Frontend

This is the repository for Helsenorge core packages. More details are found in the README for each package.

The code in this repository is maintained in a private Git repository also containing code we have not yet open sourced. We use Gitexporter to create the open source repository with only the code for NPM packages used in our other public repositories (Refero and Structor).

The private Git repository is a monorepo containing other NPM packages, web pages and micro frontends for helsenorge.no. It uses NPM workspaces and Lerna for easier installation of dependencies, building and testing. Since the setup will not work without all the code from the monorepo, this is not included in the public repository. Therefore each package has to be built and tested separately for now.

Questions

Questions about the code or project can be askes at ROX Slack channel or as issues on GitHub.

Internal documentation

https://confluence.nhn.no/display/HR2/@helsenorge+NPM+pakker

Setup - Frontend

For developing locally you should follow these steps:

First time

  1. Clone the repository
  2. Run npm iin root folder
  3. Run npm run build in build folder
    • To build what is needed for a specific package you can run npm run build -- --scope=@helsenorge/core-framework in root folder
  4. Run the specific package you are going to work on inside the package. Check the specific run scripts for each package.

Common errors

  • Missing packages when building/running a package:

    • Run npm run buildin root folder to make sure that all the packages are existing
  • Other npm errors and troubles:

    • Delete all node_modules and package-lock.json and try reinstalling all packages.
      • npm i and npm run build in root

Updating dependencies

npm i -g npm-check-updates
ncu -u \
    --deep \
    -x react \
    -x react-dom \
    -x react-router \
    -x @types/react \
    -x @types/react-dom \
    -x @types/node \
    -x conventional-changelog-cli

Documentation

Create a {componentname}.stories.tsx file in the same folder where the component code is.

Run Storybook locally to develop your component:

cd npm/packages/storybook
npm run start

Build using docker:

docker build -f documentation.Dockerfile --build-arg PAT=$env:HNDEV_PAT -t helsenorge/frontenddocs/static .
docker run -p 8080:8080 --rm -it --name helsenorge-frontenddocs-static helsenorge/frontenddocs/static

Available sites:

Playwright tests

cd web # Or other folder with Playwright tests
# Only necessary the first time
npx playwright install
# Run tests
npx playwright test
# or use the UI
npx playwright test --ui

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 28