Skip to content

Commit

Permalink
Merge branch 'main' into feature/dot-776-create-asset-page
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikskog committed Oct 24, 2024
2 parents 061d83e + ad0d463 commit 0fdac4a
Show file tree
Hide file tree
Showing 168 changed files with 1,823 additions and 1,010 deletions.
22 changes: 8 additions & 14 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"enabled": false,
"configMigration": true,
"extends": ["config:recommended"],
"extends": [
"config:recommended"
],
"packageRules": [
{
"matchPackagePatterns": ["^@dotkomonline/"],
"enabled": false
},
{
"description": "Ignore nodejs and pnpm",
"matchPackageNames": ["node", "pnpm"],
"enabled": false
"enabled": false,
"matchPackageNames": [
"/^@dotkomonline//"
]
}
],
"updateInternalDeps": true,
"rangeStrategy": "bump",
"automerge": true,
"automergeType": "branch"
]
}
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: ["main"]
pull_request:
types: [opened, synchronize]
merge_group:

env:
DASHBOARD_AUTH0_CLIENT_ID: ${{ secrets.DASHBOARD_AUTH0_CLIENT_ID }}
Expand All @@ -26,6 +27,8 @@ env:
GTX_AUTH0_CLIENT_ID: ${{ secrets.GTX_AUTH0_CLIENT_ID }}
GTX_AUTH0_CLIENT_SECRET: ${{ secrets.GTX_AUTH0_CLIENT_SECRET }}
GTX_AUTH0_ISSUER: ${{ secrets.GTX_AUTH0_ISSUER }}
RPC_HOST: ${{ secrets.RPC_HOST }}
RPC_ALLOWED_ORIGINS: ${{ secrets.RPC_ALLOWED_ORIGINS }}

jobs:
build:
Expand All @@ -42,7 +45,7 @@ jobs:
fetch-depth: 2

- name: Cache turbo build setup
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
Expand All @@ -54,7 +57,7 @@ jobs:
version: 9.0.4

- name: Setup Node.js environment
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.12.2
cache: 'pnpm'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
name: Checkout source code

- uses: actions/cache@v3
- uses: actions/cache@v4
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
46 changes: 43 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ architecture, the tools used, and the local development process.

## Table of Contents

- [Architecture](#architecture)
- [Tools](#tools)
- [Local Development](#local-development)
- [Monoweb Developer Guide](#monoweb-developer-guide)
- [Table of Contents](#table-of-contents)
- [Architecture](#architecture)
- [Tools](#tools)
- [Local Development](#local-development)
- [Required Environment Variables](#required-environment-variables)
- [Running with your own PostgreSQL database](#running-with-your-own-postgresql-database)
- [What runs where?](#what-runs-where)
- [Testing](#testing)
- [Integration tests](#integration-tests)
- [Prerequisites](#prerequisites)
- [How to run](#how-to-run)

## Architecture

Expand Down Expand Up @@ -152,3 +159,36 @@ The following applications run on the following ports:
- `/apps/invoicing`: 3004
- `/apps/brevduen`: AWS Lambda only
- `/packages/ui`: 61000 (ladle)

## Testing

### Integration tests

Config file: `packages/core/vitest-integration.config.ts`
Setup functions: `packages/core/vitest-integration.setup.ts`

#### Prerequisites

- Docker

Monoweb uses test containers to run a PostgreSQL database in Docker for testing. The tests are setup to use a custom postgres image with ulid extension (see setup file). By running the tests, this image should be downloaded. When the image is downloaded, you should be able to run the tests. It might take a while to download the image the first time.

#### How to run

```bash
cd packages/core
doppler run -- pnpm exec vitest run -c ./vitest-integration.config.ts
```

**Note:** The `DATABASE_URL` environment variable is overwritten in the setup file to use the test container database.

**Filtering**

For filtering test you can use the normal vitest filtering, see [Vitest documentation](https://vitest.dev/guide/filtering).

*Example: run a spesific test*

```bash
cd packages/core
doppler run -- pnpm exec vitest run -c ./vitest-integration.config.ts user -t "can update users given their id"
```
4 changes: 2 additions & 2 deletions apps/brevduen/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM public.ecr.aws/lambda/nodejs:20 AS builder
WORKDIR /usr/app
COPY apps ./apps
COPY packages ./packages
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.json turbo.json ./
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./

RUN npm i -g pnpm@8
RUN npm i -g pnpm@9.0.4
RUN pnpm install --frozen-lockfile
RUN pnpm build:brevduen

Expand Down
13 changes: 7 additions & 6 deletions apps/brevduen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@
"scripts": {
"docker:dev": "docker run -p 9000:8080 -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_REGION=eu-north-1 brevduen:latest",
"build": "tsup src/lambda.ts && echo '{\"type\":\"module\"}' > dist/package.json",
"lint": "biome check . --apply",
"lint": "biome check . --write",
"lint-check": "biome check .",
"docker:build": "docker build --platform linux/amd64 -t brevduen:latest -f Dockerfile ../..",
"docker:push:staging": "docker tag brevduen:latest 891459268445.dkr.ecr.eu-north-1.amazonaws.com/brevduen-staging:latest && docker push 891459268445.dkr.ecr.eu-north-1.amazonaws.com/brevduen-staging:latest",
"docker:push:prod": "docker tag brevduen:latest 891459268445.dkr.ecr.eu-north-1.amazonaws.com/brevduen-prod:latest && docker push 891459268445.dkr.ecr.eu-north-1.amazonaws.com/brevduen-prod:latest",
"lambda:update:staging": "aws lambda update-function-code --function-name brevduen-staging --image-uri 891459268445.dkr.ecr.eu-north-1.amazonaws.com/brevduen-staging:latest",
"lambda:update:prod": "aws lambda update-function-code --function-name brevduen-prod --image-uri 891459268445.dkr.ecr.eu-north-1.amazonaws.com/brevduen-prod:latest",
"lambda:update:staging": "aws lambda update-function-code --function-name brevduen-staging --image-uri 891459268445.dkr.ecr.eu-north-1.amazonaws.com/brevduen-staging:latest --region eu-north-1",
"lambda:update:prod": "aws lambda update-function-code --function-name brevduen-prod --image-uri 891459268445.dkr.ecr.eu-north-1.amazonaws.com/brevduen-prod:latest --region eu-north-1",
"type-check": "tsc --noEmit"
},
"dependencies": {
"@aws-sdk/client-ses": "^3.507.0",
"@aws-sdk/client-ses": "^3.665.0",
"@dotkomonline/emails": "workspace:*",
"zod": "^3.22.4"
},
"devDependencies": {
"@biomejs/biome": "1.6.4",
"@biomejs/biome": "^1.9.3",
"@dotkomonline/tsconfig": "workspace:*",
"@types/aws-lambda": "^8.10.129",
"@types/node": "^20.12.7",
"@types/node": "^20.16.10",
"tsup": "^7.2.0",
"typescript": "^5.4.5"
}
Expand Down
7 changes: 5 additions & 2 deletions apps/brevduen/src/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@ export const handler: Handler<APIGatewayProxyEventV2, APIGatewayProxyResultV2> =
return { statusCode: 201 }
} catch (err) {
if (err instanceof ZodError) {
return { statusCode: 400, body: "Provided arguments don't match email input schema" }
return { statusCode: 400, body: `Provided arguments don't match email input schema: ${err.message}` }
}
if (err instanceof InvalidTemplateArguments) {
return { statusCode: 400, body: "Arguments provided to template don't match the template's arguments" }
return {
statusCode: 400,
body: `Arguments provided to template don't match the template's argument schema: ${err.message}`,
}
}
console.error(err)
return { statusCode: 500 }
Expand Down
2 changes: 1 addition & 1 deletion apps/brevduen/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../packages/tsconfig/tsconfig.json",
"compilerOptions": {
"jsx": "react-jsx"
},
Expand Down
36 changes: 21 additions & 15 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,58 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 3002",
"dev": "next dev -p 3002 --turbo",
"build": "next build",
"start": "next start",
"lint": "biome check . --apply",
"lint": "biome check . --write",
"lint-check": "biome check .",
"type-check": "tsc --noEmit"
},
"dependencies": {
"@dotkomonline/auth": "workspace:*",
"@dotkomonline/env": "workspace:*",
"@dotkomonline/gateway-trpc": "workspace:*",
"@dotkomonline/proxy-nextjs": "workspace:*",
"@dotkomonline/types": "workspace:*",
"@dotkomonline/ui": "workspace:*",
"@dotkomonline/utils": "workspace:*",
"@aws-sdk/client-s3": "^3.665.0",
"@aws-sdk/s3-presigned-post": "^3.665.0",
"@hookform/error-message": "^2.0.1",
"@hookform/resolvers": "^3.3.4",
"@iconify/react": "^4.1.1",
"@mantine/core": "^7.2.2",
"@mantine/dates": "^7.2.2",
"@mantine/hooks": "^7.2.2",
"@mantine/modals": "^7.2.2",
"@mantine/notifications": "^7.2.2",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-dialog": "^1.0.5",
"@mantine/core": "^7.13.2",
"@mantine/dates": "^7.13.2",
"@mantine/hooks": "^7.13.2",
"@mantine/modals": "^7.13.2",
"@mantine/notifications": "^7.13.2",
"@radix-ui/react-alert-dialog": "^1.1.2",
"@radix-ui/react-dialog": "^1.1.2",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-table": "^8.10.7",
"@trpc/client": "^10.45.0",
"@trpc/react-query": "^10.45.0",
"@trpc/server": "^10.45.0",
"clsx": "^2.0.0",
"dayjs": "^1.11.10",
"next": "^14.0.3",
"next-auth": "^4.24.5",
"next": "^14.2.14",
"next-auth": "^4.24.8",
"pg-native": "file:./stubs/pg-native",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.48.2",
"react-image-crop": "^11.0.5",
"react-zxing": "^2.0.0",
"superjson": "^1.13.3",
"superjson": "^2.0.0",
"pg": "^8.11.3",
"zod": "^3.22.4"
},
"devDependencies": {
"@biomejs/biome": "1.6.4",
"@biomejs/biome": "^1.9.3",
"@dotkomonline/config": "workspace:^",
"@types/node": "^20.12.7",
"@types/react": "^18.2.38",
"@dotkomonline/tsconfig": "workspace:*",
"@types/node": "^20.16.10",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.2.17",
"autoprefixer": "^10.4.16",
"open-color": "^1.9.1",
Expand Down
Loading

0 comments on commit 0fdac4a

Please sign in to comment.