From 99a10970534c9010d974205ad70f59b9b9fb22a7 Mon Sep 17 00:00:00 2001 From: Theis Gaedigk Date: Wed, 8 Jul 2026 18:42:54 +0200 Subject: [PATCH] fix: cannot build prod and delete unused file --- backend/babel.config.json | 14 -------------- backend/package.json | 2 +- backend/scripts/copy-assets.cjs | 17 +++++++++++++++++ eslint.config.mjs | 12 ++++++++++-- package-lock.json | 3 ++- package.json | 3 ++- 6 files changed, 32 insertions(+), 19 deletions(-) delete mode 100644 backend/babel.config.json create mode 100644 backend/scripts/copy-assets.cjs diff --git a/backend/babel.config.json b/backend/babel.config.json deleted file mode 100644 index 6e8dc4f..0000000 --- a/backend/babel.config.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "node": "current" - }, - "modules": false - } - ], - "@babel/preset-typescript" - ] -} diff --git a/backend/package.json b/backend/package.json index 5fb4020..44415c8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -5,7 +5,7 @@ "main": "server.ts", "scripts": { "dev": "tsx --watch server.ts", - "build": "tsc -b", + "build": "tsc -b && node scripts/copy-assets.cjs", "start": "node dist/server.js" }, "keywords": [], diff --git a/backend/scripts/copy-assets.cjs b/backend/scripts/copy-assets.cjs new file mode 100644 index 0000000..29bf4c1 --- /dev/null +++ b/backend/scripts/copy-assets.cjs @@ -0,0 +1,17 @@ +// scripts/copy-assets.cjs +const fs = require("fs"); +const path = require("path"); + +const rootDir = path.join(__dirname, ".."); +const distDir = path.join(rootDir, "dist"); + +const sqlFiles = fs + .readdirSync(rootDir) + .filter((f) => f.endsWith(".scheme.sql")); + +for (const file of sqlFiles) { + const srcPath = path.join(rootDir, file); + const distPath = path.join(distDir, file); + fs.copyFileSync(srcPath, distPath); + console.log(`Copied ${srcPath} -> ${distPath}`); +} diff --git a/eslint.config.mjs b/eslint.config.mjs index e3254ff..6f22a6d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,5 +1,13 @@ import js from "@eslint/js"; +import globals from "globals"; export default [ - js.configs.recommended, -]; \ No newline at end of file + js.configs.recommended, + { + languageOptions: { + globals: { + ...globals.node, + }, + }, + }, +]; diff --git a/package-lock.json b/package-lock.json index 6763087..d66ad3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,8 @@ "@eslint/js": "^10.0.1", "@types/cors": "^2.8.19", "@types/express": "^5.0.6", - "concurrently": "^10.0.3" + "concurrently": "^10.0.3", + "globals": "^17.7.0" } }, "backend": { diff --git a/package.json b/package.json index ebf8c49..73b8d65 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@eslint/js": "^10.0.1", "@types/cors": "^2.8.19", "@types/express": "^5.0.6", - "concurrently": "^10.0.3" + "concurrently": "^10.0.3", + "globals": "^17.7.0" } }