diff --git a/flake.lock b/flake.lock index 243467a0d..ed36ceded 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1728492678, - "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "lastModified": 1729665710, + "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", "type": "github" }, "original": { diff --git a/package-lock.json b/package-lock.json index 1978d8449..cdfb564dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,6 +62,7 @@ "@types/i18next-node-fs-backend": "^2.1.2", "@types/json-bigint": "^1.0.1", "@types/jsonwebtoken": "^9.0.2", + "@types/module-alias": "^2.0.4", "@types/morgan": "^1.9.4", "@types/multer": "^1.4.7", "@types/murmurhash-js": "^1.0.4", @@ -3051,6 +3052,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/module-alias": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/module-alias/-/module-alias-2.0.4.tgz", + "integrity": "sha512-5+G/QXO/DvHZw60FjvbDzO4JmlD/nG5m2/vVGt25VN1eeP3w2bCoks1Wa7VuptMPM1TxJdx6RjO70N9Fw0nZPA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/morgan": { "version": "1.9.9", "resolved": "https://registry.npmjs.org/@types/morgan/-/morgan-1.9.9.tgz", @@ -3089,12 +3097,12 @@ } }, "node_modules/@types/node": { - "version": "22.7.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", - "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "version": "22.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.0.tgz", + "integrity": "sha512-84rafSBHC/z1i1E3p0cJwKA+CfYDNSXX9WSZBRopjIzLET8oNt6ht2tei4C7izwDeEiLLfdeSVBv1egOH916hg==", "license": "MIT", "dependencies": { - "undici-types": "~6.19.2" + "undici-types": "~6.19.8" } }, "node_modules/@types/node-fetch": { diff --git a/package.json b/package.json index 1e7b2047c..42e729f51 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@types/i18next-node-fs-backend": "^2.1.2", "@types/json-bigint": "^1.0.1", "@types/jsonwebtoken": "^9.0.2", + "@types/module-alias": "^2.0.4", "@types/morgan": "^1.9.4", "@types/multer": "^1.4.7", "@types/murmurhash-js": "^1.0.4", diff --git a/scripts/test-non-cwd-exec.sh b/scripts/test-non-cwd-exec.sh new file mode 100755 index 000000000..7d33c46f8 --- /dev/null +++ b/scripts/test-non-cwd-exec.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i "bash -x" -p bash jq git nodejs +npm i +npm run setup || exit 1 + +export OWD="$PWD" +export NWD="`mktemp -d`" +echo "Src dir: $OWD" +echo "Exec dir: $NWD" + +#NODE_PATH="$OWD/dist" +node "$OWD/dist/api/start.js" \ No newline at end of file diff --git a/src/api/start.ts b/src/api/start.ts index 088c6f8de..4a3f858eb 100644 --- a/src/api/start.ts +++ b/src/api/start.ts @@ -16,7 +16,8 @@ along with this program. If not, see . */ -require("module-alias/register"); +import moduleAlias from "module-alias"; +moduleAlias(__dirname + "../../../package.json"); process.on("uncaughtException", console.error); process.on("unhandledRejection", console.error); diff --git a/src/bundle/start.ts b/src/bundle/start.ts index df50fd4ca..fe177cbc7 100644 --- a/src/bundle/start.ts +++ b/src/bundle/start.ts @@ -17,7 +17,9 @@ */ // process.env.MONGOMS_DEBUG = "true"; -require("module-alias/register"); +import moduleAlias from "module-alias"; +moduleAlias(__dirname + "../../../package.json"); + import "reflect-metadata"; import cluster, { Worker } from "cluster"; import os from "os"; diff --git a/src/cdn/start.ts b/src/cdn/start.ts index d793077d2..21da69e9f 100644 --- a/src/cdn/start.ts +++ b/src/cdn/start.ts @@ -16,7 +16,8 @@ along with this program. If not, see . */ -require("module-alias/register"); +import moduleAlias from "module-alias"; +moduleAlias(__dirname + "../../../package.json"); import "dotenv/config"; import { CDNServer } from "./Server"; diff --git a/src/gateway/start.ts b/src/gateway/start.ts index 8af96c130..b04048e1b 100644 --- a/src/gateway/start.ts +++ b/src/gateway/start.ts @@ -16,7 +16,8 @@ along with this program. If not, see . */ -require("module-alias/register"); +import moduleAlias from "module-alias"; +moduleAlias(__dirname + "../../../package.json"); process.on("uncaughtException", console.error); process.on("unhandledRejection", console.error);