mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2024-09-20 06:56:05 +08:00
fix: locales serving
This commit is contained in:
parent
2b79e9dd80
commit
94581a8999
|
@ -51,6 +51,10 @@ if (
|
|||
["/app", "/app/*"],
|
||||
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) {
|
||||
res.sendFile(path.join(__dirname, "..", "frontend", "build", "index.html"));
|
||||
});
|
||||
|
|
|
@ -41,7 +41,8 @@
|
|||
"rimraf": "^5.0.5",
|
||||
"source-map-explorer": "^2.5.3",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^4.4.11"
|
||||
"vite": "^4.4.11",
|
||||
"vite-plugin-static-copy": "^1.0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as url from "url";
|
|||
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
export default function GenerateLocalesPlugin() {
|
||||
export default function generateLocalesPlugin() {
|
||||
return {
|
||||
name: "generate-locales",
|
||||
buildStart() {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import process from "node:process";
|
||||
import { defineConfig, searchForWorkspaceRoot } from "vite";
|
||||
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({
|
||||
base: "/app",
|
||||
|
@ -29,5 +30,16 @@ export default defineConfig({
|
|||
outDir: "build",
|
||||
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\"",
|
||||
"build": "cd frontend && cross-env GENERATE_SOURCEMAP=false yarn build",
|
||||
"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",
|
||||
"commit": "yarn git-cz"
|
||||
},
|
||||
|
|
21
yarn.lock
21
yarn.lock
|
@ -2376,7 +2376,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"chokidar@npm:^3.5.2":
|
||||
"chokidar@npm:^3.5.2, chokidar@npm:^3.5.3":
|
||||
version: 3.6.0
|
||||
resolution: "chokidar@npm:3.6.0"
|
||||
dependencies:
|
||||
|
@ -4246,7 +4246,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-glob@npm:^3.2.9":
|
||||
"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.9":
|
||||
version: 3.3.2
|
||||
resolution: "fast-glob@npm:3.3.2"
|
||||
dependencies:
|
||||
|
@ -4535,6 +4535,7 @@ __metadata:
|
|||
styled-components: "npm:^5.3.11"
|
||||
typescript: "npm:^5.2.2"
|
||||
vite: "npm:^4.4.11"
|
||||
vite-plugin-static-copy: "npm:^1.0.6"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
|
@ -4550,7 +4551,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fs-extra@npm:^11.0.0":
|
||||
"fs-extra@npm:^11.0.0, fs-extra@npm:^11.1.0":
|
||||
version: 11.2.0
|
||||
resolution: "fs-extra@npm:11.2.0"
|
||||
dependencies:
|
||||
|
@ -9344,6 +9345,20 @@ __metadata:
|
|||
languageName: node
|
||||
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":
|
||||
version: 4.5.3
|
||||
resolution: "vite@npm:4.5.3"
|
||||
|
|
Loading…
Reference in a new issue