Skip to content

Commit

Permalink
fix: npm run build && npm run start (again) (spaceninjaserver#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan authored Jun 2, 2024
1 parent 41f4065 commit 259822d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"start": "node --import ./build/src/pathman.js build/src/index.js",
"dev": "ts-node-dev --openssl-legacy-provider -r tsconfig-paths/register src/index.ts ",
"build": "tsc && copyfiles static/webui/* build",
"build": "tsc && copyfiles static/webui/** build",
"lint": "eslint --ext .ts .",
"lint:fix": "eslint --fix --ext .ts .",
"prettier": "prettier --write ."
Expand Down
5 changes: 3 additions & 2 deletions src/routes/webui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from "path";

const webuiRouter = express.Router();
const rootDir = path.join(__dirname, "../..");
const repoDir = path.basename(rootDir) == "build" ? path.join(rootDir, "..") : rootDir;

// Redirect / to /webui/
webuiRouter.get("/", (_req, res) => {
Expand Down Expand Up @@ -35,10 +36,10 @@ webuiRouter.get("/favicon.ico", (_req, res) => {

// Serve warframe-riven-info
webuiRouter.get("/webui/riven-tool/", (_req, res) => {
res.sendFile(path.join(rootDir, "node_modules/warframe-riven-info/index.html"));
res.sendFile(path.join(repoDir, "node_modules/warframe-riven-info/index.html"));
});
webuiRouter.get("/webui/riven-tool/RivenParser.js", (_req, res) => {
res.sendFile(path.join(rootDir, "node_modules/warframe-riven-info/RivenParser.js"));
res.sendFile(path.join(repoDir, "node_modules/warframe-riven-info/RivenParser.js"));
});

export { webuiRouter };

0 comments on commit 259822d

Please sign in to comment.