Merge branch 'feature/use-version-module'

This commit is contained in:
Robbie Cahill
2025-02-07 20:03:56 +11:00
4 changed files with 8 additions and 20 deletions
+2 -1
View File
@@ -17,6 +17,7 @@ import dispatchCommand from '../src/cli/dispatch-command.js';
import { sendMessage } from '../src/telemetry/send-message.js';
import { initStorage } from '../src/node-persist/storage.js';
import { initialiseClientId } from '../src/identity/client-id-service.js';
import { version } from '../version.js';
// This will make tunnelmole appear in the process list
process.title = "tunnelmole";
@@ -45,7 +46,7 @@ tunnelmole.com URLs are accessible from any unrestricted internet connection in
More detailed instructions, cookbooks and more are available at https://tunnelmole.com/docs
`
)
.version('2.3.4')
.version(version)
.arguments('[arg0]')
.option('--set-api-key <apiKey>', 'Set your API key. After purchasing a subscription you can copy and paste the command shown on the page')
.option('--unreserve-subdomain <subdomain>', 'Unreserve a subdomain, for example if the number of subdomains you have reserved exceeds your limit')
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tunnelmole",
"version": "2.3.4",
"version": "2.3.5",
"description": "Tunnelmole, an open source ngrok alternative. Instant public URLs for any http/https based application. Available as a command line application or as an NPM dependency for your code. Stable and maintained. Good test coverage. Works behind firewalls",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
+3 -3
View File
@@ -1,4 +1,4 @@
import { getPackageVersion } from "../../version.js";
import { version } from "../../version.js";
import { ConnectionInfo } from "./connection-info";
/**
@@ -14,8 +14,8 @@ const setIsCli = (isCli: boolean) => {
connectionInfo.isCli = isCli;
};
const getConnectionInfo = async() => {
connectionInfo.tunnelmoleVersion = await getPackageVersion();
const getConnectionInfo = () => {
connectionInfo.tunnelmoleVersion = version
return connectionInfo;
}
+2 -15
View File
@@ -1,15 +1,2 @@
import { readFile } from 'fs/promises';
const getPackageVersion = async(): Promise<string> => {
try {
const data = await readFile('./package.json', 'utf8');
const packageJson = JSON.parse(data);
return packageJson.version ?? "Unknown - version seems to be missing from package.json";
} catch (error) {
console.info('Error reading package.json:', error);
return "Error reading version from package.json"
}
}
export { getPackageVersion }
const version = '2.3.4';
export { version }