ntpclient 1.6.4 → 1.6.5
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.
- package/dist/cjs/cli.js +7 -12
- package/dist/cjs/index.js +4 -1
- package/dist/esm/cli.js +5 -1
- package/dist/esm/index.js +4 -1
- package/package.json +3 -3
package/dist/cjs/cli.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
import { program as commander } from 'commander';
|
|
12
3
|
import { createRequire } from 'module';
|
|
13
4
|
const require = createRequire(import.meta.url);
|
|
@@ -22,9 +13,13 @@ commander
|
|
|
22
13
|
.option('-t, --timeout <number>', 'Specify the timeout in milliseconds')
|
|
23
14
|
.parse(process.argv);
|
|
24
15
|
const commanderOptions = commander.opts();
|
|
25
|
-
void (() =>
|
|
16
|
+
void (async () => {
|
|
26
17
|
try {
|
|
27
|
-
const date =
|
|
18
|
+
const date = await new NTPClient({
|
|
19
|
+
...(commanderOptions.server && { server: commanderOptions.server }),
|
|
20
|
+
...(commanderOptions.port && { port: commanderOptions.port }),
|
|
21
|
+
...(commanderOptions.timeout && { replyTimeout: commanderOptions.timeout }),
|
|
22
|
+
}).getNetworkTime();
|
|
28
23
|
console.info(date.toString());
|
|
29
24
|
process.exit();
|
|
30
25
|
}
|
|
@@ -32,4 +27,4 @@ void (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
32
27
|
console.error(error);
|
|
33
28
|
process.exit(1);
|
|
34
29
|
}
|
|
35
|
-
})
|
|
30
|
+
})();
|
package/dist/cjs/index.js
CHANGED
|
@@ -12,7 +12,10 @@ export class NTPClient {
|
|
|
12
12
|
this.config.server = configOrServer;
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
this.config =
|
|
15
|
+
this.config = {
|
|
16
|
+
...this.config,
|
|
17
|
+
...configOrServer,
|
|
18
|
+
};
|
|
16
19
|
}
|
|
17
20
|
if (port) {
|
|
18
21
|
this.config.port = port;
|
package/dist/esm/cli.js
CHANGED
|
@@ -15,7 +15,11 @@ commander
|
|
|
15
15
|
const commanderOptions = commander.opts();
|
|
16
16
|
void (async () => {
|
|
17
17
|
try {
|
|
18
|
-
const date = await new NTPClient(
|
|
18
|
+
const date = await new NTPClient({
|
|
19
|
+
...(commanderOptions.server && { server: commanderOptions.server }),
|
|
20
|
+
...(commanderOptions.port && { port: commanderOptions.port }),
|
|
21
|
+
...(commanderOptions.timeout && { replyTimeout: commanderOptions.timeout }),
|
|
22
|
+
}).getNetworkTime();
|
|
19
23
|
console.info(date.toString());
|
|
20
24
|
process.exit();
|
|
21
25
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -12,7 +12,10 @@ export class NTPClient {
|
|
|
12
12
|
this.config.server = configOrServer;
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
this.config =
|
|
15
|
+
this.config = {
|
|
16
|
+
...this.config,
|
|
17
|
+
...configOrServer,
|
|
18
|
+
};
|
|
16
19
|
}
|
|
17
20
|
if (port) {
|
|
18
21
|
this.config.port = port;
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"description": "A TypeScript implementation of the NTP Client Protocol",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"rimraf": "5.0.7",
|
|
10
|
-
"typescript": "5.
|
|
10
|
+
"typescript": "5.5.2",
|
|
11
11
|
"vitest": "1.6.0"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"test": "vitest run"
|
|
39
39
|
},
|
|
40
40
|
"type": "module",
|
|
41
|
-
"version": "1.6.
|
|
42
|
-
"gitHead": "
|
|
41
|
+
"version": "1.6.5",
|
|
42
|
+
"gitHead": "f7a6a79286e4eb85392b5f2d33942ab166142109"
|
|
43
43
|
}
|