The repository is a monorepo that has multiple apps (something that can be built and run) and libraries (which other apps and libraries can depend on). All custom-written services are also stored there.
Run on whenever you check out a branch:
When you clone the repo for the first time, and whenever you change branches, you need to update your dependencies to match your current branch using
yarn install. In addition, schemas change frequently, so you will also need to update the generated schemas and clients using
If you you want schemas to be generated on every install you can set the environment variable
GENERATE_SCHEMAS_ON_INSTALL=true. Note that this will generate the schemas when rebuilding the workspace in the post-install phase, with no output, so the
installscript seems to hang.
For a dev server:
yarn start <project>
The app will automatically reload if you change any of the source files.
To build the project:
yarn build <project>
The build artifacts will be stored in the
dist/directory. Use the
--prodflag for a production build.
You need to format all files to follow NX code conventions. To do so run:
yarn nx format:write
We have many lint rules to help having a unify code all over the project. To execute the linting:
yarn lint <project>
Running lint locally is slow and fill up heap memory. This is related to Typescript compilation and NX lint builder being slow. As a result you might get a
NODE_OPTIONS=“--max-old-space-size=4096” yarn lint <project>to raise the memory limit.
yarn test <project>
To execute the unit tests affected by a change:
yarn e2e <project>-e2e
To execute the end-to-end tests affected by a change:
To see a diagram of the dependencies of your projects:
yarn nx dep-graph
If you have AWS access to our development account, you can connect to development databases and services using a proxy. We've set up a proxy and connection helpers for our development Postgres, Elastic Search, Redis and X-Road Security Server.
To do so, you can run for example:
If you want to run your app against one of this service (e.g.
db), you may need to edit your app environment or sequelize config to pass the proxy credentials.
The following services will run on the associated ports:
xroad:80. If you have docker running on theses ports or any others services you will need to stop them in order to run the proxies.
To be able to access environment variables in purely static projects, you need to do the following:
- 1.In the index.html file, add
<!-- environment placeholder -->.
- 2.Use the
getStaticEnvfunction from the
@island.is/shared/utilslibrary to fetch your environment variables.
- 3.Prefix your environment variables with
SI_PUBLIC_, for example
NOTE: This is only to get environment variables when running in kubernetes, not for when running locally. So you should only use
What happens behind the scenes is that static projects have a bash script that runs when the docker container starts up. This script searches for references of
SI_PUBLIC_*in the code and tries to find a match in the environment. It then puts all the matches inside the index.html which is then served to the client.