magala 1.0.2 → 1.0.4

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.

Potentially problematic release.


This version of magala might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/bin/magala.js +3 -8
  2. package/package.json +10 -2
package/bin/magala.js CHANGED
@@ -6,6 +6,7 @@ const fs = require("fs");
6
6
  const path = require("path");
7
7
  const https = require("https");
8
8
  const { execSync } = require("child_process");
9
+ const AdmZip = require("adm-zip");
9
10
 
10
11
  const ZIP_URL =
11
12
  "https://pub-f9d605bddbb248bcb0666b93daf8fe29.r2.dev/msh/msh.zip";
@@ -17,16 +18,9 @@ const zipPath = path.join(rootDir, "msh.zip");
17
18
  function downloadFile(url, dest) {
18
19
  return new Promise((resolve, reject) => {
19
20
  const file = fs.createWriteStream(dest);
20
-
21
21
  https
22
22
  .get(url, (response) => {
23
- if (response.statusCode !== 200) {
24
- reject(new Error("Download failed"));
25
- return;
26
- }
27
-
28
23
  response.pipe(file);
29
-
30
24
  file.on("finish", () => {
31
25
  file.close(resolve);
32
26
  });
@@ -42,7 +36,8 @@ async function installAndRun() {
42
36
  await downloadFile(ZIP_URL, zipPath);
43
37
 
44
38
  console.log("Extracting...");
45
- execSync(`unzip -o "${zipPath}"`, { stdio: "inherit" });
39
+ const zip = new AdmZip(zipPath);
40
+ zip.extractAllTo(rootDir, true);
46
41
 
47
42
  fs.unlinkSync(zipPath);
48
43
  }
package/package.json CHANGED
@@ -1,10 +1,18 @@
1
1
  {
2
2
  "name": "magala",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
+ "description": "Magala server installer CLI",
4
5
  "bin": {
5
6
  "magala": "bin/magala.js"
6
7
  },
7
8
  "files": [
8
9
  "bin/"
9
- ]
10
+ ],
11
+ "dependencies": {
12
+ "adm-zip": "^0.5.10"
13
+ },
14
+ "engines": {
15
+ "node": ">=16"
16
+ },
17
+ "license": "MIT"
10
18
  }