Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): Improve documentation and enforce markdown linting #16252

Open
wants to merge 106 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
11c69ad
Add markdownlint config
AndesKrrrrrrrrrrr Oct 2, 2024
00682dd
--fix for markdown files
AndesKrrrrrrrrrrr Oct 2, 2024
c90c0e5
Lint and fix many README
AndesKrrrrrrrrrrr Oct 3, 2024
a1bc267
Revert "Lint and fix many README"
AndesKrrrrrrrrrrr Oct 3, 2024
f4a160d
AI-improve non-app and non-libs READMEs
AndesKrrrrrrrrrrr Oct 3, 2024
681ec16
Revert "AI-improve non-app and non-libs READMEs"
AndesKrrrrrrrrrrr Oct 3, 2024
780153b
AI-improve non-service apps
AndesKrrrrrrrrrrr Oct 3, 2024
e66bad9
AI-improve apps/services/*
AndesKrrrrrrrrrrr Oct 3, 2024
23d368f
chore: nx format:write update dirty files
andes-it Oct 3, 2024
1c9fe5a
AI-improve libs/service-portal
AndesKrrrrrrrrrrr Oct 3, 2024
d9946b8
AI-improve libs/shared
AndesKrrrrrrrrrrr Oct 3, 2024
cbe740f
AI-improve libs/services
AndesKrrrrrrrrrrr Oct 3, 2024
6e3fe4b
AI-improve libs/testing
AndesKrrrrrrrrrrr Oct 3, 2024
fb1de24
AI-improve libs/portals
AndesKrrrrrrrrrrr Oct 3, 2024
56fd96a
AI-improve libs/nest
AndesKrrrrrrrrrrr Oct 3, 2024
4644987
AI-improve libs/nest
AndesKrrrrrrrrrrr Oct 3, 2024
bd33f0f
AI-improve libs/auth
AndesKrrrrrrrrrrr Oct 3, 2024
1091d01
AI-improve libs/api
AndesKrrrrrrrrrrr Oct 3, 2024
7b35ce6
AI-improve libs/api
AndesKrrrrrrrrrrr Oct 3, 2024
b0bd2e0
AI-improve libs/api
AndesKrrrrrrrrrrr Oct 3, 2024
2c6bc0e
AI-improve libs/application
AndesKrrrrrrrrrrr Oct 3, 2024
9bd46a4
AI-improve libs/clients
AndesKrrrrrrrrrrr Oct 3, 2024
1d85dfb
chore: nx format:write update dirty files
andes-it Oct 3, 2024
3877a4f
AI-improve libs/air-discount-scheme
AndesKrrrrrrrrrrr Oct 3, 2024
a1b5398
AI-improve libs/air-discount-scheme
AndesKrrrrrrrrrrr Oct 3, 2024
d3f84dc
AI-improve libs/cache
AndesKrrrrrrrrrrr Oct 3, 2024
4f42662
AI-improve libs/cms-translations
AndesKrrrrrrrrrrr Oct 3, 2024
923327d
AI-improve libs/cms
AndesKrrrrrrrrrrr Oct 3, 2024
afc1b83
AI-improve libs/content-search-index-manager
AndesKrrrrrrrrrrr Oct 3, 2024
0035913
AI-improve libs/content-search-indexer
AndesKrrrrrrrrrrr Oct 3, 2024
3719494
AI-improve libs/content-search-metrics
AndesKrrrrrrrrrrr Oct 3, 2024
58535a6
AI-improve libs/content-search-toolkit
AndesKrrrrrrrrrrr Oct 3, 2024
9c90cd2
AI-improve libs/dokobit-signing
AndesKrrrrrrrrrrr Oct 3, 2024
25d47b6
AI-improve libs/email-service
AndesKrrrrrrrrrrr Oct 3, 2024
50e8643
AI-improve libs/feature-flags
AndesKrrrrrrrrrrr Oct 3, 2024
dda02d8
AI-improve libs/file-storage
AndesKrrrrrrrrrrr Oct 3, 2024
765ca3c
AI-improve libs/financial-aid
AndesKrrrrrrrrrrr Oct 3, 2024
45496ac
AI-improve libs/icelandic-names-registry
AndesKrrrrrrrrrrr Oct 3, 2024
b676ad3
AI-improve libs/infra-express-server
AndesKrrrrrrrrrrr Oct 3, 2024
925440c
AI-improve libs/infra-metrics
AndesKrrrrrrrrrrr Oct 3, 2024
65b6336
AI-improve libs/infra-nest-server
AndesKrrrrrrrrrrr Oct 3, 2024
7b83744
AI-improve libs/infra-next-server
AndesKrrrrrrrrrrr Oct 3, 2024
5ebf2dc
AI-improve libs/infra-tracing
AndesKrrrrrrrrrrr Oct 3, 2024
d8cb3b9
AI-improve libs/island-ui
AndesKrrrrrrrrrrr Oct 3, 2024
5d41061
AI-improve libs/island-ui
AndesKrrrrrrrrrrr Oct 3, 2024
1f1ef3e
AI-improve libs/island-ui
AndesKrrrrrrrrrrr Oct 3, 2024
7f1b4d6
AI-improve libs/island-ui
AndesKrrrrrrrrrrr Oct 3, 2024
7f88364
AI-improve libs/island-ui
AndesKrrrrrrrrrrr Oct 3, 2024
75e1169
AI-improve libs/island-ui
AndesKrrrrrrrrrrr Oct 3, 2024
944394e
AI-improve libs/island-ui
AndesKrrrrrrrrrrr Oct 3, 2024
32f80df
AI-improve libs/judicial-system
AndesKrrrrrrrrrrr Oct 3, 2024
7d8feef
AI-improve libs/judicial-system
AndesKrrrrrrrrrrr Oct 3, 2024
c2ac29a
AI-improve libs/judicial-system
AndesKrrrrrrrrrrr Oct 3, 2024
93c1ae6
AI-improve libs/judicial-system
AndesKrrrrrrrrrrr Oct 3, 2024
3874901
AI-improve libs/judicial-system
AndesKrrrrrrrrrrr Oct 3, 2024
9c20e16
AI-improve libs/judicial-system
AndesKrrrrrrrrrrr Oct 3, 2024
716c7b7
AI-improve libs/judicial-system
AndesKrrrrrrrrrrr Oct 3, 2024
4ac5ab1
AI-improve libs/judicial-system
AndesKrrrrrrrrrrr Oct 3, 2024
24bf0d6
AI-improve libs/localization
AndesKrrrrrrrrrrr Oct 3, 2024
d44ae3b
AI-improve libs/logging
AndesKrrrrrrrrrrr Oct 3, 2024
0c2f7b7
AI-improve libs/message-queue
AndesKrrrrrrrrrrr Oct 3, 2024
514c47c
AI-improve libs/next-ids-auth
AndesKrrrrrrrrrrr Oct 3, 2024
ce77099
AI-improve libs/nova-sms
AndesKrrrrrrrrrrr Oct 3, 2024
9a36910
AI-improve libs/plausible
AndesKrrrrrrrrrrr Oct 3, 2024
abcf298
AI-improve libs/react-spa
AndesKrrrrrrrrrrr Oct 3, 2024
860cf96
AI-improve libs/react
AndesKrrrrrrrrrrr Oct 3, 2024
eebf7ab
AI-improve libs/react
AndesKrrrrrrrrrrr Oct 3, 2024
edefaf4
AI-improve libs/react
AndesKrrrrrrrrrrr Oct 3, 2024
daf1d95
AI-improve libs/regulations
AndesKrrrrrrrrrrr Oct 3, 2024
79a2b27
AI-improve libs/skilavottord
AndesKrrrrrrrrrrr Oct 3, 2024
de5a27a
AI-improve libs/skilavottord
AndesKrrrrrrrrrrr Oct 3, 2024
d85db9c
AI-improve libs/university-gateway
AndesKrrrrrrrrrrr Oct 3, 2024
f887848
AI-improve libs/user-monitoring
AndesKrrrrrrrrrrr Oct 3, 2024
a934d15
AI-improve various libs/
AndesKrrrrrrrrrrr Oct 3, 2024
d1a5e11
chore: nx format:write update dirty files
andes-it Oct 3, 2024
da22b42
Merge branch 'main' into chore/markdown-linting
AndesKrrrrrrrrrrr Oct 3, 2024
bb8b3d7
Revert all *.md
AndesKrrrrrrrrrrr Oct 3, 2024
4ef8941
AI-magic for infra
AndesKrrrrrrrrrrr Oct 3, 2024
352471f
AI-magic for scripts
AndesKrrrrrrrrrrr Oct 3, 2024
f33ee30
AI-magic for tools
AndesKrrrrrrrrrrr Oct 3, 2024
6a12691
AI-magic for apps/services
AndesKrrrrrrrrrrr Oct 3, 2024
e9bd597
AI-magic for mocks
AndesKrrrrrrrrrrr Oct 3, 2024
212118b
AI-magic for apps/services
AndesKrrrrrrrrrrr Oct 3, 2024
16835be
AI-magic for infra
AndesKrrrrrrrrrrr Oct 3, 2024
fdf9642
Manual fixes
AndesKrrrrrrrrrrr Oct 3, 2024
6c2d383
chore: nx format:write update dirty files
andes-it Oct 3, 2024
3718a62
AI-magic for apps/
AndesKrrrrrrrrrrr Oct 3, 2024
42a7d7b
chore: nx format:write update dirty files
andes-it Oct 3, 2024
fb1f3cd
AI-magic for libs/
AndesKrrrrrrrrrrr Oct 3, 2024
a0d91d0
chore: nx format:write update dirty files
andes-it Oct 3, 2024
266b7cd
Add markdown linting workflow step
AndesKrrrrrrrrrrr Oct 4, 2024
958e1b5
Name changes
AndesKrrrrrrrrrrr Oct 4, 2024
ec8d7b7
version typo
AndesKrrrrrrrrrrr Oct 4, 2024
2918e26
No-quote glob
AndesKrrrrrrrrrrr Oct 4, 2024
eb631a1
Move docs linting to own job
AndesKrrrrrrrrrrr Oct 4, 2024
eacf8ef
Manually fix/revert AI bullshit
AndesKrrrrrrrrrrr Oct 4, 2024
0cfe54a
no sh, always bash
AndesKrrrrrrrrrrr Oct 4, 2024
d2cb3a3
Always prefix `nx` usage with `yarn`
AndesKrrrrrrrrrrr Oct 4, 2024
ba4e434
Fewer code block types
AndesKrrrrrrrrrrr Oct 4, 2024
55373b3
AI-magic applied to lint-failing markdowns
AndesKrrrrrrrrrrr Oct 4, 2024
f06ae5e
More manual editing
AndesKrrrrrrrrrrr Oct 4, 2024
2aaf96c
chore: nx format:write update dirty files
andes-it Oct 4, 2024
993df62
Update libs/application/templates/social-insurance-administration/inc…
ylfahfa Oct 4, 2024
a932662
Update libs/application/templates/social-insurance-administration/old…
ylfahfa Oct 4, 2024
fee7bda
Update libs/application/templates/parental-leave/README.md
ylfahfa Oct 4, 2024
45a68f5
Update libs/application/templates/social-insurance-administration/inc…
ylfahfa Oct 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .githooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ In this directory is a collection of helpful git hooks to ease your development

Setup is easy, just configure git to use this as your hooks path instead of the default:

```sh
```bash
git config core.hooksPath .githooks
```
2 changes: 1 addition & 1 deletion .github/actions/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# GitHub Actions supporting scripts

In this section of the repo you will find GitHub specific integrations. We really hope there will not be many of them.

Check failure on line 3 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Line length

.github/actions/README.md:3:81 MD013/line-length Line length [Expected: 80; Actual: 118] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md

## Testing

```

Check failure on line 7 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Fenced code blocks should have a language specified

.github/actions/README.md:7 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md040.md
yarn
yarn test
```

## Building/Packaging

```

Check failure on line 14 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Fenced code blocks should have a language specified

.github/actions/README.md:14 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md040.md
yarn
yarn build
```

## Running locally

Running locally can be done by using [local-runner.ts](./local-runner.ts). You will need a GitHub PAT with `repo`

Check failure on line 21 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Line length

.github/actions/README.md:21:81 MD013/line-length Line length [Expected: 80; Actual: 113] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
permissions.

```shell
```bash
node -r esbuild-runner/register local-runner.ts
```

# Change detection script

Check failure on line 28 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Multiple top-level headings in the same document

.github/actions/README.md:28 MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "Change detection script"] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md025.md

## What is a Github PR?

Basically a PR is a sort of "dry-run" of what would happen if you merged your branch to the base branch at a given point

Check failure on line 32 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Line length

.github/actions/README.md:32:81 MD013/line-length Line length [Expected: 80; Actual: 120] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
in time. Here is what roughly happens when you open a PR:

```mermaid
Expand All @@ -49,14 +49,14 @@
classDef merge fill:orange;
```

If the two branches cannot be merged together, someone must step in to fix that up. If the two branches can be merged

Check failure on line 52 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Line length

.github/actions/README.md:52:81 MD013/line-length Line length [Expected: 80; Actual: 117] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
together, then that's great and at least it means the head branch can be auto-merged into the base one. If there are

Check failure on line 53 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Line length

.github/actions/README.md:53:81 MD013/line-length Line length [Expected: 80; Actual: 116] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
GitHub Actions workflows configured for this event (pull request, that is) and the `PR1` merge was successful, then

Check failure on line 54 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Line length

.github/actions/README.md:54:81 MD013/line-length Line length [Expected: 80; Actual: 115] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
those are executed.

## The challenge

In the context of monorepo, such as we are, re-building and re-integrating the code at every step fully is very

Check failure on line 59 in .github/actions/README.md

View workflow job for this annotation

GitHub Actions / docs

Line length

.github/actions/README.md:59:81 MD013/line-length Line length [Expected: 80; Actual: 111] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
expensive (and only getting more so over time) in all kinds of ways and is therefore impractical. We are employing a
process where we re-integrate and re-build only the components that have changed from the last successful build.

Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,27 @@ jobs:
./scripts/ci/20_check-formatting.sh "write"
./infra/scripts/ci/git-check-dirty.sh "/" "nx format:write" "dirtybot"

docs:
needs:
- prepare
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
if: needs.prepare.outputs.LINT_CHUNKS
# env:
# AFFECTED_PROJECTS: ${{ matrix.projects }}
# NODE_OPTIONS: --max-old-space-size=4096
# MAX_JOBS: 3
# strategy:
# fail-fast: false
# matrix: ${{ fromJson(needs.prepare.outputs.LINT_CHUNKS) }}
steps:
- name: Markdown linting
uses: DavidAnson/markdownlint-cli2-action@v17
with:
globs: |
**/*.md

linting:
needs:
- prepare
Expand Down Expand Up @@ -362,7 +383,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
keys: ${{ needs.prepare.outputs.CACHE_KEYS }}
enable-cache: 'node_modules,generated-files'
- name: Linting
- name: Nx linting
run: ./scripts/ci/run-in-parallel-native.sh lint

build:
Expand Down
7 changes: 7 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Default state for all rules
default: true

# MD013/line-length - Line length
MD013:
line_length: 1000
tables: false
108 changes: 40 additions & 68 deletions apps/air-discount-scheme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

## About

Generates discount codes that can be used for booking domestic flights online.
Generates discount codes for eligible domestic flight bookings. Eligibility:

There are certain precondition to be eligible for a discount. They are:

- The person's legal domicile needs to be in a predefined set of towns outside
the capital (We fetch postal codes from Þjóðskrá to validate if user is
eligible).
- Legal domicile in specified towns outside the capital. Validated using Þjóðskrá postal codes.

## URLs

Expand All @@ -18,13 +14,7 @@ There are certain precondition to be eligible for a discount. They are:

## API

The API is used by airlines to verify the discount code validity and get basic
booking info about the user.

The airlines that have access to this api are `Icelandair`, `Ernir` and
`Norlandair`. Historically some flights were booked for `Norlandair` through
`Icelandair`, those flights are marked with the `Icelandair` airline but have a
cooperation field with `Norlandair`.
Airlines can verify discount codes and access basic booking info. Authorized airlines: `Icelandair`, `Ernir`, `Norlandair`. Flights booked through `Icelandair` for `Norlandair` are marked with `Icelandair`, with a cooperation field for `Norlandair`.

[Swagger API](https://loftbru.dev01.devland.is/api/swagger)

Expand All @@ -34,8 +24,7 @@ yarn start air-discount-scheme-api

## Backend

The admin frontend has a view over the bookings that have been registered in
the system. This is mainly for Vegagerðin.
The admin interface offers an overview of registered bookings, mainly for Vegagerðin.

[Admin](https://loftbru.dev01.devland.is/admin)

Expand All @@ -45,8 +34,7 @@ yarn start air-discount-scheme-backend

## Web

The user frontend has information about the initiative, legal terms and a way
for users to get their discount codes.
Includes initiative details, legal terms, and a tool for obtaining discount codes.

[Dev](https://loftbru.dev01.devland.is)

Expand All @@ -56,89 +44,73 @@ yarn start air-discount-scheme-web

## Integrations

- [Þjóðskrá](https://skra.is): To be able to verify the persons legal domicile,
give the airlines basic information about the person and fetch a persons
relations to show the discount codes for related children.
- [Þjóðskrá](https://skra.is): Validates legal domicile and provides airlines with personal info and discount codes for related children.

## Development

To get started developing this project, go ahead and:

1. Fetch the environment secrets:

```bash
yarn get-secrets air-discount-scheme-api
yarn get-secrets air-discount-scheme-backend
yarn get-secrets air-discount-scheme-web
```
To start development:

2. Start the resources with docker compose and migrate/seed the database:
1. Fetch environment secrets:

```bash
docker compose -f apps/air-discount-scheme/backend/docker-compose.yml up
```
```bash
yarn get-secrets air-discount-scheme-api
yarn get-secrets air-discount-scheme-backend
yarn get-secrets air-discount-scheme-web
```

```bash
yarn nx run air-discount-scheme-backend:migrate
2. Start resources with Docker Compose and migrate/seed the database:

yarn nx run air-discount-scheme-backend:seed
```
```bash
docker compose -f apps/air-discount-scheme/backend/docker-compose.yml up
yarn nx run air-discount-scheme-backend:migrate
yarn nx run air-discount-scheme-backend:seed
```

3. Start the front end:

```bash
yarn start air-discount-scheme-web
```
```bash
yarn start air-discount-scheme-web
```

4. Start the graphql api:
4. Start the GraphQL API:

```bash
yarn start air-discount-scheme-api
```
```bash
yarn start air-discount-scheme-api
```

5. Start the backend api:
5. Start the backend API:

```bash
yarn start air-discount-scheme-backend
```
```bash
yarn start air-discount-scheme-backend
```

6. Check Contentful and AWS
6. Verify Contentful and AWS:

Login here <https://island-is.awsapps.com/start#/> (Contact devops if you need access)
Copy env variables as instructed [here](https://docs.devland.is/technical-overview/devops/dockerizing#troubleshooting) (image arrows 1,2,3)
Paste env variables into terminal
Run `./scripts/run-es-proxy.sh` from island.is root
You have success if you see `Forwarding from 0.0.0.0:9200 -> 9200` in terminal
Log in at <https://island-is.awsapps.com/start#/> (Contact devops for access). Copy environment variables as described in [the documentation](https://docs.devland.is/technical-overview/devops/dockerizing#troubleshooting), then paste into terminal. Execute `./scripts/run-es-proxy.sh` from island.is root directory. Success is indicated by `Forwarding from 0.0.0.0:9200 -> 9200`.

Navigate to [localhost:4200](http://localhost:4200) for the website or
[localhost:4248/api/swagger/](http://localhost:4248/api/swagger/) for the
airline api.
Visit [localhost:4200](http://localhost:4200) for the website or [localhost:4248/api/swagger/](http://localhost:4248/api/swagger/) for the airline API.

### Admin

To access the Admin UI, you'll need to add your Icelandic National ID to the
comma separated environment variable `DEVELOPERS` (.env.secret) and restart the
`api`.
To access the Admin UI, add your Icelandic National ID to the `DEVELOPERS` environment variable in `.env.secret` and restart the API.

```bash
export DEVELOPERS=1234567890
```

## Shortcuts

Because of the short timeline this assignment had, there were few shortcuts
taken that can be improved upon:
Due to time constraints, certain shortcuts were taken:

- The authentication is pretty primitive, the IDP is still in development at
the time of this writing so we needed to use static api keys.
- The deployment pipeline is outside of the islandis main pipeline.
- The graphql api is separate of the main graphql api of islandis.
- Basic authentication with static API keys; IDP was in development.
- Separate deployment pipeline from the main island.is pipeline.
- Independent GraphQL API from island.is's main API.

## Project owner
## Project Owner

- [Vegagerðin](http://www.vegagerdin.is)

## Code owners and maintainers
## Code Owners and Maintainers

- [Brian - @barabrian](https://github.com/barabrian)
- [Davíð Guðni - @dabbeg](https://github.com/dabbeg)
Expand Down
Loading
Loading