update electron to v43
This commit is contained in:
parent
68ac0beedf
commit
fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions
200
electron/node_modules/app-builder-lib/out/publish/PublishManager.js
generated
vendored
200
electron/node_modules/app-builder-lib/out/publish/PublishManager.js
generated
vendored
|
|
@ -1,28 +1,28 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getPublishConfigs = exports.computeDownloadUrl = exports.createPublisher = exports.getPublishConfigsForUpdateInfo = exports.getAppUpdatePublishConfiguration = exports.PublishManager = void 0;
|
||||
const bluebird_lst_1 = require("bluebird-lst");
|
||||
exports.PublishManager = void 0;
|
||||
exports.getAppUpdatePublishConfiguration = getAppUpdatePublishConfiguration;
|
||||
exports.getPublishConfigsForUpdateInfo = getPublishConfigsForUpdateInfo;
|
||||
exports.createPublisher = createPublisher;
|
||||
exports.computeDownloadUrl = computeDownloadUrl;
|
||||
exports.getPublishConfigs = getPublishConfigs;
|
||||
const builder_util_1 = require("builder-util");
|
||||
const builder_util_runtime_1 = require("builder-util-runtime");
|
||||
const debug_1 = require("debug");
|
||||
const electron_publish_1 = require("electron-publish");
|
||||
const gitHubPublisher_1 = require("electron-publish/out/gitHubPublisher");
|
||||
const multiProgress_1 = require("electron-publish/out/multiProgress");
|
||||
const s3Publisher_1 = require("./s3/s3Publisher");
|
||||
const spacesPublisher_1 = require("./s3/spacesPublisher");
|
||||
const promises_1 = require("fs/promises");
|
||||
const isCi = require("is-ci");
|
||||
const ci_info_1 = require("ci-info");
|
||||
const path = require("path");
|
||||
const url = require("url");
|
||||
const index_1 = require("../index");
|
||||
const macroExpander_1 = require("../util/macroExpander");
|
||||
const SnapStorePublisher_1 = require("./SnapStorePublisher");
|
||||
const updateInfoBuilder_1 = require("./updateInfoBuilder");
|
||||
const KeygenPublisher_1 = require("./KeygenPublisher");
|
||||
const BitbucketPublisher_1 = require("./BitbucketPublisher");
|
||||
const resolve_1 = require("../util/resolve");
|
||||
const pathManager_1 = require("../util/pathManager");
|
||||
const publishForPrWarning = "There are serious security concerns with PUBLISH_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)" +
|
||||
"\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you.";
|
||||
const debug = debug_1.default("electron-builder:publish");
|
||||
const debug = (0, debug_1.default)("electron-builder:publish");
|
||||
function checkOptions(publishPolicy) {
|
||||
if (publishPolicy != null && publishPolicy !== "onTag" && publishPolicy !== "onTagOrDraft" && publishPolicy !== "always" && publishPolicy !== "never") {
|
||||
if (typeof publishPolicy === "string") {
|
||||
|
|
@ -42,25 +42,26 @@ class PublishManager {
|
|||
checkOptions(publishOptions.publish);
|
||||
this.taskManager = new builder_util_1.AsyncTaskManager(cancellationToken);
|
||||
const forcePublishForPr = process.env.PUBLISH_FOR_PULL_REQUEST === "true";
|
||||
if (!builder_util_1.isPullRequest() || forcePublishForPr) {
|
||||
if (!(0, builder_util_1.isPullRequest)() || forcePublishForPr) {
|
||||
if (publishOptions.publish === undefined) {
|
||||
if (process.env.npm_lifecycle_event === "release") {
|
||||
builder_util_1.log.warn("Implicit publishing triggered by npm lifecycle event 'release'. This behavior will be disabled in electron-builder v27. Please use --publish explicitly.");
|
||||
publishOptions.publish = "always";
|
||||
}
|
||||
else {
|
||||
const tag = electron_publish_1.getCiTag();
|
||||
const tag = (0, electron_publish_1.getCiTag)();
|
||||
if (tag != null) {
|
||||
builder_util_1.log.info({ reason: "tag is defined", tag }, "artifacts will be published");
|
||||
builder_util_1.log.warn({ tag }, "Implicit publishing triggered by git tag. This behavior will be disabled in electron-builder v27. Please use --publish explicitly.");
|
||||
publishOptions.publish = "onTag";
|
||||
}
|
||||
else if (isCi) {
|
||||
builder_util_1.log.info({ reason: "CI detected" }, "artifacts will be published if draft release exists");
|
||||
else if (ci_info_1.isCI) {
|
||||
builder_util_1.log.warn("Implicit publishing triggered by CI detection. This behavior will be disabled in electron-builder v27. Please use --publish explicitly.");
|
||||
publishOptions.publish = "onTagOrDraft";
|
||||
}
|
||||
}
|
||||
}
|
||||
const publishPolicy = publishOptions.publish;
|
||||
this.isPublish = publishPolicy != null && publishOptions.publish !== "never" && (publishPolicy !== "onTag" || electron_publish_1.getCiTag() != null);
|
||||
this.isPublish = publishPolicy != null && publishOptions.publish !== "never" && (publishPolicy !== "onTag" || (0, electron_publish_1.getCiTag)() != null);
|
||||
if (this.isPublish && forcePublishForPr) {
|
||||
builder_util_1.log.warn(publishForPrWarning);
|
||||
}
|
||||
|
|
@ -71,7 +72,7 @@ class PublishManager {
|
|||
solution: `set env PUBLISH_FOR_PULL_REQUEST to true to force code signing\n${publishForPrWarning}`,
|
||||
}, "publishing will be skipped");
|
||||
}
|
||||
packager.addAfterPackHandler(async (event) => {
|
||||
packager.onAfterPack(async (event) => {
|
||||
const packager = event.packager;
|
||||
if (event.electronPlatformName === "darwin") {
|
||||
if (!event.targets.some(it => it.name === "dmg" || it.name === "zip")) {
|
||||
|
|
@ -83,25 +84,21 @@ class PublishManager {
|
|||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// AppImage writes data to AppImage stage dir, not to linux-unpacked
|
||||
return;
|
||||
}
|
||||
const publishConfig = await getAppUpdatePublishConfiguration(packager, event.arch, this.isPublish);
|
||||
const publishConfig = await getAppUpdatePublishConfiguration(packager, null, event.arch, this.isPublish);
|
||||
if (publishConfig != null) {
|
||||
await promises_1.writeFile(path.join(packager.getResourcesDir(event.appOutDir), "app-update.yml"), builder_util_1.serializeToYaml(publishConfig));
|
||||
await (0, promises_1.writeFile)(path.join(packager.getResourcesDir(event.appOutDir), "app-update.yml"), (0, builder_util_1.serializeToYaml)(publishConfig));
|
||||
}
|
||||
});
|
||||
packager.artifactCreated(event => {
|
||||
packager.onArtifactCreated(async (event) => {
|
||||
const publishConfiguration = event.publishConfig;
|
||||
if (publishConfiguration == null) {
|
||||
this.taskManager.addTask(this.artifactCreatedWithoutExplicitPublishConfig(event));
|
||||
}
|
||||
else if (this.isPublish) {
|
||||
if (debug.enabled) {
|
||||
debug(`artifactCreated (isPublish: ${this.isPublish}): ${builder_util_1.safeStringifyJson(event, new Set(["packager"]))},\n publishConfig: ${builder_util_1.safeStringifyJson(publishConfiguration)}`);
|
||||
debug(`artifactCreated (isPublish: ${this.isPublish}): ${(0, builder_util_1.safeStringifyJson)(event, new Set(["packager"]))},\n publishConfig: ${(0, builder_util_1.safeStringifyJson)(publishConfiguration)}`);
|
||||
}
|
||||
this.scheduleUpload(publishConfiguration, event, this.getAppInfo(event.packager));
|
||||
await this.scheduleUpload(publishConfiguration, event, this.getAppInfo(event.packager));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -112,23 +109,22 @@ class PublishManager {
|
|||
const publishers = this.packager.config.publish;
|
||||
return await resolvePublishConfigurations(publishers, null, this.packager, null, true);
|
||||
}
|
||||
/** @internal */
|
||||
scheduleUpload(publishConfig, event, appInfo) {
|
||||
async scheduleUpload(publishConfig, event, appInfo) {
|
||||
if (publishConfig.provider === "generic") {
|
||||
return;
|
||||
}
|
||||
const publisher = this.getOrCreatePublisher(publishConfig, appInfo);
|
||||
const publisher = await this.getOrCreatePublisher(publishConfig, appInfo);
|
||||
if (publisher == null) {
|
||||
builder_util_1.log.debug({
|
||||
file: event.file,
|
||||
file: builder_util_1.log.filePath(event.file),
|
||||
reason: "publisher is null",
|
||||
publishConfig: builder_util_1.safeStringifyJson(publishConfig),
|
||||
publishConfig: (0, builder_util_1.safeStringifyJson)(publishConfig),
|
||||
}, "not published");
|
||||
return;
|
||||
}
|
||||
const providerName = publisher.providerName;
|
||||
if (this.publishOptions.publish === "onTagOrDraft" && electron_publish_1.getCiTag() == null && providerName !== "bitbucket" && providerName !== "github") {
|
||||
builder_util_1.log.info({ file: event.file, reason: "current build is not for a git tag", publishPolicy: "onTagOrDraft" }, `not published to ${providerName}`);
|
||||
if (this.publishOptions.publish === "onTagOrDraft" && (0, electron_publish_1.getCiTag)() == null && providerName !== "bitbucket" && providerName !== "github") {
|
||||
builder_util_1.log.info({ file: builder_util_1.log.filePath(event.file), reason: "current build is not for a git tag", publishPolicy: "onTagOrDraft" }, `not published to ${providerName}`);
|
||||
return;
|
||||
}
|
||||
if (publishConfig.timeout) {
|
||||
|
|
@ -141,7 +137,7 @@ class PublishManager {
|
|||
const target = event.target;
|
||||
const publishConfigs = await getPublishConfigs(platformPackager, target == null ? null : target.options, event.arch, this.isPublish);
|
||||
if (debug.enabled) {
|
||||
debug(`artifactCreated (isPublish: ${this.isPublish}): ${builder_util_1.safeStringifyJson(event, new Set(["packager"]))},\n publishConfigs: ${builder_util_1.safeStringifyJson(publishConfigs)}`);
|
||||
debug(`artifactCreated (isPublish: ${this.isPublish}): ${(0, builder_util_1.safeStringifyJson)(event, new Set(["packager"]))},\n publishConfigs: ${(0, builder_util_1.safeStringifyJson)(publishConfigs)}`);
|
||||
}
|
||||
const eventFile = event.file;
|
||||
if (publishConfigs == null) {
|
||||
|
|
@ -156,7 +152,7 @@ class PublishManager {
|
|||
builder_util_1.log.debug({ file: event.file, reason: "cancelled" }, "not published");
|
||||
break;
|
||||
}
|
||||
this.scheduleUpload(publishConfig, event, this.getAppInfo(platformPackager));
|
||||
await this.scheduleUpload(publishConfig, event, this.getAppInfo(platformPackager));
|
||||
}
|
||||
}
|
||||
if (event.isWriteUpdateInfo &&
|
||||
|
|
@ -164,15 +160,15 @@ class PublishManager {
|
|||
eventFile != null &&
|
||||
!this.cancellationToken.cancelled &&
|
||||
(platformPackager.platform !== index_1.Platform.WINDOWS || isSuitableWindowsTarget(target))) {
|
||||
this.taskManager.addTask(updateInfoBuilder_1.createUpdateInfoTasks(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it)));
|
||||
this.taskManager.addTask((0, updateInfoBuilder_1.createUpdateInfoTasks)(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it)));
|
||||
}
|
||||
}
|
||||
getOrCreatePublisher(publishConfig, appInfo) {
|
||||
async getOrCreatePublisher(publishConfig, appInfo) {
|
||||
// to not include token into cache key
|
||||
const providerCacheKey = builder_util_1.safeStringifyJson(publishConfig);
|
||||
const providerCacheKey = (0, builder_util_1.safeStringifyJson)(publishConfig);
|
||||
let publisher = this.nameToPublisher.get(providerCacheKey);
|
||||
if (publisher == null) {
|
||||
publisher = createPublisher(this, appInfo.version, publishConfig, this.publishOptions, this.packager);
|
||||
publisher = await createPublisher(this, appInfo.version, publishConfig, this.publishOptions, this.packager);
|
||||
this.nameToPublisher.set(providerCacheKey, publisher);
|
||||
builder_util_1.log.info({ publisher: publisher.toString() }, "publishing");
|
||||
}
|
||||
|
|
@ -189,12 +185,12 @@ class PublishManager {
|
|||
if (this.cancellationToken.cancelled || updateInfoFileTasks.length === 0) {
|
||||
return;
|
||||
}
|
||||
await updateInfoBuilder_1.writeUpdateInfoFiles(updateInfoFileTasks, this.packager);
|
||||
await (0, updateInfoBuilder_1.writeUpdateInfoFiles)(updateInfoFileTasks, this.packager);
|
||||
await this.taskManager.awaitTasks();
|
||||
}
|
||||
}
|
||||
exports.PublishManager = PublishManager;
|
||||
async function getAppUpdatePublishConfiguration(packager, arch, errorIfCannot) {
|
||||
async function getAppUpdatePublishConfiguration(packager, targetSpecificOptions, arch, errorIfCannot) {
|
||||
const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, null, arch, errorIfCannot), arch);
|
||||
if (publishConfigs == null || publishConfigs.length === 0) {
|
||||
return null;
|
||||
|
|
@ -205,14 +201,13 @@ async function getAppUpdatePublishConfiguration(packager, arch, errorIfCannot) {
|
|||
};
|
||||
if (packager.platform === index_1.Platform.WINDOWS && publishConfig.publisherName == null) {
|
||||
const winPackager = packager;
|
||||
const publisherName = winPackager.isForceCodeSigningVerification ? await winPackager.computedPublisherName.value : undefined;
|
||||
const publisherName = winPackager.isForceCodeSigningVerification ? await (await winPackager.signingManager.value).computedPublisherName.value : undefined;
|
||||
if (publisherName != null) {
|
||||
publishConfig.publisherName = publisherName;
|
||||
}
|
||||
}
|
||||
return publishConfig;
|
||||
}
|
||||
exports.getAppUpdatePublishConfiguration = getAppUpdatePublishConfiguration;
|
||||
async function getPublishConfigsForUpdateInfo(packager, publishConfigs, arch) {
|
||||
if (publishConfigs === null) {
|
||||
return null;
|
||||
|
|
@ -222,68 +217,98 @@ async function getPublishConfigsForUpdateInfo(packager, publishConfigs, arch) {
|
|||
// https://github.com/electron-userland/electron-builder/issues/925#issuecomment-261732378
|
||||
// default publish config is github, file should be generated regardless of publish state (user can test installer locally or manage the release process manually)
|
||||
const repositoryInfo = await packager.info.repositoryInfo;
|
||||
debug(`getPublishConfigsForUpdateInfo: ${builder_util_1.safeStringifyJson(repositoryInfo)}`);
|
||||
debug(`getPublishConfigsForUpdateInfo: ${(0, builder_util_1.safeStringifyJson)(repositoryInfo)}`);
|
||||
if (repositoryInfo != null && repositoryInfo.type === "github") {
|
||||
const resolvedPublishConfig = await getResolvedPublishConfig(packager, packager.info, { provider: repositoryInfo.type }, arch, false);
|
||||
if (resolvedPublishConfig != null) {
|
||||
debug(`getPublishConfigsForUpdateInfo: resolve to publish config ${builder_util_1.safeStringifyJson(resolvedPublishConfig)}`);
|
||||
debug(`getPublishConfigsForUpdateInfo: resolve to publish config ${(0, builder_util_1.safeStringifyJson)(resolvedPublishConfig)}`);
|
||||
return [resolvedPublishConfig];
|
||||
}
|
||||
}
|
||||
}
|
||||
return publishConfigs;
|
||||
}
|
||||
exports.getPublishConfigsForUpdateInfo = getPublishConfigsForUpdateInfo;
|
||||
function createPublisher(context, version, publishConfig, options, packager) {
|
||||
async function resolveReleaseBody(packager) {
|
||||
const releaseInfo = packager.config.releaseInfo;
|
||||
if (releaseInfo === null || releaseInfo === void 0 ? void 0 : releaseInfo.releaseNotes) {
|
||||
return releaseInfo.releaseNotes;
|
||||
}
|
||||
if (releaseInfo === null || releaseInfo === void 0 ? void 0 : releaseInfo.releaseNotesFile) {
|
||||
try {
|
||||
return await (0, promises_1.readFile)(path.resolve(packager.projectDir, releaseInfo.releaseNotesFile), "utf-8");
|
||||
}
|
||||
catch (e) {
|
||||
builder_util_1.log.warn({ file: releaseInfo.releaseNotesFile, error: e.message }, "cannot read release notes file");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await (0, promises_1.readFile)(path.resolve(packager.projectDir, "release-notes.md"), "utf-8");
|
||||
}
|
||||
catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
async function createPublisher(context, version, publishConfig, options, packager) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
if (debug.enabled) {
|
||||
debug(`Create publisher: ${builder_util_1.safeStringifyJson(publishConfig)}`);
|
||||
debug(`Create publisher: ${(0, builder_util_1.safeStringifyJson)(publishConfig)}`);
|
||||
}
|
||||
const provider = publishConfig.provider;
|
||||
switch (provider) {
|
||||
case "github":
|
||||
return new gitHubPublisher_1.GitHubPublisher(context, publishConfig, version, options);
|
||||
case "github": {
|
||||
const releaseBody = await resolveReleaseBody(packager);
|
||||
const releaseName = (_b = (_a = packager.config.releaseInfo) === null || _a === void 0 ? void 0 : _a.releaseName) !== null && _b !== void 0 ? _b : null;
|
||||
return new electron_publish_1.GitHubPublisher(context, publishConfig, version, options, releaseBody, releaseName);
|
||||
}
|
||||
case "gitlab": {
|
||||
const releaseBody = await resolveReleaseBody(packager);
|
||||
const releaseName = (_d = (_c = packager.config.releaseInfo) === null || _c === void 0 ? void 0 : _c.releaseName) !== null && _d !== void 0 ? _d : null;
|
||||
return new electron_publish_1.GitlabPublisher(context, publishConfig, version, releaseBody, releaseName);
|
||||
}
|
||||
case "keygen":
|
||||
return new KeygenPublisher_1.KeygenPublisher(context, publishConfig, version);
|
||||
return new electron_publish_1.KeygenPublisher(context, publishConfig, version);
|
||||
case "snapStore":
|
||||
return new SnapStorePublisher_1.SnapStorePublisher(context, publishConfig);
|
||||
return new electron_publish_1.SnapStorePublisher(context, publishConfig, { cscLink: (_e = packager.config.snapcraft) === null || _e === void 0 ? void 0 : _e.cscLink, resourcesDir: packager.buildResourcesDir });
|
||||
case "generic":
|
||||
return null;
|
||||
default: {
|
||||
const clazz = requireProviderClass(provider, packager);
|
||||
const clazz = await requireProviderClass(provider, packager);
|
||||
return clazz == null ? null : new clazz(context, publishConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.createPublisher = createPublisher;
|
||||
function requireProviderClass(provider, packager) {
|
||||
async function requireProviderClass(provider, packager) {
|
||||
switch (provider) {
|
||||
case "github":
|
||||
return gitHubPublisher_1.GitHubPublisher;
|
||||
return electron_publish_1.GitHubPublisher;
|
||||
case "gitlab":
|
||||
return electron_publish_1.GitlabPublisher;
|
||||
case "generic":
|
||||
return null;
|
||||
case "keygen":
|
||||
return KeygenPublisher_1.KeygenPublisher;
|
||||
return electron_publish_1.KeygenPublisher;
|
||||
case "s3":
|
||||
return s3Publisher_1.default;
|
||||
return electron_publish_1.S3Publisher;
|
||||
case "snapStore":
|
||||
return SnapStorePublisher_1.SnapStorePublisher;
|
||||
return electron_publish_1.SnapStorePublisher;
|
||||
case "spaces":
|
||||
return spacesPublisher_1.default;
|
||||
return electron_publish_1.SpacesPublisher;
|
||||
case "bitbucket":
|
||||
return BitbucketPublisher_1.BitbucketPublisher;
|
||||
return electron_publish_1.BitbucketPublisher;
|
||||
default: {
|
||||
const name = `electron-publisher-${provider}`;
|
||||
let module = null;
|
||||
try {
|
||||
module = require(path.join(packager.buildResourcesDir, name + ".js"));
|
||||
const extensions = ["mjs", "js", "cjs"];
|
||||
const template = `electron-publisher-${provider}`;
|
||||
const name = (ext) => `${template}.${ext}`;
|
||||
const validPublisherFiles = extensions.map(ext => path.join(packager.buildResourcesDir, name(ext)));
|
||||
for (const potentialFile of validPublisherFiles) {
|
||||
if (await (0, builder_util_1.exists)(potentialFile)) {
|
||||
const module = await (0, resolve_1.resolveModule)(packager.appInfo.type, potentialFile);
|
||||
return module.default || module;
|
||||
}
|
||||
}
|
||||
catch (ignored) {
|
||||
console.log(ignored);
|
||||
}
|
||||
if (module == null) {
|
||||
module = require(name);
|
||||
}
|
||||
return module.default || module;
|
||||
builder_util_1.log.error({ path: builder_util_1.log.filePath(packager.buildResourcesDir), template, extensionsChecked: extensions }, "unable to find publish provider in build resources");
|
||||
throw new builder_util_1.InvalidConfigurationError(`Cannot find module for publisher "${provider}" with any extension: ${extensions.join(", ")}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -293,23 +318,22 @@ function computeDownloadUrl(publishConfiguration, fileName, packager) {
|
|||
if (fileName == null) {
|
||||
return baseUrlString;
|
||||
}
|
||||
const baseUrl = url.parse(baseUrlString);
|
||||
return url.format({ ...baseUrl, pathname: path.posix.resolve(baseUrl.pathname || "/", encodeURI(fileName)) });
|
||||
const baseUrl = (0, pathManager_1.parseUrl)(baseUrlString);
|
||||
return url.format({ ...baseUrl, pathname: path.posix.resolve((baseUrl === null || baseUrl === void 0 ? void 0 : baseUrl.pathname) || "/", encodeURI(fileName)) });
|
||||
}
|
||||
let baseUrl;
|
||||
if (publishConfiguration.provider === "github") {
|
||||
const gh = publishConfiguration;
|
||||
baseUrl = `${builder_util_runtime_1.githubUrl(gh)}/${gh.owner}/${gh.repo}/releases/download/${gh.vPrefixedTagName === false ? "" : "v"}${packager.appInfo.version}`;
|
||||
baseUrl = `${(0, builder_util_runtime_1.githubUrl)(gh)}/${gh.owner}/${gh.repo}/releases/download/${(0, builder_util_runtime_1.githubTagPrefix)(gh)}${packager.appInfo.version}`;
|
||||
}
|
||||
else {
|
||||
baseUrl = builder_util_runtime_1.getS3LikeProviderBaseUrl(publishConfiguration);
|
||||
baseUrl = (0, builder_util_runtime_1.getS3LikeProviderBaseUrl)(publishConfiguration);
|
||||
}
|
||||
if (fileName == null) {
|
||||
return baseUrl;
|
||||
}
|
||||
return `${baseUrl}/${encodeURI(fileName)}`;
|
||||
}
|
||||
exports.computeDownloadUrl = computeDownloadUrl;
|
||||
async function getPublishConfigs(platformPackager, targetSpecificOptions, arch, errorIfCannot) {
|
||||
let publishers;
|
||||
// check build.nsis (target)
|
||||
|
|
@ -335,20 +359,22 @@ async function getPublishConfigs(platformPackager, targetSpecificOptions, arch,
|
|||
}
|
||||
return await resolvePublishConfigurations(publishers, platformPackager, platformPackager.info, arch, errorIfCannot);
|
||||
}
|
||||
exports.getPublishConfigs = getPublishConfigs;
|
||||
async function resolvePublishConfigurations(publishers, platformPackager, packager, arch, errorIfCannot) {
|
||||
if (publishers == null) {
|
||||
let serviceName = null;
|
||||
if (!builder_util_1.isEmptyOrSpaces(process.env.GH_TOKEN) || !builder_util_1.isEmptyOrSpaces(process.env.GITHUB_TOKEN)) {
|
||||
if (!(0, builder_util_1.isEmptyOrSpaces)(process.env.GH_TOKEN) || !(0, builder_util_1.isEmptyOrSpaces)(process.env.GITHUB_TOKEN)) {
|
||||
serviceName = "github";
|
||||
}
|
||||
else if (!builder_util_1.isEmptyOrSpaces(process.env.KEYGEN_TOKEN)) {
|
||||
else if (!(0, builder_util_1.isEmptyOrSpaces)(process.env.GITLAB_TOKEN)) {
|
||||
serviceName = "gitlab";
|
||||
}
|
||||
else if (!(0, builder_util_1.isEmptyOrSpaces)(process.env.KEYGEN_TOKEN)) {
|
||||
serviceName = "keygen";
|
||||
}
|
||||
else if (!builder_util_1.isEmptyOrSpaces(process.env.BITBUCKET_TOKEN)) {
|
||||
else if (!(0, builder_util_1.isEmptyOrSpaces)(process.env.BITBUCKET_TOKEN)) {
|
||||
serviceName = "bitbucket";
|
||||
}
|
||||
else if (!builder_util_1.isEmptyOrSpaces(process.env.BT_TOKEN)) {
|
||||
else if (!(0, builder_util_1.isEmptyOrSpaces)(process.env.BT_TOKEN)) {
|
||||
throw new Error("Bintray has been sunset and is no longer supported by electron-builder. Ref: https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/");
|
||||
}
|
||||
if (serviceName != null) {
|
||||
|
|
@ -359,8 +385,8 @@ async function resolvePublishConfigurations(publishers, platformPackager, packag
|
|||
if (publishers == null) {
|
||||
return [];
|
||||
}
|
||||
debug(`Explicit publish provider: ${builder_util_1.safeStringifyJson(publishers)}`);
|
||||
return await bluebird_lst_1.default.map(builder_util_1.asArray(publishers), it => getResolvedPublishConfig(platformPackager, packager, typeof it === "string" ? { provider: it } : it, arch, errorIfCannot));
|
||||
debug(`Explicit publish provider: ${(0, builder_util_1.safeStringifyJson)(publishers)}`);
|
||||
return (await Promise.all((0, builder_util_1.asArray)(publishers).map(it => getResolvedPublishConfig(platformPackager, packager, typeof it === "string" ? { provider: it } : it, arch, errorIfCannot))));
|
||||
}
|
||||
function isSuitableWindowsTarget(target) {
|
||||
if (target.name === "appx" && target.options != null && target.options.electronUpdaterAware) {
|
||||
|
|
@ -373,7 +399,7 @@ function expandPublishConfig(options, platformPackager, packager, arch) {
|
|||
const value = options[name];
|
||||
if (typeof value === "string") {
|
||||
const archValue = arch == null ? null : builder_util_1.Arch[arch];
|
||||
const expanded = platformPackager == null ? macroExpander_1.expandMacro(value, archValue, packager.appInfo) : platformPackager.expandMacro(value, archValue);
|
||||
const expanded = platformPackager == null ? (0, macroExpander_1.expandMacro)(value, archValue, packager.appInfo) : platformPackager.expandMacro(value, archValue);
|
||||
if (expanded !== value) {
|
||||
options[name] = expanded;
|
||||
}
|
||||
|
|
@ -404,7 +430,7 @@ async function getResolvedPublishConfig(platformPackager, packager, options, arc
|
|||
}
|
||||
return options;
|
||||
}
|
||||
const providerClass = requireProviderClass(options.provider, packager);
|
||||
const providerClass = await requireProviderClass(options.provider, packager);
|
||||
if (providerClass != null && providerClass.checkAndResolveOptions != null) {
|
||||
await providerClass.checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot);
|
||||
return options;
|
||||
|
|
@ -434,7 +460,7 @@ async function getResolvedPublishConfig(platformPackager, packager, options, arc
|
|||
if (info != null) {
|
||||
return info;
|
||||
}
|
||||
const message = `Cannot detect repository by .git/config. Please specify "repository" in the package.json (https://docs.npmjs.com/files/package.json#repository).\nPlease see https://electron.build/configuration/publish`;
|
||||
const message = `Cannot detect repository by .git/config. Please specify "repository" in the package.json (https://docs.npmjs.com/files/package.json#repository).\nPlease see https://electron.build/publish`;
|
||||
if (errorIfCannot) {
|
||||
throw new Error(message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue