@livedesk/client 0.1.118 → 0.1.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { dirname, join, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ const packageRoot = resolve(__dirname, '..');
7
+
8
+ export function readClientPackageVersion() {
9
+ try {
10
+ const packageInfo = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'));
11
+ return String(packageInfo.version || '0.0.0');
12
+ } catch {
13
+ return '0.0.0';
14
+ }
15
+ }
16
+
17
+ export function formatClientVersionBanner(env = process.env) {
18
+ const clientPackage = `@livedesk/client@${readClientPackageVersion()}`;
19
+ const launcherName = String(env.LIVEDESK_NPM_LAUNCHER_NAME || '').trim();
20
+ const launcherVersion = String(env.LIVEDESK_NPM_LAUNCHER_VERSION || '').trim();
21
+
22
+ if (launcherName && launcherVersion) {
23
+ return `[LiveDesk Client] npm packages: ${launcherName}@${launcherVersion} -> ${clientPackage}`;
24
+ }
25
+
26
+ return `[LiveDesk Client] npm package: ${clientPackage}`;
27
+ }
@@ -8,6 +8,7 @@ import { createServer } from 'node:http';
8
8
  import { createRequire } from 'node:module';
9
9
  import net from 'node:net';
10
10
  import os from 'node:os';
11
+ import { formatClientVersionBanner, readClientPackageVersion } from './client-version.js';
11
12
 
12
13
  const __dirname = dirname(fileURLToPath(import.meta.url));
13
14
  const require = createRequire(import.meta.url);
@@ -74,12 +75,7 @@ Enable Windows auto-start from the connection page when this client signs in.
74
75
  }
75
76
 
76
77
  function readPackageVersion() {
77
- try {
78
- const packageInfo = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'));
79
- return packageInfo.version || '0.0.0';
80
- } catch {
81
- return '0.0.0';
82
- }
78
+ return readClientPackageVersion();
83
79
  }
84
80
 
85
81
  function isTruthy(value) {
@@ -2727,6 +2723,8 @@ async function main() {
2727
2723
  return;
2728
2724
  }
2729
2725
 
2726
+ console.log(formatClientVersionBanner());
2727
+
2730
2728
  let connectionPage = null;
2731
2729
  while (true) {
2732
2730
  const prepared = await prepareLoginConnection(parsed, connectionPage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livedesk/client",
3
- "version": "0.1.118",
3
+ "version": "0.1.119",
4
4
  "description": "LiveDesk local remote client",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,8 @@
16
16
  "THIRD_PARTY_NOTICES.md"
17
17
  ],
18
18
  "scripts": {
19
- "check": "node --check bin/livedesk-client.js && node --check bin/livedesk-client-node.js && node --check bin/livedesk-client-fast.js",
19
+ "check": "node --check bin/client-version.js && node --check bin/livedesk-client.js && node --check bin/livedesk-client-node.js && node --check bin/livedesk-client-fast.js",
20
+ "test:version": "node --test tests/client-version.test.mjs",
20
21
  "pack:dry": "npm pack --dry-run"
21
22
  },
22
23
  "keywords": [