fix: backend won't start
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"@babel/preset-env",
|
||||||
|
{
|
||||||
|
"targets": {
|
||||||
|
"node": "current"
|
||||||
|
},
|
||||||
|
"modules": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@babel/preset-typescript"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -5,8 +5,9 @@
|
|||||||
"main": "server.ts",
|
"main": "server.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"start": "node server.ts",
|
"start": "node dist/server.js",
|
||||||
"dev": "node --watch server.ts"
|
"dev": "tsx --watch server.ts",
|
||||||
|
"build": "babel server.ts routes services --extensions .ts --out-dir dist --copy-files"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
@@ -22,7 +23,12 @@
|
|||||||
"mysql2": "^3.16.0"
|
"mysql2": "^3.16.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/cli": "^8.0.1",
|
||||||
|
"@babel/core": "^8.0.1",
|
||||||
|
"@babel/preset-env": "^8.0.2",
|
||||||
|
"@babel/preset-typescript": "^8.0.1",
|
||||||
"@types/express": "^5.0.6",
|
"@types/express": "^5.0.6",
|
||||||
"@types/node": "^26.1.0"
|
"@types/node": "^26.1.0",
|
||||||
|
"tsx": "^4.23.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import dotenv from "dotenv";
|
import dotenv from "dotenv";
|
||||||
import {authenticate, generateToken} from "../../services/tokenService.js";
|
import {authenticate, generateToken} from "../../services/tokenService.ts";
|
||||||
import {changePassword, findUser, getSettings, loginUser, updateSettings,} from "./database/users.database.ts";
|
import {changePassword, findUser, getSettings, loginUser, updateSettings,} from "./database/users.database.ts";
|
||||||
import {GENERAL_ERROR_CODE, USER_ERROR_CODE} from "@stockhome/shared";
|
import {GENERAL_ERROR_CODE, USER_ERROR_CODE} from "@stockhome/shared";
|
||||||
|
|
||||||
|
|||||||
+8
-11
@@ -1,7 +1,7 @@
|
|||||||
import {defineConfig} from 'vite'
|
import {defineConfig} from 'vite'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import {dirname} from "node:path";
|
import {dirname} from "node:path"
|
||||||
import {fileURLToPath} from "node:url";
|
import {fileURLToPath} from "node:url"
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = dirname(__filename);
|
const __dirname = dirname(__filename);
|
||||||
@@ -12,21 +12,18 @@ export default defineConfig({
|
|||||||
outDir: '../dist',
|
outDir: '../dist',
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
minify: 'esbuild', // Use esbuild for minification (default)
|
minify: 'esbuild',
|
||||||
assetsDir: 'assets',
|
assetsDir: 'assets',
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: path.resolve(__dirname, 'src/index.html'),
|
input: path.resolve(__dirname, 'src/index.html'),
|
||||||
output: {
|
output: {
|
||||||
assetFileNames: 'assets/[name]-[hash][extname]' // Hashing for cache busting
|
assetFileNames: 'assets/[name]-[hash][extname]',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.resolve(__dirname, 'src'), // Optional alias for cleaner imports
|
'@': path.resolve(__dirname, 'src'),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
define: {
|
|
||||||
'process.env.NODE_ENV': '"production"' // Inject environment variables
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
Generated
+2183
-315
File diff suppressed because it is too large
Load Diff
+6
-4
@@ -7,15 +7,14 @@
|
|||||||
"shared"
|
"shared"
|
||||||
],
|
],
|
||||||
"version": "0.1.0-dev",
|
"version": "0.1.0-dev",
|
||||||
"description": "       [](#)     ",
|
"description": "",
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:frontend": "npm run dev --workspace=frontend",
|
"dev:frontend": "npm run dev --workspace=frontend",
|
||||||
"dev:backend": "npm run dev --workspace=backend",
|
"dev:backend": "npm run dev --workspace=backend",
|
||||||
"dev:docker": "docker compose -f docker-compose.dev.yml up -d --wait",
|
"dev:docker": "docker compose -f docker-compose.dev.yml up -d --wait",
|
||||||
"dev": "npm run dev:docker && concurrently --kill-others \"npm:dev:frontend\" \"npm:dev:backend\"",
|
"dev": "npm run dev:docker && concurrently --kill-others \"npm:dev:frontend\" \"npm:dev:backend\"",
|
||||||
"dev:stop": "docker compose -f docker-compose.dev.yml down",
|
"dev:stop": "docker compose -f docker-compose.dev.yml down",
|
||||||
"buildProd": ""
|
"buildProd": "npm run build --workspace=frontend && npm run build --workspace=backend"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -24,7 +23,10 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"type": "commonjs",
|
"type": "module",
|
||||||
|
"overrides": {
|
||||||
|
"@babel/core": "^7.26.0"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
"@types/cors": "^2.8.19",
|
"@types/cors": "^2.8.19",
|
||||||
|
|||||||
+18
-9
@@ -4,13 +4,9 @@
|
|||||||
// File Layout
|
// File Layout
|
||||||
// "rootDir": "./src",
|
// "rootDir": "./src",
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
|
|
||||||
// Environment Settings
|
// Environment Settings
|
||||||
// See also https://aka.ms/tsconfig/module
|
// See also https://aka.ms/tsconfig/module
|
||||||
"module": "esnext",
|
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"types": [],
|
"types": [],
|
||||||
// For nodejs:
|
// For nodejs:
|
||||||
// "lib": ["esnext"],
|
// "lib": ["esnext"],
|
||||||
@@ -21,11 +17,9 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
|
|
||||||
// Stricter Typechecking Options
|
// Stricter Typechecking Options
|
||||||
"noUncheckedIndexedAccess": true,
|
"noUncheckedIndexedAccess": true,
|
||||||
"exactOptionalPropertyTypes": true,
|
"exactOptionalPropertyTypes": true,
|
||||||
|
|
||||||
// Style Options
|
// Style Options
|
||||||
// "noImplicitReturns": true,
|
// "noImplicitReturns": true,
|
||||||
// "noImplicitOverride": true,
|
// "noImplicitOverride": true,
|
||||||
@@ -35,12 +29,27 @@
|
|||||||
// "noPropertyAccessFromIndexSignature": true,
|
// "noPropertyAccessFromIndexSignature": true,
|
||||||
|
|
||||||
// Recommended Options
|
// Recommended Options
|
||||||
"strict": true,
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": true,
|
||||||
"isolatedModules": true,
|
|
||||||
"noUncheckedSideEffectImports": true,
|
"noUncheckedSideEffectImports": true,
|
||||||
"moduleDetection": "force",
|
"moduleDetection": "force",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"strict": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noUnusedLocals": false,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"incremental": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user