@teamvibe/poller 0.1.32 → 0.1.33
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/cli/commands.js +15 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/commands.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
1
2
|
import { install } from './install.js';
|
|
2
3
|
import { uninstall } from './uninstall.js';
|
|
3
4
|
import { update } from './update.js';
|
|
@@ -19,9 +20,18 @@ Commands:
|
|
|
19
20
|
restart Restart the installed service
|
|
20
21
|
status Show service status
|
|
21
22
|
logs Tail service logs
|
|
23
|
+
--version, -v Show version
|
|
22
24
|
--help, -h Show this help message
|
|
23
25
|
`);
|
|
24
26
|
}
|
|
27
|
+
function getVersion() {
|
|
28
|
+
const require = createRequire(import.meta.url);
|
|
29
|
+
const pkg = require('../../package.json');
|
|
30
|
+
return pkg.version;
|
|
31
|
+
}
|
|
32
|
+
function showVersion() {
|
|
33
|
+
console.log(getVersion());
|
|
34
|
+
}
|
|
25
35
|
export async function handleCommand(command) {
|
|
26
36
|
switch (command) {
|
|
27
37
|
case 'install':
|
|
@@ -46,8 +56,13 @@ export async function handleCommand(command) {
|
|
|
46
56
|
restart();
|
|
47
57
|
break;
|
|
48
58
|
case 'status':
|
|
59
|
+
console.log(`Version: ${getVersion()}`);
|
|
49
60
|
status();
|
|
50
61
|
break;
|
|
62
|
+
case '--version':
|
|
63
|
+
case '-v':
|
|
64
|
+
showVersion();
|
|
65
|
+
break;
|
|
51
66
|
case '--help':
|
|
52
67
|
case '-h':
|
|
53
68
|
showHelp();
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const command = process.argv[2];
|
|
3
|
-
if (command && ['install', 'uninstall', 'update', 'logs', 'status', 'start', 'stop', 'restart', '--help', '-h'].includes(command)) {
|
|
3
|
+
if (command && ['install', 'uninstall', 'update', 'logs', 'status', 'start', 'stop', 'restart', '--help', '-h', '--version', '-v'].includes(command)) {
|
|
4
4
|
const { handleCommand } = await import('./cli/commands.js');
|
|
5
5
|
await handleCommand(command);
|
|
6
6
|
}
|