Refactor ansi to be a global instance.

master
Starbeamrainbowlabs 4 years ago
parent d6e65ca294
commit fcceb7de46
  1. 4
      server/Helpers/Ansi.mjs
  2. 3
      server/help.mjs
  3. 8
      server/index.mjs
  4. 1654
      server/package-lock.json
  5. 6
      server/package.json
  6. 3
      server/ttn-app-server/TTNAppServer.mjs

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

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

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

File diff suppressed because it is too large Load Diff

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

@ -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() {

Loading…
Cancel
Save