Skip to content

Commit

Permalink
fix: use a more compatible way to read package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Aug 3, 2024
1 parent a65077e commit 73d6804
Show file tree
Hide file tree
Showing 4 changed files with 3,025 additions and 1,233 deletions.
4 changes: 3 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#! /usr/bin/env node
const { name, version } = require(__dirname + "/package.json");

const { run } = require("./dist/cmd.js");
run();
run(name, version);
20 changes: 8 additions & 12 deletions lib/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ import { resolve } from "path";
import { Socket } from "./socket";
import { versionChecker } from "./version-checker";

export const run = () => {

// Read the content of package.json
const { name, version } = require(__dirname + "/../package.json") as { name: string, version: string }

export const run = (name: string, version: string) => {
console.info(
blueBright(
"Taskforce Connector v" + version + " - (c) 2017-2024 Taskforce.sh Inc."
Expand Down Expand Up @@ -107,8 +103,8 @@ export const run = () => {
const queueNames = options.queuesFile
? parseQueuesFile(options.queuesFile)
: options.queues
? parseQueues(options.queues)
: undefined;
? parseQueues(options.queues)
: undefined;

const connection = {
port: options.port,
Expand All @@ -119,10 +115,10 @@ export const run = () => {
uri: options.uri,
tls: options.tls
? {
rejectUnauthorized: false,
requestCert: true,
agent: false,
}
rejectUnauthorized: false,
requestCert: true,
agent: false,
}
: void 0,
sentinels:
options.sentinels &&
Expand Down Expand Up @@ -163,4 +159,4 @@ export const run = () => {
function parseQueues(queuesString: string) {
return queuesString.split(",");
}
}
};
Loading

0 comments on commit 73d6804

Please sign in to comment.