1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-05 02:12:28 +01:00

Fix module resolution when $CWD != .

This commit is contained in:
Emma [it/its]@Rory& 2024-10-25 18:57:29 +02:00 committed by Rory&
parent 168758924c
commit 2feb90475e
8 changed files with 37 additions and 11 deletions

View File

@ -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": {

16
package-lock.json generated
View File

@ -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": {

View File

@ -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",

12
scripts/test-non-cwd-exec.sh Executable file
View File

@ -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"

View File

@ -16,7 +16,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
require("module-alias/register");
import moduleAlias from "module-alias";
moduleAlias(__dirname + "../../../package.json");
process.on("uncaughtException", console.error);
process.on("unhandledRejection", console.error);

View File

@ -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";

View File

@ -16,7 +16,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
require("module-alias/register");
import moduleAlias from "module-alias";
moduleAlias(__dirname + "../../../package.json");
import "dotenv/config";
import { CDNServer } from "./Server";

View File

@ -16,7 +16,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
require("module-alias/register");
import moduleAlias from "module-alias";
moduleAlias(__dirname + "../../../package.json");
process.on("uncaughtException", console.error);
process.on("unhandledRejection", console.error);