47 lines
4.8 KiB
JavaScript
47 lines
4.8 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
|
|
require("source-map-support/register");
|
|
|
|
var _installerDarwin = _interopRequireDefault(require("@electron-forge/installer-darwin"));
|
|
|
|
var _crossSpawnPromise = require("@malept/cross-spawn-promise");
|
|
|
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
|
|
var _path = _interopRequireDefault(require("path"));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
class InstallerZip extends _installerDarwin.default {
|
|
constructor(...args) {
|
|
super(...args);
|
|
|
|
_defineProperty(this, "name", 'zip');
|
|
}
|
|
|
|
async install({
|
|
filePath,
|
|
installSpinner
|
|
}) {
|
|
await (0, _crossSpawnPromise.spawn)('unzip', ['-q', '-o', _path.default.basename(filePath)], {
|
|
cwd: _path.default.dirname(filePath)
|
|
});
|
|
const appPath = (await _fsExtra.default.readdir(_path.default.dirname(filePath))).filter(file => file.endsWith('.app')).map(file => _path.default.resolve(_path.default.dirname(filePath), file)).sort((fA, fB) => _fsExtra.default.statSync(fA).ctime.getTime() - _fsExtra.default.statSync(fB).ctime.getTime())[0];
|
|
const targetApplicationPath = `/Applications/${_path.default.basename(appPath)}`;
|
|
await this.moveApp(appPath, targetApplicationPath, installSpinner);
|
|
await (0, _crossSpawnPromise.spawn)('open', ['-R', targetApplicationPath], {
|
|
detached: true
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = InstallerZip;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9JbnN0YWxsZXJaaXAudHMiXSwibmFtZXMiOlsiS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