@snowdreamtech/unirtm 0.0.1 → 0.0.3
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/install.js +36 -36
- package/package.json +17 -17
package/install.js
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
// - Runs it (when invoked as CLI)
|
|
7
7
|
// - Validates the installation (when invoked via postinstall)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
"use strict";
|
|
10
10
|
|
|
11
|
-
const { execFileSync, spawnSync } = require(
|
|
12
|
-
const path = require(
|
|
13
|
-
const fs = require(
|
|
14
|
-
const os = require(
|
|
11
|
+
const { execFileSync, spawnSync } = require("child_process");
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const os = require("os");
|
|
15
15
|
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
17
|
// Platform detection
|
|
@@ -23,41 +23,41 @@ const os = require('os');
|
|
|
23
23
|
*/
|
|
24
24
|
function getPlatformPackageSuffix() {
|
|
25
25
|
const platform = process.platform; // 'darwin' | 'linux' | 'win32'
|
|
26
|
-
const arch = process.arch;
|
|
26
|
+
const arch = process.arch; // 'x64' | 'arm64' | 'arm' | 'ia32'
|
|
27
27
|
|
|
28
28
|
// ARM sub-arch detection (armv5/armv6/armv7)
|
|
29
29
|
// process.config.variables.arm_version is available in some Node builds
|
|
30
|
-
const armVersion = (process.config && process.config.variables && process.config.variables.arm_version) ||
|
|
30
|
+
const armVersion = (process.config && process.config.variables && process.config.variables.arm_version) || "";
|
|
31
31
|
|
|
32
|
-
if (platform ===
|
|
33
|
-
if (arch ===
|
|
34
|
-
if (arch ===
|
|
32
|
+
if (platform === "darwin") {
|
|
33
|
+
if (arch === "arm64") return "darwin-arm64";
|
|
34
|
+
if (arch === "x64") return "darwin-x64";
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (platform ===
|
|
38
|
-
if (arch ===
|
|
39
|
-
if (arch ===
|
|
40
|
-
if (arch ===
|
|
41
|
-
if (arch ===
|
|
42
|
-
if (armVersion ===
|
|
43
|
-
if (armVersion ===
|
|
44
|
-
return
|
|
37
|
+
if (platform === "linux") {
|
|
38
|
+
if (arch === "x64") return "linux-x64";
|
|
39
|
+
if (arch === "arm64") return "linux-arm64";
|
|
40
|
+
if (arch === "ia32") return "linux-ia32";
|
|
41
|
+
if (arch === "arm") {
|
|
42
|
+
if (armVersion === "5") return "linux-arm-5";
|
|
43
|
+
if (armVersion === "6") return "linux-arm-6";
|
|
44
|
+
return "linux-arm"; // armv7 default
|
|
45
45
|
}
|
|
46
|
-
if (arch ===
|
|
47
|
-
if (arch ===
|
|
48
|
-
if (arch ===
|
|
49
|
-
if (arch ===
|
|
46
|
+
if (arch === "loong64") return "linux-loong64";
|
|
47
|
+
if (arch === "ppc64") return "linux-ppc64le";
|
|
48
|
+
if (arch === "riscv64") return "linux-riscv64";
|
|
49
|
+
if (arch === "s390x") return "linux-s390x";
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
if (platform ===
|
|
53
|
-
if (arch ===
|
|
54
|
-
if (arch ===
|
|
55
|
-
if (arch ===
|
|
52
|
+
if (platform === "win32") {
|
|
53
|
+
if (arch === "x64") return "windows-x64";
|
|
54
|
+
if (arch === "arm64") return "windows-arm64";
|
|
55
|
+
if (arch === "ia32") return "windows-ia32";
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
throw new Error(
|
|
59
59
|
`Unsupported platform: ${platform}-${arch}\n` +
|
|
60
|
-
|
|
60
|
+
"Please open an issue at https://github.com/snowdreamtech/unirtm/issues"
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -72,13 +72,13 @@ function getPlatformPackageSuffix() {
|
|
|
72
72
|
*/
|
|
73
73
|
function resolveBinary(suffix) {
|
|
74
74
|
const pkgName = `@snowdreamtech/unirtm-${suffix}`;
|
|
75
|
-
const binaryName = process.platform ===
|
|
75
|
+
const binaryName = process.platform === "win32" ? "unirtm.exe" : "unirtm";
|
|
76
76
|
|
|
77
77
|
// Strategy 1: resolve via require.resolve (works when package is installed)
|
|
78
78
|
try {
|
|
79
79
|
const pkgJsonPath = require.resolve(`${pkgName}/package.json`);
|
|
80
80
|
const pkgDir = path.dirname(pkgJsonPath);
|
|
81
|
-
const binPath = path.join(pkgDir,
|
|
81
|
+
const binPath = path.join(pkgDir, "bin", binaryName);
|
|
82
82
|
if (fs.existsSync(binPath)) {
|
|
83
83
|
return binPath;
|
|
84
84
|
}
|
|
@@ -89,7 +89,7 @@ function resolveBinary(suffix) {
|
|
|
89
89
|
// Strategy 2: walk up node_modules hierarchy
|
|
90
90
|
let dir = __dirname;
|
|
91
91
|
for (let i = 0; i < 10; i++) {
|
|
92
|
-
const candidate = path.join(dir,
|
|
92
|
+
const candidate = path.join(dir, "node_modules", pkgName, "bin", binaryName);
|
|
93
93
|
if (fs.existsSync(candidate)) {
|
|
94
94
|
return candidate;
|
|
95
95
|
}
|
|
@@ -100,9 +100,9 @@ function resolveBinary(suffix) {
|
|
|
100
100
|
|
|
101
101
|
throw new Error(
|
|
102
102
|
`Could not find binary for ${pkgName}.\n` +
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
"Try reinstalling @snowdreamtech/unirtm:\n" +
|
|
104
|
+
" npm install @snowdreamtech/unirtm\n\n" +
|
|
105
|
+
`Platform: ${process.platform}-${process.arch}`
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -110,14 +110,14 @@ function resolveBinary(suffix) {
|
|
|
110
110
|
// Entry point
|
|
111
111
|
// ---------------------------------------------------------------------------
|
|
112
112
|
|
|
113
|
-
const isPostInstall = process.env.npm_lifecycle_event ===
|
|
113
|
+
const isPostInstall = process.env.npm_lifecycle_event === "postinstall";
|
|
114
114
|
|
|
115
115
|
if (isPostInstall) {
|
|
116
116
|
// Postinstall: just validate that the binary can be found
|
|
117
117
|
try {
|
|
118
118
|
const suffix = getPlatformPackageSuffix();
|
|
119
119
|
const binPath = resolveBinary(suffix);
|
|
120
|
-
const result = spawnSync(binPath, [
|
|
120
|
+
const result = spawnSync(binPath, ["--version"], { encoding: "utf8" });
|
|
121
121
|
if (result.status === 0) {
|
|
122
122
|
process.stdout.write(`✅ unirtm installed successfully (${binPath})\n`);
|
|
123
123
|
}
|
|
@@ -133,7 +133,7 @@ if (isPostInstall) {
|
|
|
133
133
|
const args = process.argv.slice(2);
|
|
134
134
|
|
|
135
135
|
const result = spawnSync(binPath, args, {
|
|
136
|
-
stdio:
|
|
136
|
+
stdio: "inherit",
|
|
137
137
|
windowsHide: false,
|
|
138
138
|
});
|
|
139
139
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowdreamtech/unirtm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "UniRTM - Universal Runtime Manager: enterprise-grade foundational toolchain for multi-AI IDE collaboration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/snowdreamtech/unirtm",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/snowdreamtech/unirtm"
|
|
9
|
+
"url": "git+https://github.com/snowdreamtech/unirtm.git"
|
|
10
10
|
},
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/snowdreamtech/unirtm/issues"
|
|
@@ -32,21 +32,21 @@
|
|
|
32
32
|
"README_zh-CN.md"
|
|
33
33
|
],
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"@snowdreamtech/unirtm-darwin-arm64": "0.0.
|
|
36
|
-
"@snowdreamtech/unirtm-darwin-x64": "0.0.
|
|
37
|
-
"@snowdreamtech/unirtm-linux-x64": "0.0.
|
|
38
|
-
"@snowdreamtech/unirtm-linux-arm64": "0.0.
|
|
39
|
-
"@snowdreamtech/unirtm-linux-ia32": "0.0.
|
|
40
|
-
"@snowdreamtech/unirtm-linux-arm": "0.0.
|
|
41
|
-
"@snowdreamtech/unirtm-linux-arm-5": "0.0.
|
|
42
|
-
"@snowdreamtech/unirtm-linux-arm-6": "0.0.
|
|
43
|
-
"@snowdreamtech/unirtm-linux-loong64": "0.0.
|
|
44
|
-
"@snowdreamtech/unirtm-linux-ppc64le": "0.0.
|
|
45
|
-
"@snowdreamtech/unirtm-linux-riscv64": "0.0.
|
|
46
|
-
"@snowdreamtech/unirtm-linux-s390x": "0.0.
|
|
47
|
-
"@snowdreamtech/unirtm-windows-x64": "0.0.
|
|
48
|
-
"@snowdreamtech/unirtm-windows-arm64": "0.0.
|
|
49
|
-
"@snowdreamtech/unirtm-windows-ia32": "0.0.
|
|
35
|
+
"@snowdreamtech/unirtm-darwin-arm64": "0.0.3",
|
|
36
|
+
"@snowdreamtech/unirtm-darwin-x64": "0.0.3",
|
|
37
|
+
"@snowdreamtech/unirtm-linux-x64": "0.0.3",
|
|
38
|
+
"@snowdreamtech/unirtm-linux-arm64": "0.0.3",
|
|
39
|
+
"@snowdreamtech/unirtm-linux-ia32": "0.0.3",
|
|
40
|
+
"@snowdreamtech/unirtm-linux-arm": "0.0.3",
|
|
41
|
+
"@snowdreamtech/unirtm-linux-arm-5": "0.0.3",
|
|
42
|
+
"@snowdreamtech/unirtm-linux-arm-6": "0.0.3",
|
|
43
|
+
"@snowdreamtech/unirtm-linux-loong64": "0.0.3",
|
|
44
|
+
"@snowdreamtech/unirtm-linux-ppc64le": "0.0.3",
|
|
45
|
+
"@snowdreamtech/unirtm-linux-riscv64": "0.0.3",
|
|
46
|
+
"@snowdreamtech/unirtm-linux-s390x": "0.0.3",
|
|
47
|
+
"@snowdreamtech/unirtm-windows-x64": "0.0.3",
|
|
48
|
+
"@snowdreamtech/unirtm-windows-arm64": "0.0.3",
|
|
49
|
+
"@snowdreamtech/unirtm-windows-ia32": "0.0.3"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=18"
|