Skip to content

Commit 5d14948

Browse files
authored
Dev (#361)
* upgrade mantine libs * pattern error update * fix checkbox with indeterminate * refactor * notes * notes * ramdisk for build * remove old comments * upgrade pnpm version req * notes for ordering * update ts * fixme - mantine table types infinite loop * tsc in ci * ts check * random notes * fix orval gen and update opentelemetry js due to build failures
1 parent d6dd5f5 commit 5d14948

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+6796
-6495
lines changed

.github/workflows/tests.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ jobs:
7878
7979
{ test -n "$bg_pid" && kill $bg_pid; } || true
8080
81-
8281
- name: Postgres logs
8382
if: failure() # always()
8483
run: docker logs postgres_db_openapi-go-gin
@@ -100,3 +99,8 @@ jobs:
10099
# https://stackoverflow.com/questions/65242830/in-a-github-actions-workflow-is-there-a-way-to-have-multiple-jobs-reuse-the-sam
101100
# https://github.com/kmadof/github-actions-manual/blob/main/.github/actions/say-hello/action.yml
102101

102+
- name: Build frontend
103+
run: |
104+
source .envrc
105+
106+
project build.frontend

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ run:
77
linters:
88
enable-all: true
99
disable:
10+
- nlreturn
11+
- mnd
1012
- dupword
1113
- ireturn # oapi-codegen strict handlers
1214
# - interfacebloat

bin/.project.dependencies.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ install.bin.direnv() {
212212
check.bin.pnpm() {
213213
{ { {
214214
vers=$(pnpm --version)k
215-
minver=8
215+
minver=9
216216
if [[ "$vers" =~ [v]?([0-9]+)[\.]{1} ]] && ((BASH_REMATCH[1] >= minver)); then
217217
report_success
218218
else
@@ -223,7 +223,7 @@ check.bin.pnpm() {
223223

224224
install.bin.pnpm() {
225225
{ { {
226-
npm install --prefix ./bin/tools/ -g pnpm@8.3.1
226+
npm install --prefix ./bin/tools/ -g pnpm@9.12.0
227227
} 2>&4 | xlog >&3; } 4>&1 | xerr >&3; } 3>&1
228228
}
229229

bin/project

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,15 @@ x.test.backend() {
13721372
xsetup.backup.cleanup
13731373
}
13741374

1375+
# Build frontend.
1376+
# Args: [...]
1377+
x.build.frontend() {
1378+
config_template_setup frontend
1379+
1380+
cd frontend
1381+
pnpm run build
1382+
}
1383+
13751384
# Test frontend. Accepts `vitest` parameters.
13761385
# Args: [...]
13771386
x.test.frontend() {
@@ -1539,12 +1548,20 @@ x.run.backend-hr() {
15391548
# to prevent either bombarding with req or having to wait too long at startup.
15401549
# see https://github.com/moby/moby/issues/33410
15411550

1542-
# https://github.com/cosmtrek/air/blob/master/air_example.toml
1543-
# NOTE: building binary unreliable, leads to bin not found.
1551+
# https://github.com/air-verse/air/blob/master/air_example.toml
1552+
# NOTE: building binary unreliable sometimes, leads to bin not found.
1553+
local build_cmd="go build -o /mnt/ramdisk/rest-server ./cmd/rest-server/main.go"
1554+
local bin_cmd="/mnt/ramdisk/rest-server -env=.env.$X_ENV"
1555+
if ! test -d /mnt/ramdisk; then # setup with sudo mkdir -p /mnt/ramdisk; sudo mount -t tmpfs -o size=100M tmpfs /mnt/ramdisk
1556+
build_cmd=""
1557+
bin_cmd="go run ./cmd/rest-server/main.go -env=.env.$X_ENV"
1558+
fi
1559+
echo "Running $bin_cmd"
1560+
15441561
air \
15451562
--build.pre_cmd "$pre_build_cmd" \
1546-
--build.cmd "" \
1547-
--build.bin "go run ./cmd/rest-server/main.go -env=.env.$X_ENV" \
1563+
--build.cmd "$build_cmd" \
1564+
--build.bin "$bin_cmd" \
15481565
--build.include_ext "go,work,mod" \
15491566
--build.include_file "openapi.yaml" \
15501567
--build.exclude_regex ".gen.go,_test.go" \
@@ -1652,6 +1669,7 @@ x.backend.typecheck() {
16521669
}
16531670

16541671
# depends on gen.xo output
1672+
# still no branded types in orval: https://github.com/orval-labs/orval/issues/1222
16551673
orval_frontend_branded_types() {
16561674
local import_string="import type * as EntityIDs from 'src/gen/entity-ids'"
16571675
local escaped_import_string=$(escape_sed "$import_string")
@@ -1669,7 +1687,10 @@ orval_frontend_branded_types() {
16691687
"-e" "s/${camel}?: number/${camel}?: EntityIDs.${pascal}/g"
16701688
"-e" "s/${camel}: number/${camel}: EntityIDs.${pascal}/g"
16711689
"-e" "s/${camel}: faker.number.int({min: undefined, max: undefined})/${camel}: faker.number.int({min: undefined, max: undefined}) as EntityIDs.${pascal}/g"
1690+
"-e" "s/${camel}: faker.number.int({min: undefined, max: undefined})/${camel}: faker.number.int({min: undefined, max: undefined}) as EntityIDs.${pascal}/g"
1691+
"-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"
16721692
)
1693+
16731694
done
16741695

16751696
local uuid_ids=()
@@ -1682,6 +1703,7 @@ orval_frontend_branded_types() {
16821703
"-e" "s/${camel}?: Models${pascal}/${camel}?: EntityIDs.${pascal}/g"
16831704
"-e" "s/${camel}: Models${pascal}/${camel}: EntityIDs.${pascal}/g"
16841705
"-e" "s/${camel}: faker.word.sample()/${camel}: faker.string.uuid() as EntityIDs.${pascal}/g"
1706+
"-e" "s/${camel}: faker.string.uuid()/${camel}: faker.string.uuid() as EntityIDs.${pascal}/g"
16851707
)
16861708
done
16871709

e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"eslint-config-prettier": "^8.5.0",
1313
"eslint-plugin-prettier": "^3.4.1",
1414
"prettier": "^2.7.1",
15-
"typescript": "^4.8.2"
15+
"typescript": "^5.7.2"
1616
},
1717
"dependencies": {
1818
"@playwright/test": "^1.35.0",

e2e/pnpm-lock.yaml

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pnpm-debug.log*
88
lerna-debug.log*
99
/build
1010
config.json
11+
tsconfig.tsbuildinfo
1112

1213
node_modules
1314
dist

frontend/orval.config.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'orval'
22
import { faker } from '@faker-js/faker'
3-
import _, { uniqueId } from 'lodash'
3+
import * as _ from 'lodash'
4+
45
// relative paths only
56
import { reactQueryDefaultAppOptions } from './src/react-query.default'
67

@@ -24,7 +25,21 @@ export default defineConfig({
2425
useQuery: true,
2526
useInfinite: true, // https://tanstack.com/query/v4/docs/guides/infinite-queries
2627
options: reactQueryDefaultAppOptions.queries,
27-
useInfiniteQueryParam: 'cursor', // same param for all app paginated queries
28+
// FIXME: leads to issues with /events, /oidc and /project where it assumes there's a cursor param
29+
useInfiniteQueryParam: 'cursor', // same param for all app paginated queries.
30+
},
31+
operations: {
32+
..._.fromPairs(
33+
['GetProjectWorkitems', 'MyProviderLogin', 'Events'].map((operation) => [
34+
operation,
35+
{
36+
query: {
37+
useQuery: true,
38+
useInfinite: false,
39+
},
40+
},
41+
]),
42+
),
2843
},
2944
mock: {
3045
delay: 200,

frontend/package.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,28 @@
2525
"@fortawesome/free-solid-svg-icons": "^6.2.1",
2626
"@fortawesome/react-fontawesome": "^0.1.19",
2727
"@hookform/resolvers": "^3.1.1",
28-
"@mantine/code-highlight": "7.6.1",
29-
"@mantine/core": "7.6.1",
30-
"@mantine/dates": "7.6.1",
31-
"@mantine/hooks": "7.6.1",
32-
"@mantine/modals": "7.6.1",
33-
"@mantine/notifications": "^7.1.7",
34-
"@opentelemetry/api": "1.7.0",
35-
"@opentelemetry/auto-instrumentations-web": "0.30.0",
36-
"@opentelemetry/context-zone": "1.7.0",
37-
"@opentelemetry/context-zone-peer-dep": "1.7.0",
38-
"@opentelemetry/core": "1.19.0",
39-
"@opentelemetry/exporter-trace-otlp-http": "0.33.0",
40-
"@opentelemetry/exporter-zipkin": "1.21.0",
41-
"@opentelemetry/instrumentation": "0.46.0",
42-
"@opentelemetry/instrumentation-document-load": "0.34.0",
43-
"@opentelemetry/instrumentation-fetch": "0.46.0",
44-
"@opentelemetry/instrumentation-xml-http-request": "0.46.0",
45-
"@opentelemetry/propagator-b3": "1.7.0",
46-
"@opentelemetry/resources": "1.19.0",
47-
"@opentelemetry/sdk-trace-base": "1.19.0",
48-
"@opentelemetry/sdk-trace-web": "1.19.0",
49-
"@opentelemetry/semantic-conventions": "1.19.0",
28+
"@mantine/code-highlight": "7.13.2",
29+
"@mantine/core": "7.13.2",
30+
"@mantine/dates": "7.13.2",
31+
"@mantine/hooks": "7.13.2",
32+
"@mantine/modals": "7.13.2",
33+
"@mantine/notifications": "^7.13.2",
34+
"@opentelemetry/api": "1.9.0",
35+
"@opentelemetry/auto-instrumentations-web": "0.45.0",
36+
"@opentelemetry/context-zone": "1.30.1",
37+
"@opentelemetry/context-zone-peer-dep": "1.30.1",
38+
"@opentelemetry/core": "1.30.1",
39+
"@opentelemetry/exporter-trace-otlp-http": "0.57.1",
40+
"@opentelemetry/exporter-zipkin": "1.30.1",
41+
"@opentelemetry/instrumentation": "0.57.1",
42+
"@opentelemetry/instrumentation-document-load": "0.44.0",
43+
"@opentelemetry/instrumentation-fetch": "0.57.1",
44+
"@opentelemetry/instrumentation-xml-http-request": "0.57.1",
45+
"@opentelemetry/propagator-b3": "1.30.1",
46+
"@opentelemetry/resources": "1.30.1",
47+
"@opentelemetry/sdk-trace-base": "1.30.1",
48+
"@opentelemetry/sdk-trace-web": "1.30.1",
49+
"@opentelemetry/semantic-conventions": "1.28.0",
5050
"@reactour/tour": "^3.6.1",
5151
"@tabler/icons": "^1.119.0",
5252
"@tabler/icons-react": "^2.47.0",
@@ -75,7 +75,7 @@
7575
"json-schema-ref-parser": "^9.0.9",
7676
"json-schema-to-ts": "^2.9.1",
7777
"lodash": "^4.17.21",
78-
"mantine-react-table": "2.0.0-beta.0",
78+
"mantine-react-table": "2.0.0-beta.7",
7979
"moment": "^2.29.4",
8080
"msw": "^2.2.1",
8181
"openapi-typescript": "^6.4.3",
@@ -90,7 +90,7 @@
9090
"react-dom": "^18.2.0",
9191
"react-error-boundary": "^4.0.10",
9292
"react-helmet": "^6.1.0",
93-
"react-hook-form": "^7.50.1",
93+
"react-hook-form": "^7.54.2",
9494
"react-router-dom": "^6.6.1",
9595
"react-status-beacon": "^1.0.4",
9696
"react-tooltip": "^5.25.1",
@@ -137,7 +137,7 @@
137137
"prettier": "^2.7.1",
138138
"resize-observer-polyfill": "^1.5.1",
139139
"terser": "^5.15.0",
140-
"typescript": "^5.1.3",
140+
"typescript": "^5.7.2",
141141
"vite": "5.1.5"
142142
}
143143
}

0 commit comments

Comments
 (0)