mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-06 04:51:44 -07:00
fix: locales serving
This commit is contained in:
parent
2b79e9dd80
commit
94581a8999
6 changed files with 41 additions and 7 deletions
|
@ -51,6 +51,10 @@ if (
|
||||||
["/app", "/app/*"],
|
["/app", "/app/*"],
|
||||||
express.static(path.join(__dirname, "..", "frontend", "build"))
|
express.static(path.join(__dirname, "..", "frontend", "build"))
|
||||||
);
|
);
|
||||||
|
app.use(
|
||||||
|
["/locales", "/locales/*"],
|
||||||
|
express.static(path.join(__dirname, "..", "frontend", "build", "locales"))
|
||||||
|
);
|
||||||
app.get(["/app/network/*"], function (req, res) {
|
app.get(["/app/network/*"], function (req, res) {
|
||||||
res.sendFile(path.join(__dirname, "..", "frontend", "build", "index.html"));
|
res.sendFile(path.join(__dirname, "..", "frontend", "build", "index.html"));
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,7 +41,8 @@
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^5.0.5",
|
||||||
"source-map-explorer": "^2.5.3",
|
"source-map-explorer": "^2.5.3",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"vite": "^4.4.11"
|
"vite": "^4.4.11",
|
||||||
|
"vite-plugin-static-copy": "^1.0.6"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vite",
|
"start": "vite",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as url from "url";
|
||||||
|
|
||||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||||
|
|
||||||
export default function GenerateLocalesPlugin() {
|
export default function generateLocalesPlugin() {
|
||||||
return {
|
return {
|
||||||
name: "generate-locales",
|
name: "generate-locales",
|
||||||
buildStart() {
|
buildStart() {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import process from "node:process";
|
import process from "node:process";
|
||||||
import { defineConfig, searchForWorkspaceRoot } from "vite";
|
import { defineConfig, searchForWorkspaceRoot } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import GenerateLocalesPlugin from "./vite-plugin-generate-locales.js";
|
import { viteStaticCopy } from "vite-plugin-static-copy";
|
||||||
|
import generateLocalesPlugin from "./vite-plugin-generate-locales.js";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: "/app",
|
base: "/app",
|
||||||
|
@ -29,5 +30,16 @@ export default defineConfig({
|
||||||
outDir: "build",
|
outDir: "build",
|
||||||
chunkSizeWarningLimit: 1000,
|
chunkSizeWarningLimit: 1000,
|
||||||
},
|
},
|
||||||
plugins: [react(), GenerateLocalesPlugin()],
|
plugins: [
|
||||||
|
react(),
|
||||||
|
generateLocalesPlugin(),
|
||||||
|
viteStaticCopy({
|
||||||
|
targets: [
|
||||||
|
{
|
||||||
|
src: "public/locales",
|
||||||
|
dest: "",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
});
|
});
|
|
@ -16,6 +16,8 @@
|
||||||
"dev": "concurrently \"cd frontend && cross-env FAST_REFRESH=true yarn start\" \"cd backend && cross-env NODE_ENV=development ZU_DEFAULT_USERNAME=admin ZU_DEFAULT_PASSWORD=zero-ui nodemon ./bin/www --ignore data/db.json\"",
|
"dev": "concurrently \"cd frontend && cross-env FAST_REFRESH=true yarn start\" \"cd backend && cross-env NODE_ENV=development ZU_DEFAULT_USERNAME=admin ZU_DEFAULT_PASSWORD=zero-ui nodemon ./bin/www --ignore data/db.json\"",
|
||||||
"build": "cd frontend && cross-env GENERATE_SOURCEMAP=false yarn build",
|
"build": "cd frontend && cross-env GENERATE_SOURCEMAP=false yarn build",
|
||||||
"prod": "cd backend && cross-env NODE_ENV=production ZU_SECURE_HEADERS=false yarn start",
|
"prod": "cd backend && cross-env NODE_ENV=production ZU_SECURE_HEADERS=false yarn start",
|
||||||
|
"docker:build": "docker build . -t dec0dos/zero-ui -f docker/zero-ui/Dockerfile --progress=plain",
|
||||||
|
"docker:run": "docker run --rm --env-file .env -e ZU_CONTROLLER_ENDPOINT=http://host.docker.internal:9993 -p 4000:4000 --name zero-ui dec0dos/zero-ui",
|
||||||
"release": "standard-version && git push --follow-tags origin main && git add CHANGELOG.md",
|
"release": "standard-version && git push --follow-tags origin main && git add CHANGELOG.md",
|
||||||
"commit": "yarn git-cz"
|
"commit": "yarn git-cz"
|
||||||
},
|
},
|
||||||
|
|
21
yarn.lock
21
yarn.lock
|
@ -2376,7 +2376,7 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"chokidar@npm:^3.5.2":
|
"chokidar@npm:^3.5.2, chokidar@npm:^3.5.3":
|
||||||
version: 3.6.0
|
version: 3.6.0
|
||||||
resolution: "chokidar@npm:3.6.0"
|
resolution: "chokidar@npm:3.6.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -4246,7 +4246,7 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"fast-glob@npm:^3.2.9":
|
"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.9":
|
||||||
version: 3.3.2
|
version: 3.3.2
|
||||||
resolution: "fast-glob@npm:3.3.2"
|
resolution: "fast-glob@npm:3.3.2"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -4535,6 +4535,7 @@ __metadata:
|
||||||
styled-components: "npm:^5.3.11"
|
styled-components: "npm:^5.3.11"
|
||||||
typescript: "npm:^5.2.2"
|
typescript: "npm:^5.2.2"
|
||||||
vite: "npm:^4.4.11"
|
vite: "npm:^4.4.11"
|
||||||
|
vite-plugin-static-copy: "npm:^1.0.6"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
@ -4550,7 +4551,7 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"fs-extra@npm:^11.0.0":
|
"fs-extra@npm:^11.0.0, fs-extra@npm:^11.1.0":
|
||||||
version: 11.2.0
|
version: 11.2.0
|
||||||
resolution: "fs-extra@npm:11.2.0"
|
resolution: "fs-extra@npm:11.2.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -9344,6 +9345,20 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"vite-plugin-static-copy@npm:^1.0.6":
|
||||||
|
version: 1.0.6
|
||||||
|
resolution: "vite-plugin-static-copy@npm:1.0.6"
|
||||||
|
dependencies:
|
||||||
|
chokidar: "npm:^3.5.3"
|
||||||
|
fast-glob: "npm:^3.2.11"
|
||||||
|
fs-extra: "npm:^11.1.0"
|
||||||
|
picocolors: "npm:^1.0.0"
|
||||||
|
peerDependencies:
|
||||||
|
vite: ^5.0.0
|
||||||
|
checksum: 10c0/997114571bd429481974483465ab78d1ecd5fc48d2de06cbfe9dbf005f9b870aa072b0d9c22e2fd8def759db2c48ad662a6a0cdf47706fba409c82db7c03ed22
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"vite@npm:^4.4.11":
|
"vite@npm:^4.4.11":
|
||||||
version: 4.5.3
|
version: 4.5.3
|
||||||
resolution: "vite@npm:4.5.3"
|
resolution: "vite@npm:4.5.3"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue