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 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

Version and publish

Alle disse kommandoene kjøres enten fra branch der man jobber med beta, eller fra master.

NB! Etter at du har kjørt release-scriptet, må du pushe endringene til origin, og også pushe tagene for å starte et bygg som vil publisere den nye versjonen:

git push origin tag v38.0.0-beta.10

Opprette første betaversjon av ny major (overgang fra v37.x.y => v38.0.0-beta.0)

npm run release:premajor

Lage nye betaversjoner (v38.0.0-beta.0 => v38.0.0-beta.1):

npm run release:beta

Opprette første versjon av ny major (overgang fra v38.0.0-beta.0 => v38.0.0)

Før du slipper en ny major, må du ta i bruk en versjon av designsystemet som ikke er beta (både dependencies og peerDependencies).

npm run release:major

Opprette ny minor (overgang fra v38.0.0 => v38.1.0)

npm run release:minor

Opprette ny patch (overgang fra v38.1.0 => v38.1.1)

npm run release:patch

Publisere betaversjon til npmjs.org

cd npm/packages/eslint-config # Eller annen pakke :-)
npm publish --tag beta --registry https://registry.npmjs.org/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors