Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async getLatestVersion(): Promise {
const cancellationToken = new CancellationToken()
const feedXml: string = (await this.httpRequest(newUrlFromBase(`${this.basePath}.atom`, this.baseUrl), {
accept: "application/xml, application/atom+xml, text/xml, */*",
}, cancellationToken))!
const feed = parseXml(feedXml)
let latestRelease = feed.element("entry", false, `No published versions on GitHub`)
let version: string | null
try {
if (this.updater.allowPrerelease) {
// noinspection TypeScriptValidateJSTypes
version = latestRelease.element("link").attribute("href").match(hrefRegExp)!![1]
}
else {
version = await this.getLatestVersionString(cancellationToken)
for (const element of feed.getElements("entry")) {
async getLatestVersion(): Promise {
const cancellationToken = new CancellationToken()
const channelFile = getChannelFilename(this.getDefaultChannelName())
const releaseInfo = await this.getLatestVersionInfo(cancellationToken)
const asset = releaseInfo.assets.find(it => it.name === channelFile)
if (asset == null) {
// html_url must be always, but just to be sure
throw newError(`Cannot find ${channelFile} in the release ${releaseInfo.html_url || releaseInfo.name}`, "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND")
}
const url = new URL(asset.url)
let result: any
try {
result = safeLoad((await this.httpRequest(url, this.configureHeaders("application/octet-stream"), cancellationToken))!!)
}
catch (e) {
if (e instanceof HttpError && e.statusCode === 404) {
async function packAndCheck(packagerOptions: PackagerOptions, checkOptions: AssertPackOptions) {
const cancellationToken = new CancellationToken()
const packager = new Packager(packagerOptions, cancellationToken)
const publishManager = new PublishManager(packager, {publish: "publish" in checkOptions ? checkOptions.publish : "never"})
const artifacts: Map> = new Map()
packager.artifactCreated(event => {
if (event.file == null) {
return
}
assertThat(event.file).isAbsolute()
addValue(artifacts, event.packager.platform, event)
})
const {outDir, platformToTargets} = await packager.build()
await publishManager.awaitTasks()
constructor(options: PackagerOptions, readonly cancellationToken = new CancellationToken()) {
if ("devMetadata" in options) {
throw new InvalidConfigurationError("devMetadata in the options is deprecated, please use config instead")
}
if ("extraMetadata" in options) {
throw new InvalidConfigurationError("extraMetadata in the options is deprecated, please use config.extraMetadata instead")
}
const targets = options.targets || new Map>>()
if (options.targets == null) {
options.targets = targets
}
function processTargets(platform: Platform, types: Array) {
function commonArch(currentIfNotSpecified: boolean): Array {
if (platform === Platform.MAC) {
return currentIfNotSpecified ? [Arch.x64] : []