This commit is contained in:
2022-09-30 05:39:11 +00:00
parent 41ee9463ae
commit 4687fa49bc
11418 changed files with 1312504 additions and 0 deletions

View File

@ -0,0 +1,16 @@
import { Arch } from "builder-util";
import { BintrayOptions } from "builder-util-runtime";
import { ClientRequest } from "http";
import { HttpPublisher, PublishContext, PublishOptions } from "electron-publish";
export declare class BintrayPublisher extends HttpPublisher {
private readonly version;
private readonly options;
private readonly _versionPromise;
private readonly client;
readonly providerName = "Bintray";
constructor(context: PublishContext, info: BintrayOptions, version: string, options?: PublishOptions);
private init;
protected doUpload(fileName: string, arch: Arch, dataLength: number, requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void): Promise<string | undefined>;
deleteRelease(isForce?: boolean): Promise<void>;
toString(): string;
}

View File

@ -0,0 +1,182 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BintrayPublisher = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _builderUtilRuntime() {
const data = require("builder-util-runtime");
_builderUtilRuntime = function () {
return data;
};
return data;
}
function _bintray() {
const data = require("builder-util-runtime/out/bintray");
_bintray = function () {
return data;
};
return data;
}
function _nodeHttpExecutor() {
const data = require("builder-util/out/nodeHttpExecutor");
_nodeHttpExecutor = function () {
return data;
};
return data;
}
function _lazyVal() {
const data = require("lazy-val");
_lazyVal = function () {
return data;
};
return data;
}
function _electronPublish() {
const data = require("electron-publish");
_electronPublish = function () {
return data;
};
return data;
}
class BintrayPublisher extends _electronPublish().HttpPublisher {
constructor(context, info, version, options = {}) {
super(context);
this.version = version;
this.options = options;
this._versionPromise = new (_lazyVal().Lazy)(() => this.init());
this.providerName = "Bintray";
let token = info.token;
if ((0, _builderUtil().isEmptyOrSpaces)(token)) {
token = process.env.BT_TOKEN;
if ((0, _builderUtil().isEmptyOrSpaces)(token)) {
throw new (_builderUtil().InvalidConfigurationError)(`Bintray token is not set, neither programmatically, nor using env "BT_TOKEN" (see https://www.electron.build/configuration/publish#bintrayoptions)`);
}
token = token.trim();
if (!(0, _builderUtil().isTokenCharValid)(token)) {
throw new (_builderUtil().InvalidConfigurationError)(`Bintray token (${JSON.stringify(token)}) contains invalid characters, please check env "BT_TOKEN"`);
}
}
this.client = new (_bintray().BintrayClient)(info, _nodeHttpExecutor().httpExecutor, this.context.cancellationToken, token);
}
async init() {
try {
return await this.client.getVersion(this.version);
} catch (e) {
if (e instanceof _builderUtilRuntime().HttpError && e.statusCode === 404) {
if (this.options.publish !== "onTagOrDraft") {
_builderUtil().log.info({
version: this.version
}, "version doesn't exist, creating one");
return await this.client.createVersion(this.version);
} else {
_builderUtil().log.warn({
reason: "version doesn't exist",
version: this.version
}, "skipped publishing");
}
}
throw e;
}
}
async doUpload(fileName, arch, dataLength, requestProcessor) {
const version = await this._versionPromise.value;
if (version == null) {
_builderUtil().log.warn({
file: fileName,
reason: "version doesn't exist and is not created",
version: this.version
}, "skipped publishing");
return;
}
const options = {
hostname: "api.bintray.com",
path: `/content/${this.client.owner}/${this.client.repo}/${this.client.packageName}/${encodeURI(`${version.name}/${fileName}`)}`,
method: "PUT",
headers: {
"Content-Length": dataLength,
"X-Bintray-Override": "1",
"X-Bintray-Publish": "1",
"X-Bintray-Debian-Architecture": (0, _builderUtil().toLinuxArchString)(arch, "deb")
}
};
if (this.client.distribution != null) {
options.headers["X-Bintray-Debian-Distribution"] = this.client.distribution;
}
if (this.client.component != null) {
options.headers["X-Bintray-Debian-Component"] = this.client.component;
}
for (let attemptNumber = 0;; attemptNumber++) {
try {
return await _nodeHttpExecutor().httpExecutor.doApiRequest((0, _builderUtilRuntime().configureRequestOptions)(options, this.client.auth), this.context.cancellationToken, requestProcessor);
} catch (e) {
if (attemptNumber < 3 && (e instanceof _builderUtilRuntime().HttpError && e.statusCode === 502 || e.code === "EPIPE")) {
continue;
}
throw e;
}
}
} //noinspection JSUnusedGlobalSymbols
async deleteRelease(isForce = false) {
if (!isForce && !this._versionPromise.hasValue) {
return;
}
const version = await this._versionPromise.value;
if (version != null) {
await this.client.deleteVersion(version.name);
}
}
toString() {
return `Bintray (user: ${this.client.user || this.client.owner}, owner: ${this.client.owner}, package: ${this.client.packageName}, repository: ${this.client.repo}, version: ${this.version})`;
}
} exports.BintrayPublisher = BintrayPublisher;
// __ts-babel@6.0.4
//# sourceMappingURL=BintrayPublisher.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,36 @@
/// <reference types="node/http" />
import { Arch } from "builder-util";
import { CancellationToken, PublishConfiguration, PublishProvider } from "builder-util-runtime";
import { PublishContext, Publisher, PublishOptions } from "electron-publish";
import { MultiProgress } from "electron-publish/out/multiProgress";
import { PlatformSpecificBuildOptions } from "../index";
import { Packager } from "../packager";
import { PlatformPackager } from "../platformPackager";
export declare class PublishManager implements PublishContext {
private readonly packager;
private readonly publishOptions;
readonly cancellationToken: CancellationToken;
private readonly nameToPublisher;
private readonly taskManager;
readonly isPublish: boolean;
readonly progress: MultiProgress | null;
private readonly updateFileWriteTask;
constructor(packager: Packager, publishOptions: PublishOptions, cancellationToken?: CancellationToken);
private getAppInfo;
getGlobalPublishConfigurations(): Promise<Array<PublishConfiguration> | null>;
private artifactCreatedWithoutExplicitPublishConfig;
private getOrCreatePublisher;
cancelTasks(): void;
awaitTasks(): Promise<void>;
}
export declare function getAppUpdatePublishConfiguration(packager: PlatformPackager<any>, arch: Arch, errorIfCannot: boolean): Promise<{
updaterCacheDirName: string;
provider: PublishProvider;
publisherName?: string[] | null | undefined;
publishAutoUpdate?: boolean | undefined;
requestHeaders?: import("http").OutgoingHttpHeaders | undefined;
} | null>;
export declare function getPublishConfigsForUpdateInfo(packager: PlatformPackager<any>, publishConfigs: Array<PublishConfiguration> | null, arch: Arch | null): Promise<Array<PublishConfiguration> | null>;
export declare function createPublisher(context: PublishContext, version: string, publishConfig: PublishConfiguration, options: PublishOptions, packager: Packager): Publisher | null;
export declare function computeDownloadUrl(publishConfiguration: PublishConfiguration, fileName: string | null, packager: PlatformPackager<any>): string;
export declare function getPublishConfigs(platformPackager: PlatformPackager<any>, targetSpecificOptions: PlatformSpecificBuildOptions | null | undefined, arch: Arch | null, errorIfCannot: boolean): Promise<Array<PublishConfiguration> | null>;

View File

@ -0,0 +1,756 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getAppUpdatePublishConfiguration = getAppUpdatePublishConfiguration;
exports.getPublishConfigsForUpdateInfo = getPublishConfigsForUpdateInfo;
exports.createPublisher = createPublisher;
exports.computeDownloadUrl = computeDownloadUrl;
exports.getPublishConfigs = getPublishConfigs;
exports.PublishManager = void 0;
function _bluebirdLst() {
const data = _interopRequireDefault(require("bluebird-lst"));
_bluebirdLst = function () {
return data;
};
return data;
}
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _builderUtilRuntime() {
const data = require("builder-util-runtime");
_builderUtilRuntime = function () {
return data;
};
return data;
}
var _debug2 = _interopRequireDefault(require("debug"));
function _electronPublish() {
const data = require("electron-publish");
_electronPublish = function () {
return data;
};
return data;
}
function _BintrayPublisher() {
const data = require("./BintrayPublisher");
_BintrayPublisher = function () {
return data;
};
return data;
}
function _gitHubPublisher() {
const data = require("electron-publish/out/gitHubPublisher");
_gitHubPublisher = function () {
return data;
};
return data;
}
function _multiProgress() {
const data = require("electron-publish/out/multiProgress");
_multiProgress = function () {
return data;
};
return data;
}
function _s3Publisher() {
const data = _interopRequireDefault(require("./s3/s3Publisher"));
_s3Publisher = function () {
return data;
};
return data;
}
function _spacesPublisher() {
const data = _interopRequireDefault(require("./s3/spacesPublisher"));
_spacesPublisher = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function _isCi() {
const data = _interopRequireDefault(require("is-ci"));
_isCi = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function url() {
const data = _interopRequireWildcard(require("url"));
url = function () {
return data;
};
return data;
}
function _index() {
const data = require("../index");
_index = function () {
return data;
};
return data;
}
function _macroExpander() {
const data = require("../util/macroExpander");
_macroExpander = function () {
return data;
};
return data;
}
function _SnapStorePublisher() {
const data = require("./SnapStorePublisher");
_SnapStorePublisher = function () {
return data;
};
return data;
}
function _updateInfoBuilder() {
const data = require("./updateInfoBuilder");
_updateInfoBuilder = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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 = (0, _debug2.default)("electron-builder:publish");
function checkOptions(publishPolicy) {
if (publishPolicy != null && publishPolicy !== "onTag" && publishPolicy !== "onTagOrDraft" && publishPolicy !== "always" && publishPolicy !== "never") {
if (typeof publishPolicy === "string") {
throw new (_builderUtil().InvalidConfigurationError)(`Expected one of "onTag", "onTagOrDraft", "always", "never", but got ${JSON.stringify(publishPolicy)}.\nPlease note that publish configuration should be specified under "config"`);
}
}
}
class PublishManager {
constructor(packager, publishOptions, cancellationToken = packager.cancellationToken) {
this.packager = packager;
this.publishOptions = publishOptions;
this.cancellationToken = cancellationToken;
this.nameToPublisher = new Map();
this.isPublish = false;
this.progress = process.stdout.isTTY ? new (_multiProgress().MultiProgress)() : null;
this.updateFileWriteTask = [];
checkOptions(publishOptions.publish);
this.taskManager = new (_builderUtil().AsyncTaskManager)(cancellationToken);
const forcePublishForPr = process.env.PUBLISH_FOR_PULL_REQUEST === "true";
if (!(0, _builderUtil().isPullRequest)() || forcePublishForPr) {
if (publishOptions.publish === undefined) {
if (process.env.npm_lifecycle_event === "release") {
publishOptions.publish = "always";
} else {
const tag = (0, _electronPublish().getCiTag)();
if (tag != null) {
_builderUtil().log.info({
reason: "tag is defined",
tag
}, "artifacts will be published");
publishOptions.publish = "onTag";
} else if (_isCi().default) {
_builderUtil().log.info({
reason: "CI detected"
}, "artifacts will be published if draft release exists");
publishOptions.publish = "onTagOrDraft";
}
}
}
const publishPolicy = publishOptions.publish;
this.isPublish = publishPolicy != null && publishOptions.publish !== "never" && (publishPolicy !== "onTag" || (0, _electronPublish().getCiTag)() != null);
if (this.isPublish && forcePublishForPr) {
_builderUtil().log.warn(publishForPrWarning);
}
} else if (publishOptions.publish !== "never") {
_builderUtil().log.info({
reason: "current build is a part of pull request",
solution: `set env PUBLISH_FOR_PULL_REQUEST to true to force code signing\n${publishForPrWarning}`
}, "publishing will be skipped");
}
packager.addAfterPackHandler(async event => {
const packager = event.packager;
if (event.electronPlatformName === "darwin") {
if (!event.targets.some(it => it.name === "dmg" || it.name === "zip")) {
return;
}
} else if (packager.platform === _index().Platform.WINDOWS) {
if (!event.targets.some(it => isSuitableWindowsTarget(it))) {
return;
}
} else {
// AppImage writes data to AppImage stage dir, not to linux-unpacked
return;
}
const publishConfig = await getAppUpdatePublishConfiguration(packager, event.arch, this.isPublish);
if (publishConfig != null) {
await (0, _fsExtra().writeFile)(path.join(packager.getResourcesDir(event.appOutDir), "app-update.yml"), (0, _builderUtil().serializeToYaml)(publishConfig));
}
});
packager.artifactCreated(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}): ${(0, _builderUtil().safeStringifyJson)(event, new Set(["packager"]))},\n publishConfig: ${(0, _builderUtil().safeStringifyJson)(publishConfiguration)}`);
}
this.scheduleUpload(publishConfiguration, event, this.getAppInfo(event.packager));
}
});
}
getAppInfo(platformPackager) {
return platformPackager == null ? this.packager.appInfo : platformPackager.appInfo;
}
async getGlobalPublishConfigurations() {
const publishers = this.packager.config.publish;
return await resolvePublishConfigurations(publishers, null, this.packager, null, true);
}
/** @internal */
scheduleUpload(publishConfig, event, appInfo) {
if (publishConfig.provider === "generic") {
return;
}
const publisher = this.getOrCreatePublisher(publishConfig, appInfo);
if (publisher == null) {
_builderUtil().log.debug({
file: event.file,
reason: "publisher is null",
publishConfig: (0, _builderUtil().safeStringifyJson)(publishConfig)
}, "not published");
return;
}
const providerName = publisher.providerName;
if (this.publishOptions.publish === "onTagOrDraft" && (0, _electronPublish().getCiTag)() == null && !(providerName === "GitHub" || providerName === "Bintray")) {
_builderUtil().log.info({
file: event.file,
reason: "current build is not for a git tag",
publishPolicy: "onTagOrDraft"
}, `not published to ${providerName}`);
return;
}
this.taskManager.addTask(publisher.upload(event));
}
async artifactCreatedWithoutExplicitPublishConfig(event) {
const platformPackager = event.packager;
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}): ${(0, _builderUtil().safeStringifyJson)(event, new Set(["packager"]))},\n publishConfigs: ${(0, _builderUtil().safeStringifyJson)(publishConfigs)}`);
}
const eventFile = event.file;
if (publishConfigs == null) {
if (this.isPublish) {
_builderUtil().log.debug({
file: eventFile,
reason: "no publish configs"
}, "not published");
}
return;
}
if (this.isPublish) {
for (const publishConfig of publishConfigs) {
if (this.cancellationToken.cancelled) {
_builderUtil().log.debug({
file: event.file,
reason: "cancelled"
}, "not published");
break;
}
this.scheduleUpload(publishConfig, event, this.getAppInfo(platformPackager));
}
}
if (event.isWriteUpdateInfo && target != null && eventFile != null && !this.cancellationToken.cancelled && (platformPackager.platform !== _index().Platform.WINDOWS || isSuitableWindowsTarget(target))) {
this.taskManager.addTask((0, _updateInfoBuilder().createUpdateInfoTasks)(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it)));
}
}
getOrCreatePublisher(publishConfig, appInfo) {
// to not include token into cache key
const providerCacheKey = (0, _builderUtil().safeStringifyJson)(publishConfig);
let publisher = this.nameToPublisher.get(providerCacheKey);
if (publisher == null) {
publisher = createPublisher(this, appInfo.version, publishConfig, this.publishOptions, this.packager);
this.nameToPublisher.set(providerCacheKey, publisher);
_builderUtil().log.info({
publisher: publisher.toString()
}, "publishing");
}
return publisher;
} // noinspection JSUnusedGlobalSymbols
cancelTasks() {
this.taskManager.cancelTasks();
this.nameToPublisher.clear();
}
async awaitTasks() {
await this.taskManager.awaitTasks();
const updateInfoFileTasks = this.updateFileWriteTask;
if (this.cancellationToken.cancelled || updateInfoFileTasks.length === 0) {
return;
}
await (0, _updateInfoBuilder().writeUpdateInfoFiles)(updateInfoFileTasks, this.packager);
await this.taskManager.awaitTasks();
}
}
exports.PublishManager = PublishManager;
async function getAppUpdatePublishConfiguration(packager, arch, errorIfCannot) {
const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, null, arch, errorIfCannot), arch);
if (publishConfigs == null || publishConfigs.length === 0) {
return null;
}
const publishConfig = { ...publishConfigs[0],
updaterCacheDirName: packager.appInfo.updaterCacheDirName
};
if (packager.platform === _index().Platform.WINDOWS && publishConfig.publisherName == null) {
const winPackager = packager;
const publisherName = winPackager.isForceCodeSigningVerification ? await winPackager.computedPublisherName.value : undefined;
if (publisherName != null) {
publishConfig.publisherName = publisherName;
}
}
return publishConfig;
}
async function getPublishConfigsForUpdateInfo(packager, publishConfigs, arch) {
if (publishConfigs === null) {
return null;
}
if (publishConfigs.length === 0) {
_builderUtil().log.debug(null, "getPublishConfigsForUpdateInfo: no publishConfigs, detect using repository info"); // 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: ${(0, _builderUtil().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 ${(0, _builderUtil().safeStringifyJson)(resolvedPublishConfig)}`);
return [resolvedPublishConfig];
}
}
}
return publishConfigs;
}
function createPublisher(context, version, publishConfig, options, packager) {
if (debug.enabled) {
debug(`Create publisher: ${(0, _builderUtil().safeStringifyJson)(publishConfig)}`);
}
const provider = publishConfig.provider;
switch (provider) {
case "github":
return new (_gitHubPublisher().GitHubPublisher)(context, publishConfig, version, options);
case "bintray":
return new (_BintrayPublisher().BintrayPublisher)(context, publishConfig, version, options);
case "generic":
return null;
case "snapStore":
return new (_SnapStorePublisher().SnapStorePublisher)(context, publishConfig);
default:
{
const clazz = requireProviderClass(provider, packager);
return clazz == null ? null : new clazz(context, publishConfig);
}
}
}
function requireProviderClass(provider, packager) {
switch (provider) {
case "github":
return _gitHubPublisher().GitHubPublisher;
case "bintray":
return _BintrayPublisher().BintrayPublisher;
case "generic":
return null;
case "s3":
return _s3Publisher().default;
case "snapStore":
return _SnapStorePublisher().SnapStorePublisher;
case "spaces":
return _spacesPublisher().default;
default:
{
const name = `electron-publisher-${provider}`;
let module = null;
try {
module = require(path.join(packager.buildResourcesDir, name + ".js"));
} catch (ignored) {
console.log(ignored);
}
if (module == null) {
module = require(name);
}
return module.default || module;
}
}
}
function computeDownloadUrl(publishConfiguration, fileName, packager) {
if (publishConfiguration.provider === "generic") {
const baseUrlString = publishConfiguration.url;
if (fileName == null) {
return baseUrlString;
}
const baseUrl = url().parse(baseUrlString);
return url().format({ ...baseUrl,
pathname: path.posix.resolve(baseUrl.pathname || "/", encodeURI(fileName))
});
}
let baseUrl;
if (publishConfiguration.provider === "github") {
const gh = publishConfiguration;
baseUrl = `${(0, _builderUtilRuntime().githubUrl)(gh)}/${gh.owner}/${gh.repo}/releases/download/${gh.vPrefixedTagName === false ? "" : "v"}${packager.appInfo.version}`;
} else {
baseUrl = (0, _builderUtilRuntime().getS3LikeProviderBaseUrl)(publishConfiguration);
}
if (fileName == null) {
return baseUrl;
}
return `${baseUrl}/${encodeURI(fileName)}`;
}
async function getPublishConfigs(platformPackager, targetSpecificOptions, arch, errorIfCannot) {
let publishers; // check build.nsis (target)
if (targetSpecificOptions != null) {
publishers = targetSpecificOptions.publish; // if explicitly set to null - do not publish
if (publishers === null) {
return null;
}
} // check build.win (platform)
if (publishers == null) {
publishers = platformPackager.platformSpecificBuildOptions.publish;
if (publishers === null) {
return null;
}
}
if (publishers == null) {
publishers = platformPackager.config.publish;
if (publishers === null) {
return null;
}
}
return await resolvePublishConfigurations(publishers, platformPackager, platformPackager.info, arch, errorIfCannot);
}
async function resolvePublishConfigurations(publishers, platformPackager, packager, arch, errorIfCannot) {
if (publishers == null) {
let serviceName = null;
if (!(0, _builderUtil().isEmptyOrSpaces)(process.env.GH_TOKEN) || !(0, _builderUtil().isEmptyOrSpaces)(process.env.GITHUB_TOKEN)) {
serviceName = "github";
} else if (!(0, _builderUtil().isEmptyOrSpaces)(process.env.BT_TOKEN)) {
serviceName = "bintray";
}
if (serviceName != null) {
_builderUtil().log.debug(null, `detect ${serviceName} as publish provider`);
return [await getResolvedPublishConfig(platformPackager, packager, {
provider: serviceName
}, arch, errorIfCannot)];
}
}
if (publishers == null) {
return [];
}
debug(`Explicit publish provider: ${(0, _builderUtil().safeStringifyJson)(publishers)}`);
return await _bluebirdLst().default.map((0, _builderUtil().asArray)(publishers), 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) {
return true;
}
return target.name === "nsis" || target.name.startsWith("nsis-");
}
function expandPublishConfig(options, platformPackager, packager, arch) {
for (const name of Object.keys(options)) {
const value = options[name];
if (typeof value === "string") {
const archValue = arch == null ? null : _builderUtil().Arch[arch];
const expanded = platformPackager == null ? (0, _macroExpander().expandMacro)(value, archValue, packager.appInfo) : platformPackager.expandMacro(value, archValue);
if (expanded !== value) {
options[name] = expanded;
}
}
}
}
function isDetectUpdateChannel(platformSpecificConfiguration, configuration) {
const value = platformSpecificConfiguration == null ? null : platformSpecificConfiguration.detectUpdateChannel;
return value == null ? configuration.detectUpdateChannel !== false : value;
}
async function getResolvedPublishConfig(platformPackager, packager, options, arch, errorIfCannot) {
options = { ...options
};
expandPublishConfig(options, platformPackager, packager, arch);
let channelFromAppVersion = null;
if (options.channel == null && isDetectUpdateChannel(platformPackager == null ? null : platformPackager.platformSpecificBuildOptions, packager.config)) {
channelFromAppVersion = packager.appInfo.channel;
}
const provider = options.provider;
if (provider === "generic") {
const o = options;
if (o.url == null) {
throw new (_builderUtil().InvalidConfigurationError)(`Please specify "url" for "generic" update server`);
}
if (channelFromAppVersion != null) {
o.channel = channelFromAppVersion;
}
return options;
}
const providerClass = requireProviderClass(options.provider, packager);
if (providerClass != null && providerClass.checkAndResolveOptions != null) {
await providerClass.checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot);
return options;
}
const isGithub = provider === "github";
if (!isGithub && provider !== "bintray") {
return options;
}
let owner = isGithub ? options.owner : options.owner;
let project = isGithub ? options.repo : options.package;
if (isGithub && owner == null && project != null) {
const index = project.indexOf("/");
if (index > 0) {
const repo = project;
project = repo.substring(0, index);
owner = repo.substring(index + 1);
}
}
async function getInfo() {
const info = await packager.repositoryInfo;
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`;
if (errorIfCannot) {
throw new Error(message);
} else {
_builderUtil().log.warn(message);
return null;
}
}
if (!owner || !project) {
_builderUtil().log.debug({
reason: "owner or project is not specified explicitly",
provider,
owner,
project
}, "calling getInfo");
const info = await getInfo();
if (info == null) {
return null;
}
if (!owner) {
owner = info.user;
}
if (!project) {
project = info.project;
}
}
if (isGithub) {
if (options.token != null && !options.private) {
_builderUtil().log.warn('"token" specified in the github publish options. It should be used only for [setFeedURL](module:electron-updater/out/AppUpdater.AppUpdater+setFeedURL).');
} //tslint:disable-next-line:no-object-literal-type-assertion
return {
owner,
repo: project,
...options
};
} else {
//tslint:disable-next-line:no-object-literal-type-assertion
return {
owner,
package: project,
...options
};
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=PublishManager.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
import { Publisher, UploadTask, PublishContext } from "electron-publish";
import { PublishConfiguration } from "builder-util-runtime";
export declare class SnapStorePublisher extends Publisher {
private options;
readonly providerName = "snapStore";
constructor(context: PublishContext, options: SnapStoreOptions);
upload(task: UploadTask): Promise<any>;
toString(): string;
}
/**
* [Snap Store](https://snapcraft.io/) options.
*/
export interface SnapStoreOptions extends PublishConfiguration {
/**
* The list of channels the snap would be released.
* @default ["edge"]
*/
readonly channels?: string | Array<string> | null;
}

View File

@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SnapStorePublisher = void 0;
function _electronPublish() {
const data = require("electron-publish");
_electronPublish = function () {
return data;
};
return data;
}
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
class SnapStorePublisher extends _electronPublish().Publisher {
constructor(context, options) {
super(context);
this.options = options;
this.providerName = "snapStore";
}
upload(task) {
this.createProgressBar(path.basename(task.file), -1);
const args = ["publish-snap", "-f", task.file];
let channels = this.options.channels;
if (channels == null) {
channels = ["edge"];
} else {
if (typeof channels === "string") {
channels = channels.split(",");
}
}
for (const channel of channels) {
args.push("-c", channel);
}
return (0, _builderUtil().executeAppBuilder)(args);
}
toString() {
return "Snap Store";
}
} exports.SnapStorePublisher = SnapStorePublisher;
// __ts-babel@6.0.4
//# sourceMappingURL=SnapStorePublisher.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/publish/SnapStorePublisher.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;;;;;AAGM,MAAO,kBAAP,SAAkC,4BAAlC,CAA2C;AAG/C,EAAA,WAAA,CAAY,OAAZ,EAA6C,OAA7C,EAAsE;AACpE,UAAM,OAAN;AAD2C,SAAA,OAAA,GAAA,OAAA;AAFpC,SAAA,YAAA,GAAe,WAAf;AAIR;;AAED,EAAA,MAAM,CAAC,IAAD,EAAiB;AACrB,SAAK,iBAAL,CAAuB,IAAI,CAAC,QAAL,CAAc,IAAI,CAAC,IAAnB,CAAvB,EAAiD,CAAC,CAAlD;AAEA,UAAM,IAAI,GAAG,CAAC,cAAD,EAAiB,IAAjB,EAAuB,IAAI,CAAC,IAA5B,CAAb;AAEA,QAAI,QAAQ,GAAG,KAAK,OAAL,CAAa,QAA5B;;AACA,QAAI,QAAQ,IAAI,IAAhB,EAAsB;AACpB,MAAA,QAAQ,GAAG,CAAC,MAAD,CAAX;AACD,KAFD,MAGK;AACH,UAAI,OAAO,QAAP,KAAoB,QAAxB,EAAkC;AAChC,QAAA,QAAQ,GAAG,QAAQ,CAAC,KAAT,CAAe,GAAf,CAAX;AACD;AACF;;AAED,SAAK,MAAM,OAAX,IAAsB,QAAtB,EAAgC;AAC9B,MAAA,IAAI,CAAC,IAAL,CAAU,IAAV,EAAgB,OAAhB;AACD;;AAED,WAAO,sCAAkB,IAAlB,CAAP;AACD;;AAED,EAAA,QAAQ,GAAA;AACN,WAAO,YAAP;AACD;;AA/B8C,C","sourcesContent":["import { Publisher, UploadTask, PublishContext } from \"electron-publish\"\nimport { executeAppBuilder } from \"builder-util\"\nimport * as path from \"path\"\nimport { PublishConfiguration } from \"builder-util-runtime\"\n\nexport class SnapStorePublisher extends Publisher {\n readonly providerName = \"snapStore\"\n\n constructor(context: PublishContext, private options: SnapStoreOptions) {\n super(context)\n }\n\n upload(task: UploadTask): Promise<any> {\n this.createProgressBar(path.basename(task.file), -1)\n\n const args = [\"publish-snap\", \"-f\", task.file]\n\n let channels = this.options.channels\n if (channels == null) {\n channels = [\"edge\"]\n }\n else {\n if (typeof channels === \"string\") {\n channels = channels.split(\",\")\n }\n }\n\n for (const channel of channels) {\n args.push(\"-c\", channel)\n }\n\n return executeAppBuilder(args)\n }\n\n toString(): string {\n return \"Snap Store\"\n }\n}\n\n/**\n * [Snap Store](https://snapcraft.io/) options.\n */\nexport interface SnapStoreOptions extends PublishConfiguration {\n /**\n * The list of channels the snap would be released.\n * @default [\"edge\"]\n */\n readonly channels?: string | Array<string> | null\n}"],"sourceRoot":""}

View File

@ -0,0 +1,10 @@
import { BaseS3Options } from "builder-util-runtime";
import { PublishContext, Publisher, UploadTask } from "electron-publish";
export declare abstract class BaseS3Publisher extends Publisher {
private options;
protected constructor(context: PublishContext, options: BaseS3Options);
protected abstract getBucketName(): string;
protected configureS3Options(args: Array<string>): void;
upload(task: UploadTask): Promise<any>;
toString(): string;
}

View File

@ -0,0 +1,107 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BaseS3Publisher = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _electronPublish() {
const data = require("electron-publish");
_electronPublish = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
class BaseS3Publisher extends _electronPublish().Publisher {
constructor(context, options) {
super(context);
this.options = options;
}
configureS3Options(args) {
// if explicitly set to null, do not add
if (this.options.acl !== null) {
args.push("--acl", this.options.acl || "public-read");
}
} // http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html
async upload(task) {
const fileName = path.basename(task.file);
const cancellationToken = this.context.cancellationToken;
const target = (this.options.path == null ? "" : `${this.options.path}/`) + fileName;
const args = ["publish-s3", "--bucket", this.getBucketName(), "--key", target, "--file", task.file];
this.configureS3Options(args);
if (process.env.__TEST_S3_PUBLISHER__ != null) {
const testFile = path.join(process.env.__TEST_S3_PUBLISHER__, target);
await (0, _fsExtra().ensureDir)(path.dirname(testFile));
await (0, _fsExtra().symlink)(task.file, testFile);
return;
} // https://github.com/aws/aws-sdk-go/issues/279
this.createProgressBar(fileName, -1); // if (progressBar != null) {
// const callback = new ProgressCallback(progressBar)
// uploader.on("progress", () => {
// if (!cancellationToken.cancelled) {
// callback.update(uploader.loaded, uploader.contentLength)
// }
// })
// }
return await cancellationToken.createPromise((resolve, reject, onCancel) => {
(0, _builderUtil().executeAppBuilder)(args, process => {
onCancel(() => {
process.kill("SIGINT");
});
}).then(() => {
try {
_builderUtil().log.debug({
provider: this.providerName,
file: fileName,
bucket: this.getBucketName()
}, "uploaded");
} finally {
resolve();
}
}).catch(reject);
});
}
toString() {
return `${this.providerName} (bucket: ${this.getBucketName()})`;
}
} exports.BaseS3Publisher = BaseS3Publisher;
// __ts-babel@6.0.4
//# sourceMappingURL=BaseS3Publisher.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/publish/s3/BaseS3Publisher.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;;;;;AAEM,MAAgB,eAAhB,SAAwC,4BAAxC,CAAiD;AACrD,EAAA,WAAA,CAAsB,OAAtB,EAAuD,OAAvD,EAA6E;AAC3E,UAAM,OAAN;AADqD,SAAA,OAAA,GAAA,OAAA;AAEtD;;AAIS,EAAA,kBAAkB,CAAC,IAAD,EAAoB;AAC9C;AACA,QAAI,KAAK,OAAL,CAAa,GAAb,KAAqB,IAAzB,EAA+B;AAC7B,MAAA,IAAI,CAAC,IAAL,CAAU,OAAV,EAAmB,KAAK,OAAL,CAAa,GAAb,IAAoB,aAAvC;AACD;AACF,GAZoD,CAcrD;;;AACA,QAAM,MAAN,CAAa,IAAb,EAA6B;AAC3B,UAAM,QAAQ,GAAG,IAAI,CAAC,QAAL,CAAc,IAAI,CAAC,IAAnB,CAAjB;AACA,UAAM,iBAAiB,GAAG,KAAK,OAAL,CAAa,iBAAvC;AAEA,UAAM,MAAM,GAAG,CAAC,KAAK,OAAL,CAAa,IAAb,IAAqB,IAArB,GAA4B,EAA5B,GAAiC,GAAG,KAAK,OAAL,CAAa,IAAI,GAAtD,IAA6D,QAA5E;AAEA,UAAM,IAAI,GAAG,CAAC,YAAD,EAAe,UAAf,EAA2B,KAAK,aAAL,EAA3B,EAAiD,OAAjD,EAA0D,MAA1D,EAAkE,QAAlE,EAA4E,IAAI,CAAC,IAAjF,CAAb;AACA,SAAK,kBAAL,CAAwB,IAAxB;;AAEA,QAAI,OAAO,CAAC,GAAR,CAAY,qBAAZ,IAAqC,IAAzC,EAA+C;AAC7C,YAAM,QAAQ,GAAG,IAAI,CAAC,IAAL,CAAU,OAAO,CAAC,GAAR,CAAY,qBAAtB,EAA8C,MAA9C,CAAjB;AACA,YAAM,0BAAU,IAAI,CAAC,OAAL,CAAa,QAAb,CAAV,CAAN;AACA,YAAM,wBAAQ,IAAI,CAAC,IAAb,EAAmB,QAAnB,CAAN;AACA;AACD,KAd0B,CAgB3B;;;AACA,SAAK,iBAAL,CAAuB,QAAvB,EAAiC,CAAC,CAAlC,EAjB2B,CAkB3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,WAAO,MAAM,iBAAiB,CAAC,aAAlB,CAAgC,CAAC,OAAD,EAAU,MAAV,EAAkB,QAAlB,KAA8B;AACzE,4CAAkB,IAAlB,EAAwB,OAAO,IAAG;AAChC,QAAA,QAAQ,CAAC,MAAK;AACZ,UAAA,OAAO,CAAC,IAAR,CAAa,QAAb;AACD,SAFO,CAAR;AAGD,OAJD,EAKG,IALH,CAKQ,MAAK;AACT,YAAI;AACF,6BAAI,KAAJ,CAAU;AAAC,YAAA,QAAQ,EAAE,KAAK,YAAhB;AAA8B,YAAA,IAAI,EAAE,QAApC;AAA8C,YAAA,MAAM,EAAE,KAAK,aAAL;AAAtD,WAAV,EAAuF,UAAvF;AACD,SAFD,SAGQ;AACN,UAAA,OAAO;AACR;AACF,OAZH,EAaG,KAbH,CAaS,MAbT;AAcD,KAfY,CAAb;AAgBD;;AAED,EAAA,QAAQ,GAAA;AACN,WAAO,GAAG,KAAK,YAAY,aAAa,KAAK,aAAL,EAAoB,GAA5D;AACD;;AA9DoD,C","sourcesContent":["import { log, executeAppBuilder } from \"builder-util\"\nimport { BaseS3Options } from \"builder-util-runtime\"\nimport { PublishContext, Publisher, UploadTask } from \"electron-publish\"\nimport { ensureDir, symlink } from \"fs-extra\"\nimport * as path from \"path\"\n\nexport abstract class BaseS3Publisher extends Publisher {\n protected constructor(context: PublishContext, private options: BaseS3Options) {\n super(context)\n }\n\n protected abstract getBucketName(): string\n\n protected configureS3Options(args: Array<string>) {\n // if explicitly set to null, do not add\n if (this.options.acl !== null) {\n args.push(\"--acl\", this.options.acl || \"public-read\")\n }\n }\n\n // http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html\n async upload(task: UploadTask): Promise<any> {\n const fileName = path.basename(task.file)\n const cancellationToken = this.context.cancellationToken\n\n const target = (this.options.path == null ? \"\" : `${this.options.path}/`) + fileName\n\n const args = [\"publish-s3\", \"--bucket\", this.getBucketName(), \"--key\", target, \"--file\", task.file]\n this.configureS3Options(args)\n\n if (process.env.__TEST_S3_PUBLISHER__ != null) {\n const testFile = path.join(process.env.__TEST_S3_PUBLISHER__!, target)\n await ensureDir(path.dirname(testFile))\n await symlink(task.file, testFile)\n return\n }\n\n // https://github.com/aws/aws-sdk-go/issues/279\n this.createProgressBar(fileName, -1)\n // if (progressBar != null) {\n // const callback = new ProgressCallback(progressBar)\n // uploader.on(\"progress\", () => {\n // if (!cancellationToken.cancelled) {\n // callback.update(uploader.loaded, uploader.contentLength)\n // }\n // })\n // }\n\n return await cancellationToken.createPromise((resolve, reject, onCancel) => {\n executeAppBuilder(args, process => {\n onCancel(() => {\n process.kill(\"SIGINT\")\n })\n })\n .then(() => {\n try {\n log.debug({provider: this.providerName, file: fileName, bucket: this.getBucketName()}, \"uploaded\")\n }\n finally {\n resolve()\n }\n })\n .catch(reject)\n })\n }\n\n toString() {\n return `${this.providerName} (bucket: ${this.getBucketName()})`\n }\n}\n"],"sourceRoot":""}

View File

@ -0,0 +1,12 @@
import { S3Options } from "builder-util-runtime";
import { PublishContext } from "electron-publish";
import { BaseS3Publisher } from "./BaseS3Publisher";
export default class S3Publisher extends BaseS3Publisher {
private readonly info;
readonly providerName = "S3";
constructor(context: PublishContext, info: S3Options);
static checkAndResolveOptions(options: S3Options, channelFromAppVersion: string | null, errorIfCannot: boolean): Promise<void>;
protected getBucketName(): string;
protected configureS3Options(args: Array<string>): void;
toString(): string;
}

View File

@ -0,0 +1,101 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _BaseS3Publisher() {
const data = require("./BaseS3Publisher");
_BaseS3Publisher = function () {
return data;
};
return data;
}
class S3Publisher extends _BaseS3Publisher().BaseS3Publisher {
constructor(context, info) {
super(context, info);
this.info = info;
this.providerName = "S3";
}
static async checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot) {
const bucket = options.bucket;
if (bucket == null) {
throw new (_builderUtil().InvalidConfigurationError)(`Please specify "bucket" for "s3" publish provider`);
}
if (options.endpoint == null && bucket.includes(".") && options.region == null) {
// on dotted bucket names, we need to use a path-based endpoint URL. Path-based endpoint URLs need to include the region.
try {
options.region = await (0, _builderUtil().executeAppBuilder)(["get-bucket-location", "--bucket", bucket]);
} catch (e) {
if (errorIfCannot) {
throw e;
} else {
_builderUtil().log.warn(`cannot compute region for bucket (required because on dotted bucket names, we need to use a path-based endpoint URL): ${e}`);
}
}
}
if (options.channel == null && channelFromAppVersion != null) {
options.channel = channelFromAppVersion;
}
if (options.endpoint != null && options.endpoint.endsWith("/")) {
options.endpoint = options.endpoint.slice(0, -1);
}
}
getBucketName() {
return this.info.bucket;
}
configureS3Options(args) {
super.configureS3Options(args);
if (this.info.endpoint != null) {
args.push("--endpoint", this.info.endpoint);
}
if (this.info.region != null) {
args.push("--region", this.info.region);
}
if (this.info.storageClass != null) {
args.push("--storageClass", this.info.storageClass);
}
if (this.info.encryption != null) {
args.push("--encryption", this.info.encryption);
}
}
toString() {
const result = super.toString();
const endpoint = this.info.endpoint;
if (endpoint != null) {
return result.substring(0, result.length - 1) + `, endpoint: ${endpoint})`;
}
return result;
}
} exports.default = S3Publisher;
// __ts-babel@6.0.4
//# sourceMappingURL=s3Publisher.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/publish/s3/s3Publisher.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEc,MAAO,WAAP,SAA2B,kCAA3B,CAA0C;AAGtD,EAAA,WAAA,CAAY,OAAZ,EAAsD,IAAtD,EAAqE;AACnE,UAAM,OAAN,EAAe,IAAf;AADoD,SAAA,IAAA,GAAA,IAAA;AAF7C,SAAA,YAAA,GAAe,IAAf;AAIR;;AAED,eAAa,sBAAb,CAAoC,OAApC,EAAwD,qBAAxD,EAA8F,aAA9F,EAAoH;AAClH,UAAM,MAAM,GAAG,OAAO,CAAC,MAAvB;;AACA,QAAI,MAAM,IAAI,IAAd,EAAoB;AAClB,YAAM,KAAI,wCAAJ,EAA8B,mDAA9B,CAAN;AACD;;AAED,QAAI,OAAO,CAAC,QAAR,IAAoB,IAApB,IAA6B,MAAM,CAAC,QAAP,CAAgB,GAAhB,KAAwB,OAAO,CAAC,MAAR,IAAkB,IAA3E,EAAkF;AAChF;AACA,UAAI;AACF,QAAA,OAAO,CAAC,MAAR,GAAiB,MAAM,sCAAkB,CAAC,qBAAD,EAAwB,UAAxB,EAAoC,MAApC,CAAlB,CAAvB;AACD,OAFD,CAGA,OAAO,CAAP,EAAU;AACR,YAAI,aAAJ,EAAmB;AACjB,gBAAM,CAAN;AACD,SAFD,MAGK;AACH,6BAAI,IAAJ,CAAS,yHAAyH,CAAC,EAAnI;AACD;AACF;AACF;;AAED,QAAI,OAAO,CAAC,OAAR,IAAmB,IAAnB,IAA2B,qBAAqB,IAAI,IAAxD,EAA8D;AAC5D,MAAA,OAAO,CAAC,OAAR,GAAkB,qBAAlB;AACD;;AAED,QAAI,OAAO,CAAC,QAAR,IAAoB,IAApB,IAA4B,OAAO,CAAC,QAAR,CAAiB,QAAjB,CAA0B,GAA1B,CAAhC,EAAgE;AAC7D,MAAA,OAAe,CAAC,QAAhB,GAA2B,OAAO,CAAC,QAAR,CAAiB,KAAjB,CAAuB,CAAvB,EAA0B,CAAC,CAA3B,CAA3B;AACF;AACF;;AAES,EAAA,aAAa,GAAA;AACrB,WAAO,KAAK,IAAL,CAAU,MAAjB;AACD;;AAES,EAAA,kBAAkB,CAAC,IAAD,EAAoB;AAC9C,UAAM,kBAAN,CAAyB,IAAzB;;AAEA,QAAI,KAAK,IAAL,CAAU,QAAV,IAAsB,IAA1B,EAAgC;AAC9B,MAAA,IAAI,CAAC,IAAL,CAAU,YAAV,EAAwB,KAAK,IAAL,CAAU,QAAlC;AACD;;AACD,QAAI,KAAK,IAAL,CAAU,MAAV,IAAoB,IAAxB,EAA8B;AAC5B,MAAA,IAAI,CAAC,IAAL,CAAU,UAAV,EAAsB,KAAK,IAAL,CAAU,MAAhC;AACD;;AAED,QAAI,KAAK,IAAL,CAAU,YAAV,IAA0B,IAA9B,EAAoC;AAClC,MAAA,IAAI,CAAC,IAAL,CAAU,gBAAV,EAA4B,KAAK,IAAL,CAAU,YAAtC;AACD;;AACD,QAAI,KAAK,IAAL,CAAU,UAAV,IAAwB,IAA5B,EAAkC;AAChC,MAAA,IAAI,CAAC,IAAL,CAAU,cAAV,EAA0B,KAAK,IAAL,CAAU,UAApC;AACD;AACF;;AAED,EAAA,QAAQ,GAAA;AACN,UAAM,MAAM,GAAG,MAAM,QAAN,EAAf;AACA,UAAM,QAAQ,GAAG,KAAK,IAAL,CAAU,QAA3B;;AACA,QAAI,QAAQ,IAAI,IAAhB,EAAsB;AACpB,aAAO,MAAM,CAAC,SAAP,CAAiB,CAAjB,EAAoB,MAAM,CAAC,MAAP,GAAgB,CAApC,IAAyC,eAAe,QAAQ,GAAvE;AACD;;AACD,WAAO,MAAP;AACD;;AAlEqD,C","sourcesContent":["import { executeAppBuilder, InvalidConfigurationError, log } from \"builder-util\"\nimport { S3Options } from \"builder-util-runtime\"\nimport { PublishContext } from \"electron-publish\"\nimport { BaseS3Publisher } from \"./BaseS3Publisher\"\n\nexport default class S3Publisher extends BaseS3Publisher {\n readonly providerName = \"S3\"\n\n constructor(context: PublishContext, private readonly info: S3Options) {\n super(context, info)\n }\n\n static async checkAndResolveOptions(options: S3Options, channelFromAppVersion: string | null, errorIfCannot: boolean) {\n const bucket = options.bucket\n if (bucket == null) {\n throw new InvalidConfigurationError(`Please specify \"bucket\" for \"s3\" publish provider`)\n }\n\n if (options.endpoint == null && (bucket.includes(\".\") && options.region == null)) {\n // on dotted bucket names, we need to use a path-based endpoint URL. Path-based endpoint URLs need to include the region.\n try {\n options.region = await executeAppBuilder([\"get-bucket-location\", \"--bucket\", bucket])\n }\n catch (e) {\n if (errorIfCannot) {\n throw e\n }\n else {\n log.warn(`cannot compute region for bucket (required because on dotted bucket names, we need to use a path-based endpoint URL): ${e}`)\n }\n }\n }\n\n if (options.channel == null && channelFromAppVersion != null) {\n options.channel = channelFromAppVersion\n }\n\n if (options.endpoint != null && options.endpoint.endsWith(\"/\")) {\n (options as any).endpoint = options.endpoint.slice(0, -1)\n }\n }\n\n protected getBucketName(): string {\n return this.info.bucket!\n }\n\n protected configureS3Options(args: Array<string>): void {\n super.configureS3Options(args)\n\n if (this.info.endpoint != null) {\n args.push(\"--endpoint\", this.info.endpoint)\n }\n if (this.info.region != null) {\n args.push(\"--region\", this.info.region)\n }\n\n if (this.info.storageClass != null) {\n args.push(\"--storageClass\", this.info.storageClass)\n }\n if (this.info.encryption != null) {\n args.push(\"--encryption\", this.info.encryption)\n }\n }\n\n toString() {\n const result = super.toString()\n const endpoint = this.info.endpoint\n if (endpoint != null) {\n return result.substring(0, result.length - 1) + `, endpoint: ${endpoint})`\n }\n return result\n }\n}\n"],"sourceRoot":""}

View File

@ -0,0 +1,11 @@
import { SpacesOptions } from "builder-util-runtime";
import { PublishContext } from "electron-publish";
import { BaseS3Publisher } from "./BaseS3Publisher";
export default class SpacesPublisher extends BaseS3Publisher {
private readonly info;
readonly providerName = "Spaces";
constructor(context: PublishContext, info: SpacesOptions);
static checkAndResolveOptions(options: SpacesOptions, channelFromAppVersion: string | null, errorIfCannot: boolean): Promise<void>;
protected getBucketName(): string;
protected configureS3Options(args: Array<string>): void;
}

View File

@ -0,0 +1,75 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _BaseS3Publisher() {
const data = require("./BaseS3Publisher");
_BaseS3Publisher = function () {
return data;
};
return data;
}
class SpacesPublisher extends _BaseS3Publisher().BaseS3Publisher {
constructor(context, info) {
super(context, info);
this.info = info;
this.providerName = "Spaces";
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
static async checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot) {
if (options.name == null) {
throw new (_builderUtil().InvalidConfigurationError)(`Please specify "name" for "spaces" publish provider (see https://www.electron.build/configuration/publish#spacesoptions)`);
}
if (options.region == null) {
throw new (_builderUtil().InvalidConfigurationError)(`Please specify "region" for "spaces" publish provider (see https://www.electron.build/configuration/publish#spacesoptions)`);
}
if (options.channel == null && channelFromAppVersion != null) {
options.channel = channelFromAppVersion;
}
}
getBucketName() {
return this.info.name;
}
configureS3Options(args) {
super.configureS3Options(args);
args.push("--endpoint", `${this.info.region}.digitaloceanspaces.com`);
args.push("--region", this.info.region);
const accessKey = process.env.DO_KEY_ID;
const secretKey = process.env.DO_SECRET_KEY;
if ((0, _builderUtil().isEmptyOrSpaces)(accessKey)) {
throw new (_builderUtil().InvalidConfigurationError)("Please set env DO_KEY_ID (see https://www.electron.build/configuration/publish#spacesoptions)");
}
if ((0, _builderUtil().isEmptyOrSpaces)(secretKey)) {
throw new (_builderUtil().InvalidConfigurationError)("Please set env DO_SECRET_KEY (see https://www.electron.build/configuration/publish#spacesoptions)");
}
args.push("--accessKey", accessKey);
args.push("--secretKey", secretKey);
}
} exports.default = SpacesPublisher;
// __ts-babel@6.0.4
//# sourceMappingURL=spacesPublisher.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/publish/s3/spacesPublisher.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEc,MAAO,eAAP,SAA+B,kCAA/B,CAA8C;AAG1D,EAAA,WAAA,CAAY,OAAZ,EAAsD,IAAtD,EAAyE;AACvE,UAAM,OAAN,EAAe,IAAf;AADoD,SAAA,IAAA,GAAA,IAAA;AAF7C,SAAA,YAAA,GAAe,QAAf;AAIR,GALyD,CAO1D;;;AACA,eAAa,sBAAb,CAAoC,OAApC,EAA4D,qBAA5D,EAAkG,aAAlG,EAAwH;AACtH,QAAI,OAAO,CAAC,IAAR,IAAgB,IAApB,EAA0B;AACxB,YAAM,KAAI,wCAAJ,EAA8B,0HAA9B,CAAN;AACD;;AACD,QAAI,OAAO,CAAC,MAAR,IAAkB,IAAtB,EAA4B;AAC1B,YAAM,KAAI,wCAAJ,EAA8B,4HAA9B,CAAN;AACD;;AAED,QAAI,OAAO,CAAC,OAAR,IAAmB,IAAnB,IAA2B,qBAAqB,IAAI,IAAxD,EAA8D;AAC5D,MAAA,OAAO,CAAC,OAAR,GAAkB,qBAAlB;AACD;AACF;;AAES,EAAA,aAAa,GAAA;AACrB,WAAO,KAAK,IAAL,CAAU,IAAjB;AACD;;AAES,EAAA,kBAAkB,CAAC,IAAD,EAAoB;AAC9C,UAAM,kBAAN,CAAyB,IAAzB;AAEA,IAAA,IAAI,CAAC,IAAL,CAAU,YAAV,EAAwB,GAAG,KAAK,IAAL,CAAU,MAAM,yBAA3C;AACA,IAAA,IAAI,CAAC,IAAL,CAAU,UAAV,EAAsB,KAAK,IAAL,CAAU,MAAhC;AAEA,UAAM,SAAS,GAAG,OAAO,CAAC,GAAR,CAAY,SAA9B;AACA,UAAM,SAAS,GAAG,OAAO,CAAC,GAAR,CAAY,aAA9B;;AACA,QAAI,oCAAgB,SAAhB,CAAJ,EAAgC;AAC9B,YAAM,KAAI,wCAAJ,EAA8B,+FAA9B,CAAN;AACD;;AACD,QAAI,oCAAgB,SAAhB,CAAJ,EAAgC;AAC9B,YAAM,KAAI,wCAAJ,EAA8B,mGAA9B,CAAN;AACD;;AACD,IAAA,IAAI,CAAC,IAAL,CAAU,aAAV,EAAyB,SAAzB;AACA,IAAA,IAAI,CAAC,IAAL,CAAU,aAAV,EAAyB,SAAzB;AACD;;AAzCyD,C","sourcesContent":["import { InvalidConfigurationError, isEmptyOrSpaces } from \"builder-util\"\nimport { SpacesOptions } from \"builder-util-runtime\"\nimport { PublishContext } from \"electron-publish\"\nimport { BaseS3Publisher } from \"./BaseS3Publisher\"\n\nexport default class SpacesPublisher extends BaseS3Publisher {\n readonly providerName = \"Spaces\"\n\n constructor(context: PublishContext, private readonly info: SpacesOptions) {\n super(context, info)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static async checkAndResolveOptions(options: SpacesOptions, channelFromAppVersion: string | null, errorIfCannot: boolean) {\n if (options.name == null) {\n throw new InvalidConfigurationError(`Please specify \"name\" for \"spaces\" publish provider (see https://www.electron.build/configuration/publish#spacesoptions)`)\n }\n if (options.region == null) {\n throw new InvalidConfigurationError(`Please specify \"region\" for \"spaces\" publish provider (see https://www.electron.build/configuration/publish#spacesoptions)`)\n }\n\n if (options.channel == null && channelFromAppVersion != null) {\n options.channel = channelFromAppVersion\n }\n }\n\n protected getBucketName(): string {\n return this.info.name\n }\n\n protected configureS3Options(args: Array<string>): void {\n super.configureS3Options(args)\n\n args.push(\"--endpoint\", `${this.info.region}.digitaloceanspaces.com`)\n args.push(\"--region\", this.info.region)\n\n const accessKey = process.env.DO_KEY_ID\n const secretKey = process.env.DO_SECRET_KEY\n if (isEmptyOrSpaces(accessKey)) {\n throw new InvalidConfigurationError(\"Please set env DO_KEY_ID (see https://www.electron.build/configuration/publish#spacesoptions)\")\n }\n if (isEmptyOrSpaces(secretKey)) {\n throw new InvalidConfigurationError(\"Please set env DO_SECRET_KEY (see https://www.electron.build/configuration/publish#spacesoptions)\")\n }\n args.push(\"--accessKey\", accessKey)\n args.push(\"--secretKey\", secretKey)\n }\n}"],"sourceRoot":""}

View File

@ -0,0 +1,10 @@
import { PublishConfiguration, UpdateInfo } from "builder-util-runtime";
import { Packager } from "../packager";
import { PlatformPackager } from "../platformPackager";
export interface UpdateInfoFileTask {
readonly file: string;
readonly info: UpdateInfo;
readonly publishConfiguration: PublishConfiguration;
readonly packager: PlatformPackager<any>;
}
export declare function writeUpdateInfoFiles(updateInfoFileTasks: Array<UpdateInfoFileTask>, packager: Packager): Promise<void>;

View File

@ -0,0 +1,352 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createUpdateInfoTasks = createUpdateInfoTasks;
exports.writeUpdateInfoFiles = writeUpdateInfoFiles;
function _bluebirdLst() {
const data = _interopRequireDefault(require("bluebird-lst"));
_bluebirdLst = function () {
return data;
};
return data;
}
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function _lazyVal() {
const data = require("lazy-val");
_lazyVal = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function semver() {
const data = _interopRequireWildcard(require("semver"));
semver = function () {
return data;
};
return data;
}
function _core() {
const data = require("../core");
_core = function () {
return data;
};
return data;
}
function _hash() {
const data = require("../util/hash");
_hash = function () {
return data;
};
return data;
}
function _PublishManager() {
const data = require("./PublishManager");
_PublishManager = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function getReleaseInfo(packager) {
const releaseInfo = { ...(packager.platformSpecificBuildOptions.releaseInfo || packager.config.releaseInfo)
};
if (releaseInfo.releaseNotes == null) {
const releaseNotesFile = await packager.getResource(releaseInfo.releaseNotesFile, `release-notes-${packager.platform.buildConfigurationKey}.md`, `release-notes-${packager.platform.name}.md`, `release-notes-${packager.platform.nodeName}.md`, "release-notes.md");
const releaseNotes = releaseNotesFile == null ? null : await (0, _fsExtra().readFile)(releaseNotesFile, "utf-8"); // to avoid undefined in the file, check for null
if (releaseNotes != null) {
releaseInfo.releaseNotes = releaseNotes;
}
}
delete releaseInfo.releaseNotesFile;
return releaseInfo;
}
function isGenerateUpdatesFilesForAllChannels(packager) {
const value = packager.platformSpecificBuildOptions.generateUpdatesFilesForAllChannels;
return value == null ? packager.config.generateUpdatesFilesForAllChannels : value;
}
/**
if this is an "alpha" version, we need to generate only the "alpha" .yml file
if this is a "beta" version, we need to generate both the "alpha" and "beta" .yml file
if this is a "stable" version, we need to generate all the "alpha", "beta" and "stable" .yml file
*/
function computeChannelNames(packager, publishConfig) {
const currentChannel = publishConfig.channel || "latest"; // for GitHub should be pre-release way be used
if (currentChannel === "alpha" || publishConfig.provider === "github" || !isGenerateUpdatesFilesForAllChannels(packager)) {
return [currentChannel];
}
switch (currentChannel) {
case "beta":
return [currentChannel, "alpha"];
case "latest":
return [currentChannel, "alpha", "beta"];
default:
return [currentChannel];
}
}
function getUpdateInfoFileName(channel, packager, arch) {
const osSuffix = packager.platform === _core().Platform.WINDOWS ? "" : `-${packager.platform.buildConfigurationKey}`;
return `${channel}${osSuffix}${getArchPrefixForUpdateFile(arch, packager)}.yml`;
}
function getArchPrefixForUpdateFile(arch, packager) {
if (arch == null || arch === _builderUtil().Arch.x64 || packager.platform !== _core().Platform.LINUX) {
return "";
}
return arch === _builderUtil().Arch.armv7l ? "-arm" : `-${_builderUtil().Arch[arch]}`;
}
function computeIsisElectronUpdater1xCompatibility(updaterCompatibility, publishConfiguration, packager) {
if (updaterCompatibility != null) {
return semver().satisfies("1.0.0", updaterCompatibility);
} // spaces is a new publish provider, no need to keep backward compatibility
if (publishConfiguration.provider === "spaces") {
return false;
}
const updaterVersion = packager.metadata.dependencies == null ? null : packager.metadata.dependencies["electron-updater"];
return updaterVersion == null || semver().lt(updaterVersion, "4.0.0");
}
/** @internal */
async function createUpdateInfoTasks(event, _publishConfigs) {
const packager = event.packager;
const publishConfigs = await (0, _PublishManager().getPublishConfigsForUpdateInfo)(packager, _publishConfigs, event.arch);
if (publishConfigs == null || publishConfigs.length === 0) {
return [];
}
const outDir = event.target.outDir;
const version = packager.appInfo.version;
const sha2 = new (_lazyVal().Lazy)(() => (0, _hash().hashFile)(event.file, "sha256", "hex"));
const isMac = packager.platform === _core().Platform.MAC;
const createdFiles = new Set();
const sharedInfo = await createUpdateInfo(version, event, await getReleaseInfo(packager));
const tasks = [];
const electronUpdaterCompatibility = packager.platformSpecificBuildOptions.electronUpdaterCompatibility || packager.config.electronUpdaterCompatibility || ">=2.15";
for (const publishConfiguration of publishConfigs) {
const isBintray = publishConfiguration.provider === "bintray";
let dir = outDir; // Bintray uses different variant of channel file info, better to generate it to a separate dir by always
if (isBintray || publishConfigs.length > 1 && publishConfiguration !== publishConfigs[0]) {
dir = path.join(outDir, publishConfiguration.provider);
}
let isElectronUpdater1xCompatibility = computeIsisElectronUpdater1xCompatibility(electronUpdaterCompatibility, publishConfiguration, packager.info);
let info = sharedInfo; // noinspection JSDeprecatedSymbols
if (isElectronUpdater1xCompatibility && packager.platform === _core().Platform.WINDOWS) {
info = { ...info
}; // noinspection JSDeprecatedSymbols
info.sha2 = await sha2.value;
}
if (event.safeArtifactName != null && publishConfiguration.provider === "github") {
const newFiles = info.files.slice();
newFiles[0].url = event.safeArtifactName;
info = { ...info,
files: newFiles,
path: event.safeArtifactName
};
}
for (const channel of computeChannelNames(packager, publishConfiguration)) {
if (isMac && isElectronUpdater1xCompatibility && event.file.endsWith(".zip")) {
// write only for first channel (generateUpdatesFilesForAllChannels is a new functionality, no need to generate old mac update info file)
isElectronUpdater1xCompatibility = false;
await writeOldMacInfo(publishConfiguration, outDir, dir, channel, createdFiles, version, packager);
}
const updateInfoFile = path.join(dir, (isBintray ? `${version}_` : "") + getUpdateInfoFileName(channel, packager, event.arch));
if (createdFiles.has(updateInfoFile)) {
continue;
}
createdFiles.add(updateInfoFile); // artifact should be uploaded only to designated publish provider
tasks.push({
file: updateInfoFile,
info,
publishConfiguration,
packager
});
}
}
return tasks;
}
async function createUpdateInfo(version, event, releaseInfo) {
const customUpdateInfo = event.updateInfo;
const url = path.basename(event.file);
const sha512 = (customUpdateInfo == null ? null : customUpdateInfo.sha512) || (await (0, _hash().hashFile)(event.file));
const files = [{
url,
sha512
}];
const result = {
// @ts-ignore
version,
// @ts-ignore
files,
// @ts-ignore
path: url
/* backward compatibility, electron-updater 1.x - electron-updater 2.15.0 */
,
// @ts-ignore
sha512
/* backward compatibility, electron-updater 1.x - electron-updater 2.15.0 */
,
...releaseInfo
};
if (customUpdateInfo != null) {
// file info or nsis web installer packages info
Object.assign("sha512" in customUpdateInfo ? files[0] : result, customUpdateInfo);
}
return result;
}
async function writeUpdateInfoFiles(updateInfoFileTasks, packager) {
// zip must be first and zip info must be used for old path/sha512 properties in the update info
updateInfoFileTasks.sort((a, b) => (a.info.files[0].url.endsWith(".zip") ? 0 : 100) - (b.info.files[0].url.endsWith(".zip") ? 0 : 100));
const updateChannelFileToInfo = new Map();
for (const task of updateInfoFileTasks) {
// https://github.com/electron-userland/electron-builder/pull/2994
const key = `${task.file}@${(0, _builderUtil().safeStringifyJson)(task.publishConfiguration, new Set(["releaseType"]))}`;
const existingTask = updateChannelFileToInfo.get(key);
if (existingTask == null) {
updateChannelFileToInfo.set(key, task);
continue;
}
existingTask.info.files.push(...task.info.files);
}
const releaseDate = new Date().toISOString();
await _bluebirdLst().default.map(updateChannelFileToInfo.values(), async task => {
const publishConfig = task.publishConfiguration;
if (publishConfig.publishAutoUpdate === false) {
_builderUtil().log.debug({
provider: publishConfig.provider,
reason: "publishAutoUpdate is set to false"
}, "auto update metadata file not published");
return;
}
if (task.info.releaseDate == null) {
task.info.releaseDate = releaseDate;
}
const fileContent = Buffer.from((0, _builderUtil().serializeToYaml)(task.info, false, true));
await (0, _fsExtra().outputFile)(task.file, fileContent);
packager.dispatchArtifactCreated({
file: task.file,
fileContent,
arch: null,
packager: task.packager,
target: null,
publishConfig
});
}, {
concurrency: 4
});
} // backward compatibility - write json file
async function writeOldMacInfo(publishConfig, outDir, dir, channel, createdFiles, version, packager) {
const isGitHub = publishConfig.provider === "github";
const updateInfoFile = isGitHub && outDir === dir ? path.join(dir, "github", `${channel}-mac.json`) : path.join(dir, `${channel}-mac.json`);
if (!createdFiles.has(updateInfoFile)) {
createdFiles.add(updateInfoFile);
await (0, _fsExtra().outputJson)(updateInfoFile, {
version,
releaseDate: new Date().toISOString(),
url: (0, _PublishManager().computeDownloadUrl)(publishConfig, packager.generateName2("zip", "mac", isGitHub), packager)
}, {
spaces: 2
});
packager.info.dispatchArtifactCreated({
file: updateInfoFile,
arch: null,
packager,
target: null,
publishConfig
});
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=updateInfoBuilder.js.map

File diff suppressed because one or more lines are too long