@varavel/vdl 0.4.0-alpha.5 → 0.5.0-alpha.2
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 +7 -26
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -40,9 +40,7 @@ function getPlatform() {
|
|
|
40
40
|
function getArch() {
|
|
41
41
|
const arch = ARCH_MAP[process.arch];
|
|
42
42
|
if (!arch) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
`Unsupported architecture: ${process.arch}. VDL supports x64 and arm64.`,
|
|
45
|
-
);
|
|
43
|
+
throw new Error(`Unsupported architecture: ${process.arch}. VDL supports x64 and arm64.`);
|
|
46
44
|
}
|
|
47
45
|
return arch;
|
|
48
46
|
}
|
|
@@ -103,9 +101,7 @@ function getChecksumsURL() {
|
|
|
103
101
|
*/
|
|
104
102
|
function verifyChecksum(binaryBuffer, checksumsBuffer, filename) {
|
|
105
103
|
const checksums = checksumsBuffer.toString("utf8");
|
|
106
|
-
const expectedLine = checksums
|
|
107
|
-
.split("\n")
|
|
108
|
-
.find((line) => line.trim().endsWith(filename));
|
|
104
|
+
const expectedLine = checksums.split("\n").find((line) => line.trim().endsWith(filename));
|
|
109
105
|
|
|
110
106
|
if (!expectedLine) {
|
|
111
107
|
throw new Error(`Checksum for ${filename} not found in checksums.txt`);
|
|
@@ -114,10 +110,7 @@ function verifyChecksum(binaryBuffer, checksumsBuffer, filename) {
|
|
|
114
110
|
// Checksums file format is: <hash> <filename>
|
|
115
111
|
const expectedHash = expectedLine.split(/\s+/)[0].trim();
|
|
116
112
|
|
|
117
|
-
const calculatedHash = crypto
|
|
118
|
-
.createHash("sha256")
|
|
119
|
-
.update(binaryBuffer)
|
|
120
|
-
.digest("hex");
|
|
113
|
+
const calculatedHash = crypto.createHash("sha256").update(binaryBuffer).digest("hex");
|
|
121
114
|
|
|
122
115
|
if (expectedHash !== calculatedHash) {
|
|
123
116
|
throw new Error(
|
|
@@ -162,10 +155,7 @@ function extractTarGz(buffer, binDir, binaryName) {
|
|
|
162
155
|
});
|
|
163
156
|
|
|
164
157
|
let binaryFound = false;
|
|
165
|
-
const searchPaths = [
|
|
166
|
-
path.join(tempDir, binaryName),
|
|
167
|
-
path.join(tempDir, "vdl", binaryName),
|
|
168
|
-
];
|
|
158
|
+
const searchPaths = [path.join(tempDir, binaryName), path.join(tempDir, "vdl", binaryName)];
|
|
169
159
|
|
|
170
160
|
for (const searchPath of searchPaths) {
|
|
171
161
|
if (fs.existsSync(searchPath)) {
|
|
@@ -181,11 +171,7 @@ function extractTarGz(buffer, binDir, binaryName) {
|
|
|
181
171
|
const files = execSync(`find "${tempDir}" -type f`, {
|
|
182
172
|
encoding: "utf8",
|
|
183
173
|
});
|
|
184
|
-
reject(
|
|
185
|
-
new Error(
|
|
186
|
-
`Binary ${binaryName} not found in archive.\nFound files:\n${files}`,
|
|
187
|
-
),
|
|
188
|
-
);
|
|
174
|
+
reject(new Error(`Binary ${binaryName} not found in archive.\nFound files:\n${files}`));
|
|
189
175
|
} else {
|
|
190
176
|
resolve();
|
|
191
177
|
}
|
|
@@ -235,10 +221,7 @@ function extractZip(buffer, binDir, binaryName) {
|
|
|
235
221
|
}
|
|
236
222
|
|
|
237
223
|
let binaryFound = false;
|
|
238
|
-
const searchPaths = [
|
|
239
|
-
path.join(tempDir, binaryName),
|
|
240
|
-
path.join(tempDir, "vdl", binaryName),
|
|
241
|
-
];
|
|
224
|
+
const searchPaths = [path.join(tempDir, binaryName), path.join(tempDir, "vdl", binaryName)];
|
|
242
225
|
|
|
243
226
|
for (const searchPath of searchPaths) {
|
|
244
227
|
if (fs.existsSync(searchPath)) {
|
|
@@ -288,9 +271,7 @@ function download(url) {
|
|
|
288
271
|
response.statusCode === 307 ||
|
|
289
272
|
response.statusCode === 308
|
|
290
273
|
) {
|
|
291
|
-
return download(response.headers.location)
|
|
292
|
-
.then(resolve)
|
|
293
|
-
.catch(reject);
|
|
274
|
+
return download(response.headers.location).then(resolve).catch(reject);
|
|
294
275
|
}
|
|
295
276
|
|
|
296
277
|
if (response.statusCode !== 200) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varavel/vdl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-alpha.2",
|
|
4
4
|
"description": "Open-source cross-language definition engine for modern stacks. Define your data structures, APIs, contracts, and generate type-safe code for your backend and frontend instantly.",
|
|
5
5
|
"author": "Varavel",
|
|
6
6
|
"license": "MIT",
|