codecane 1.0.292 → 1.0.293
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/postinstall.js +3 -13
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -33,12 +33,11 @@ const destPath = path.join(destDir, binary);
|
|
|
33
33
|
|
|
34
34
|
(async () => {
|
|
35
35
|
if (fs.existsSync(destPath)) {
|
|
36
|
-
|
|
36
|
+
process.stdout.write("CodeCane: binary already exists ✓\n");
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
console.log("CodeCane: will extract to", destPath);
|
|
40
|
+
process.stdout.write("CodeCane: downloading binary...\n");
|
|
42
41
|
await fs.promises.mkdir(destDir, { recursive: true });
|
|
43
42
|
|
|
44
43
|
await new Promise((resolve, reject) => {
|
|
@@ -50,13 +49,7 @@ const destPath = path.join(destDir, binary);
|
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
console.log("CodeCane: download started, status:", res.statusCode);
|
|
54
|
-
|
|
55
52
|
const onDone = () => {
|
|
56
|
-
console.log("CodeCane: extraction complete");
|
|
57
|
-
// List contents of bin directory
|
|
58
|
-
const files = fs.readdirSync(destDir);
|
|
59
|
-
console.log("CodeCane: contents of", destDir, ":", files);
|
|
60
53
|
resolve();
|
|
61
54
|
};
|
|
62
55
|
const onErr = (err) => {
|
|
@@ -65,13 +58,11 @@ const destPath = path.join(destDir, binary);
|
|
|
65
58
|
};
|
|
66
59
|
|
|
67
60
|
if (ext === "zip") {
|
|
68
|
-
console.log("CodeCane: extracting zip...");
|
|
69
61
|
res
|
|
70
62
|
.pipe(unzip.Extract({ path: destDir }))
|
|
71
63
|
.once("close", onDone)
|
|
72
64
|
.once("error", onErr);
|
|
73
65
|
} else {
|
|
74
|
-
console.log("CodeCane: extracting tar.gz...");
|
|
75
66
|
const gunzip = zlib.createGunzip();
|
|
76
67
|
const untar = tar
|
|
77
68
|
.x({ C: destDir, strip: 0 })
|
|
@@ -99,10 +90,9 @@ const destPath = path.join(destDir, binary);
|
|
|
99
90
|
}
|
|
100
91
|
|
|
101
92
|
if (!isWin) {
|
|
102
|
-
console.log("CodeCane: setting executable permissions");
|
|
103
93
|
fs.chmodSync(destPath, 0o755);
|
|
104
94
|
}
|
|
105
|
-
|
|
95
|
+
process.stdout.write("CodeCane installed successfully ✓\n");
|
|
106
96
|
})().catch((err) => {
|
|
107
97
|
console.error("CodeCane postinstall failed:", err.message);
|
|
108
98
|
console.error("You can retry with: npm rebuild codecane --force");
|