Skip to content

Commit 1496056

Browse files
committed
Try something radical
1 parent bacacc0 commit 1496056

File tree

4 files changed

+44
-10
lines changed

4 files changed

+44
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "NitroBolt Experiments",
55
"scripts": {
66
"start": "rspack serve --config rspack.config.cjs",
7-
"build": "rspack build --config rspack.config.cjs",
7+
"build": "rspack build --config rspack.config.cjs && node scripts/copy-static-subfolders.cjs",
88
"preview": "rspack serve --config rspack.config.cjs --mode production",
99
"format": "prettier . --write"
1010
},

rspack.config.cjs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ module.exports = {
4848
new rspack.HtmlRspackPlugin({
4949
template: path.resolve(__dirname, "static/index.html"),
5050
}),
51-
new rspack.CopyRspackPlugin({
52-
patterns: [
53-
{
54-
from: path.resolve(__dirname, "static/favicon.ico"),
55-
to: "favicon.ico",
56-
},
57-
],
58-
}),
5951
],
6052
devServer: {
6153
port: 2142,

scripts/copy-static-subfolders.cjs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const fs = require("fs");
2+
const path = require("path");
3+
4+
const rootDir = path.resolve(__dirname, "..");
5+
const staticDir = path.resolve(rootDir, "static");
6+
const buildDir = path.resolve(rootDir, "build");
7+
8+
const ensureDirectory = (dirPath) => {
9+
fs.mkdirSync(dirPath, { recursive: true });
10+
};
11+
12+
const copyRecursive = (sourcePath, destinationPath) => {
13+
const stat = fs.statSync(sourcePath);
14+
15+
if (stat.isDirectory()) {
16+
ensureDirectory(destinationPath);
17+
for (const entry of fs.readdirSync(sourcePath)) {
18+
copyRecursive(
19+
path.resolve(sourcePath, entry),
20+
path.resolve(destinationPath, entry)
21+
);
22+
}
23+
return;
24+
}
25+
26+
ensureDirectory(path.dirname(destinationPath));
27+
fs.copyFileSync(sourcePath, destinationPath);
28+
};
29+
30+
if (!fs.existsSync(staticDir) || !fs.existsSync(buildDir)) {
31+
process.exit(0);
32+
}
33+
34+
for (const entry of fs.readdirSync(staticDir)) {
35+
if (entry === "index.html") {
36+
continue;
37+
}
38+
39+
const sourcePath = path.resolve(staticDir, entry);
40+
const destinationPath = path.resolve(buildDir, entry);
41+
copyRecursive(sourcePath, destinationPath);
42+
}

src/components/experiment-card/experiment-card.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import "./experiment-card.css";
22

33
const ExperimentCard = ({ path, name, description, status }) => {
4-
const href = path ? `/${path}` : "#";
4+
const href = path ? `/${path}/` : "#";
55
const statusClass = status.toLowerCase().replace(/\s+/g, "-");
66

77
return (

0 commit comments

Comments
 (0)