electron-builder
Version:
A complete solution to package and build a ready for distribution Electron app for MacOS, Windows and Linux with “auto update” support out of the box
103 lines (86 loc) • 3.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _bluebirdLstC;
function _load_bluebirdLstC() {
return _bluebirdLstC = require("bluebird-lst-c");
}
let getGitUrlFromGitConfig = (() => {
var _ref = (0, (_bluebirdLstC || _load_bluebirdLstC()).coroutine)(function* () {
let data = null;
try {
data = yield (0, (_fsExtraP || _load_fsExtraP()).readFile)((_path || _load_path()).join(".git", "config"), "utf8");
} catch (e) {
if (e.code === "ENOENT") {
return null;
}
throw e;
}
const conf = data.split(/\r?\n/);
const i = conf.indexOf('[remote "origin"]');
if (i !== -1) {
let u = conf[i + 1];
if (!u.match(/^\s*url =/)) {
u = conf[i + 2];
}
if (u.match(/^\s*url =/)) {
return u.replace(/^\s*url = /, "");
}
}
return null;
});
return function getGitUrlFromGitConfig() {
return _ref.apply(this, arguments);
};
})();
let _getInfo = (() => {
var _ref2 = (0, (_bluebirdLstC || _load_bluebirdLstC()).coroutine)(function* (metadata, devMetadata) {
const repo = metadata == null ? null : devMetadata.repository || metadata.repository;
if (repo == null) {
let url = process.env.TRAVIS_REPO_SLUG;
if (url == null) {
const user = process.env.APPVEYOR_ACCOUNT_NAME || process.env.CIRCLE_PROJECT_USERNAME;
const project = process.env.APPVEYOR_PROJECT_NAME || process.env.CIRCLE_PROJECT_REPONAME;
if (user != null && project != null) {
return {
user: user,
project: project
};
}
url = yield getGitUrlFromGitConfig();
}
if (url != null) {
return (0, (_hostedGitInfo || _load_hostedGitInfo()).fromUrl)(url);
}
} else {
return (0, (_hostedGitInfo || _load_hostedGitInfo()).fromUrl)(typeof repo === "string" ? repo : repo.url);
}
return null;
});
return function _getInfo(_x, _x2) {
return _ref2.apply(this, arguments);
};
})();
//# sourceMappingURL=repositoryInfo.js.map
exports.getRepositoryInfo = getRepositoryInfo;
var _hostedGitInfo;
function _load_hostedGitInfo() {
return _hostedGitInfo = require("hosted-git-info");
}
var _fsExtraP;
function _load_fsExtraP() {
return _fsExtraP = require("fs-extra-p");
}
var _path;
function _load_path() {
return _path = _interopRequireWildcard(require("path"));
}
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; } }
let info;
function getRepositoryInfo(metadata, devMetadata) {
if (info == null) {
info = _getInfo(metadata, devMetadata);
}
return info;
}