thedesk/app/node_modules/app-builder-lib/out/publish/PublishManager.js.map
2019-09-12 23:38:13 +09:00

2 lines
36 KiB
Plaintext

{"version":3,"sources":["../../src/publish/PublishManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAEA,MAAM,mBAAmB,GAAG,yKAC1B,6LADF;AAGA,MAAM,KAAK,GAAG,qBAAO,0BAAP,CAAd;;AAEA,SAAS,YAAT,CAAsB,aAAtB,EAAwC;AACtC,MAAI,aAAa,IAAI,IAAjB,IAAyB,aAAa,KAAK,OAA3C,IAAsD,aAAa,KAAK,cAAxE,IAA0F,aAAa,KAAK,QAA5G,IAAwH,aAAa,KAAK,OAA9I,EAAuJ;AACrJ,QAAI,OAAO,aAAP,KAAyB,QAA7B,EAAuC;AACrC,YAAM,KAAI,wCAAJ,EAA8B,u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,EAAkB;AAChB,aAAO,IAAP;AACD;;AAED,UAAM,OAAO,GAAG,2MAAhB;;AACA,QAAI,aAAJ,EAAmB;AACjB,YAAM,IAAI,KAAJ,CAAU,OAAV,CAAN;AACD,KAFD,MAGK;AACH,yBAAI,IAAJ,CAAS,OAAT;;AACA,aAAO,IAAP;AACD;AACF;;AAED,MAAI,CAAC,KAAD,IAAU,CAAC,OAAf,EAAwB;AACtB,uBAAI,KAAJ,CAAU;AAAC,MAAA,MAAM,EAAE,8CAAT;AAAyD,MAAA,QAAzD;AAAmE,MAAA,KAAnE;AAA0E,MAAA;AAA1E,KAAV,EAA8F,iBAA9F;;AACA,UAAM,IAAI,GAAG,MAAM,OAAO,EAA1B;;AACA,QAAI,IAAI,IAAI,IAAZ,EAAkB;AAChB,aAAO,IAAP;AACD;;AAED,QAAI,CAAC,KAAL,EAAY;AACV,MAAA,KAAK,GAAG,IAAI,CAAC,IAAb;AACD;;AACD,QAAI,CAAC,OAAL,EAAc;AACZ,MAAA,OAAO,GAAG,IAAI,CAAC,OAAf;AACD;AACF;;AAED,MAAI,QAAJ,EAAc;AACZ,QAAK,OAAyB,CAAC,KAA1B,IAAmC,IAAnC,IAA2C,CAAE,OAAyB,CAAC,OAA5E,EAAqF;AACnF,yBAAI,IAAJ,CAAS,yJAAT;AACD,KAHW,CAIZ;;;AACA,WAAO,MAAA,CAAA,MAAA,CAAA;AAAC,MAAA,KAAD;AAAQ,MAAA,IAAI,EAAE;AAAd,KAAA,EAA0B,OAA1B,CAAP;AACD,GAND,MAOK;AACH;AACA,WAAO,MAAA,CAAA,MAAA,CAAA;AAAC,MAAA,KAAD;AAAQ,MAAA,OAAO,EAAE;AAAjB,KAAA,EAA6B,OAA7B,CAAP;AACD;AACF,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, AsyncTaskManager, InvalidConfigurationError, isEmptyOrSpaces, isPullRequest, log, safeStringifyJson, serializeToYaml } from \"builder-util\"\nimport { BintrayOptions, CancellationToken, GenericServerOptions, getS3LikeProviderBaseUrl, GithubOptions, githubUrl, PublishConfiguration, PublishProvider } from \"builder-util-runtime\"\nimport _debug from \"debug\"\nimport { getCiTag, PublishContext, Publisher, PublishOptions, UploadTask } from \"electron-publish\"\nimport { BintrayPublisher } from \"./BintrayPublisher\"\nimport { GitHubPublisher } from \"electron-publish/out/gitHubPublisher\"\nimport { MultiProgress } from \"electron-publish/out/multiProgress\"\nimport S3Publisher from \"./s3/s3Publisher\"\nimport SpacesPublisher from \"./s3/spacesPublisher\"\nimport { writeFile } from \"fs-extra\"\nimport isCi from \"is-ci\"\nimport * as path from \"path\"\nimport { WriteStream as TtyWriteStream } from \"tty\"\nimport * as url from \"url\"\nimport { AppInfo, ArtifactCreated, Configuration, Platform, PlatformSpecificBuildOptions, Target } from \"../index\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { expandMacro } from \"../util/macroExpander\"\nimport { WinPackager } from \"../winPackager\"\nimport { SnapStoreOptions, SnapStorePublisher } from \"./SnapStorePublisher\"\nimport { createUpdateInfoTasks, UpdateInfoFileTask, writeUpdateInfoFiles } from \"./updateInfoBuilder\"\n\nconst 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)\" +\n \"\\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.\"\n\nconst debug = _debug(\"electron-builder:publish\")\n\nfunction checkOptions(publishPolicy: any) {\n if (publishPolicy != null && publishPolicy !== \"onTag\" && publishPolicy !== \"onTagOrDraft\" && publishPolicy !== \"always\" && publishPolicy !== \"never\") {\n if (typeof publishPolicy === \"string\") {\n throw new InvalidConfigurationError(`Expected one of \"onTag\", \"onTagOrDraft\", \"always\", \"never\", but got ${JSON.stringify(publishPolicy)}.\\nPlease note that publish configuration should be specified under \"config\"`)\n }\n }\n}\n\nexport class PublishManager implements PublishContext {\n private readonly nameToPublisher = new Map<string, Publisher | null>()\n\n private readonly taskManager: AsyncTaskManager\n\n readonly isPublish: boolean = false\n\n readonly progress = (process.stdout as TtyWriteStream).isTTY ? new MultiProgress() : null\n\n private readonly updateFileWriteTask: Array<UpdateInfoFileTask> = []\n\n constructor(private readonly packager: Packager, private readonly publishOptions: PublishOptions, readonly cancellationToken: CancellationToken = packager.cancellationToken) {\n checkOptions(publishOptions.publish)\n\n this.taskManager = new AsyncTaskManager(cancellationToken)\n\n const forcePublishForPr = process.env.PUBLISH_FOR_PULL_REQUEST === \"true\"\n if (!isPullRequest() || forcePublishForPr) {\n if (publishOptions.publish === undefined) {\n if (process.env.npm_lifecycle_event === \"release\") {\n publishOptions.publish = \"always\"\n }\n else {\n const tag = getCiTag()\n if (tag != null) {\n log.info({reason: \"tag is defined\", tag}, \"artifacts will be published\")\n publishOptions.publish = \"onTag\"\n }\n else if (isCi) {\n log.info({reason: \"CI detected\"}, \"artifacts will be published if draft release exists\")\n publishOptions.publish = \"onTagOrDraft\"\n }\n }\n }\n\n const publishPolicy = publishOptions.publish\n this.isPublish = publishPolicy != null && publishOptions.publish !== \"never\" && (publishPolicy !== \"onTag\" || getCiTag() != null)\n if (this.isPublish && forcePublishForPr) {\n log.warn(publishForPrWarning)\n }\n }\n else if (publishOptions.publish !== \"never\") {\n log.info({\n reason: \"current build is a part of pull request\",\n solution: `set env PUBLISH_FOR_PULL_REQUEST to true to force code signing\\n${publishForPrWarning}`,\n }, \"publishing will be skipped\")\n }\n\n packager.addAfterPackHandler(async event => {\n const packager = event.packager\n if (event.electronPlatformName === \"darwin\") {\n if (!event.targets.some(it => it.name === \"dmg\" || it.name === \"zip\")) {\n return\n }\n }\n else if (packager.platform === Platform.WINDOWS) {\n if (!event.targets.some(it => isSuitableWindowsTarget(it))) {\n return\n }\n }\n else {\n // AppImage writes data to AppImage stage dir, not to linux-unpacked\n return\n }\n\n const publishConfig = await getAppUpdatePublishConfiguration(packager, event.arch, this.isPublish)\n if (publishConfig != null) {\n await writeFile(path.join(packager.getResourcesDir(event.appOutDir), \"app-update.yml\"), serializeToYaml(publishConfig))\n }\n })\n\n packager.artifactCreated(event => {\n const publishConfiguration = event.publishConfig\n if (publishConfiguration == null) {\n this.taskManager.addTask(this.artifactCreatedWithoutExplicitPublishConfig(event))\n }\n else if (this.isPublish) {\n if (debug.enabled) {\n debug(`artifactCreated (isPublish: ${this.isPublish}): ${safeStringifyJson(event, new Set([\"packager\"]))},\\n publishConfig: ${safeStringifyJson(publishConfiguration)}`)\n }\n this.scheduleUpload(publishConfiguration, event, this.getAppInfo(event.packager))\n }\n })\n }\n\n private getAppInfo(platformPackager: PlatformPackager<any> | null) {\n return platformPackager == null ? this.packager.appInfo : platformPackager.appInfo\n }\n\n async getGlobalPublishConfigurations(): Promise<Array<PublishConfiguration> | null> {\n const publishers = this.packager.config.publish\n return await resolvePublishConfigurations(publishers, null, this.packager, null, true)\n }\n\n /** @internal */\n scheduleUpload(publishConfig: PublishConfiguration, event: UploadTask, appInfo: AppInfo): void {\n if (publishConfig.provider === \"generic\") {\n return\n }\n\n const publisher = this.getOrCreatePublisher(publishConfig, appInfo)\n if (publisher == null) {\n log.debug({\n file: event.file,\n reason: \"publisher is null\",\n publishConfig: safeStringifyJson(publishConfig),\n }, \"not published\")\n return\n }\n\n const providerName = publisher.providerName\n if (this.publishOptions.publish === \"onTagOrDraft\" && getCiTag() == null && !(providerName === \"GitHub\" || providerName === \"Bintray\")) {\n log.info({file: event.file, reason: \"current build is not for a git tag\", publishPolicy: \"onTagOrDraft\"}, `not published to ${providerName}`)\n return\n }\n\n this.taskManager.addTask(publisher.upload(event))\n }\n\n private async artifactCreatedWithoutExplicitPublishConfig(event: ArtifactCreated) {\n const platformPackager = event.packager\n const target = event.target\n const publishConfigs = await getPublishConfigs(platformPackager, target == null ? null : target.options, event.arch, this.isPublish)\n\n if (debug.enabled) {\n debug(`artifactCreated (isPublish: ${this.isPublish}): ${safeStringifyJson(event, new Set([\"packager\"]))},\\n publishConfigs: ${safeStringifyJson(publishConfigs)}`)\n }\n\n const eventFile = event.file\n if (publishConfigs == null) {\n if (this.isPublish) {\n log.debug({file: eventFile, reason: \"no publish configs\"}, \"not published\")\n }\n return\n }\n\n if (this.isPublish) {\n for (const publishConfig of publishConfigs) {\n if (this.cancellationToken.cancelled) {\n log.debug({file: event.file, reason: \"cancelled\"}, \"not published\")\n break\n }\n\n this.scheduleUpload(publishConfig, event, this.getAppInfo(platformPackager))\n }\n }\n\n if (event.isWriteUpdateInfo && target != null && eventFile != null &&\n !this.cancellationToken.cancelled &&\n (platformPackager.platform !== Platform.WINDOWS || isSuitableWindowsTarget(target))) {\n this.taskManager.addTask(createUpdateInfoTasks(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it)))\n }\n }\n\n private getOrCreatePublisher(publishConfig: PublishConfiguration, appInfo: AppInfo): Publisher | null {\n // to not include token into cache key\n const providerCacheKey = safeStringifyJson(publishConfig)\n let publisher = this.nameToPublisher.get(providerCacheKey)\n if (publisher == null) {\n publisher = createPublisher(this, appInfo.version, publishConfig, this.publishOptions, this.packager)\n this.nameToPublisher.set(providerCacheKey, publisher)\n log.info({publisher: publisher!!.toString()}, \"publishing\")\n }\n return publisher\n }\n\n // noinspection JSUnusedGlobalSymbols\n cancelTasks() {\n this.taskManager.cancelTasks()\n this.nameToPublisher.clear()\n }\n\n async awaitTasks(): Promise<void> {\n await this.taskManager.awaitTasks()\n\n const updateInfoFileTasks = this.updateFileWriteTask\n if (this.cancellationToken.cancelled || updateInfoFileTasks.length === 0) {\n return\n }\n\n await writeUpdateInfoFiles(updateInfoFileTasks, this.packager)\n await this.taskManager.awaitTasks()\n }\n}\n\nexport async function getAppUpdatePublishConfiguration(packager: PlatformPackager<any>, arch: Arch, errorIfCannot: boolean) {\n const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, null, arch, errorIfCannot), arch)\n if (publishConfigs == null || publishConfigs.length === 0) {\n return null\n }\n\n const publishConfig = {\n ...publishConfigs[0],\n updaterCacheDirName: packager.appInfo.updaterCacheDirName,\n }\n\n if (packager.platform === Platform.WINDOWS && publishConfig.publisherName == null) {\n const winPackager = packager as WinPackager\n const publisherName = winPackager.isForceCodeSigningVerification ? await winPackager.computedPublisherName.value : undefined\n if (publisherName != null) {\n publishConfig.publisherName = publisherName\n }\n }\n return publishConfig\n}\n\nexport async function getPublishConfigsForUpdateInfo(packager: PlatformPackager<any>, publishConfigs: Array<PublishConfiguration> | null, arch: Arch | null): Promise<Array<PublishConfiguration> | null> {\n if (publishConfigs === null) {\n return null\n }\n\n if (publishConfigs.length === 0) {\n log.debug(null, \"getPublishConfigsForUpdateInfo: no publishConfigs, detect using repository info\")\n // https://github.com/electron-userland/electron-builder/issues/925#issuecomment-261732378\n // default publish config is github, file should be generated regardless of publish state (user can test installer locally or manage the release process manually)\n const repositoryInfo = await packager.info.repositoryInfo\n debug(`getPublishConfigsForUpdateInfo: ${safeStringifyJson(repositoryInfo)}`)\n if (repositoryInfo != null && repositoryInfo.type === \"github\") {\n const resolvedPublishConfig = await getResolvedPublishConfig(packager, packager.info, {provider: repositoryInfo.type}, arch, false)\n if (resolvedPublishConfig != null) {\n debug(`getPublishConfigsForUpdateInfo: resolve to publish config ${safeStringifyJson(resolvedPublishConfig)}`)\n return [resolvedPublishConfig]\n }\n }\n }\n return publishConfigs\n}\n\nexport function createPublisher(context: PublishContext, version: string, publishConfig: PublishConfiguration, options: PublishOptions, packager: Packager): Publisher | null {\n if (debug.enabled) {\n debug(`Create publisher: ${safeStringifyJson(publishConfig)}`)\n }\n\n const provider = publishConfig.provider\n switch (provider) {\n case \"github\":\n return new GitHubPublisher(context, publishConfig as GithubOptions, version, options)\n\n case \"bintray\":\n return new BintrayPublisher(context, publishConfig as BintrayOptions, version, options)\n\n case \"generic\":\n return null\n\n case \"snapStore\":\n return new SnapStorePublisher(context, publishConfig as SnapStoreOptions)\n\n default:\n const clazz = requireProviderClass(provider, packager)\n return clazz == null ? null : new clazz(context, publishConfig)\n }\n}\n\nfunction requireProviderClass(provider: string, packager: Packager): any | null {\n switch (provider) {\n case \"github\":\n return GitHubPublisher\n\n case \"bintray\":\n return BintrayPublisher\n\n case \"generic\":\n return null\n\n case \"s3\":\n return S3Publisher\n\n case \"snapStore\":\n return SnapStorePublisher\n\n case \"spaces\":\n return SpacesPublisher\n\n default:\n const name = `electron-publisher-${provider}`\n let module: any = null\n try {\n module = require(path.join(packager.buildResourcesDir, name + \".js\"))\n }\n catch (ignored) {\n console.log(ignored)\n }\n\n if (module == null) {\n module = require(name)\n }\n return module.default || module\n }\n}\n\nexport function computeDownloadUrl(publishConfiguration: PublishConfiguration, fileName: string | null, packager: PlatformPackager<any>) {\n if (publishConfiguration.provider === \"generic\") {\n const baseUrlString = (publishConfiguration as GenericServerOptions).url\n if (fileName == null) {\n return baseUrlString\n }\n\n const baseUrl = url.parse(baseUrlString)\n return url.format({...baseUrl as url.UrlObject, pathname: path.posix.resolve(baseUrl.pathname || \"/\", encodeURI(fileName))})\n }\n\n let baseUrl\n if (publishConfiguration.provider === \"github\") {\n const gh = publishConfiguration as GithubOptions\n baseUrl = `${githubUrl(gh)}/${gh.owner}/${gh.repo}/releases/download/${gh.vPrefixedTagName === false ? \"\" : \"v\"}${packager.appInfo.version}`\n }\n else {\n baseUrl = getS3LikeProviderBaseUrl(publishConfiguration)\n }\n\n if (fileName == null) {\n return baseUrl\n }\n return `${baseUrl}/${encodeURI(fileName)}`\n}\n\nexport async function getPublishConfigs(platformPackager: PlatformPackager<any>, targetSpecificOptions: PlatformSpecificBuildOptions | null | undefined, arch: Arch | null, errorIfCannot: boolean): Promise<Array<PublishConfiguration> | null> {\n let publishers\n\n // check build.nsis (target)\n if (targetSpecificOptions != null) {\n publishers = targetSpecificOptions.publish\n // if explicitly set to null - do not publish\n if (publishers === null) {\n return null\n }\n }\n\n // check build.win (platform)\n if (publishers == null) {\n publishers = platformPackager.platformSpecificBuildOptions.publish\n if (publishers === null) {\n return null\n }\n }\n\n if (publishers == null) {\n publishers = platformPackager.config.publish\n if (publishers === null) {\n return null\n }\n }\n return await resolvePublishConfigurations(publishers, platformPackager, platformPackager.info, arch, errorIfCannot)\n}\n\nasync function resolvePublishConfigurations(publishers: any, platformPackager: PlatformPackager<any> | null, packager: Packager, arch: Arch | null, errorIfCannot: boolean): Promise<Array<PublishConfiguration> | null> {\n if (publishers == null) {\n let serviceName: PublishProvider | null = null\n if (!isEmptyOrSpaces(process.env.GH_TOKEN) || !isEmptyOrSpaces(process.env.GITHUB_TOKEN)) {\n serviceName = \"github\"\n }\n else if (!isEmptyOrSpaces(process.env.BT_TOKEN)) {\n serviceName = \"bintray\"\n }\n\n if (serviceName != null) {\n log.debug(null, `detect ${serviceName} as publish provider`)\n return [(await getResolvedPublishConfig(platformPackager, packager, {provider: serviceName}, arch, errorIfCannot))!]\n }\n }\n\n if (publishers == null) {\n return []\n }\n\n debug(`Explicit publish provider: ${safeStringifyJson(publishers)}`)\n return await (BluebirdPromise.map(asArray(publishers), it => getResolvedPublishConfig(platformPackager, packager, typeof it === \"string\" ? {provider: it} : it, arch, errorIfCannot)) as Promise<Array<PublishConfiguration>>)\n}\n\nfunction isSuitableWindowsTarget(target: Target) {\n if (target.name === \"appx\" && target.options != null && (target.options as any).electronUpdaterAware) {\n return true\n }\n return target.name === \"nsis\" || target.name.startsWith(\"nsis-\")\n}\n\nfunction expandPublishConfig(options: any, platformPackager: PlatformPackager<any> | null, packager: Packager, arch: Arch | null): void {\n for (const name of Object.keys(options)) {\n const value = options[name]\n if (typeof value === \"string\") {\n const archValue = arch == null ? null : Arch[arch]\n const expanded = platformPackager == null ? expandMacro(value, archValue, packager.appInfo) : platformPackager.expandMacro(value, archValue)\n if (expanded !== value) {\n options[name] = expanded\n }\n }\n }\n}\n\nfunction isDetectUpdateChannel(platformSpecificConfiguration: PlatformSpecificBuildOptions | null, configuration: Configuration) {\n const value = platformSpecificConfiguration == null ? null : platformSpecificConfiguration.detectUpdateChannel\n return value == null ? configuration.detectUpdateChannel !== false : value\n}\n\nasync function getResolvedPublishConfig(platformPackager: PlatformPackager<any> | null, packager: Packager, options: PublishConfiguration, arch: Arch | null, errorIfCannot: boolean): Promise<PublishConfiguration | GithubOptions | BintrayOptions | null> {\n options = {...options}\n expandPublishConfig(options, platformPackager, packager, arch)\n\n let channelFromAppVersion: string | null = null\n if ((options as GenericServerOptions).channel == null && isDetectUpdateChannel(platformPackager == null ? null : platformPackager.platformSpecificBuildOptions, packager.config)) {\n channelFromAppVersion = packager.appInfo.channel\n }\n\n const provider = options.provider\n if (provider === \"generic\") {\n const o = options as GenericServerOptions\n if (o.url == null) {\n throw new InvalidConfigurationError(`Please specify \"url\" for \"generic\" update server`)\n }\n\n if (channelFromAppVersion != null) {\n (o as any).channel = channelFromAppVersion\n }\n return options\n }\n\n const providerClass = requireProviderClass(options.provider, packager)\n if (providerClass != null && providerClass.checkAndResolveOptions != null) {\n await providerClass.checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot)\n return options\n }\n\n const isGithub = provider === \"github\"\n if (!isGithub && provider !== \"bintray\") {\n return options\n }\n\n let owner = isGithub ? (options as GithubOptions).owner : (options as BintrayOptions).owner\n let project = isGithub ? (options as GithubOptions).repo : (options as BintrayOptions).package\n\n if (isGithub && owner == null && project != null) {\n const index = project.indexOf(\"/\")\n if (index > 0) {\n const repo = project\n project = repo.substring(0, index)\n owner = repo.substring(index + 1)\n }\n }\n\n async function getInfo() {\n const info = await packager.repositoryInfo\n if (info != null) {\n return info\n }\n\n 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`\n if (errorIfCannot) {\n throw new Error(message)\n }\n else {\n log.warn(message)\n return null\n }\n }\n\n if (!owner || !project) {\n log.debug({reason: \"owner or project is not specified explicitly\", provider, owner, project}, \"calling getInfo\")\n const info = await getInfo()\n if (info == null) {\n return null\n }\n\n if (!owner) {\n owner = info.user\n }\n if (!project) {\n project = info.project\n }\n }\n\n if (isGithub) {\n if ((options as GithubOptions).token != null && !(options as GithubOptions).private) {\n log.warn('\"token\" specified in the github publish options. It should be used only for [setFeedURL](module:electron-updater/out/AppUpdater.AppUpdater+setFeedURL).')\n }\n //tslint:disable-next-line:no-object-literal-type-assertion\n return {owner, repo: project, ...options} as GithubOptions\n }\n else {\n //tslint:disable-next-line:no-object-literal-type-assertion\n return {owner, package: project, ...options} as BintrayOptions\n }\n}"],"sourceRoot":""}