Clean up the project for building

This commit is contained in:
David Majdandžić
2023-04-07 08:39:58 +02:00
parent 0945fb0363
commit 5e31372207
6 changed files with 9 additions and 41 deletions

2
.gitignore vendored
View File

@@ -4,3 +4,5 @@ package-lock.json
sessions.json sessions.json
client_sessions.json client_sessions.json
center_sessions.json center_sessions.json
dist
main.exe

View File

@@ -1,5 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main.js" type="NodeJSConfigurationType" nameIsGenerated="true" path-to-js-file="$PROJECT_DIR$/main.js" working-dir="$PROJECT_DIR$">
<method v="2" />
</configuration>
</component>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="main.ts" type="TypeScriptProgramRunner" factoryName="TypeScript"> <configuration default="false" name="main.ts" type="TypeScriptProgramRunner" factoryName="TypeScript">
<module name="smsgwtester" /> <module name="smsgwtester" />
<envs> <envs>
<env name="LOG_LEVEL" value="4" /> <env name="LOG_LEVEL" value="0" />
</envs> </envs>
<option name="interpreterRef" value="project" /> <option name="interpreterRef" value="project" />
<option name="enabledTsNodeEsmLoader" value="false" /> <option name="enabledTsNodeEsmLoader" value="false" />

View File

@@ -4,8 +4,9 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"pkg:windows": "pkg main.js --target node16-windows-x64 --output main.exe", "tsc": "tsc",
"pkg:linux": "pkg main.js --target node16-linux-x64 --output main.exe" "pkg:windows": "pkg ./dist/main.js --target node16-windows-x64 --output main.exe",
"pkg:linux": "pkg ./dist/main.js --target node16-linux-x64 --output main.exe"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

View File

@@ -1,11 +1,8 @@
// @ts-ignore
import {WriteStream} from "fs"; import {WriteStream} from "fs";
const fs = require('fs'); const fs = require('fs');
// @ts-ignore const LOG_LEVEL: number = Number(process.env.LOG_LEVEL) || 0;
const LOG_LEVEL: number = process.env.LOG_LEVEL || 6;
// @ts-ignore
const LOG_FILE: string = process.env.LOG_FILE || ""; const LOG_FILE: string = process.env.LOG_FILE || "";
export default class Logger { export default class Logger {

View File

@@ -1,17 +1,15 @@
import CenterSessionManager from "./Center/CenterSessionManager"; import CenterSessionManager from "./Center/CenterSessionManager";
import Client from "./Client/Client";
import ClientSessionManager from "./Client/ClientSessionManager"; import ClientSessionManager from "./Client/ClientSessionManager";
import HttpServer from "./HttpServer/HttpServer"; import HttpServer from "./HttpServer/HttpServer";
import Logger from "./Logger"; import Logger from "./Logger";
import SourceEnumeratorProcessor from "./PDUProcessor/Preprocessor/Client/SourceEnumeratorProcessor";
import ProcessorManager from "./PDUProcessor/ProcessorManager"; import ProcessorManager from "./PDUProcessor/ProcessorManager";
import WSServer from "./WS/WSServer"; import WSServer from "./WS/WSServer";
const {PDU} = require("smpp"); const {PDU} = require("smpp");
let logger = new Logger("main"); let logger: Logger = new Logger("main");
new ProcessorManager(); let pm: ProcessorManager = new ProcessorManager();
let clientManager: ClientSessionManager = new ClientSessionManager(); let clientManager: ClientSessionManager = new ClientSessionManager();
let centerManager: CenterSessionManager = new CenterSessionManager(); let centerManager: CenterSessionManager = new CenterSessionManager();
@@ -25,31 +23,6 @@ function cleanup(): void {
process.exit(0); process.exit(0);
} }
async function main() {
let client: Client = await clientManager.getSession(0) as Client
// let center: Center = await centerManager.getSession(0) as Center;
// setInterval(async () => {
// await client.doConnect();
// setTimeout(async () => {
// await client.doBind();
// setTimeout(async () => {
// await center.close();
// }, 1000);
// }, 1000);
// }, 3000);
// console.log(ProcessorManager.getProcessorsForType(Client.name));
// ProcessorManager.attachProcessor(client, ProcessorManager.getProcessor(SourceEnumeratorProcessor.name));
// await client.doConnect();
// await client.doBind();
// client.sendMultipleDefault();
ProcessorManager.attachProcessor(client, ProcessorManager.getProcessor(SourceEnumeratorProcessor.name));
console.log("OK");
}
main();
process.on('exit', cleanup); process.on('exit', cleanup);
process.on('SIGINT', cleanup); process.on('SIGINT', cleanup);
process.on('SIGUSR1', cleanup); process.on('SIGUSR1', cleanup);