dlw-machine-setup 0.14.1 → 0.15.0-test.10

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.
Files changed (2) hide show
  1. package/bin/installer.js +6 -3
  2. package/package.json +1 -1
package/bin/installer.js CHANGED
@@ -278,6 +278,9 @@ var import_path2 = require("path");
278
278
  var import_child_process2 = require("child_process");
279
279
  var MIN_FILE_SIZE = 1024;
280
280
  async function downloadAndExtractAsset(token, asset, projectPath, tempDirName) {
281
+ return downloadAndExtractTgz(token, asset.url, asset.name, projectPath, tempDirName, "application/octet-stream");
282
+ }
283
+ async function downloadAndExtractTgz(token, url, archiveName, projectPath, tempDirName, accept) {
281
284
  const tarCheck = (0, import_child_process2.spawnSync)("tar", ["--version"], { stdio: "ignore" });
282
285
  if (tarCheck.status !== 0) {
283
286
  throw new Error("tar command not found. Please ensure tar is installed and available in your PATH.");
@@ -294,13 +297,13 @@ async function downloadAndExtractAsset(token, asset, projectPath, tempDirName) {
294
297
  }
295
298
  };
296
299
  try {
297
- const dlRes = await fetchWithRetry(asset.url, {
298
- headers: { "Accept": "application/octet-stream", "Authorization": `Bearer ${token}` }
300
+ const dlRes = await fetchWithRetry(url, {
301
+ headers: { "Accept": accept, "Authorization": `Bearer ${token}` }
299
302
  });
300
303
  if (!dlRes.ok) {
301
304
  throw new Error(`Download failed: ${getReadableError(dlRes.status)}`);
302
305
  }
303
- const archivePath = (0, import_path2.join)(tempDir, asset.name);
306
+ const archivePath = (0, import_path2.join)(tempDir, archiveName);
304
307
  (0, import_fs2.writeFileSync)(archivePath, Buffer.from(await dlRes.arrayBuffer()));
305
308
  if ((0, import_fs2.statSync)(archivePath).size < MIN_FILE_SIZE) {
306
309
  throw new Error("File corrupted");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.14.1",
3
+ "version": "0.15.0-test.10",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"