@virtualagency/server 0.1.0 → 1.0.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.
- package/README.md +4 -0
- package/bin/virtual-agency-server.js +25 -3
- package/dist/virtual-agency-server-linux-x64 +0 -0
- package/dist/virtual-agency-server-macos-arm64 +0 -0
- package/dist/virtual-agency-server-windows-x64.exe +0 -0
- package/package.json +1 -1
- package/dist/virtual-agency-server-macos-x64 +0 -0
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Rust-powered Virtual Agency server packaged as an npm CLI.
|
|
4
4
|
|
|
5
|
+
Includes a `--version` flag in the wrapper CLI so users can verify installed package version quickly.
|
|
6
|
+
This package is published from GitHub Actions via npm Trusted Publisher.
|
|
7
|
+
|
|
5
8
|
## Install
|
|
6
9
|
|
|
7
10
|
```bash
|
|
@@ -18,6 +21,7 @@ npx @virtualagency/server
|
|
|
18
21
|
|
|
19
22
|
```bash
|
|
20
23
|
virtual-agency-server --port 1337
|
|
24
|
+
virtual-agency-server --version
|
|
21
25
|
```
|
|
22
26
|
|
|
23
27
|
The `--port` flag sets `VIRTUAL_AGENCY_PORT` for the server process.
|
|
@@ -19,19 +19,36 @@ const DIST_BINARY_NAMES = {
|
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
function getPackageVersion() {
|
|
23
|
+
try {
|
|
24
|
+
const packageJsonPath = path.join(__dirname, "..", "package.json");
|
|
25
|
+
const content = fs.readFileSync(packageJsonPath, "utf8");
|
|
26
|
+
const parsed = JSON.parse(content);
|
|
27
|
+
return parsed.version || "unknown";
|
|
28
|
+
} catch {
|
|
29
|
+
return "unknown";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
function printHelp() {
|
|
23
|
-
console.log(`virtual-agency-server\n\nRuns the Virtual Agency Rust server binary.\n\nUsage:\n virtual-agency-server [--port <number>]\n virtual-agency-server --help\n\nOptions:\n --port <number> Sets VIRTUAL_AGENCY_PORT for the server process.\n -h, --help Show this help message.\n\nEnvironment:\n VIRTUAL_AGENCY_SERVER_BINARY Absolute path to a custom server binary.\n VIRTUAL_AGENCY_PORT Default port (used when --port is not passed).\n`);
|
|
34
|
+
console.log(`virtual-agency-server\n\nRuns the Virtual Agency Rust server binary.\n\nUsage:\n virtual-agency-server [--port <number>]\n virtual-agency-server --help\n virtual-agency-server --version\n\nOptions:\n --port <number> Sets VIRTUAL_AGENCY_PORT for the server process.\n -h, --help Show this help message.\n -v, --version Show npm package version.\n\nEnvironment:\n VIRTUAL_AGENCY_SERVER_BINARY Absolute path to a custom server binary.\n VIRTUAL_AGENCY_PORT Default port (used when --port is not passed).\n`);
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
function parseArgs(argv) {
|
|
27
38
|
let port;
|
|
39
|
+
let version = false;
|
|
28
40
|
const passthrough = [];
|
|
29
41
|
|
|
30
42
|
for (let i = 0; i < argv.length; i += 1) {
|
|
31
43
|
const arg = argv[i];
|
|
32
44
|
|
|
33
45
|
if (arg === "-h" || arg === "--help") {
|
|
34
|
-
return { help: true, port, passthrough: [] };
|
|
46
|
+
return { help: true, version: false, port, passthrough: [] };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (arg === "-v" || arg === "--version") {
|
|
50
|
+
version = true;
|
|
51
|
+
continue;
|
|
35
52
|
}
|
|
36
53
|
|
|
37
54
|
if (arg === "--port") {
|
|
@@ -56,7 +73,7 @@ function parseArgs(argv) {
|
|
|
56
73
|
passthrough.push(arg);
|
|
57
74
|
}
|
|
58
75
|
|
|
59
|
-
return { help: false, port, passthrough };
|
|
76
|
+
return { help: false, version, port, passthrough };
|
|
60
77
|
}
|
|
61
78
|
|
|
62
79
|
function resolveBinaryPath() {
|
|
@@ -96,6 +113,11 @@ function start() {
|
|
|
96
113
|
process.exit(0);
|
|
97
114
|
}
|
|
98
115
|
|
|
116
|
+
if (parsed.version) {
|
|
117
|
+
console.log(getPackageVersion());
|
|
118
|
+
process.exit(0);
|
|
119
|
+
}
|
|
120
|
+
|
|
99
121
|
const binaryPath = resolveBinaryPath();
|
|
100
122
|
if (!binaryPath) {
|
|
101
123
|
console.error(
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|