🏡 index : github.com/captn3m0/which-electron.git

author Nemo <me@captnemo.in> 2021-07-16 21:10:18.0 +05:30:00
committer Nemo <me@captnemo.in> 2021-07-16 21:10:18.0 +05:30:00
commit
6350b54b85c802240907a6c3d5fbd484e86f9dc8 [patch]
tree
f748281cabaff82b4545e3817ecb42dec302cbf6
parent
339c92f6ad95429582c6e586e7df66062385ce77
download
6350b54b85c802240907a6c3d5fbd484e86f9dc8.tar.gz

Remove unused dependencies and get 7z binary



Diff

 package-lock.json | 163 ++++++++++----------------------------------------------------------------------
 package.json      |   4 +---
 zip.js            |   9 +++++++--
 3 files changed, 17 insertions(+), 159 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 568578c..44639df 100644
--- a/package-lock.json
+++ a/package-lock.json
@@ -8,11 +8,9 @@
      "version": "1.0.0",
      "license": "MIT",
      "dependencies": {
        "asar": "^3.0.3",
        "7zip-bin": "^5.1.1",
        "electron-fingerprints": "^1.0.0",
        "elfinfo": "*",
        "hasha": "^5.2.2",
        "macho": "^1.4.0",
        "node-7z": "^3.0.0",
        "rimraf": "^3.0.2",
        "semver-sort": "^0.0.4"
@@ -24,47 +22,10 @@
        "kuta": "*"
      }

    },

    "node_modules/@types/glob": {
      "version": "7.1.4",
      "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.4.tgz",
      "integrity": "sha512-w+LsMxKyYQm347Otw+IfBXOv9UWVjpHpCDdbBMt8Kz/xbvCYNjP+0qPh91Km3iKfSRLBB0P7fAMf0KHrPu+MyA==",
      "optional": true,
      "dependencies": {
        "@types/minimatch": "*",
        "@types/node": "*"
      }

    },

    "node_modules/@types/minimatch": {
      "version": "3.0.5",
      "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz",
      "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==",
      "optional": true
    },

    "node_modules/@types/node": {
      "version": "16.3.2",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.2.tgz",
      "integrity": "sha512-jJs9ErFLP403I+hMLGnqDRWT0RYKSvArxuBVh2veudHV7ifEC1WAmjJADacZ7mRbA2nWgHtn8xyECMAot0SkAw==",
      "optional": true
    },

    "node_modules/asar": {
      "version": "3.0.3",
      "resolved": "https://registry.npmjs.org/asar/-/asar-3.0.3.tgz",
      "integrity": "sha512-k7zd+KoR+n8pl71PvgElcoKHrVNiSXtw7odKbyNpmgKe7EGRF9Pnu3uLOukD37EvavKwVFxOUpqXTIZC5B5Pmw==",
      "dependencies": {
        "chromium-pickle-js": "^0.2.0",
        "commander": "^5.0.0",
        "glob": "^7.1.6",
        "minimatch": "^3.0.4"
      },

      "bin": {
        "asar": "bin/asar.js"
      },

      "engines": {
        "node": ">=10.12.0"
      },

      "optionalDependencies": {
        "@types/glob": "^7.1.1"
      }

    "node_modules/7zip-bin": {
      "version": "5.1.1",
      "resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-5.1.1.tgz",
      "integrity": "sha512-sAP4LldeWNz0lNzmTird3uWfFDWWTeg6V/MsmyyLR9X1idwKBWIgt/ZvinqQldJm3LecKEs1emkbquO6PCiLVQ=="
    },

    "node_modules/balanced-match": {
      "version": "1.0.2",
@@ -92,11 +53,6 @@
        "concat-map": "0.0.1"
      }

    },

    "node_modules/chromium-pickle-js": {
      "version": "0.2.0",
      "resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz",
      "integrity": "sha1-BKEGZywYsIWrd02YPfo+oTjyIgU="
    },

    "node_modules/cli-cursor": {
      "version": "2.1.0",
      "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
@@ -116,14 +72,6 @@
      "dev": true,
      "engines": {
        "node": ">=0.1.90"
      }

    },

    "node_modules/commander": {
      "version": "5.1.0",
      "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz",
      "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==",
      "engines": {
        "node": ">= 6"
      }

    },

    "node_modules/concat-map": {
@@ -151,25 +99,7 @@
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/electron-fingerprints/-/electron-fingerprints-1.0.0.tgz",
      "integrity": "sha512-vDW8IBu4tj/ZP/JGa7lcal9/Yc+prokzHfazi0OB/GIMeyUxfGznlK3RVJzGD5XxXgPyy6GEt5xrTNxB8TU/bA=="
    },

    "node_modules/elfinfo": {
      "version": "0.2.0-beta",
      "resolved": "https://registry.npmjs.org/elfinfo/-/elfinfo-0.2.0-beta.tgz",
      "integrity": "sha512-wIKg6MhAzNbzZug0/ppz+dfWYvNvgpbLGn+1OBUsB7+S0kgVC+ASNBYduhkKanQO0u7GcJUVd3AQYTmAi7FAIQ==",
      "dependencies": {
        "@types/node": "^14.14.22"
      }

    },

    "node_modules/elfinfo/node_modules/@types/node": {
      "version": "14.17.5",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.5.tgz",
      "integrity": "sha512-bjqH2cX/O33jXT/UmReo2pM7DIJREPMnarixbQ57DOOzzFaI6D2+IcwaJQaJpv0M1E9TIhPCYVxrkcityLjlqA=="
    },

    "node_modules/endian-reader": {
      "version": "0.1.0",
      "resolved": "https://registry.npmjs.org/endian-reader/-/endian-reader-0.1.0.tgz",
      "integrity": "sha1-7tYexWSqX2KFJI82JF4siRVtlKw="
    },

    "node_modules/fs.realpath": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -272,14 +202,6 @@
      "version": "3.0.2",
      "resolved": "https://registry.npmjs.org/lodash.negate/-/lodash.negate-3.0.2.tgz",
      "integrity": "sha1-nIl7C/YQAZ4LQ7j/Pwr+89e2bzQ="
    },

    "node_modules/macho": {
      "version": "1.4.0",
      "resolved": "https://registry.npmjs.org/macho/-/macho-1.4.0.tgz",
      "integrity": "sha512-PT3YMEKYogCeVYEA2bCFRZASNyn/JaOhjq6eV8SzBQ3RFia7XU8ASQCgGx+f3RnJFHT+xavLP+Qds48jQb0J5Q==",
      "dependencies": {
        "endian-reader": "^0.1.0"
      }

    },

    "node_modules/mimic-fn": {
      "version": "1.2.0",
@@ -450,39 +372,10 @@
    }

  },

  "dependencies": {
    "@types/glob": {
      "version": "7.1.4",
      "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.4.tgz",
      "integrity": "sha512-w+LsMxKyYQm347Otw+IfBXOv9UWVjpHpCDdbBMt8Kz/xbvCYNjP+0qPh91Km3iKfSRLBB0P7fAMf0KHrPu+MyA==",
      "optional": true,
      "requires": {
        "@types/minimatch": "*",
        "@types/node": "*"
      }

    },

    "@types/minimatch": {
      "version": "3.0.5",
      "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz",
      "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==",
      "optional": true
    },

    "@types/node": {
      "version": "16.3.2",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.2.tgz",
      "integrity": "sha512-jJs9ErFLP403I+hMLGnqDRWT0RYKSvArxuBVh2veudHV7ifEC1WAmjJADacZ7mRbA2nWgHtn8xyECMAot0SkAw==",
      "optional": true
    },

    "asar": {
      "version": "3.0.3",
      "resolved": "https://registry.npmjs.org/asar/-/asar-3.0.3.tgz",
      "integrity": "sha512-k7zd+KoR+n8pl71PvgElcoKHrVNiSXtw7odKbyNpmgKe7EGRF9Pnu3uLOukD37EvavKwVFxOUpqXTIZC5B5Pmw==",
      "requires": {
        "@types/glob": "^7.1.1",
        "chromium-pickle-js": "^0.2.0",
        "commander": "^5.0.0",
        "glob": "^7.1.6",
        "minimatch": "^3.0.4"
      }

    "7zip-bin": {
      "version": "5.1.1",
      "resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-5.1.1.tgz",
      "integrity": "sha512-sAP4LldeWNz0lNzmTird3uWfFDWWTeg6V/MsmyyLR9X1idwKBWIgt/ZvinqQldJm3LecKEs1emkbquO6PCiLVQ=="
    },

    "balanced-match": {
      "version": "1.0.2",
@@ -504,11 +397,6 @@
        "concat-map": "0.0.1"
      }

    },

    "chromium-pickle-js": {
      "version": "0.2.0",
      "resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz",
      "integrity": "sha1-BKEGZywYsIWrd02YPfo+oTjyIgU="
    },

    "cli-cursor": {
      "version": "2.1.0",
      "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
@@ -524,11 +412,6 @@
      "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
      "dev": true
    },

    "commander": {
      "version": "5.1.0",
      "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz",
      "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg=="
    },

    "concat-map": {
      "version": "0.0.1",
      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -546,27 +429,7 @@
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/electron-fingerprints/-/electron-fingerprints-1.0.0.tgz",
      "integrity": "sha512-vDW8IBu4tj/ZP/JGa7lcal9/Yc+prokzHfazi0OB/GIMeyUxfGznlK3RVJzGD5XxXgPyy6GEt5xrTNxB8TU/bA=="
    },

    "elfinfo": {
      "version": "0.2.0-beta",
      "resolved": "https://registry.npmjs.org/elfinfo/-/elfinfo-0.2.0-beta.tgz",
      "integrity": "sha512-wIKg6MhAzNbzZug0/ppz+dfWYvNvgpbLGn+1OBUsB7+S0kgVC+ASNBYduhkKanQO0u7GcJUVd3AQYTmAi7FAIQ==",
      "requires": {
        "@types/node": "^14.14.22"
      },

      "dependencies": {
        "@types/node": {
          "version": "14.17.5",
          "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.5.tgz",
          "integrity": "sha512-bjqH2cX/O33jXT/UmReo2pM7DIJREPMnarixbQ57DOOzzFaI6D2+IcwaJQaJpv0M1E9TIhPCYVxrkcityLjlqA=="
        }

      }

    },

    "endian-reader": {
      "version": "0.1.0",
      "resolved": "https://registry.npmjs.org/endian-reader/-/endian-reader-0.1.0.tgz",
      "integrity": "sha1-7tYexWSqX2KFJI82JF4siRVtlKw="
    },

    "fs.realpath": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -651,14 +514,6 @@
      "version": "3.0.2",
      "resolved": "https://registry.npmjs.org/lodash.negate/-/lodash.negate-3.0.2.tgz",
      "integrity": "sha1-nIl7C/YQAZ4LQ7j/Pwr+89e2bzQ="
    },

    "macho": {
      "version": "1.4.0",
      "resolved": "https://registry.npmjs.org/macho/-/macho-1.4.0.tgz",
      "integrity": "sha512-PT3YMEKYogCeVYEA2bCFRZASNyn/JaOhjq6eV8SzBQ3RFia7XU8ASQCgGx+f3RnJFHT+xavLP+Qds48jQb0J5Q==",
      "requires": {
        "endian-reader": "^0.1.0"
      }

    },

    "mimic-fn": {
      "version": "1.2.0",
diff --git a/package.json b/package.json
index 326af3c..fde2fdc 100644
--- a/package.json
+++ a/package.json
@@ -27,11 +27,9 @@
  },

  "homepage": "https://github.com/captn3m0/which-electron#readme",
  "dependencies": {
    "asar": "^3.0.3",
    "7zip-bin": "^5.1.1",
    "electron-fingerprints": "^1.0.0",
    "elfinfo": "*",
    "hasha": "^5.2.2",
    "macho": "^1.4.0",
    "node-7z": "^3.0.0",
    "rimraf": "^3.0.2",
    "semver-sort": "^0.0.4"
diff --git a/zip.js b/zip.js
index 594139c..51e5b0a 100644
--- a/zip.js
+++ a/zip.js
@@ -1,4 +1,5 @@
const Seven = require("node-7z");
const sevenBin = require('7zip-bin').path7za;
const path = require("path");
const fs = require("fs");

@@ -8,6 +9,7 @@
    let stream = Seven.extract(archive, "/tmp", {
      recursive: true,
      $cherryPick: filepath,
      $bin: sevenBin
    });
    let fn = path.basename(filepath);
    stream.on("end", ()=>{
@@ -17,14 +19,17 @@
  extractSomeFiles: function(archive, list, cb) {
    let dir = fs.mkdtempSync('/tmp/which-electron')
    let stream = Seven.extract(archive, dir, {
      $cherryPick: list
      $cherryPick: list,
      $bin: sevenBin
    })
    stream.on('end', ()=>{
      cb(dir)
    })
  },
  listFileContents: function(archive, cb) {
    let zip = Seven.list(archive);
    let zip = Seven.list(archive, {
      $bin: sevenBin
    });
    let entries = [];
    zip.on("data", (data) => {
      entries.push(data);