whatsapp-rpc 0.0.8 → 0.0.9
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/package.json +1 -1
- package/scripts/cli.js +3 -2
package/package.json
CHANGED
package/scripts/cli.js
CHANGED
|
@@ -5,12 +5,13 @@ import { execa } from 'execa';
|
|
|
5
5
|
import killPort from 'kill-port';
|
|
6
6
|
import { Socket } from 'net';
|
|
7
7
|
import { execSync, spawn } from 'child_process';
|
|
8
|
-
import { existsSync, statSync, mkdirSync, rmSync, readdirSync, unlinkSync } from 'fs';
|
|
8
|
+
import { existsSync, statSync, mkdirSync, rmSync, readdirSync, unlinkSync, readFileSync } from 'fs';
|
|
9
9
|
import { dirname, join } from 'path';
|
|
10
10
|
import { fileURLToPath } from 'url';
|
|
11
11
|
|
|
12
12
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
13
|
const ROOT = join(__dirname, '..');
|
|
14
|
+
const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf8'));
|
|
14
15
|
const DEFAULT_PORT = 9400;
|
|
15
16
|
const BIN = process.platform === 'win32' ? 'whatsapp-rpc-server.exe' : 'whatsapp-rpc-server';
|
|
16
17
|
const BIN_DIR = join(ROOT, 'bin');
|
|
@@ -175,7 +176,7 @@ async function clean(opts = {}) {
|
|
|
175
176
|
// Global port option for all commands
|
|
176
177
|
const portOption = ['-p, --port <port>', 'API port (default: 9400, or PORT/WHATSAPP_RPC_PORT env var)'];
|
|
177
178
|
|
|
178
|
-
program.name('whatsapp-rpc').version(
|
|
179
|
+
program.name('whatsapp-rpc').version(pkg.version);
|
|
179
180
|
program.command('start').description('Start API server').option(...portOption).action(start);
|
|
180
181
|
program.command('stop').description('Stop API server').option(...portOption).action(stop);
|
|
181
182
|
program.command('restart').description('Restart API server').option(...portOption).action(async (opts) => { await stop(opts); await sleep(1000); await start(opts); });
|