Skip to content

Commit 0560011

Browse files
authored
Merge pull request #172 from thomaxxl/feat/docker-fastapi-demo-github-client
demo: fetch safrs-jsonapi-client from github by default
2 parents f5b595b + 495f04d commit 0560011

File tree

4 files changed

+104
-19
lines changed

4 files changed

+104
-19
lines changed

examples/docker_fastapi_demo/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This directory packages the current Northwind validation app as a self-contained
77
- `reference/` contains the shipped `admin.yaml`
88
- `site/` contains the simple landing page served by nginx at `/`
99
- `vendor/safrs/` is a vendored copy of the current SAFRS source used by the backend image
10-
- `vendor/safrs-jsonapi-client/` is a vendored client package used by the frontend
10+
- `vendor/safrs-jsonapi-client/` is an optional local fallback for the frontend client package
1111

1212
The container runs multiple processes:
1313

@@ -100,6 +100,18 @@ Container paths:
100100
- default baked-in frontend: `/app/frontend`
101101
- dev-mounted frontend: `/demo/frontend`
102102

103+
## Client dependency source
104+
105+
By default, the frontend installs `safrs-jsonapi-client` from:
106+
107+
- `https://codeload.github.com/thomaxxl/safrs-jsonapi-client/tar.gz/refs/heads/main`
108+
109+
To force local vendored fallback instead, set:
110+
111+
```bash
112+
USE_LOCAL_SAFRS_JSONAPI_CLIENT=1 docker compose up --build
113+
```
114+
103115
## Notes
104116

105117
- The runtime SQLite database is stored in the `northwind_demo_data` Docker volume.

examples/docker_fastapi_demo/entrypoint.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ export VITE_DEV_PORT="5173"
5656
export VITE_HMR_CLIENT_PORT="${DEMO_EXTERNAL_PORT:-8000}"
5757
export VITE_HMR_PATH="/admin-app/__vite_hmr"
5858

59+
SAFRS_JSONAPI_CLIENT_SPEC="https://codeload.github.com/thomaxxl/safrs-jsonapi-client/tar.gz/refs/heads/main"
60+
if is_true "${USE_LOCAL_SAFRS_JSONAPI_CLIENT:-0}"; then
61+
LOCAL_CLIENT_DIR="$SOURCE_ROOT/vendor/safrs-jsonapi-client"
62+
if [ ! -f "$LOCAL_CLIENT_DIR/package.json" ]; then
63+
echo "USE_LOCAL_SAFRS_JSONAPI_CLIENT is set, but $LOCAL_CLIENT_DIR is missing" >&2
64+
exit 1
65+
fi
66+
SAFRS_JSONAPI_CLIENT_SPEC="file:$LOCAL_CLIENT_DIR"
67+
fi
68+
69+
(
70+
cd "$SOURCE_ROOT/frontend"
71+
npm pkg set "dependencies.safrs-jsonapi-client=$SAFRS_JSONAPI_CLIENT_SPEC"
72+
)
73+
5974
if [ "$SOURCE_ROOT" = "/demo" ]; then
6075
(cd /demo/frontend && npm install --no-audit --no-fund --package-lock=false)
6176
elif [ ! -x /app/frontend/node_modules/.bin/vite ]; then

examples/docker_fastapi_demo/frontend/package-lock.json

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

examples/docker_fastapi_demo/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"react": "^18.3.1",
1818
"react-admin": "^5.3.2",
1919
"react-dom": "^18.3.1",
20-
"safrs-jsonapi-client": "file:../vendor/safrs-jsonapi-client"
20+
"safrs-jsonapi-client": "https://codeload.github.com/thomaxxl/safrs-jsonapi-client/tar.gz/refs/heads/main"
2121
},
2222
"devDependencies": {
2323
"@playwright/test": "^1.58.2",

0 commit comments

Comments
 (0)