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IAAI,IAAI,OAAO,GAAG,KAAK,SAAS,EAAE,CAAC;QAC5C,MAAM,IAAI,wCAAyB,CAAC,kDAAkD,GAAG,kBAAkB,CAAC,CAAA;IAC9G,CAAC;AACH,CAAC","sourcesContent":["import { sanitizeFileName } from \"app-builder-lib/out/util/filename\"\nimport { InvalidConfigurationError, log, isEmptyOrSpaces } from \"builder-util\"\nimport { getBinFromUrl } from \"app-builder-lib/out/binDownload\"\nimport { Arch, getArchSuffix, SquirrelWindowsOptions, Target } from \"app-builder-lib\"\nimport { WinPackager } from \"app-builder-lib/out/winPackager\"\nimport * as path from \"path\"\nimport { convertVersion, SquirrelBuilder, SquirrelOptions } from \"./squirrelPack\"\n\nexport default class SquirrelWindowsTarget extends Target {\n //tslint:disable-next-line:no-object-literal-type-assertion\n readonly options: SquirrelWindowsOptions = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config.squirrelWindows } as SquirrelWindowsOptions\n\n constructor(\n private readonly packager: WinPackager,\n readonly outDir: string\n ) {\n super(\"squirrel\")\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const version = packager.appInfo.version\n const sanitizedName = sanitizeFileName(this.appName)\n\n // tslint:disable-next-line:no-invalid-template-strings\n const setupFile = packager.expandArtifactNamePattern(this.options, \"exe\", arch, \"${productName} Setup ${version}.${ext}\")\n const packageFile = `${sanitizedName}-${convertVersion(version)}-full.nupkg`\n\n const installerOutDir = path.join(this.outDir, `squirrel-windows${getArchSuffix(arch)}`)\n const artifactPath = path.join(installerOutDir, setupFile)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"Squirrel.Windows\",\n file: artifactPath,\n arch,\n })\n\n if (arch === Arch.ia32) {\n log.warn(\"For windows consider only distributing 64-bit or use nsis target, see https://github.com/electron-userland/electron-builder/issues/359#issuecomment-214851130\")\n }\n\n const distOptions = await this.computeEffectiveDistOptions()\n const squirrelBuilder = new SquirrelBuilder(distOptions, installerOutDir, packager)\n await squirrelBuilder.buildInstaller({ setupFile, packageFile }, appOutDir, this.outDir, arch)\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n target: this,\n arch,\n safeArtifactName: `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.exe`,\n packager: this.packager,\n })\n\n const packagePrefix = `${this.appName}-${convertVersion(version)}-`\n packager.info.dispatchArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),\n target: this,\n arch,\n packager,\n })\n if (distOptions.remoteReleases != null) {\n packager.info.dispatchArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}delta.nupkg`),\n target: this,\n arch,\n packager,\n })\n }\n\n packager.info.dispatchArtifactCreated({\n file: path.join(installerOutDir, \"RELEASES\"),\n target: this,\n arch,\n packager,\n })\n }\n\n private get appName() {\n return this.options.name || this.packager.appInfo.name\n }\n\n async computeEffectiveDistOptions(): Promise<SquirrelOptions> {\n const packager = this.packager\n let iconUrl = this.options.iconUrl\n if (iconUrl == null) {\n const info = await packager.info.repositoryInfo\n if (info != null) {\n iconUrl = `https://github.com/${info.user}/${info.project}/blob/master/${packager.info.relativeBuildResourcesDirname}/icon.ico?raw=true`\n }\n\n if (iconUrl == null) {\n throw new InvalidConfigurationError(\n \"squirrelWindows.iconUrl is not specified, please see https://www.electron.build/configuration/squirrel-windows#SquirrelWindowsOptions-iconUrl\"\n )\n }\n }\n\n checkConflictingOptions(this.options)\n\n const appInfo = packager.appInfo\n const projectUrl = await appInfo.computePackageUrl()\n const appName = this.appName\n const options: SquirrelOptions = {\n name: appName,\n productName: this.options.name || appInfo.productName,\n appId: this.options.useAppIdAsId ? appInfo.id : appName,\n version: appInfo.version,\n description: appInfo.description,\n // better to explicitly set to empty string, to avoid any nugget errors\n authors: appInfo.companyName || \"\",\n iconUrl,\n extraMetadataSpecs: projectUrl == null ? null : `\\n <projectUrl>${projectUrl}</projectUrl>`,\n copyright: appInfo.copyright,\n packageCompressionLevel: parseInt((process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL || packager.compression === \"store\" ? 0 : 9) as any, 10),\n vendorPath: await getBinFromUrl(\"Squirrel.Windows\", \"1.9.0\", \"zJHk4CMATM7jHJ2ojRH1n3LkOnaIezDk5FAzJmlSEQSiEdRuB4GGLCegLDtsRCakfHIVfKh3ysJHLjynPkXwhQ==\"),\n ...(this.options as any),\n }\n\n if (isEmptyOrSpaces(options.description)) {\n options.description = options.productName\n }\n\n if (options.remoteToken == null) {\n options.remoteToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN\n }\n\n if (!(\"loadingGif\" in options)) {\n const resourceList = await packager.resourceList\n if (resourceList.includes(\"install-spinner.gif\")) {\n options.loadingGif = path.join(packager.buildResourcesDir, \"install-spinner.gif\")\n }\n }\n\n if (this.options.remoteReleases === true) {\n const info = await packager.info.repositoryInfo\n if (info == null) {\n log.warn(\"remoteReleases set to true, but cannot get repository info\")\n } else {\n options.remoteReleases = `https://github.com/${info.user}/${info.project}`\n log.info({ remoteReleases: options.remoteReleases }, `remoteReleases is set`)\n }\n }\n\n return options\n }\n}\n\nfunction checkConflictingOptions(options: any) {\n for (const name of [\"outputDirectory\", \"appDirectory\", \"exe\", \"fixUpPaths\", \"usePackageJson\", \"extraFileSpecs\", \"extraMetadataSpecs\", \"skipUpdateIcon\", \"setupExe\"]) {\n if (name in options) {\n throw new InvalidConfigurationError(`Option ${name} is ignored, do not specify it.`)\n }\n }\n\n if (\"noMsi\" in options) {\n log.warn(`noMsi is deprecated, please specify as \"msi\": true if you want to create an MSI installer`)\n options.msi = !options.noMsi\n }\n\n const msi = options.msi\n if (msi != null && typeof msi !== \"boolean\") {\n throw new InvalidConfigurationError(`msi expected to be boolean value, but string '\"${msi}\"' was specified`)\n }\n}\n"]} |