Skip to content
Merged

Dev #361

Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ jobs:

{ test -n "$bg_pid" && kill $bg_pid; } || true


- name: Postgres logs
if: failure() # always()
run: docker logs postgres_db_openapi-go-gin
Expand All @@ -100,3 +99,8 @@ jobs:
# https://stackoverflow.com/questions/65242830/in-a-github-actions-workflow-is-there-a-way-to-have-multiple-jobs-reuse-the-sam
# https://github.com/kmadof/github-actions-manual/blob/main/.github/actions/say-hello/action.yml

- name: Build frontend
run: |
source .envrc

project build.frontend
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ run:
linters:
enable-all: true
disable:
- nlreturn
- mnd
- dupword
- ireturn # oapi-codegen strict handlers
# - interfacebloat
Expand Down
4 changes: 2 additions & 2 deletions bin/.project.dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ install.bin.direnv() {
check.bin.pnpm() {
{ { {
vers=$(pnpm --version)k
minver=8
minver=9
if [[ "$vers" =~ [v]?([0-9]+)[\.]{1} ]] && ((BASH_REMATCH[1] >= minver)); then
report_success
else
Expand All @@ -223,7 +223,7 @@ check.bin.pnpm() {

install.bin.pnpm() {
{ { {
npm install --prefix ./bin/tools/ -g pnpm@8.3.1
npm install --prefix ./bin/tools/ -g pnpm@9.12.0
} 2>&4 | xlog >&3; } 4>&1 | xerr >&3; } 3>&1
}

Expand Down
30 changes: 26 additions & 4 deletions bin/project
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,15 @@ x.test.backend() {
xsetup.backup.cleanup
}

# Build frontend.
# Args: [...]
x.build.frontend() {
config_template_setup frontend

cd frontend
pnpm run build
}

# Test frontend. Accepts `vitest` parameters.
# Args: [...]
x.test.frontend() {
Expand Down Expand Up @@ -1539,12 +1548,20 @@ x.run.backend-hr() {
# to prevent either bombarding with req or having to wait too long at startup.
# see https://github.com/moby/moby/issues/33410

# https://github.com/cosmtrek/air/blob/master/air_example.toml
# NOTE: building binary unreliable, leads to bin not found.
# https://github.com/air-verse/air/blob/master/air_example.toml
# NOTE: building binary unreliable sometimes, leads to bin not found.
local build_cmd="go build -o /mnt/ramdisk/rest-server ./cmd/rest-server/main.go"
local bin_cmd="/mnt/ramdisk/rest-server -env=.env.$X_ENV"
if ! test -d /mnt/ramdisk; then # setup with sudo mkdir -p /mnt/ramdisk; sudo mount -t tmpfs -o size=100M tmpfs /mnt/ramdisk
build_cmd=""
bin_cmd="go run ./cmd/rest-server/main.go -env=.env.$X_ENV"
fi
echo "Running $bin_cmd"

air \
--build.pre_cmd "$pre_build_cmd" \
--build.cmd "" \
--build.bin "go run ./cmd/rest-server/main.go -env=.env.$X_ENV" \
--build.cmd "$build_cmd" \
--build.bin "$bin_cmd" \
--build.include_ext "go,work,mod" \
--build.include_file "openapi.yaml" \
--build.exclude_regex ".gen.go,_test.go" \
Expand Down Expand Up @@ -1652,6 +1669,7 @@ x.backend.typecheck() {
}

# depends on gen.xo output
# still no branded types in orval: https://github.com/orval-labs/orval/issues/1222
orval_frontend_branded_types() {
local import_string="import type * as EntityIDs from 'src/gen/entity-ids'"
local escaped_import_string=$(escape_sed "$import_string")
Expand All @@ -1669,7 +1687,10 @@ orval_frontend_branded_types() {
"-e" "s/${camel}?: number/${camel}?: EntityIDs.${pascal}/g"
"-e" "s/${camel}: number/${camel}: EntityIDs.${pascal}/g"
"-e" "s/${camel}: faker.number.int({min: undefined, max: undefined})/${camel}: faker.number.int({min: undefined, max: undefined}) as EntityIDs.${pascal}/g"
"-e" "s/${camel}: faker.number.int({min: undefined, max: undefined})/${camel}: faker.number.int({min: undefined, max: undefined}) as EntityIDs.${pascal}/g"
"-e" "s/${camel}:[[:space:]]*faker\.helpers\.arrayElement(\[faker\.number\.int({min:[[:space:]]*undefined,[[:space:]]*max:[[:space:]]*undefined}),[[:space:]]*null\])/${camel}: faker.helpers.arrayElement([faker.number.int({min: undefined, max: undefined}), null]) as EntityIDs.${pascal} | null/g"
)

done

local uuid_ids=()
Expand All @@ -1682,6 +1703,7 @@ orval_frontend_branded_types() {
"-e" "s/${camel}?: Models${pascal}/${camel}?: EntityIDs.${pascal}/g"
"-e" "s/${camel}: Models${pascal}/${camel}: EntityIDs.${pascal}/g"
"-e" "s/${camel}: faker.word.sample()/${camel}: faker.string.uuid() as EntityIDs.${pascal}/g"
"-e" "s/${camel}: faker.string.uuid()/${camel}: faker.string.uuid() as EntityIDs.${pascal}/g"
)
done

Expand Down
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^3.4.1",
"prettier": "^2.7.1",
"typescript": "^4.8.2"
"typescript": "^5.7.2"
},
"dependencies": {
"@playwright/test": "^1.35.0",
Expand Down
22 changes: 11 additions & 11 deletions e2e/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pnpm-debug.log*
lerna-debug.log*
/build
config.json
tsconfig.tsbuildinfo

node_modules
dist
Expand Down
19 changes: 17 additions & 2 deletions frontend/orval.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'orval'
import { faker } from '@faker-js/faker'
import _, { uniqueId } from 'lodash'
import * as _ from 'lodash'

// relative paths only
import { reactQueryDefaultAppOptions } from './src/react-query.default'

Expand All @@ -24,7 +25,21 @@ export default defineConfig({
useQuery: true,
useInfinite: true, // https://tanstack.com/query/v4/docs/guides/infinite-queries
options: reactQueryDefaultAppOptions.queries,
useInfiniteQueryParam: 'cursor', // same param for all app paginated queries
// FIXME: leads to issues with /events, /oidc and /project where it assumes there's a cursor param
useInfiniteQueryParam: 'cursor', // same param for all app paginated queries.
},
operations: {
..._.fromPairs(
['GetProjectWorkitems', 'MyProviderLogin', 'Events'].map((operation) => [
operation,
{
query: {
useQuery: true,
useInfinite: false,
},
},
]),
),
},
mock: {
delay: 200,
Expand Down
50 changes: 25 additions & 25 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@
"@fortawesome/free-solid-svg-icons": "^6.2.1",
"@fortawesome/react-fontawesome": "^0.1.19",
"@hookform/resolvers": "^3.1.1",
"@mantine/code-highlight": "7.6.1",
"@mantine/core": "7.6.1",
"@mantine/dates": "7.6.1",
"@mantine/hooks": "7.6.1",
"@mantine/modals": "7.6.1",
"@mantine/notifications": "^7.1.7",
"@opentelemetry/api": "1.7.0",
"@opentelemetry/auto-instrumentations-web": "0.30.0",
"@opentelemetry/context-zone": "1.7.0",
"@opentelemetry/context-zone-peer-dep": "1.7.0",
"@opentelemetry/core": "1.19.0",
"@opentelemetry/exporter-trace-otlp-http": "0.33.0",
"@opentelemetry/exporter-zipkin": "1.21.0",
"@opentelemetry/instrumentation": "0.46.0",
"@opentelemetry/instrumentation-document-load": "0.34.0",
"@opentelemetry/instrumentation-fetch": "0.46.0",
"@opentelemetry/instrumentation-xml-http-request": "0.46.0",
"@opentelemetry/propagator-b3": "1.7.0",
"@opentelemetry/resources": "1.19.0",
"@opentelemetry/sdk-trace-base": "1.19.0",
"@opentelemetry/sdk-trace-web": "1.19.0",
"@opentelemetry/semantic-conventions": "1.19.0",
"@mantine/code-highlight": "7.13.2",
"@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",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/auto-instrumentations-web": "0.45.0",
"@opentelemetry/context-zone": "1.30.1",
"@opentelemetry/context-zone-peer-dep": "1.30.1",
"@opentelemetry/core": "1.30.1",
"@opentelemetry/exporter-trace-otlp-http": "0.57.1",
"@opentelemetry/exporter-zipkin": "1.30.1",
"@opentelemetry/instrumentation": "0.57.1",
"@opentelemetry/instrumentation-document-load": "0.44.0",
"@opentelemetry/instrumentation-fetch": "0.57.1",
"@opentelemetry/instrumentation-xml-http-request": "0.57.1",
"@opentelemetry/propagator-b3": "1.30.1",
"@opentelemetry/resources": "1.30.1",
"@opentelemetry/sdk-trace-base": "1.30.1",
"@opentelemetry/sdk-trace-web": "1.30.1",
"@opentelemetry/semantic-conventions": "1.28.0",
"@reactour/tour": "^3.6.1",
"@tabler/icons": "^1.119.0",
"@tabler/icons-react": "^2.47.0",
Expand Down Expand Up @@ -75,7 +75,7 @@
"json-schema-ref-parser": "^9.0.9",
"json-schema-to-ts": "^2.9.1",
"lodash": "^4.17.21",
"mantine-react-table": "2.0.0-beta.0",
"mantine-react-table": "2.0.0-beta.7",
"moment": "^2.29.4",
"msw": "^2.2.1",
"openapi-typescript": "^6.4.3",
Expand All @@ -90,7 +90,7 @@
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.10",
"react-helmet": "^6.1.0",
"react-hook-form": "^7.50.1",
"react-hook-form": "^7.54.2",
"react-router-dom": "^6.6.1",
"react-status-beacon": "^1.0.4",
"react-tooltip": "^5.25.1",
Expand Down Expand Up @@ -137,7 +137,7 @@
"prettier": "^2.7.1",
"resize-observer-polyfill": "^1.5.1",
"terser": "^5.15.0",
"typescript": "^5.1.3",
"typescript": "^5.7.2",
"vite": "5.1.5"
}
}
Loading
Loading