@djinnos/djinn 0.1.0 → 0.1.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/package.json +1 -1
- package/scripts/install.js +8 -25
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -4,8 +4,6 @@ const https = require('https');
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const { execSync } = require('child_process');
|
|
7
|
-
const zlib = require('zlib');
|
|
8
|
-
const tar = require('tar');
|
|
9
7
|
|
|
10
8
|
const REPO = 'djinnos/djinn';
|
|
11
9
|
const BINARY_NAME = 'djinn';
|
|
@@ -84,27 +82,6 @@ async function downloadFile(url, dest) {
|
|
|
84
82
|
});
|
|
85
83
|
}
|
|
86
84
|
|
|
87
|
-
async function extractTarGz(archivePath, destDir) {
|
|
88
|
-
return new Promise((resolve, reject) => {
|
|
89
|
-
fs.createReadStream(archivePath)
|
|
90
|
-
.pipe(zlib.createGunzip())
|
|
91
|
-
.pipe(tar.extract({ cwd: destDir }))
|
|
92
|
-
.on('finish', resolve)
|
|
93
|
-
.on('error', reject);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async function extractZip(archivePath, destDir) {
|
|
98
|
-
// For Windows, use PowerShell to extract
|
|
99
|
-
try {
|
|
100
|
-
execSync(`powershell -command "Expand-Archive -Path '${archivePath}' -DestinationPath '${destDir}' -Force"`, {
|
|
101
|
-
stdio: 'pipe'
|
|
102
|
-
});
|
|
103
|
-
} catch (e) {
|
|
104
|
-
throw new Error('Failed to extract zip archive');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
85
|
async function main() {
|
|
109
86
|
try {
|
|
110
87
|
const platform = getPlatform();
|
|
@@ -132,9 +109,15 @@ async function main() {
|
|
|
132
109
|
|
|
133
110
|
console.log('Extracting...');
|
|
134
111
|
if (ext === 'zip') {
|
|
135
|
-
|
|
112
|
+
// Windows: use PowerShell
|
|
113
|
+
execSync(`powershell -command "Expand-Archive -Path '${archivePath}' -DestinationPath '${tmpDir}' -Force"`, {
|
|
114
|
+
stdio: 'pipe'
|
|
115
|
+
});
|
|
136
116
|
} else {
|
|
137
|
-
|
|
117
|
+
// macOS/Linux: use tar command
|
|
118
|
+
execSync(`tar -xzf "${archivePath}" -C "${tmpDir}"`, {
|
|
119
|
+
stdio: 'pipe'
|
|
120
|
+
});
|
|
138
121
|
}
|
|
139
122
|
|
|
140
123
|
// Move binary to bin directory
|