bundled build

This commit is contained in:
holmityd 2023-09-21 04:32:29 +04:00
parent b8e49c40af
commit 6599aba618
6 changed files with 1398 additions and 7 deletions

1317
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
"scripts": {
"start": "node build/index.js",
"dev": "ts-node-dev --openssl-legacy-provider -r tsconfig-paths/register src/index.ts",
"build": "tsc",
"build": "webpack",
"lint": "eslint --ext .ts .",
"prettier": "prettier --write ."
},
@ -23,13 +23,20 @@
"@types/morgan": "^1.9.4",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"copy-webpack-plugin": "^11.0.0",
"dotenv-webpack": "^8.0.1",
"eslint": "^8.45.0",
"eslint-plugin-prettier": "^5.0.0",
"morgan": "^1.10.0",
"prettier": "^3.0.0",
"string-replace-loader": "^3.1.0",
"ts-loader": "^9.4.4",
"ts-node-dev": "^2.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.6"
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^5.1.6",
"webpack-cli": "^5.1.4",
"webpack-node-externals": "^3.0.0"
},
"engines": {
"node": ">=18.15.0",

View File

@ -2,12 +2,13 @@ import http from "http";
import https from "https";
import fs from "node:fs";
import { app } from "./app";
import { join } from "path";
//const morgan = require("morgan");
//const bodyParser = require("body-parser");
const options = {
key: fs.readFileSync("static/certs/key.pem"),
cert: fs.readFileSync("static/certs/cert.pem"),
key: fs.readFileSync(join(__dirname, "../static/certs/key.pem")),
cert: fs.readFileSync(join(__dirname, "../static/certs/cert.pem")),
passphrase: "123456"
};

View File

@ -372,7 +372,7 @@ inventorySchema.set("toJSON", {
(returnedObject as IInventoryResponse).TrainingDate = {
$date: {
$numberLong: trainingDate.getTime().toString()
$numberLong: trainingDate?.getTime().toString()
}
} satisfies IMongoDate;
}

View File

@ -870,7 +870,7 @@ export enum GivingSlotOrderInfo {
LotusUpgradesModsPistolDualStatElectEventPistolMod = "/Lotus/Upgrades/Mods/Pistol/DualStat/ElectEventPistolMod"
}
export interface PeriodicMissionCompletion {
export interface IPeriodicMissionCompletion {
date: IMongoDate;
tag: string;
count?: number;

68
webpack.config.js Normal file
View File

@ -0,0 +1,68 @@
const resolve = require("path").resolve;
const webpack = require("webpack");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const Dotenv = require("dotenv-webpack");
module.exports = {
target: "node",
mode: "production",
node: {
__dirname: false,
__filename: false
},
plugins: [
new Dotenv(),
new webpack.ContextReplacementPlugin(/express\/lib/, resolve(__dirname, "../node_modules"), {
ejs: "ejs"
}),
new CopyPlugin({
patterns: [
{ from: "static/certs/", to: "certs/" },
{ from: "node_modules/warframe-items/data/json/", to: "data/json/" }
]
})
],
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/
},
{
test: /index\.ts$/,
loader: "string-replace-loader",
options: {
search: "../static/certs/",
replace: "certs/",
flags: "g"
}
}
]
},
resolve: {
plugins: [
new TsconfigPathsPlugin({
/* options: see below */
})
],
fallback: {
"mongodb-client-encryption": false,
aws4: false,
snappy: false,
"@aws-sdk/credential-providers": false,
"@mongodb-js/zstd": false,
kerberos: false
},
extensions: [".tsx", ".ts", ".js"],
alias: {
"static/certs/*": resolve(__dirname, "certs") // Assuming 'certs' is in the root directory
}
},
entry: ["./src/index.ts"],
output: {
filename: "index.js",
path: resolve(__dirname, "build")
}
};