Refactor ansi to be a global instance.

This commit is contained in:
Starbeamrainbowlabs 2019-05-20 14:38:20 +01:00
parent d6e65ca294
commit fcceb7de46
6 changed files with 1669 additions and 9 deletions

View file

@ -75,4 +75,6 @@ class Ansi {
}
}
export default Ansi;
const ansi = new Ansi();
export default ansi;

View file

@ -1,7 +1,8 @@
import path from 'path';
import ansi from './Helpers/Ansi.mjs';
export default function(settings) {
let ansi = settings.ansi;
console.log(`${settings.program_name}, ${settings.version}
${ansi.locol}By Starbeamrainbowlabs${ansi.reset}

View file

@ -2,19 +2,16 @@
// Requires Ansi.mjs, which can be found here: https://gist.github.com/8c0bb5e172438b6e62dd48587cfeba84#file-ansi-mjs
import Ansi from './Helpers/Ansi.mjs';
import ansi from './Helpers/Ansi.mjs';
import show_help from './help.mjs';
import TTNAppServer from './ttn-app-server/TTNAppServer.mjs';
// 1: Setup
const ansi = new Ansi();
const settings = {
program_name: "LoRaWAN Signal Mapper",
version: "v0.1",
description: "assists in mapping LoRaWAN signal coverage.",
ansi
description: "assists in mapping LoRaWAN signal coverage"
};
// 2: CLI Argument Parsing
@ -52,6 +49,7 @@ if(extras.length < 1) {
show_help(settings);
process.exit();
}
switch(extras[0]) {
case "ttn-app-server":
let app_server = new TTNAppServer(settings);

1654
server/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -17,5 +17,9 @@
"mapping"
],
"author": "Starbeamrainbowlabs",
"license": "MPL-2.0"
"license": "MPL-2.0",
"dependencies": {
"better-sqlite3": "^5.4.0",
"ttn": "^2.3.2"
}
}

View file

@ -1,9 +1,10 @@
"use strict";
import ansi from '../Helpers/Ansi.mjs';
class TTNAppServer {
constructor(in_settings) {
this.settings = in_settings;
this.ansi = this.settings.ansi;
}
run() {