fix bundle

This commit is contained in:
Flam3rboy 2021-08-29 16:58:53 +02:00
parent be238a89b9
commit c3a1740c76
6 changed files with 43 additions and 70 deletions

BIN
bundle/database.db Normal file

Binary file not shown.

View File

@ -63,19 +63,21 @@
"i18next-http-middleware": "^3.1.3",
"i18next-node-fs-backend": "^2.1.3",
"jsonwebtoken": "^8.5.1",
"lambert-server": "^1.2.8",
"missing-native-js-functions": "^1.2.10",
"lambert-server": "^1.2.10",
"missing-native-js-functions": "^1.2.11",
"mongoose": "^5.12.3",
"mongoose-autopopulate": "^0.12.3",
"mongoose-long": "^0.3.2",
"multer": "^1.4.2",
"node-fetch": "^2.6.1"
"node-fetch": "^2.6.1",
"typeorm": "^0.2.37"
},
"devDependencies": {
"@types/amqplib": "^0.8.1",
"@types/bcrypt": "^5.0.0",
"@types/express": "^4.17.9",
"@types/i18next-node-fs-backend": "^2.1.0",
"@types/jest": "^27.0.1",
"@types/jsonwebtoken": "^8.5.0",
"@types/mongodb": "^3.6.9",
"@types/mongoose": "^5.10.5",
@ -111,11 +113,13 @@
"file-type": "^16.5.0",
"fs-extra": "^10.0.0",
"image-size": "^1.0.0",
"jest": "^27.0.6",
"lambert-db": "^1.2.3",
"lambert-server": "^1.2.8",
"missing-native-js-functions": "^1.2.10",
"multer": "^1.4.2",
"node-fetch": "^2.6.1",
"supertest": "^6.1.6",
"typescript": "^4.1.2",
"uuid": "^8.3.2"
},
@ -173,26 +177,30 @@
"hasInstallScript": true,
"license": "GPLV3",
"dependencies": {
"ajv": "^8.5.0",
"ajv": "^8.6.2",
"amqplib": "^0.8.0",
"class-validator": "^0.13.1",
"dot-prop": "^6.0.1",
"env-paths": "^2.2.1",
"jsonwebtoken": "^8.5.1",
"missing-native-js-functions": "^1.2.10",
"mongodb": "^3.6.9",
"mongoose": "^5.13.7",
"mongoose-autopopulate": "^0.12.3",
"lambert-server": "^1.2.10",
"missing-native-js-functions": "^1.2.11",
"node-fetch": "^2.6.1",
"typescript": "^4.1.3"
"patch-package": "^6.4.7",
"pg": "^8.7.1",
"reflect-metadata": "^0.1.13",
"sqlite3": "^5.0.2",
"typeorm": "^0.2.37",
"typescript": "^4.3.5",
"typescript-json-schema": "^0.50.1"
},
"devDependencies": {
"@types/amqplib": "^0.8.1",
"@types/jsonwebtoken": "^8.5.0",
"@types/mongodb": "^3.6.9",
"@types/mongoose-autopopulate": "^0.10.1",
"@types/mongoose-lean-virtuals": "^0.5.1",
"@types/node": "^14.17.9",
"@types/node-fetch": "^2.5.12"
"@types/node-fetch": "^2.5.12",
"jest": "^27.0.6"
}
},
"node_modules/@babel/runtime": {
@ -1868,6 +1876,7 @@
"@types/bcrypt": "^5.0.0",
"@types/express": "^4.17.9",
"@types/i18next-node-fs-backend": "^2.1.0",
"@types/jest": "^27.0.1",
"@types/jsonwebtoken": "^8.5.0",
"@types/mongodb": "^3.6.9",
"@types/mongoose": "^5.10.5",
@ -1899,8 +1908,8 @@
"image-size": "^1.0.0",
"jest": "^26.6.3",
"jsonwebtoken": "^8.5.1",
"lambert-server": "^1.2.8",
"missing-native-js-functions": "^1.2.10",
"lambert-server": "^1.2.10",
"missing-native-js-functions": "^1.2.11",
"mongoose": "^5.12.3",
"mongoose-autopopulate": "^0.12.3",
"mongoose-long": "^0.3.2",
@ -1909,6 +1918,7 @@
"saslprep": "^1.0.3",
"ts-node": "^9.1.1",
"ts-node-dev": "^1.1.6",
"typeorm": "^0.2.37",
"typescript": "^4.1.2"
}
},
@ -1940,11 +1950,13 @@
"file-type": "^16.5.0",
"fs-extra": "^10.0.0",
"image-size": "^1.0.0",
"jest": "^27.0.6",
"lambert-db": "^1.2.3",
"lambert-server": "^1.2.8",
"missing-native-js-functions": "^1.2.10",
"multer": "^1.4.2",
"node-fetch": "^2.6.1",
"supertest": "^6.1.6",
"typescript": "^4.1.2",
"uuid": "^8.3.2"
}
@ -1981,22 +1993,26 @@
"requires": {
"@types/amqplib": "^0.8.1",
"@types/jsonwebtoken": "^8.5.0",
"@types/mongodb": "^3.6.9",
"@types/mongoose-autopopulate": "^0.10.1",
"@types/mongoose-lean-virtuals": "^0.5.1",
"@types/node": "^14.17.9",
"@types/node-fetch": "^2.5.12",
"ajv": "^8.5.0",
"ajv": "^8.6.2",
"amqplib": "^0.8.0",
"class-validator": "^0.13.1",
"dot-prop": "^6.0.1",
"env-paths": "^2.2.1",
"jest": "^27.0.6",
"jsonwebtoken": "^8.5.1",
"missing-native-js-functions": "^1.2.10",
"mongodb": "^3.6.9",
"mongoose": "^5.13.7",
"mongoose-autopopulate": "^0.12.3",
"lambert-server": "^1.2.10",
"missing-native-js-functions": "^1.2.11",
"node-fetch": "^2.6.1",
"typescript": "^4.1.3"
"patch-package": "^6.4.7",
"pg": "^8.7.1",
"reflect-metadata": "^0.1.13",
"sqlite3": "^5.0.2",
"typeorm": "^0.2.37",
"typescript": "^4.3.5",
"typescript-json-schema": "^0.50.1"
}
},
"@types/amqplib": {

View File

@ -5,8 +5,9 @@
"main": "src/start.js",
"scripts": {
"preinstall": "cd ../util && npm i && cd ../api && npm i && cd ../cdn && npm i && cd ../gateway && npm i",
"build": "npm run build:api && npm run build:cdn && npm run build:gateway && npm run build:bundle",
"build": "npm run build:util && npm run build:api && npm run build:cdn && npm run build:gateway && npm run build:bundle",
"build:bundle": "npx tsc -b .",
"build:util": "cd ../util/ && npm run build",
"build:api": "cd ../api/ && npm run build",
"build:cdn": "cd ../cdn/ && npm run build",
"build:gateway": "cd ../gateway/ && npm run build",

View File

@ -1,44 +0,0 @@
import fs from "fs";
import { MongoMemoryServer } from "mongodb-memory-server";
import path from "path";
import exitHook from "async-exit-hook";
if (process.arch == "ia32") {
Object.defineProperty(process, "arch", {
value: "x64",
});
}
export async function setupDatabase() {
if (process.env.MONGO_URL) return; // exit because the user provides his own mongodb
const dbPath = path.join(__dirname, "..", "..", "db");
const dbName = "fosscord";
const storageEngine = "wiredTiger";
const port = 27020;
const ip = "127.0.0.1";
var mongod: MongoMemoryServer;
fs.mkdirSync(dbPath, { recursive: true });
exitHook((callback: any) => {
(async () => {
console.log(`Stopping MongoDB ...`);
await mongod.stop();
console.log(`Stopped MongoDB`);
callback();
})();
});
console.log(`[Database] starting ...`);
mongod = new MongoMemoryServer({
instance: {
port,
ip,
dbName,
dbPath,
storageEngine,
auth: false, // by default `mongod` is started with '--noauth', start `mongod` with '--auth'
},
});
await mongod.start();
process.env.MONGO_URL = mongod.getUri(dbName);
}

View File

@ -6,7 +6,7 @@ import { FosscordServer as APIServer } from "@fosscord/api";
import { Server as GatewayServer } from "@fosscord/gateway";
import { CDNServer } from "@fosscord/cdn/";
import express from "express";
import { Config } from "@fosscord/util";
import { Config, initDatabase } from "@fosscord/util";
const app = express();
const server = http.createServer();
@ -22,6 +22,8 @@ const cdn = new CDNServer({ server, port, production, app });
const gateway = new GatewayServer({ server, port, production });
async function main() {
await initDatabase();
await Config.init();
await Config.set({
cdn: {
endpointClient: "${location.host}",

View File

@ -1,7 +1,6 @@
// process.env.MONGOMS_DEBUG = "true";
import cluster from "cluster";
import os from "os";
import { setupDatabase } from "./Database";
import { initStats } from "./stats";
// TODO: add tcp socket event transmission
@ -12,7 +11,6 @@ if (cluster.isMaster && !process.env.masterStarted) {
(async () => {
initStats();
await setupDatabase();
if (cores === 1) {
require("./Server.js");