mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 12:50:05 +01:00
feat: remove rollup options & improve clean up
This commit is contained in:
@@ -13,7 +13,7 @@ RUN npm i -g yarn pnpm
|
|||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN make swagger && make build
|
RUN make clean && make swagger && make ui && make build
|
||||||
|
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -3,6 +3,7 @@ GOINSTALL := $(GOCMD) install
|
|||||||
BIN ?= autoglue
|
BIN ?= autoglue
|
||||||
MAIN ?= main.go
|
MAIN ?= main.go
|
||||||
UI_DIR ?= ui
|
UI_DIR ?= ui
|
||||||
|
UI_DEST_DIR ?= internal/ui
|
||||||
|
|
||||||
SWAG := $(shell command -v swag 2>/dev/null)
|
SWAG := $(shell command -v swag 2>/dev/null)
|
||||||
GMU := $(shell command -v go-mod-upgrade 2>/dev/null)
|
GMU := $(shell command -v go-mod-upgrade 2>/dev/null)
|
||||||
@@ -68,7 +69,7 @@ build: prepare ui swagger
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo ">> Cleaning artifacts..."
|
@echo ">> Cleaning artifacts..."
|
||||||
@rm -rf $(BIN) docs/swagger.* docs/docs.go $(UI_DIR)/dist
|
@rm -rf $(BIN) docs/swagger.* docs/docs.go $(UI_DEST_DIR)/dist $(UI_DIR)/dist $(UI_DIR)/node_modules
|
||||||
|
|
||||||
dev: swagger
|
dev: swagger
|
||||||
@echo ">> Starting Vite (frontend) and Go API (backend)..."
|
@echo ">> Starting Vite (frontend) and Go API (backend)..."
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ services:
|
|||||||
- postgres:postgres
|
- postgres:postgres
|
||||||
env_file: .env
|
env_file: .env
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: postgres://$DB_USER:$DB_PASSWORD@postgres:5432/$DB_NAME
|
PGWEB_DATABASE_URL: postgres://$DB_USER:$DB_PASSWORD@postgres:5432/$DB_NAME
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
|
||||||
|
|||||||
7455
docs/docs.go
7455
docs/docs.go
File diff suppressed because it is too large
Load Diff
7433
docs/swagger.json
7433
docs/swagger.json
File diff suppressed because it is too large
Load Diff
4844
docs/swagger.yaml
4844
docs/swagger.yaml
File diff suppressed because it is too large
Load Diff
@@ -20,10 +20,8 @@ func NewRouter() http.Handler {
|
|||||||
|
|
||||||
r.Use(cors.Handler(cors.Options{
|
r.Use(cors.Handler(cors.Options{
|
||||||
AllowedOrigins: []string{
|
AllowedOrigins: []string{
|
||||||
"http://localhost:5173",
|
"http://*:5173",
|
||||||
"http://127.0.0.1:5173",
|
"http://*:8080",
|
||||||
"http://localhost:8080",
|
|
||||||
"http://127.0.0.1:8080",
|
|
||||||
},
|
},
|
||||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||||
AllowedHeaders: []string{"Content-Type", "content-type", "Authorization", "authorization", "X-Org-ID", "x-org-id"},
|
AllowedHeaders: []string{"Content-Type", "content-type", "Authorization", "authorization", "X-Org-ID", "x-org-id"},
|
||||||
|
|||||||
206
internal/ui/dist/assets/icons-B5E6SSBo.js
vendored
206
internal/ui/dist/assets/icons-B5E6SSBo.js
vendored
File diff suppressed because one or more lines are too long
1
internal/ui/dist/assets/index-CHoyJPs-.css
vendored
1
internal/ui/dist/assets/index-CHoyJPs-.css
vendored
File diff suppressed because one or more lines are too long
1
internal/ui/dist/assets/index-DSxuk_EI.js
vendored
1
internal/ui/dist/assets/index-DSxuk_EI.js
vendored
File diff suppressed because one or more lines are too long
11
internal/ui/dist/assets/radix-DRmH1vcw.js
vendored
11
internal/ui/dist/assets/radix-DRmH1vcw.js
vendored
File diff suppressed because one or more lines are too long
12
internal/ui/dist/assets/router-CANfZtzM.js
vendored
12
internal/ui/dist/assets/router-CANfZtzM.js
vendored
File diff suppressed because one or more lines are too long
106
internal/ui/dist/assets/vendor-DvippHRz.js
vendored
106
internal/ui/dist/assets/vendor-DvippHRz.js
vendored
File diff suppressed because one or more lines are too long
18
internal/ui/dist/index.html
vendored
18
internal/ui/dist/index.html
vendored
@@ -1,18 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>AutoGlue</title>
|
|
||||||
<script type="module" crossorigin src="/assets/index-DSxuk_EI.js"></script>
|
|
||||||
<link rel="modulepreload" crossorigin href="/assets/router-CANfZtzM.js">
|
|
||||||
<link rel="modulepreload" crossorigin href="/assets/vendor-DvippHRz.js">
|
|
||||||
<link rel="modulepreload" crossorigin href="/assets/radix-DRmH1vcw.js">
|
|
||||||
<link rel="modulepreload" crossorigin href="/assets/icons-B5E6SSBo.js">
|
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-CHoyJPs-.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="root"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
// NOTE: Vite outputs to ui/dist with assets in dist/assets.
|
// NOTE: Vite outputs to ui/dist with assets in dist/assets.
|
||||||
// If you add more nested folders in the future, include them here too.
|
// If you add more nested folders in the future, include them here too.
|
||||||
|
|
||||||
//go:embed dist/* dist/assets/*
|
//go:embed dist
|
||||||
var distFS embed.FS
|
var distFS embed.FS
|
||||||
|
|
||||||
// spaFileSystem serves embedded dist/ files with SPA fallback to index.html
|
// spaFileSystem serves embedded dist/ files with SPA fallback to index.html
|
||||||
@@ -37,7 +37,8 @@ func (s spaFileSystem) Open(name string) (fs.File, error) {
|
|||||||
// BUT only if it's not obviously a static asset extension
|
// BUT only if it's not obviously a static asset extension
|
||||||
ext := strings.ToLower(filepath.Ext(name))
|
ext := strings.ToLower(filepath.Ext(name))
|
||||||
switch ext {
|
switch ext {
|
||||||
case ".js", ".css", ".map", ".json", ".txt", ".ico", ".png", ".jpg", ".jpeg", ".svg", ".webp", ".gif", ".woff", ".woff2":
|
case ".js", ".css", ".map", ".json", ".txt", ".ico", ".png", ".jpg", ".jpeg",
|
||||||
|
".svg", ".webp", ".gif", ".woff", ".woff2", ".ttf", ".otf", ".eot", ".wasm":
|
||||||
return nil, fs.ErrNotExist
|
return nil, fs.ErrNotExist
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +90,14 @@ func SPAHandler() (http.Handler, error) {
|
|||||||
w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
|
w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info, _ := f.Stat()
|
||||||
|
modTime := time.Now()
|
||||||
|
if info != nil {
|
||||||
|
modTime = info.ModTime()
|
||||||
|
}
|
||||||
|
|
||||||
// Serve content
|
// Serve content
|
||||||
http.ServeContent(w, r, filePath, time.Now(), file{f})
|
http.ServeContent(w, r, filePath, modTime, file{f})
|
||||||
}), nil
|
}), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>AutoGlue</title>
|
<title>AutoGlue</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -34,21 +34,6 @@ export default defineConfig({
|
|||||||
chunkSizeWarningLimit: 1000,
|
chunkSizeWarningLimit: 1000,
|
||||||
outDir: "../internal/ui/dist",
|
outDir: "../internal/ui/dist",
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
rollupOptions: {
|
|
||||||
output: {
|
|
||||||
manualChunks(id) {
|
|
||||||
if (!id.includes("node_modules")) return
|
|
||||||
|
|
||||||
if (id.includes("react-router")) return "router"
|
|
||||||
if (id.includes("@radix-ui")) return "radix"
|
|
||||||
if (id.includes("lucide-react") || id.includes("react-icons")) return "icons"
|
|
||||||
if (id.includes("recharts") || id.includes("d3")) return "charts"
|
|
||||||
if (id.includes("date-fns") || id.includes("dayjs")) return "dates"
|
|
||||||
|
|
||||||
return "vendor"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
include: ["react", "react-dom", "react-router-dom"],
|
include: ["react", "react-dom", "react-router-dom"],
|
||||||
|
|||||||
Reference in New Issue
Block a user