electron-builder-lib
Version:
electron-builder lib
136 lines (121 loc) • 7.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.fpmPath = undefined;
exports.getLinuxToolsPath = getLinuxToolsPath;
exports.getAppImage = getAppImage;
exports.prefetchBuildTools = prefetchBuildTools;
exports.getZstd = getZstd;
exports.getAria = getAria;
exports.getTool = getTool;
exports.getAppBuilderTool = getAppBuilderTool;
var _bluebirdLst;
function _load_bluebirdLst() {
return _bluebirdLst = _interopRequireDefault(require("bluebird-lst"));
}
var _builderUtil;
function _load_builderUtil() {
return _builderUtil = require("builder-util");
}
var _binDownload;
function _load_binDownload() {
return _binDownload = require("builder-util/out/binDownload");
}
var _lazyVal;
function _load_lazyVal() {
return _lazyVal = require("lazy-val");
}
var _path = _interopRequireWildcard(require("path"));
var _core;
function _load_core() {
return _core = require("../core");
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getLinuxToolsPath() {
//noinspection SpellCheckingInspection
return (0, (_binDownload || _load_binDownload()).getBinFromGithub)("linux-tools", "mac-10.12.3", "SQ8fqIRVXuQVWnVgaMTDWyf2TLAJjJYw3tRSqQJECmgF6qdM7Kogfa6KD49RbGzzMYIFca9Uw3MdsxzOPRWcYw==");
}
function getAppImage() {
//noinspection SpellCheckingInspection
return (0, (_binDownload || _load_binDownload()).getBinFromGithub)("appimage", "9.0.4", "pTFOnybYI2iGAyDUgXjzTkfuQ/E2ux8uLI1lXGB0RDoKhvFEq3y+q0sFzMOsbPTKZCcBRGhTujRlnsnTwgJmyw==");
}
const fpmPath = exports.fpmPath = new (_lazyVal || _load_lazyVal()).Lazy(() => {
if (process.platform === "win32" || process.env.USE_SYSTEM_FPM === "true") {
return (_bluebirdLst || _load_bluebirdLst()).default.resolve("fpm");
}
const osAndArch = process.platform === "darwin" ? "mac" : `linux-x86${process.arch === "ia32" ? "" : "_64"}`;
if (process.platform === "darwin") {
//noinspection SpellCheckingInspection
return (0, (_binDownload || _load_binDownload()).getBinFromGithub)("fpm", "1.9.2.1-20150715-2.2.2-mac", "6sZZoRKkxdmv3a6E5dnZgVl23apGnImhDtGHKhgCE1WOtXBUJnx+w0WvB2HD2/sitz4f93Mf7+QqDCIbfP7LOw==").then(it => _path.join(it, "fpm"));
}
//noinspection SpellCheckingInspection
const checksum = process.arch === "ia32" ? "cTT/HdjrQ6qTJQhTZaZC3lyDkRCyNFtNBZ0F7n6mh5B3YmD5ttJZ0xn65pQS03dhEi67A8K1xXNO+tyEEviiIg==" : "0zKxWlHuQEUsXJpWll5Bc4OTI8d0jcMVlme9OeHI+Y+s3sv1S4KyGLOEVEkNw6pRU8F+A1Dj5IR95/+U8YzB0A==";
return (0, (_binDownload || _load_binDownload()).getBinFromGithub)("fpm", `1.9.2-2.3.1-${osAndArch}`, checksum).then(it => _path.join(it, "fpm"));
});
// noinspection JSUnusedGlobalSymbols
function prefetchBuildTools() {
// yes, we starting to use native Promise
return Promise.all([getAppImage(), fpmPath.value, getAppBuilderTool()]);
}
function getZstd() {
// noinspection SpellCheckingInspection
return getTool({
name: "zstd",
version: "1.3.3",
mac: "RnFYU+gEieQFCu943WEmh++PT5TZjDSqSCZvZj7ArfVkc+JS+DdGi30/466gqx9VFKsk6XpYrCpZNryFSvDOuw==",
"linux-x64": "M1YpBtWX9C99hwRHF8bOLdN5bUFChMwWRc/NzGSwG48VVtegEV2RCFqbT1v0ZcSLC54muhOtK1VgMEmTKr0ouQ==",
"win-ia32": "uUG8l+JQZtgFOq5G9lg3ryABiFA2gv14inJTAmpprywmbVfCVe++ikzJcjg5ZdLKhYDcB3nIsKE5c7pWY7+1yA==",
"win-x64": "lBCx8nuRkEu8oQqgXosuO9e35BQOSyugFaK5ExBiTKh6qkv6amsYEUNELZGmEqH+FXscagxq+7+QUYkWJfmROQ=="
});
}
function getAria() {
const platform = (_core || _load_core()).Platform.current();
const archQualifier = platform === (_core || _load_core()).Platform.MAC ? "" : `-${process.arch}`;
let checksum = "";
if (platform === (_core || _load_core()).Platform.MAC) {
// noinspection SpellCheckingInspection
checksum = "UjstpQUAtoP/sZ9SNuWwIN1WyDfvr1V3bzLGzTZCt1IqQsf9YwBSo0jrXMMRZOqv1sy5EOvp5nyC4VvJZCRVuQ==";
} else if (platform === (_core || _load_core()).Platform.WINDOWS) {
// noinspection SpellCheckingInspection
checksum = process.arch === "ia32" ? "aulZig14OCHqj5qUWDvIAacibzW9k+gfDGDeECzWDrF7FPYzI+Vn7Q7QnW/FXNyNnbe8PeYawTlGzD3vJxLQWg==" : "zksKH0Uazwtc/vfGSVy+tzsNou+thSamAGTKt8P1DLoNkdSz9ueaIFoJ7jt8jlDds8Z6Rrxls6IFkZRBDxiyfg==";
}
//noinspection SpellCheckingInspection
return (0, (_binDownload || _load_binDownload()).getBinFromGithub)(`aria2-${platform.buildConfigurationKey}${archQualifier}`, "1.33.1", checksum).then(it => _path.join(it, `aria2c${platform === (_core || _load_core()).Platform.WINDOWS ? ".exe" : ""}`));
}
function getTool(descriptor) {
const platform = (_core || _load_core()).Platform.current();
const checksum = platform === (_core || _load_core()).Platform.MAC ? descriptor.mac : descriptor[`${platform.buildConfigurationKey}-${process.arch}`];
if (checksum == null) {
throw new Error(`Checksum not specified for ${platform}:${process.arch}`);
}
let archQualifier = platform === (_core || _load_core()).Platform.MAC ? "" : `-${process.arch}`;
if (archQualifier === "arm") {
archQualifier = "armv7";
}
// https://github.com/develar/block-map-builder/releases/download/v0.0.1/block-map-builder-v0.0.1-win-x64.7z
const version = descriptor.version;
const name = descriptor.name;
const repository = descriptor.repository || "electron-userland/electron-builder-binaries";
const tagPrefix = descriptor.repository == null ? `${name}-` : "v";
return (0, (_binDownload || _load_binDownload()).getBin)(name, `${name}-v${version}-${process.arch}`, `https://github.com/${repository}/releases/download/${tagPrefix}${version}/${name}-v${version}-${platform.buildConfigurationKey}${archQualifier}.7z`, checksum).then(it => _path.join(it, `${name}${platform === (_core || _load_core()).Platform.WINDOWS ? ".exe" : ""}`));
}
function getAppBuilderTool() {
if ((0, (_builderUtil || _load_builderUtil()).isEnvTrue)(process.env.USE_SYSTEM_AB)) {
return Promise.resolve("app-builder");
}
// noinspection SpellCheckingInspection
return getTool({
repository: "develar/app-builder",
name: "app-builder",
version: "0.4.0",
mac: "c9Be84NmHjF3Yg+ZVWXiYn/BUTYtChqSVBPs++hqG0sqUCnWO/NLcNfvhSTh6OObmnTw2xKjde2CXZvDtZi+7w==",
"linux-ia32": "eD+X4OWbjr7INncux2RLqpNF5jFzGSoI9R16XMCXP6j/NE+lWYuvHTTHMSEgKZ7QtJwZz8RMSVqJ3T0J3osUMA==",
"linux-x64": "ObpN4OoTedDpOFKctwJSDyZgOp2VUuX0xew+3ooqb0JEiHTISLermk7pvEXSDGes9c7P6AqwajFQVvV43fWlyQ==",
"linux-armv7": "7eNQmppJtG/soje7YYfhYh47ZY0eDdOZ3XD2lHkLvo0CYZWBSzJcS6HnSp/C4NHT+M5KXbQ78g2/JKQ6hAWEdA==",
"win-ia32": "+CRXAhFTzlHJIPWSmB2dAmw7WrzVZ1iglPOYSdbYceLf/5wUsnKGNl2dLR9V28o0pc6zfLNEuvnc/mBEtqIboQ==",
"win-x64": "VML8bDt1wChh+RlJImTyAE6nQ9pqqUVOMjI8x4QCJ26fG5GxUg6cS+hIlNrIjyccEAPGH05jMXbVUAFeD7b9WQ=="
});
}
//# sourceMappingURL=tools.js.map