@hayasaka7/go-arch-xray 0.5.0 → 0.5.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/install.js +28 -2
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -101,6 +101,24 @@ function extract(archivePath, destDir) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
// Cross-volume safe replacement for fs.renameSync. On Windows, npm's tmpdir
|
|
105
|
+
// commonly lives on C: while node_modules can be on D:, which makes rename
|
|
106
|
+
// fail with EXDEV. Fall back to copy + unlink in that case.
|
|
107
|
+
function moveFile(src, dest) {
|
|
108
|
+
try {
|
|
109
|
+
fs.renameSync(src, dest);
|
|
110
|
+
return;
|
|
111
|
+
} catch (err) {
|
|
112
|
+
if (err && err.code !== "EXDEV") throw err;
|
|
113
|
+
}
|
|
114
|
+
fs.copyFileSync(src, dest);
|
|
115
|
+
try {
|
|
116
|
+
fs.unlinkSync(src);
|
|
117
|
+
} catch {
|
|
118
|
+
/* best effort */
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
104
122
|
async function main() {
|
|
105
123
|
if (process.env.GO_ARCH_XRAY_BIN) {
|
|
106
124
|
log(`GO_ARCH_XRAY_BIN is set; skipping download.`);
|
|
@@ -117,7 +135,15 @@ async function main() {
|
|
|
117
135
|
|
|
118
136
|
fs.mkdirSync(binDir, { recursive: true });
|
|
119
137
|
|
|
120
|
-
|
|
138
|
+
// Stage the download next to the install target so the final move is on the
|
|
139
|
+
// same volume; falls back to OS temp if that directory is not writable.
|
|
140
|
+
let tmpRoot;
|
|
141
|
+
try {
|
|
142
|
+
tmpRoot = fs.mkdtempSync(path.join(binDir, ".download-"));
|
|
143
|
+
} catch {
|
|
144
|
+
tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), "go-arch-xray-"));
|
|
145
|
+
}
|
|
146
|
+
const tmpDir = tmpRoot;
|
|
121
147
|
const archivePath = path.join(tmpDir, archiveAssetName(target));
|
|
122
148
|
|
|
123
149
|
try {
|
|
@@ -133,7 +159,7 @@ async function main() {
|
|
|
133
159
|
);
|
|
134
160
|
}
|
|
135
161
|
|
|
136
|
-
|
|
162
|
+
moveFile(extractedPath, binPath);
|
|
137
163
|
if (process.platform !== "win32") {
|
|
138
164
|
fs.chmodSync(binPath, 0o755);
|
|
139
165
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hayasaka7/go-arch-xray",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Model Context Protocol server for static analysis of Go codebases (call graphs, import graphs, interface topology, struct lifecycle, HTTP routes).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|