diff --git a/package.json b/package.json index be63cb8a298..103ac73010e 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "dependencies": { "7zip-bin": "~4.1.0", "@types/is-ci": "^1.1.0", - "app-builder-bin": "2.5.4", + "app-builder-bin": "2.5.5", "archiver": "^3.0.0", "async-exit-hook": "^2.0.1", "bluebird-lst": "^1.0.6", @@ -50,7 +50,7 @@ "js-yaml": "^3.12.0", "lazy-val": "^1.0.3", "lodash.isequal": "^4.5.0", - "mime": "^2.3.1", + "mime": "^2.4.0", "minimatch": "^3.0.4", "normalize-package-data": "^2.4.0", "pako": "^1.0.6", diff --git a/packages/app-builder-lib/package.json b/packages/app-builder-lib/package.json index f40ccac7fce..d2c59a0c9c1 100644 --- a/packages/app-builder-lib/package.json +++ b/packages/app-builder-lib/package.json @@ -42,7 +42,7 @@ "homepage": "https://github.com/electron-userland/electron-builder", "dependencies": { "7zip-bin": "~4.1.0", - "app-builder-bin": "2.5.4", + "app-builder-bin": "2.5.5", "async-exit-hook": "^2.0.1", "bluebird-lst": "^1.0.6", "chromium-pickle-js": "^0.2.0", diff --git a/packages/app-builder-lib/src/configuration.ts b/packages/app-builder-lib/src/configuration.ts index 8c0001d7d20..3a7cd31570a 100644 --- a/packages/app-builder-lib/src/configuration.ts +++ b/packages/app-builder-lib/src/configuration.ts @@ -11,6 +11,7 @@ import { SnapOptions } from "./options/SnapOptions" import { SquirrelWindowsOptions } from "./options/SquirrelWindowsOptions" import { WindowsConfiguration } from "./options/winOptions" import { BuildResult } from "./packager" +import { ArtifactBuildStarted, ArtifactCreated } from "./packagerApi" import { PlatformPackager } from "./platformPackager" import { NsisOptions, NsisWebOptions, PortableOptions } from "./targets/nsis/nsisOptions" @@ -196,10 +197,20 @@ export interface Configuration extends PlatformSpecificBuildOptions { * The function (or path to file or module id) to be [run after pack and sign](#aftersign) (but before pack into distributable format). */ readonly afterSign?: ((context: AfterPackContext) => Promise | any) | string | null + + /** + * The function (or path to file or module id) to be run on artifact build start. + */ + readonly artifactBuildStarted?: ((context: ArtifactBuildStarted) => Promise | any) | string | null + /** + * The function (or path to file or module id) to be run on artifact build start. + */ + readonly artifactBuildCompleted?: ((context: ArtifactCreated) => Promise | any) | string | null /** * The function (or path to file or module id) to be [run after all artifacts are build](#afterAllArtifactBuild). */ readonly afterAllArtifactBuild?: ((context: BuildResult) => Promise> | Array) | string | null + /** * The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file. */ diff --git a/packages/app-builder-lib/src/core.ts b/packages/app-builder-lib/src/core.ts index 189aa360479..4e2a2ef09c2 100644 --- a/packages/app-builder-lib/src/core.ts +++ b/packages/app-builder-lib/src/core.ts @@ -1,4 +1,4 @@ -import { Arch, archFromString, ArchType, log } from "builder-util" +import { Arch, archFromString, ArchType } from "builder-util" import { Publish } from "builder-util-runtime" export type TargetConfigType = Array | string | TargetConfiguration | null @@ -75,11 +75,6 @@ export abstract class Target { protected constructor(readonly name: string, readonly isAsyncSupported: boolean = true) { } - // noinspection JSMethodCanBeStatic - protected logBuilding(targetPresentableName: string, artifactPath: string, arch: Arch): void { - log.info({target: targetPresentableName, arch: Arch[arch], file: log.filePath(artifactPath)}, "building") - } - async checkOptions(): Promise { // ignore } diff --git a/packages/app-builder-lib/src/index.ts b/packages/app-builder-lib/src/index.ts index f9c2a324317..8d98e973290 100644 --- a/packages/app-builder-lib/src/index.ts +++ b/packages/app-builder-lib/src/index.ts @@ -8,7 +8,7 @@ import { resolveFunction } from "./platformPackager" import { PublishManager } from "./publish/PublishManager" export { Packager, BuildResult } from "./packager" -export { PackagerOptions, ArtifactCreated } from "./packagerApi" +export { PackagerOptions, ArtifactCreated, ArtifactBuildStarted } from "./packagerApi" export { TargetConfiguration, Platform, Target, DIR_TARGET, BeforeBuildContext, SourceRepositoryInfo, TargetSpecificOptions, TargetConfigType, DEFAULT_TARGET, CompressionLevel } from "./core" export { getArchSuffix, Arch, archFromString } from "builder-util" export { Configuration, AfterPackContext, MetadataDirectories } from "./configuration" diff --git a/packages/app-builder-lib/src/macPackager.ts b/packages/app-builder-lib/src/macPackager.ts index 203107e5675..c6c62e9de6d 100644 --- a/packages/app-builder-lib/src/macPackager.ts +++ b/packages/app-builder-lib/src/macPackager.ts @@ -196,7 +196,7 @@ export default class MacPackager extends PlatformPackager { const artifactName = this.expandArtifactNamePattern(masOptions, "pkg") const artifactPath = path.join(outDir!, artifactName) await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainName) - this.dispatchArtifactCreated(artifactPath, null, Arch.x64, this.computeSafeArtifactName(artifactName, "pkg")) + await this.dispatchArtifactCreated(artifactPath, null, Arch.x64, this.computeSafeArtifactName(artifactName, "pkg")) } } diff --git a/packages/app-builder-lib/src/packager.ts b/packages/app-builder-lib/src/packager.ts index aef564768ce..575e975870e 100644 --- a/packages/app-builder-lib/src/packager.ts +++ b/packages/app-builder-lib/src/packager.ts @@ -15,7 +15,7 @@ import { LibUiFramework } from "./frameworks/LibUiFramework" import { AfterPackContext, Configuration, Framework, Platform, SourceRepositoryInfo, Target } from "./index" import MacPackager from "./macPackager" import { Metadata } from "./options/metadata" -import { ArtifactCreated, PackagerOptions } from "./packagerApi" +import { ArtifactBuildStarted, ArtifactCreated, PackagerOptions } from "./packagerApi" import { PlatformPackager, resolveFunction } from "./platformPackager" import { ProtonFramework } from "./ProtonFramework" import { computeArchToTargetNamesMap, createTargets, NoOpTarget } from "./targets/targetFactory" @@ -257,10 +257,34 @@ export class Packager { return this } - dispatchArtifactCreated(event: ArtifactCreated) { + async callArtifactBuildStarted(event: ArtifactBuildStarted, logFields?: any): Promise { + log.info(logFields || { + target: event.targetPresentableName, + arch: event.arch == null ? null : Arch[event.arch], + file: log.filePath(event.file), + }, "building") + const handler = resolveFunction(this.config.artifactBuildStarted, "artifactBuildStarted") + if (handler != null) { + await Promise.resolve(handler(event)) + } + } + + /** + * Only for sub artifacts (update info), for main artifacts use `callArtifactBuildCompleted`. + */ + dispatchArtifactCreated(event: ArtifactCreated): void { this.eventEmitter.emit("artifactCreated", event) } + async callArtifactBuildCompleted(event: ArtifactCreated): Promise { + this.dispatchArtifactCreated(event) + + const handler = resolveFunction(this.config.artifactBuildCompleted, "artifactBuildCompleted") + if (handler != null) { + await Promise.resolve(handler(event)) + } + } + async build(): Promise { let configPath: string | null = null let configFromOptions = this.options.config diff --git a/packages/app-builder-lib/src/packagerApi.ts b/packages/app-builder-lib/src/packagerApi.ts index e4b849c7941..50c98ed86b5 100644 --- a/packages/app-builder-lib/src/packagerApi.ts +++ b/packages/app-builder-lib/src/packagerApi.ts @@ -35,4 +35,12 @@ export interface ArtifactCreated extends UploadTask { readonly publishConfig?: PublishConfiguration readonly isWriteUpdateInfo?: boolean +} + +export interface ArtifactBuildStarted { + readonly targetPresentableName: string + + readonly file: string + // null for NSIS + readonly arch: Arch | null } \ No newline at end of file diff --git a/packages/app-builder-lib/src/platformPackager.ts b/packages/app-builder-lib/src/platformPackager.ts index ed1eaff211b..e97758cb519 100644 --- a/packages/app-builder-lib/src/platformPackager.ts +++ b/packages/app-builder-lib/src/platformPackager.ts @@ -101,8 +101,8 @@ export abstract class PlatformPackager return this.packagerOptions.prepackaged || path.join(outDir, `${this.platform.buildConfigurationKey}${getArchSuffix(arch)}${this.platform === Platform.MAC ? "" : "-unpacked"}`) } - dispatchArtifactCreated(file: string, target: Target | null, arch: Arch | null, safeArtifactName?: string | null) { - this.info.dispatchArtifactCreated({ + dispatchArtifactCreated(file: string, target: Target | null, arch: Arch | null, safeArtifactName?: string | null): Promise { + return this.info.callArtifactBuildCompleted({ file, safeArtifactName, target, arch, packager: this, }) diff --git a/packages/app-builder-lib/src/remoteBuilder/RemoteBuilder.ts b/packages/app-builder-lib/src/remoteBuilder/RemoteBuilder.ts index 2a0d74a6c8f..aa42fc2e079 100644 --- a/packages/app-builder-lib/src/remoteBuilder/RemoteBuilder.ts +++ b/packages/app-builder-lib/src/remoteBuilder/RemoteBuilder.ts @@ -94,7 +94,7 @@ export class RemoteBuilder { const localFile = path.join(outDir, artifact.file) const artifactCreatedEvent = this.artifactInfoToArtifactCreatedEvent(artifact, localFile, outDir) // PublishManager uses outDir and options, real (the same as for local build) values must be used - this.packager.info.dispatchArtifactCreated(artifactCreatedEvent) + await this.packager.info.callArtifactBuildCompleted(artifactCreatedEvent) } } } diff --git a/packages/app-builder-lib/src/targets/AppImageTarget.ts b/packages/app-builder-lib/src/targets/AppImageTarget.ts index 57c2f72daac..b05fe44a6da 100644 --- a/packages/app-builder-lib/src/targets/AppImageTarget.ts +++ b/packages/app-builder-lib/src/targets/AppImageTarget.ts @@ -33,7 +33,11 @@ export default class AppImageTarget extends Target { // tslint:disable-next-line:no-invalid-template-strings const artifactName = packager.expandArtifactBeautyNamePattern(options, "AppImage", arch) const artifactPath = path.join(this.outDir, artifactName) - this.logBuilding("AppImage", artifactPath, arch) + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "AppImage", + file: artifactPath, + arch, + }) const c = await Promise.all([ this.desktopEntry.value, @@ -76,7 +80,7 @@ export default class AppImageTarget extends Target { args.push("--compression", "xz") } - packager.info.dispatchArtifactCreated({ + await packager.info.callArtifactBuildCompleted({ file: artifactPath, safeArtifactName: packager.computeSafeArtifactName(artifactName, "AppImage", arch, false), target: this, diff --git a/packages/app-builder-lib/src/targets/AppxTarget.ts b/packages/app-builder-lib/src/targets/AppxTarget.ts index 87dd810cc60..5727e7a5884 100644 --- a/packages/app-builder-lib/src/targets/AppxTarget.ts +++ b/packages/app-builder-lib/src/targets/AppxTarget.ts @@ -38,7 +38,11 @@ export default class AppXTarget extends Target { const packager = this.packager const artifactName = packager.expandArtifactBeautyNamePattern(this.options, "appx", arch) const artifactPath = path.join(this.outDir, artifactName) - this.logBuilding("AppX", artifactPath, arch) + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "AppX", + file: artifactPath, + arch, + }) const vendorPath = await getSignVendorPath() const vm = await packager.vm.value @@ -110,7 +114,7 @@ export default class AppXTarget extends Target { await stageDir.cleanup() - packager.info.dispatchArtifactCreated({ + await packager.info.callArtifactBuildCompleted({ file: artifactPath, packager, arch, diff --git a/packages/app-builder-lib/src/targets/ArchiveTarget.ts b/packages/app-builder-lib/src/targets/ArchiveTarget.ts index 58cde144cdb..bfb660e913c 100644 --- a/packages/app-builder-lib/src/targets/ArchiveTarget.ts +++ b/packages/app-builder-lib/src/targets/ArchiveTarget.ts @@ -31,7 +31,11 @@ export class ArchiveTarget extends Target { const artifactName = packager.expandArtifactNamePattern(this.options, format, arch, defaultPattern, false) const artifactPath = path.join(this.outDir, artifactName) - this.logBuilding(`${isMac ? "macOS " : ""}${format}`, artifactPath, arch) + await packager.info.callArtifactBuildStarted({ + targetPresentableName: `${isMac ? "macOS " : ""}${format}`, + file: artifactPath, + arch, + }) let updateInfo: any = null if (format.startsWith("tar.")) { await tar(packager.compression, format, artifactPath, appOutDir, isMac, packager.info.tempDirManager) @@ -62,7 +66,7 @@ export class ArchiveTarget extends Target { } } - packager.info.dispatchArtifactCreated({ + await packager.info.callArtifactBuildCompleted({ updateInfo, file: artifactPath, // tslint:disable-next-line:no-invalid-template-strings diff --git a/packages/app-builder-lib/src/targets/MsiTarget.ts b/packages/app-builder-lib/src/targets/MsiTarget.ts index dced1cd678a..640f2323c34 100644 --- a/packages/app-builder-lib/src/targets/MsiTarget.ts +++ b/packages/app-builder-lib/src/targets/MsiTarget.ts @@ -44,7 +44,11 @@ export default class MsiTarget extends Target { const packager = this.packager const artifactName = packager.expandArtifactBeautyNamePattern(this.options, "msi", arch) const artifactPath = path.join(this.outDir, artifactName) - this.logBuilding("MSI", artifactPath, arch) + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "MSI", + file: artifactPath, + arch, + }) const stageDir = await createStageDir(this, packager, arch) const vm = this.vm @@ -88,7 +92,7 @@ export default class MsiTarget extends Target { await packager.sign(artifactPath) - packager.info.dispatchArtifactCreated({ + await packager.info.callArtifactBuildCompleted({ file: artifactPath, packager, arch, diff --git a/packages/app-builder-lib/src/targets/differentialUpdateInfoBuilder.ts b/packages/app-builder-lib/src/targets/differentialUpdateInfoBuilder.ts index b0a81229c9a..fe83e778881 100644 --- a/packages/app-builder-lib/src/targets/differentialUpdateInfoBuilder.ts +++ b/packages/app-builder-lib/src/targets/differentialUpdateInfoBuilder.ts @@ -71,7 +71,7 @@ export async function createBlockmap(file: string, target: Target, packager: Pla const blockMapFile = `${file}${BLOCK_MAP_FILE_SUFFIX}` log.info({blockMapFile: log.filePath(blockMapFile)}, "building block map") const updateInfo = await executeAppBuilderAsJson(["blockmap", "--input", file, "--output", blockMapFile]) - packager.info.dispatchArtifactCreated({ + await packager.info.callArtifactBuildCompleted({ file: blockMapFile, safeArtifactName: safeArtifactName == null ? null : `${safeArtifactName}${BLOCK_MAP_FILE_SUFFIX}`, target, diff --git a/packages/app-builder-lib/src/targets/fpm.ts b/packages/app-builder-lib/src/targets/fpm.ts index 36cee505e50..b9a6d11bbc2 100644 --- a/packages/app-builder-lib/src/targets/fpm.ts +++ b/packages/app-builder-lib/src/targets/fpm.ts @@ -107,17 +107,21 @@ export default class FpmTarget extends Target { isUseArchIfX64 = true } - const artifactPath = path.join(this.outDir, this.packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64)) + const packager = this.packager + const artifactPath = path.join(this.outDir, packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64)) - this.logBuilding(target, artifactPath, arch) + await packager.info.callArtifactBuildStarted({ + targetPresentableName: target, + file: artifactPath, + arch, + }) await unlinkIfExists(artifactPath) - if (this.packager.packagerOptions.prepackaged != null) { + if (packager.packagerOptions.prepackaged != null) { await ensureDir(this.outDir) } const scripts = await this.scriptFiles - const packager = this.packager const appInfo = packager.appInfo const options = this.options const synopsis = options.synopsis @@ -162,7 +166,7 @@ export default class FpmTarget extends Target { } // noinspection JSDeprecatedSymbols - let depends = options.depends || this.packager.platformSpecificBuildOptions.depends + let depends = options.depends || packager.platformSpecificBuildOptions.depends if (depends == null) { if (target === "deb") { depends = ["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3", "libxss1"] @@ -206,9 +210,9 @@ export default class FpmTarget extends Target { } const desktopFilePath = await this.helper.writeDesktopEntry(this.options) - args.push(`${desktopFilePath}=/usr/share/applications/${this.packager.executableName}.desktop`) + args.push(`${desktopFilePath}=/usr/share/applications/${packager.executableName}.desktop`) - if (this.packager.packagerOptions.effectiveOptionComputed != null && await this.packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath])) { + if (packager.packagerOptions.effectiveOptionComputed != null && await packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath])) { return } @@ -231,7 +235,7 @@ export default class FpmTarget extends Target { } await exec(await fpmPath.value, args, {env}) - this.packager.dispatchArtifactCreated(artifactPath, this, arch) + await packager.dispatchArtifactCreated(artifactPath, this, arch) } } diff --git a/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts b/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts index 9b28d790f15..906bb6b00e9 100644 --- a/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts +++ b/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts @@ -140,7 +140,12 @@ export class NsisTarget extends Target { logFields.oneClick = oneClick logFields.perMachine = isPerMachine } - log.info(logFields, "building") + + await packager.info.callArtifactBuildStarted({ + targetPresentableName: this.name, + file: installerPath, + arch: null, + }, logFields) const guid = options.guid || UUID.v5(appInfo.id, ELECTRON_BUILDER_NS_UUID) const uninstallAppKey = guid.replace(/\\/g, " - ") @@ -202,7 +207,7 @@ export class NsisTarget extends Target { defines[`${defineKey}_HASH`] = Buffer.from(fileInfo.sha512, "base64").toString("hex").toUpperCase() if (this.isWebInstaller) { - packager.dispatchArtifactCreated(file, this, arch) + await packager.dispatchArtifactCreated(file, this, arch) packageFiles[Arch[arch]] = fileInfo } @@ -270,7 +275,7 @@ export class NsisTarget extends Target { updateInfo.isAdminRightsRequired = true } - packager.info.dispatchArtifactCreated({ + await packager.info.callArtifactBuildCompleted({ file: installerPath, updateInfo, target: this, diff --git a/packages/app-builder-lib/src/targets/pkg.ts b/packages/app-builder-lib/src/targets/pkg.ts index ba310af5e2e..438e910c771 100644 --- a/packages/app-builder-lib/src/targets/pkg.ts +++ b/packages/app-builder-lib/src/targets/pkg.ts @@ -37,7 +37,11 @@ export class PkgTarget extends Target { const artifactName = packager.expandArtifactNamePattern(options, "pkg") const artifactPath = path.join(this.outDir, artifactName) - this.logBuilding("pkg", artifactPath, arch) + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "pkg", + file: artifactPath, + arch, + }) const keychainName = (await packager.codeSigningInfo.value).keychainName @@ -66,7 +70,7 @@ export class PkgTarget extends Target { }) await Promise.all([unlink(innerPackageFile), unlink(distInfoFile)]) - packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, "pkg", arch)) + await packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, "pkg", arch)) } private async customizeDistributionConfiguration(distInfoFile: string, appPath: string) { diff --git a/packages/app-builder-lib/src/targets/snap.ts b/packages/app-builder-lib/src/targets/snap.ts index 35a8df5ad3b..a0588449e0f 100644 --- a/packages/app-builder-lib/src/targets/snap.ts +++ b/packages/app-builder-lib/src/targets/snap.ts @@ -11,6 +11,7 @@ import { LinuxTargetHelper } from "./LinuxTargetHelper" import { createStageDirPath } from "./targetUtil" // libxss1, libasound2, gconf2 - was "error while loading shared libraries: libXss.so.1" on Xubuntu 16.04 +// noinspection SpellCheckingInspection const defaultStagePackages = ["libasound2", "libgconf2-4", "libnotify4", "libnspr4", "libnss3", "libpcre3", "libpulse0", "libxss1", "libxtst6", "libappindicator1", "libsecret-1-0"] const defaultPlugs = ["desktop", "desktop-legacy", "home", "x11", "unity7", "browser-support", "network", "gsettings", "pulseaudio", "opengl"] @@ -116,6 +117,7 @@ export default class SnapTarget extends Target { if (!this.isUseTemplateApp && snap.parts.app.after.includes(desktopPart)) { // call super build (snapcraftctl build) otherwise /bin/desktop not created + // noinspection SpellCheckingInspection const desktopPartOverride: any = { "override-build": `set -x snapcraftctl build @@ -149,7 +151,11 @@ done` // tslint:disable-next-line:no-invalid-template-strings const artifactName = packager.expandArtifactNamePattern(this.options, "snap", arch, "${name}_${version}_${arch}.${ext}", false) const artifactPath = path.join(this.outDir, artifactName) - this.logBuilding("snap", artifactPath, arch) + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "snap", + file: artifactPath, + arch, + }) const snap: any = this.createDescriptor(arch) if (this.isUseTemplateApp) { @@ -199,7 +205,7 @@ done` args.push("--template-url", "electron2") } await executeAppBuilder(args) - packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, "snap", arch, false)) + await packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, "snap", arch, false)) } } diff --git a/packages/builder-util/package.json b/packages/builder-util/package.json index 57d00b36032..1e2468950f2 100644 --- a/packages/builder-util/package.json +++ b/packages/builder-util/package.json @@ -11,7 +11,7 @@ "out" ], "dependencies": { - "app-builder-bin": "2.5.4", + "app-builder-bin": "2.5.5", "temp-file": "^3.3.2", "fs-extra-p": "^7.0.0", "is-ci": "^1.2.1", diff --git a/packages/dmg-builder/src/dmg.ts b/packages/dmg-builder/src/dmg.ts index 95b4a68aa2e..570e757dab8 100644 --- a/packages/dmg-builder/src/dmg.ts +++ b/packages/dmg-builder/src/dmg.ts @@ -23,7 +23,11 @@ export class DmgTarget extends Target { // tslint:disable-next-line:no-invalid-template-strings const artifactName = packager.expandArtifactNamePattern(packager.config.dmg, "dmg", null, "${productName}-" + (packager.platformSpecificBuildOptions.bundleShortVersion || "${version}") + ".${ext}") const artifactPath = path.join(this.outDir, artifactName) - this.logBuilding("DMG", artifactPath, arch) + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "DMG", + file: artifactPath, + arch, + }) const specification = await this.computeDmgOptions() const volumeName = sanitizeFileName(this.computeVolumeName(specification.title)) @@ -64,7 +68,7 @@ export class DmgTarget extends Target { const safeArtifactName = packager.computeSafeArtifactName(artifactName, "dmg") const updateInfo = await createBlockmap(artifactPath, this, packager, safeArtifactName) - packager.info.dispatchArtifactCreated({ + await packager.info.callArtifactBuildCompleted({ file: artifactPath, safeArtifactName, target: this, diff --git a/packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts b/packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts index 13179cef2a9..53b30227a0b 100644 --- a/packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts +++ b/packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts @@ -24,10 +24,14 @@ export default class SquirrelWindowsTarget extends Target { const packageFile = `${sanitizedName}-${convertVersion(version)}-full.nupkg` const installerOutDir = path.join(this.outDir, `squirrel-windows${getArchSuffix(arch)}`) - const artifactPath = path.join(installerOutDir, setupFile) - this.logBuilding("Squirrel.Windows", artifactPath, arch) + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "Squirrel.Windows", + file: artifactPath, + arch, + }) + if (arch === Arch.ia32) { 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") } @@ -36,15 +40,36 @@ export default class SquirrelWindowsTarget extends Target { const squirrelBuilder = new SquirrelBuilder(distOptions as SquirrelOptions, installerOutDir, packager) await squirrelBuilder.buildInstaller({setupFile, packageFile}, appOutDir, this.outDir, arch) - packager.dispatchArtifactCreated(artifactPath, this, arch, `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.exe`) + await packager.info.callArtifactBuildCompleted({ + file: artifactPath, + target: this, + arch, + safeArtifactName: `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.exe`, + packager: this.packager, + }) const packagePrefix = `${this.appName}-${convertVersion(version)}-` - packager.dispatchArtifactCreated(path.join(installerOutDir, `${packagePrefix}full.nupkg`), this, arch) + packager.info.dispatchArtifactCreated({ + file: path.join(installerOutDir, `${packagePrefix}full.nupkg`), + target: this, + arch, + packager, + }) if (distOptions.remoteReleases != null) { - packager.dispatchArtifactCreated(path.join(installerOutDir, `${packagePrefix}delta.nupkg`), this, arch) + packager.info.dispatchArtifactCreated({ + file: path.join(installerOutDir, `${packagePrefix}delta.nupkg`), + target: this, + arch, + packager, + }) } - packager.dispatchArtifactCreated(path.join(installerOutDir, "RELEASES"), this, arch) + packager.info.dispatchArtifactCreated({ + file: path.join(installerOutDir, "RELEASES"), + target: this, + arch, + packager, + }) } private get appName() { diff --git a/packages/electron-builder/src/index.ts b/packages/electron-builder/src/index.ts index 8b4fa547787..8a354178575 100644 --- a/packages/electron-builder/src/index.ts +++ b/packages/electron-builder/src/index.ts @@ -7,7 +7,7 @@ export { LinuxConfiguration, DebOptions, CommonLinuxOptions, LinuxTargetSpecificOptions, AppImageOptions, Configuration, AfterPackContext, MetadataDirectories, Protocol, ReleaseInfo, ElectronDownloadOptions, SnapOptions, CommonWindowsInstallerConfiguration, FileAssociation, MsiOptions, AppXOptions, WindowsConfiguration, - Packager, BuildResult, PackagerOptions, ArtifactCreated, + Packager, BuildResult, PackagerOptions, ArtifactCreated, ArtifactBuildStarted, NsisOptions, NsisWebOptions, PortableOptions, CommonNsisOptions, SquirrelWindowsOptions, WindowsSignOptions, CustomWindowsSignTaskConfiguration, WindowsSignTaskConfiguration, CustomWindowsSign, FileCodeSigningInfo, CertificateFromStoreInfo, Metadata, AuthorMetadata, RepositoryInfo, AppInfo, diff --git a/packages/electron-publish/package.json b/packages/electron-publish/package.json index 8cdcda5f51c..c5b12df3591 100644 --- a/packages/electron-publish/package.json +++ b/packages/electron-publish/package.json @@ -13,7 +13,7 @@ "dependencies": { "lazy-val": "^1.0.3", "fs-extra-p": "^7.0.0", - "mime": "^2.3.1", + "mime": "^2.4.0", "bluebird-lst": "^1.0.6", "builder-util-runtime": "^0.0.0-semantic-release", "builder-util": "~0.0.0-semantic-release", diff --git a/yarn.lock b/yarn.lock index d24169085d4..51ddd596d6f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1053,10 +1053,10 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" -app-builder-bin@2.5.4: - version "2.5.4" - resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-2.5.4.tgz#b4f060d9e55f7d5fe7b7ad0557cb1dc0b6ad7625" - integrity sha512-/rcJkuCqVmf9RzDyUojW3gwA2CbIIG65Z9NZpjFgEDzXd92KFgZyLKmu/2+ue4EjnseEQDc+BmW3GMeciAGJBQ== +app-builder-bin@2.5.5: + version "2.5.5" + resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-2.5.5.tgz#5721a37b1c89d24df058e6308b5d30fc62a63bab" + integrity sha512-ZemMZqFJGf05J7qSvZeKIs3vSYl8sG8DWsyBLzxtfoIIoLD/dI/dtNwSOZwyoY54w/g8b7IbG5L6egnqfyX7oA== append-transform@^0.4.0: version "0.4.0" @@ -1653,9 +1653,9 @@ camelcase@^5.0.0: integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA== caniuse-lite@^1.0.30000899: - version "1.0.30000910" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000910.tgz#755d5181d4b006e5a2b59b1ffa05d0a0470039f5" - integrity sha512-u/nxtHGAzCGZzIxt3dA/tpSPOcirBZFWKwz1EPz4aaupnBI2XR0Rbr74g0zc6Hzy41OEM4uMoZ38k56TpYAWjQ== + version "1.0.30000911" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000911.tgz#5dfb8139ee479722da27000ca92dec47913b9605" + integrity sha512-x/E/SNwD80I0bT+fF9Y3Kbwo7Xd1xSafCAmFlpJmaVg3SQoJJOH4Ivb9fi9S0WjfqewQ6Ydt1zEVZpmMVYNeDA== capture-exit@^1.2.0: version "1.2.0" @@ -4239,10 +4239,10 @@ mime-types@^2.1.12, mime-types@~2.1.19: dependencies: mime-db "~1.37.0" -mime@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.3.1.tgz#b1621c54d63b97c47d3cfe7f7215f7d64517c369" - integrity sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg== +mime@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.0.tgz#e051fd881358585f3279df333fe694da0bcffdd6" + integrity sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w== mimic-fn@^1.0.0: version "1.2.0" @@ -4882,7 +4882,7 @@ pseudomap@^1.0.2: resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= -psl@^1.1.24: +psl@^1.1.24, psl@^1.1.28: version "1.1.29" resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.29.tgz#60f580d360170bb722a797cc704411e6da850c67" integrity sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ== @@ -4892,7 +4892,7 @@ punycode@^1.4.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= -punycode@^2.1.0: +punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== @@ -5785,7 +5785,15 @@ touch@0.0.3: dependencies: nopt "~1.0.10" -tough-cookie@>=2.3.3, tough-cookie@^2.3.4, tough-cookie@~2.4.3: +tough-cookie@>=2.3.3, tough-cookie@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==