Use asar instead

This commit is contained in:
Jiiks 2018-08-27 17:28:42 +03:00
parent 4e3a56e466
commit f14b1b71e7
4 changed files with 335 additions and 482 deletions

View File

@ -23,9 +23,10 @@
<script>
// Imports
import archiver from 'archiver';
import asar from 'asar';
import electron from 'electron';
import fs from 'fs';
import { Toasts } from 'ui';
import { Settings } from 'modules';
import { ClientLogger as Logger } from 'common';
import { shell } from 'electron';
@ -57,18 +58,10 @@
}, filepath => {
if (!filepath) return;
const archive = archiver('zip', {
zlib: { level: 0 }
asar.uncache(filepath);
asar.createPackage(this.plugin.contentPath, filepath, () => {
Toasts.success('Plugin Packaged!');
});
const out = fs.createWriteStream(filepath);
archive.pipe(out);
archive.glob('**/*', {
cwd: this.plugin.contentPath,
root: this.plugin.contentPath
});
archive.finalize();
});
},
editPlugin() {

View File

@ -32,6 +32,7 @@ module.exports = {
},
externals: {
electron: 'require("electron")',
asar: 'require("asar")',
fs: 'require("fs")',
path: 'require("path")',
util: 'require("util")',
@ -39,7 +40,7 @@ module.exports = {
net: 'require("net")',
request: 'require(require("path").join(require("electron").remote.app.getAppPath(), "node_modules", "request"))',
sparkplug: 'require("../../core/dist/sparkplug")',
archiver: 'require("archiver")',
asar: 'require("asar")',
'node-crypto': 'require("crypto")'
},
resolve: {

793
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,11 +21,11 @@
"fs-extra": "^7.0.0",
"keytar": "4.2.1",
"nedb": "^1.8.0",
"node-sass": "^4.9.2"
"node-sass": "^4.9.2",
"asar": "^0.14.3"
},
"devDependencies": {
"aes256": "^1.0.4",
"archiver": "^2.1.1",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",