Skip to content

Repository files navigation

hello.nrfcloud.com

GitHub Actions semantic-release Renovate @commitlint/config-conventional code style: prettier ESLint: TypeScript

Retrieve real-time data from your Nordic Semiconductor Development Kit within seconds.

Setup

Install the dependencies:

npm ci

API Key for AWS Location Service map resources

Create an API key

  aws location create-key \
    --region eu-west-1 \
    --key-name hello.nrfcloud.com \
    --description "Map tiles for the hello.nrfcloud.com web app" \
    --no-expiry \
    --restrictions '{"AllowActions":["geo-maps:GetTile","geo-maps:GetStaticMap"],"AllowResources":["arn:aws:geo-maps:eu-west-1::provide
  r/default"],"AllowReferers":["https://hello.nrfcloud.com/*","http://localhost:*/*"]}'

Configure

Export the map settings as the environment variables MAP_REGION and MAP_API_KEY before running it.

Run

npm start

Running the tests

End-to-end tests are run completely without a backend using Vite's built-in dev server to serve the data.

Note: It's currently not possible to run test for multiple browsers in parallel since the webServer > cannot be defined per project, and there is a state in the backend mock server that gets manipulated by the tests. So by default only the chrome project is run

npm run test:e2e

Run the Playwright code generator

npx playwright codegen

Debug individual tests

PWDEBUG=1 npx playwright test e2e-tests/

Interact with the e2e backend

See ./e2e-tests/README.e2e-server.md

Deploy

npx cdk bootstrap
npx cdk deploy --all

Continuous Deployment with GitHub Actions

Create a GitHub environment production.

Store the registry endpoint as a GitHub Action variable:

gh variable set REGISTRY_ENDPOINT --env production --body "<registry endpoint>"
# If using a custom domain name
gh variable set DOMAIN_NAME --env production --body "<domain name>"
gh variable set MAP_REGION --env production --body "<mapRegion>"
gh variable set MAP_API_KEY --env production --body "<apiKey>"

Store the role used for continuous deployment as a secret:

CD_ROLE_ARN=`aws cloudformation describe-stacks --stack-name ${STACK_NAME:-hello-nrfcloud-web} | jq -r '.Stacks[0].Outputs[] | select(.OutputKey == "gitHubCdRoleArn") | .OutputValue'`
gh secret set AWS_ROLE --env production --body "${CD_ROLE_ARN}"

Store the stack name and the region as a variable:

gh variable set STACK_NAME --env production --body "${STACK_NAME:-hello-nrfcloud-web}"
gh variable set AWS_REGION --env production --body "eu-west-1"

Continuous integration

Store the map settings as variables:

# Make sure that the `ci` environment exists in this repo
gh variable set MAP_REGION --env ci --body "<mapRegion>"
gh variable set MAP_API_KEY --env ci --body "<apiKey>"

Node & NPM

This project requires Node.js >=20.0.0 and npm >=12.0.2 <13 (enforced via check-node-version on npm install and npm ci).

The check is skipped during npm publish and npm pack, because semantic-release bundles its own npm (@semantic-release/npm depends on npm@^11.6.2) and runs the publish with that version rather than the one installed in CI.

About

Retrieve real-time data from your long-range Nordic Semiconductor Development Kit within seconds

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages