@okxweb3/a2a-node 0.0.8-beta-3678009f42-260618171101 → 0.0.8
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/check-node-version.js +50 -0
- package/dist/cli.js +265 -439
- package/dist/index.js +201 -369
- package/package.json +2 -1
- package/dist/workspace/AGENTS.md +0 -68
- package/dist/workspace/CLAUDE.md +0 -69
- package/dist/workspace/xmtp-tool.js +0 -774
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { readFileSync } = require("node:fs");
|
|
4
|
+
const { dirname, join } = require("node:path");
|
|
5
|
+
|
|
6
|
+
function parseVersion(version) {
|
|
7
|
+
const match = String(version).trim().match(/^v?(\d+)\.(\d+)\.(\d+)/);
|
|
8
|
+
if (!match) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return match.slice(1).map((part) => Number.parseInt(part, 10));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function compareVersions(actual, expected) {
|
|
15
|
+
for (let index = 0; index < 3; index += 1) {
|
|
16
|
+
if (actual[index] > expected[index]) {
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
if (actual[index] < expected[index]) {
|
|
20
|
+
return -1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getMinimumNodeVersion(range) {
|
|
27
|
+
const match = String(range).trim().match(/^>=\s*v?(\d+\.\d+\.\d+)$/);
|
|
28
|
+
return match ? match[1] : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const packageJsonPath = join(dirname(__dirname), "package.json");
|
|
32
|
+
const pkg = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
33
|
+
const nodeRange = pkg.engines?.node;
|
|
34
|
+
const minimumVersion = getMinimumNodeVersion(nodeRange);
|
|
35
|
+
|
|
36
|
+
if (!minimumVersion) {
|
|
37
|
+
console.error(`[${pkg.name}] Unsupported engines.node range: ${nodeRange}`);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const currentVersion = parseVersion(process.version);
|
|
42
|
+
const requiredVersion = parseVersion(minimumVersion);
|
|
43
|
+
|
|
44
|
+
if (!currentVersion || !requiredVersion || compareVersions(currentVersion, requiredVersion) < 0) {
|
|
45
|
+
console.error(
|
|
46
|
+
`[${pkg.name}] Node.js ${minimumVersion} or higher is required. Current version: ${process.version}.`,
|
|
47
|
+
);
|
|
48
|
+
console.error("Please upgrade Node.js and reinstall this package.");
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|