node-opcua-local-discovery-server 2.182.2 → 2.183.1

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.
@@ -10,7 +10,7 @@ import { make_debugLog } from "node-opcua-debug";
10
10
 
11
11
  const paths = envPaths("node-opcua-local-discovery-server");
12
12
 
13
- import yargs from "yargs/yargs.js";
13
+ import commandLineArgs from "command-line-args";
14
14
 
15
15
  const configFolder = paths.config;
16
16
  const pkiFolder = path.join(configFolder, "PKI");
@@ -49,46 +49,30 @@ async function getIpAddresses() {
49
49
  }
50
50
  const applicationUri = "";
51
51
 
52
- const argv = yargs(process.argv)
53
- .wrap(132)
54
-
55
- .number("port")
56
- .describe("port", "port to listen to (default: 4840)")
57
- .default("port", 4840)
58
-
59
- .boolean("tolerant")
60
- .describe("tolerant", "automatically accept unknown registering server certificate")
61
- .default("tolerant", true)
62
-
63
- .boolean("force")
64
- .describe("force", "force recreation of LDS self-signed certification (taking into account alternateHostname) ")
65
- .default("force", false)
66
-
67
- .string("alternateHostname")
68
- .describe("alternateHostname ", "alternate hostname to use in certificate")
69
- .string("hostname")
70
- .describe("hostname", "the hostname")
71
-
72
- .string("applicationName")
73
- .describe("applicationName", "the application name")
74
- .default("applicationName", "NodeOPCUA-DiscoveryServer")
75
-
76
- .alias("a", "alternateHostname")
77
- .alias("n", "applicationName")
78
- .alias("p", "port")
79
- .alias("h", "hostname")
80
- .alias("f", "force")
81
- .alias("t", "tolerant")
82
-
83
- .help(true).argv/* as {
84
- port: number,
85
- tolerant: boolean,
86
- force: boolean,
87
- applicationName: string,
88
- hostname?: string,
89
- alternateHostname?: string
90
- }*/
91
- ;
52
+ // `--tolerant` and `--force` default to true/false and both had a yargs `--no-x` form.
53
+ // command-line-args has no negation, so they take an optional value instead: `--tolerant false`.
54
+ const flag = () => (value) => (value === null || value === undefined ? true : value !== "false" && value !== "0");
55
+
56
+ const argv = commandLineArgs([
57
+ { name: "port", alias: "p", type: Number, defaultValue: 4840, description: "port to listen to (default: 4840)" },
58
+ {
59
+ name: "tolerant",
60
+ alias: "t",
61
+ type: flag(),
62
+ defaultValue: true,
63
+ description: "automatically accept unknown registering server certificate"
64
+ },
65
+ {
66
+ name: "force",
67
+ alias: "f",
68
+ type: flag(),
69
+ defaultValue: false,
70
+ description: "force recreation of LDS self-signed certification (taking into account alternateHostname) "
71
+ },
72
+ { name: "alternateHostname", alias: "a", type: String, description: "alternate hostname to use in certificate" },
73
+ { name: "hostname", alias: "h", type: String, description: "the hostname" },
74
+ { name: "applicationName", alias: "n", type: String, defaultValue: "NodeOPCUA-DiscoveryServer", description: "the application name" }
75
+ ]);
92
76
 
93
77
  const port = argv.port;
94
78
  const automaticallyAcceptUnknownCertificate = argv.tolerant;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-local-discovery-server",
3
- "version": "2.182.2",
3
+ "version": "2.183.1",
4
4
  "description": "pure nodejs OPCUA SDK - module local-discovery-server",
5
5
  "bin": {
6
6
  "lds": "./bin/local-discovery-server.mjs",
@@ -27,14 +27,17 @@
27
27
  "opc ua",
28
28
  "internet of things"
29
29
  ],
30
+ "engines": {
31
+ "node": ">=22.13.0"
32
+ },
30
33
  "dependencies": {
31
34
  "@inquirer/prompts": "8.7.1",
35
+ "command-line-args": "6.0.2",
32
36
  "env-paths": "2.2.1",
33
- "node-opcua": "2.182.2",
34
- "node-opcua-debug": "2.181.0",
35
- "yargs": "15.4.1"
37
+ "node-opcua": "2.183.1",
38
+ "node-opcua-debug": "2.183.0"
36
39
  },
37
40
  "homepage": "http://node-opcua.github.io/",
38
- "gitHead": "cb72d06e8bcb611479f44f9f45f67bbee93bc32e",
41
+ "gitHead": "2326127b73f78cae1f0957788f16850a3be70701",
39
42
  "files": []
40
43
  }