Skip to content

Commit 3e25bb3

Browse files
committed
ignore public copy
1 parent af6f7a2 commit 3e25bb3

3 files changed

Lines changed: 122 additions & 1 deletion

File tree

package-lock.json

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

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"@types/chroma-js": "^2.4.4",
5252
"@types/classnames": "^2.3.4",
5353
"@types/file-saver": "^2.0.7",
54+
"@types/fs-extra": "^11.0.4",
5455
"@types/lodash": "^4.17.13",
5556
"@types/node": "^22.10.1",
5657
"@types/react": "^18.3.12",
@@ -65,6 +66,7 @@
6566
"eslint": "^9.15.0",
6667
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
6768
"eslint-plugin-react-refresh": "^0.4.14",
69+
"fs-extra": "^11.3.0",
6870
"globals": "^15.12.0",
6971
"nodemon": "^3.0.0",
7072
"playwright": "^1.49.0",

vite.config.mts

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
11
import react from "@vitejs/plugin-react-swc";
22
import { defineConfig } from "vite";
3+
import { resolve } from 'path';
4+
import fs from 'fs-extra';
5+
6+
// Custom plugin to copy specific files from public
7+
const copySpecificFiles = () => ({
8+
name: 'copy-specific-files',
9+
closeBundle: async () => {
10+
const filesToCopy = [
11+
'manifest.json',
12+
'robots.txt',
13+
'logo.svg',
14+
'deepgit_logo.png',
15+
'dxl_logo.png',
16+
'ossci_logo.jpg'
17+
];
18+
19+
for (const file of filesToCopy) {
20+
const sourcePath = resolve(__dirname, 'public', file);
21+
const targetPath = resolve(__dirname, 'dist', file);
22+
if (fs.existsSync(sourcePath)) {
23+
await fs.copy(sourcePath, targetPath);
24+
}
25+
}
26+
}
27+
});
328

429
console.log(`Building DeepGit with BASE_PATH="${process.env.BASE_PATH || "/"}"`);
530

631
export default defineConfig({
732
base: process.env.BASE_PATH || "/",
8-
plugins: [react()],
33+
plugins: [
34+
react(),
35+
copySpecificFiles()
36+
],
937
server: {
1038
host: "0.0.0.0",
1139
port: process.env.PORT ? parseInt(process.env.PORT) : 5173,
@@ -17,5 +45,18 @@ export default defineConfig({
1745
port: process.env.PORT ? parseInt(process.env.PORT) : 5173,
1846
allowedHosts: ["deepgit.onrender.com"]
1947
},
48+
// Disable automatic public directory copying
49+
publicDir: false,
50+
// Manually copy only specific files from public
51+
build: {
52+
rollupOptions: {
53+
input: {
54+
main: resolve(__dirname, 'index.html'),
55+
},
56+
},
57+
// Copy only specific files from public
58+
copyPublicDir: true,
59+
assetsInlineLimit: 0,
60+
},
2061
});
2162

0 commit comments

Comments
 (0)