Attempt to integrate Mantine UI into npm workspaces + Prometheus binary

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2024-02-21 11:14:35 +01:00
parent d6a347e5de
commit cc38c1426a
5 changed files with 2178 additions and 9914 deletions

View file

@ -30,10 +30,10 @@ function buildModule() {
}
function buildReactApp() {
echo "build react-app"
npm run build -w @prometheus-io/app
echo "build mantine-ui"
npm run build -w @prometheus-io/mantine-ui
rm -rf ./static/react
mv ./react-app/build ./static/react
mv ./mantine-ui/dist ./static/react
}
for i in "$@"; do

View file

@ -1,5 +1,5 @@
{
"name": "mantine-ui",
"name": "@prometheus-io/mantine-ui",
"private": true,
"version": "0.0.0",
"type": "module",

12071
web/ui/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,18 +4,19 @@
"scripts": {
"build": "GENERATE_SOURCEMAP=false bash build_ui.sh --all",
"build:module": "bash build_ui.sh --build-module",
"start": "npm run start -w react-app",
"start": "npm run start -w mantine-ui",
"test": "npm run test --workspaces",
"lint": "npm run lint --workspaces"
},
"workspaces": [
"react-app",
"mantine-ui",
"module/*"
],
"engines": {
"npm": ">=7.0.0"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.4",
"eslint-config-prettier": "^8.10.0",
@ -24,9 +25,9 @@
"jest-canvas-mock": "^2.5.2",
"jest-fetch-mock": "^3.0.3",
"prettier": "^2.8.8",
"react-scripts": "^5.0.1",
"rollup": "^4.12.0",
"ts-jest": "^29.1.1",
"typescript": "^4.9.5"
"typescript": "^5.3.3"
},
"version": "0.49.1"
}

View file

@ -436,8 +436,8 @@ func New(logger log.Logger, o *Options) *Handler {
}
// Static files required by the React app.
router.Get("/static/*filepath", func(w http.ResponseWriter, r *http.Request) {
r.URL.Path = path.Join("/static/react/static", route.Param(r.Context(), "filepath"))
router.Get("/assets/*filepath", func(w http.ResponseWriter, r *http.Request) {
r.URL.Path = path.Join("/static/react/assets", route.Param(r.Context(), "filepath"))
fs := server.StaticFileServer(ui.Assets)
fs.ServeHTTP(w, r)
})