diff --git a/.changeset/selfish-experts-wonder.md b/.changeset/selfish-experts-wonder.md new file mode 100644 index 0000000000..7375fb505c --- /dev/null +++ b/.changeset/selfish-experts-wonder.md @@ -0,0 +1,5 @@ +--- +"builder-util": patch +--- + +should not chmod for 7za when process.env.USE_SYSTEM_7ZA is true diff --git a/.changeset/serious-nails-shop.md b/.changeset/serious-nails-shop.md new file mode 100644 index 0000000000..777bd402d4 --- /dev/null +++ b/.changeset/serious-nails-shop.md @@ -0,0 +1,7 @@ +--- +"app-builder-lib": minor +"dmg-builder": minor +"electron-builder": minor +--- + +feat: export Packager sub-classes from main electron-builder types diff --git a/docs/api/electron-builder.md b/docs/api/electron-builder.md index 164761bcd7..6d11923cf1 100644 --- a/docs/api/electron-builder.md +++ b/docs/api/electron-builder.md @@ -127,6 +127,51 @@ Developer API only. See [Configuration](../configuration/configuration.md) for u
  • .getVersionInWeirdWindowsForm(isSetBuildNumber)String
  • +
  • .LinuxPackagerPlatformPackager + +
  • +
  • .MacPackagerPlatformPackager + +
  • .Packager
  • +
  • .WinPackagerPlatformPackager + +
  • .build(options, packager)Promise<Array<String>>
  • .buildForge(forgeOptions, options)Promise<Array<String>>
  • @@ -444,57 +513,43 @@ Developer API only. See [Configuration](../configuration/configuration.md) for u -

    -

    Packager

    +

    +

    LinuxPackager ⇐ PlatformPackager

    Kind: class of app-builder-lib
    +Extends: PlatformPackager
    Properties

    Methods

    -

    -

    packager._build(configuration, metadata, devMetadata, repositoryInfo)Promise<BuildResult>

    +

    +

    linuxPackager.createTargets(targets, mapper)

    +

    Overrides: createTargets

    @@ -504,25 +559,17 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - - - - - - - - - - + + - - + +
    configurationConfiguration
    metadataMetadata
    devMetadataMetadata | “undefined”targetsArray<String>
    repositoryInfoSourceRepositoryInfomappercallback
    -

    -

    packager.addAfterPackHandler(handler)

    +

    +

    linuxPackager.artifactPatternConfig(targetSpecificOptions, defaultPattern)module:app-builder-lib/out/platformPackager.__object

    @@ -532,13 +579,17 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - - + + + + + +
    handlercallbacktargetSpecificOptionsTargetSpecificOptions | “undefined” | undefined
    defaultPatternString | undefined
    -

    -

    packager.afterPack(context)Promise<any>

    +

    +

    linuxPackager.computeSafeArtifactName(suggestedName, ext, arch, skipDefaultArch, defaultArch, safePattern)null | String

    @@ -548,47 +599,35 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - - + + - -
    contextmodule:app-builder-lib/out/configuration.PackContextsuggestedNameString | “undefined”
    -

    -

    packager.artifactCreated(handler)Packager

    - - - - + + - - - - + + - -
    ParamTypeextString
    handlercallbackarchArch | “undefined”
    -

    -

    packager.build()Promise<BuildResult>

    -

    -

    packager.callAppxManifestCreated(path)Promise<void>

    - - - - + + - - - + + + + +
    ParamTypeskipDefaultArch
    pathdefaultArch String
    safePattern
    -

    -

    packager.callArtifactBuildCompleted(event)Promise<void>

    +

    +

    linuxPackager.getDefaultFrameworkIcon()null | String

    +

    +

    linuxPackager.dispatchArtifactCreated(file, target, arch, safeArtifactName)Promise<void>

    @@ -598,33 +637,25 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - - + + - -
    eventArtifactCreatedfileString
    -

    -

    packager.callArtifactBuildStarted(event, logFields)Promise<void>

    - - - - + + - - - - + + - - + +
    ParamTypetargetTarget | “undefined”
    eventArtifactBuildStartedarchArch | “undefined”
    logFieldsanysafeArtifactNameString | “undefined”
    -

    -

    packager.callMsiProjectCreated(path)Promise<void>

    +

    +

    linuxPackager.getElectronDestinationDir(appOutDir)String

    @@ -634,14 +665,13 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - +
    pathappOutDir String
    -

    -

    packager.dispatchArtifactCreated(event)

    -

    Only for sub artifacts (update info), for main artifacts use callArtifactBuildCompleted.

    +

    +

    linuxPackager.getElectronSrcDir(dist)String

    @@ -651,13 +681,13 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - - + +
    eventArtifactCreateddistString
    -

    -

    packager.disposeOnBuildFinish(disposer)

    +

    +

    linuxPackager.expandArtifactBeautyNamePattern(targetSpecificOptions, ext, arch)String

    @@ -667,33 +697,21 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - - - - -
    disposercallback
    -

    -

    packager.installAppDependencies(platform, arch)Promise<any>

    - - - - - + + - - - - + + - +
    ParamTypetargetSpecificOptionsTargetSpecificOptions | “undefined” | undefined
    platformPlatformextString
    archArchArch | “undefined”
    -

    -

    packager.getNodeDependencyInfo(platform)Lazy<Array<module:app-builder-lib/out/util/packageDependencies.NodeModuleDirInfo>>

    +

    +

    linuxPackager.expandArtifactNamePattern(targetSpecificOptions, ext, arch, defaultPattern, skipDefaultArch, defaultArch)String

    @@ -703,33 +721,1446 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - - + + + + + + + + + + + + + + + + + + + + + + + + +
    platformPlatform | “undefined”targetSpecificOptionsTargetSpecificOptions | “undefined” | undefined
    extString
    archArch | “undefined”
    defaultPatternString
    skipDefaultArch
    defaultArchString
    +

    +

    linuxPackager.expandMacro(pattern, arch, extra, isProductNameSanitized)String

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    patternString
    archString | “undefined”
    extraany
    isProductNameSanitized
    +

    +

    linuxPackager.generateName2(ext, classifier, deployment)String

    + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    extString | “undefined”
    classifierString | “undefined” | undefined
    deploymentBoolean
    +

    +

    linuxPackager.getIconPath()Promise< | String>

    +

    +

    linuxPackager.getMacOsResourcesDir(appOutDir)String

    + + + + + + + + + + + + + +
    ParamType
    appOutDirString
    +

    +

    linuxPackager.pack(outDir, arch, targets, taskManager)Promise<any>

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    outDirString
    archArch
    targetsArray<Target>
    taskManagerAsyncTaskManager
    +

    +

    linuxPackager.resolveIcon(sources, fallbackSources, outputFormat)Promise<Array<module:app-builder-lib/out/platformPackager.IconInfo>>

    + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    sourcesArray<String>
    fallbackSourcesArray<String>
    outputFormat“set” | “icns” | “ico”
    +

    +

    linuxPackager.getResource(custom, names)Promise< | String>

    + + + + + + + + + + + + + + + + + +
    ParamType
    customString | “undefined” | undefined
    namesArray<String>
    +

    +

    linuxPackager.getResourcesDir(appOutDir)String

    + + + + + + + + + + + + + +
    ParamType
    appOutDirString
    +

    +

    linuxPackager.getTempFile(suffix)Promise<String>

    + + + + + + + + + + + + + +
    ParamType
    suffixString
    +

    +

    MacPackager ⇐ PlatformPackager

    +

    Kind: class of app-builder-lib
    +Extends: PlatformPackager
    +Properties

    +
      +
    • +

      **<code id="MacPackager-[codeSigningInfo=new Lazy(() => { +const cscLink = this.getCscLink() +if (cscLink == null || process.platform !== “darwin”) { +return Promise.resolve({ keychainFile: process.env.CSC_KEYCHAIN || null }) +}

      +

      return createKeychain({ +tmpDir: this.info.tempDirManager, +cscLink, +cscKeyPassword: this.getCscPassword(), +cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK), +cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD), +currentDir: this.projectDir, +}).then(result => { +const keychainFile = result.keychainFile +if (keychainFile != null) { +this.info.disposeOnBuildFinish(() => removeKeychain(keychainFile)) +} +return result +}) +})]">[codeSigningInfo=new Lazy(() => { +const cscLink = this.getCscLink() +if (cscLink == null || process.platform !== “darwin”) { +return Promise.resolve({ keychainFile: process.env.CSC_KEYCHAIN || null }) +}

      +

      return createKeychain({ +tmpDir: this.info.tempDirManager, +cscLink, +cscKeyPassword: this.getCscPassword(), +cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK), +cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD), +currentDir: this.projectDir, +}).then(result => { +const keychainFile = result.keychainFile +if (keychainFile != null) { +this.info.disposeOnBuildFinish(() => removeKeychain(keychainFile)) +} +return result +}) +})]** Lazy<module:app-builder-lib/out/codeSign/macCodeSign.CodeSigningInfo>

      +
    • +
    • +

      defaultTarget Array<String>

      +
    • +
    +

    Methods

    + +

    +

    macPackager.applyCommonInfo(appPlist, contentsPath)Promise<void>

    + + + + + + + + + + + + + + + + + +
    ParamType
    appPlistany
    contentsPathString
    +

    +

    macPackager.createTargets(targets, mapper)

    +

    Overrides: createTargets

    + + + + + + + + + + + + + + + + + +
    ParamType
    targetsArray<String>
    mappercallback
    +

    +

    macPackager.getElectronDestinationDir(appOutDir)String

    +

    Overrides: getElectronDestinationDir

    + + + + + + + + + + + + + +
    ParamType
    appOutDirString
    +

    +

    macPackager.getElectronSrcDir(dist)String

    +

    Overrides: getElectronSrcDir

    + + + + + + + + + + + + + +
    ParamType
    distString
    +

    +

    macPackager.getIconPath()Promise< | String>

    +

    Overrides: getIconPath
    +

    +

    macPackager.pack(outDir, arch, targets, taskManager)Promise<void>

    +

    Overrides: pack

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    outDirString
    archArch
    targetsArray<Target>
    taskManagerAsyncTaskManager
    +

    +

    macPackager.artifactPatternConfig(targetSpecificOptions, defaultPattern)module:app-builder-lib/out/platformPackager.__object

    + + + + + + + + + + + + + + + + + +
    ParamType
    targetSpecificOptionsTargetSpecificOptions | “undefined” | undefined
    defaultPatternString | undefined
    +

    +

    macPackager.computeSafeArtifactName(suggestedName, ext, arch, skipDefaultArch, defaultArch, safePattern)null | String

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    suggestedNameString | “undefined”
    extString
    archArch | “undefined”
    skipDefaultArch
    defaultArchString
    safePattern
    +

    +

    macPackager.getDefaultFrameworkIcon()null | String

    +

    +

    macPackager.dispatchArtifactCreated(file, target, arch, safeArtifactName)Promise<void>

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    fileString
    targetTarget | “undefined”
    archArch | “undefined”
    safeArtifactNameString | “undefined”
    +

    +

    macPackager.expandArtifactBeautyNamePattern(targetSpecificOptions, ext, arch)String

    + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    targetSpecificOptionsTargetSpecificOptions | “undefined” | undefined
    extString
    archArch | “undefined”
    +

    +

    macPackager.expandArtifactNamePattern(targetSpecificOptions, ext, arch, defaultPattern, skipDefaultArch, defaultArch)String

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    targetSpecificOptionsTargetSpecificOptions | “undefined” | undefined
    extString
    archArch | “undefined”
    defaultPatternString
    skipDefaultArch
    defaultArchString
    +

    +

    macPackager.expandMacro(pattern, arch, extra, isProductNameSanitized)String

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    patternString
    archString | “undefined”
    extraany
    isProductNameSanitized
    +

    +

    macPackager.generateName2(ext, classifier, deployment)String

    + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    extString | “undefined”
    classifierString | “undefined” | undefined
    deploymentBoolean
    +

    +

    macPackager.getMacOsResourcesDir(appOutDir)String

    + + + + + + + + + + + + + +
    ParamType
    appOutDirString
    +

    +

    macPackager.resolveIcon(sources, fallbackSources, outputFormat)Promise<Array<module:app-builder-lib/out/platformPackager.IconInfo>>

    + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    sourcesArray<String>
    fallbackSourcesArray<String>
    outputFormat“set” | “icns” | “ico”
    +

    +

    macPackager.getResource(custom, names)Promise< | String>

    + + + + + + + + + + + + + + + + + +
    ParamType
    customString | “undefined” | undefined
    namesArray<String>
    +

    +

    macPackager.getResourcesDir(appOutDir)String

    + + + + + + + + + + + + + +
    ParamType
    appOutDirString
    +

    +

    macPackager.getTempFile(suffix)Promise<String>

    + + + + + + + + + + + + + +
    ParamType
    suffixString
    +

    +

    Packager

    +

    Kind: class of app-builder-lib
    +Properties

    +
      +
    • projectDir String
    • +
    • appDir String
    • +
    • metadata Metadata
    • +
    • areNodeModulesHandledExternally Boolean
    • +
    • isPrepackedAppAsar Boolean
    • +
    • devMetadata Metadata | “undefined”
    • +
    • config Configuration
    • +
    • isTwoPackageJsonProjectLayoutUsed = false Boolean
    • +
    • eventEmitter = new EventEmitter() module:events.EventEmitter
    • +
    • _appInfo AppInfo | “undefined”
    • +
    • appInfo AppInfo
    • +
    • tempDirManager = new TmpDir("packager") TmpDir
    • +
    • options PackagerOptions
    • +
    • debugLogger = new DebugLogger(log.isDebugEnabled) DebugLogger
    • +
    • repositoryInfo Promise< | SourceRepositoryInfo>
    • +
    • [stageDirPathCustomizer=(target, packager, arch) => { +return path.join(target.outDir, __${target.name}-${getArtifactArchName(arch, target.name)}) +}] callback
    • +
    • buildResourcesDir String
    • +
    • relativeBuildResourcesDirname String
    • +
    • framework Framework
    • +
    +

    Methods

    + +

    +

    packager._build(configuration, metadata, devMetadata, repositoryInfo)Promise<BuildResult>

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    configurationConfiguration
    metadataMetadata
    devMetadataMetadata | “undefined”
    repositoryInfoSourceRepositoryInfo
    +

    +

    packager.addAfterPackHandler(handler)

    + + + + + + + + + + + + + +
    ParamType
    handlercallback
    +

    +

    packager.afterPack(context)Promise<any>

    + + + + + + + + + + + + + +
    ParamType
    contextmodule:app-builder-lib/out/configuration.PackContext
    +

    +

    packager.artifactCreated(handler)Packager

    + + + + + + + + + + + + + +
    ParamType
    handlercallback
    +

    +

    packager.build()Promise<BuildResult>

    +

    +

    packager.callAppxManifestCreated(path)Promise<void>

    + + + + + + + + + + + + + +
    ParamType
    pathString
    +

    +

    packager.callArtifactBuildCompleted(event)Promise<void>

    + + + + + + + + + + + + + +
    ParamType
    eventArtifactCreated
    +

    +

    packager.callArtifactBuildStarted(event, logFields)Promise<void>

    + + + + + + + + + + + + + + + + + +
    ParamType
    eventArtifactBuildStarted
    logFieldsany
    +

    +

    packager.callMsiProjectCreated(path)Promise<void>

    + + + + + + + + + + + + + +
    ParamType
    pathString
    +

    +

    packager.dispatchArtifactCreated(event)

    +

    Only for sub artifacts (update info), for main artifacts use callArtifactBuildCompleted.

    + + + + + + + + + + + + + +
    ParamType
    eventArtifactCreated
    +

    +

    packager.disposeOnBuildFinish(disposer)

    + + + + + + + + + + + + + +
    ParamType
    disposercallback
    +

    +

    packager.installAppDependencies(platform, arch)Promise<any>

    + + + + + + + + + + + + + + + + + +
    ParamType
    platformPlatform
    archArch
    +

    +

    packager.getNodeDependencyInfo(platform)Lazy<Array<module:app-builder-lib/out/util/packageDependencies.NodeModuleDirInfo>>

    + + + + + + + + + + + + + +
    ParamType
    platformPlatform | “undefined”
    +

    +

    Platform

    +

    Kind: class of app-builder-lib
    +Properties

    +
      +
    • MAC = new Platform("mac", "mac", "darwin") Platform
    • +
    • LINUX = new Platform("linux", "linux", "linux") Platform
    • +
    • WINDOWS = new Platform("windows", "win", "win32") Platform
    • +
    +

    Methods

    + +

    +

    platform.createTarget(type, archs)Map<Platform | Map<Arch | Array<String>>>

    + + + + + + + + + + + + + + + + + +
    ParamType
    typeString | Array<String> | “undefined”
    archsArray<Arch>
    +

    +

    platform.current()Platform

    +

    +

    platform.fromString(name)Platform

    + + + + + + + + + + + + + +
    ParamType
    nameString
    +

    +

    platform.toString()String

    +

    +

    PlatformPackager

    +

    Kind: class of app-builder-lib
    +Properties

    +
      +
    • packagerOptions PackagerOptions
    • +
    • buildResourcesDir String
    • +
    • projectDir String
    • +
    • config Configuration
    • +
    • platformSpecificBuildOptions module:app-builder-lib/out/platformPackager.DC
    • +
    • resourceList Promise<Array<String>>
    • +
    • appInfo AppInfo
    • +
    • compression “store” | “normal” | “maximum”
    • +
    • debugLogger DebugLogger
    • +
    • defaultTarget Array<String>
    • +
    • fileAssociations Array<FileAssociation>
    • +
    • forceCodeSigning Boolean
    • +
    +

    Methods

    + +

    +

    platformPackager.artifactPatternConfig(targetSpecificOptions, defaultPattern)module:app-builder-lib/out/platformPackager.__object

    + + + + + + + + + + + + + + + + + +
    ParamType
    targetSpecificOptionsTargetSpecificOptions | “undefined” | undefined
    defaultPatternString | undefined
    +

    +

    platformPackager.computeSafeArtifactName(suggestedName, ext, arch, skipDefaultArch, defaultArch, safePattern)null | String

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    suggestedNameString | “undefined”
    extString
    archArch | “undefined”
    skipDefaultArch
    defaultArchString
    safePattern
    +

    +

    platformPackager.createTargets(targets, mapper)

    + + + + + + + + + + + + + + + + + +
    ParamType
    targetsArray<String>
    mappercallback
    +

    +

    platformPackager.getDefaultFrameworkIcon()null | String

    +

    +

    platformPackager.dispatchArtifactCreated(file, target, arch, safeArtifactName)Promise<void>

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    fileString
    targetTarget | “undefined”
    archArch | “undefined”
    safeArtifactNameString | “undefined”
    +

    +

    platformPackager.getElectronDestinationDir(appOutDir)String

    + + + + + + + + + + + + + +
    ParamType
    appOutDirString
    +

    +

    platformPackager.getElectronSrcDir(dist)String

    + + + + + + + + + + + + + +
    ParamType
    distString
    +

    +

    platformPackager.expandArtifactBeautyNamePattern(targetSpecificOptions, ext, arch)String

    + + + + + + + + + + + + + + + + + + +
    ParamType
    targetSpecificOptionsTargetSpecificOptions | “undefined” | undefined
    extString
    archArch | “undefined”
    -

    -

    Platform

    +

    +

    platformPackager.expandArtifactNamePattern(targetSpecificOptions, ext, arch, defaultPattern, skipDefaultArch, defaultArch)String

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    targetSpecificOptionsTargetSpecificOptions | “undefined” | undefined
    extString
    archArch | “undefined”
    defaultPatternString
    skipDefaultArch
    defaultArchString
    +

    +

    platformPackager.expandMacro(pattern, arch, extra, isProductNameSanitized)String

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    patternString
    archString | “undefined”
    extraany
    isProductNameSanitized
    +

    +

    platformPackager.generateName2(ext, classifier, deployment)String

    + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    extString | “undefined”
    classifierString | “undefined” | undefined
    deploymentBoolean
    +

    +

    platformPackager.getIconPath()Promise< | String>

    +

    +

    platformPackager.getMacOsResourcesDir(appOutDir)String

    + + + + + + + + + + + + + +
    ParamType
    appOutDirString
    +

    +

    platformPackager.pack(outDir, arch, targets, taskManager)Promise<any>

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    outDirString
    archArch
    targetsArray<Target>
    taskManagerAsyncTaskManager
    +

    +

    platformPackager.resolveIcon(sources, fallbackSources, outputFormat)Promise<Array<module:app-builder-lib/out/platformPackager.IconInfo>>

    + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    sourcesArray<String>
    fallbackSourcesArray<String>
    outputFormat“set” | “icns” | “ico”
    +

    +

    platformPackager.getResource(custom, names)Promise< | String>

    + + + + + + + + + + + + + + + + + +
    ParamType
    customString | “undefined” | undefined
    namesArray<String>
    +

    +

    platformPackager.getResourcesDir(appOutDir)String

    + + + + + + + + + + + + + +
    ParamType
    appOutDirString
    +

    +

    platformPackager.getTempFile(suffix)Promise<String>

    + + + + + + + + + + + + + +
    ParamType
    suffixString
    +

    +

    PublishManager ⇐ module:packages/electron-publish/out/publisher.PublishContext

    Kind: class of app-builder-lib
    +Extends: module:packages/electron-publish/out/publisher.PublishContext
    Properties

      -
    • MAC = new Platform("mac", "mac", "darwin") Platform
    • -
    • LINUX = new Platform("linux", "linux", "linux") Platform
    • -
    • WINDOWS = new Platform("windows", "win", "win32") Platform
    • +
    • isPublish = false Boolean
    • +
    • progress = (process.stdout as TtyWriteStream).isTTY ? new MultiProgress() : null MultiProgress

    Methods

    -

    -

    platform.createTarget(type, archs)Map<Platform | Map<Arch | Array<String>>>

    +

    +

    publishManager.awaitTasks()Promise<void>

    +

    +

    publishManager.cancelTasks()

    +

    +

    publishManager.getGlobalPublishConfigurations()Promise< | Array>

    +

    +

    publishManager.scheduleUpload(publishConfig, event, appInfo)

    @@ -739,19 +2170,38 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - - + + + + + + - - + +
    typeString | Array<String> | “undefined”publishConfigPublishConfiguration
    eventmodule:packages/electron-publish/out/publisher.UploadTask
    archsArray<Arch>appInfoAppInfo
    -

    -

    platform.current()Platform

    -

    -

    platform.fromString(name)Platform

    +

    +

    Target

    +

    Kind: class of app-builder-lib
    +Properties

    + +

    Methods

    + +

    +

    target.build(appOutDir, arch)Promise<any>

    @@ -761,38 +2211,192 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc - + + + + +
    nameappOutDir String
    archArch
    -

    -

    platform.toString()String

    -

    -

    PlatformPackager

    +

    +

    target.finishBuild()Promise<any>

    +

    +

    WinPackager ⇐ PlatformPackager

    Kind: class of app-builder-lib
    +Extends: PlatformPackager
    Properties

      -
    • packagerOptions PackagerOptions
    • -
    • buildResourcesDir String
    • -
    • projectDir String
    • -
    • config Configuration
    • -
    • platformSpecificBuildOptions module:app-builder-lib/out/platformPackager.DC
    • -
    • resourceList Promise<Array<String>>
    • -
    • appInfo AppInfo
    • -
    • compression “store” | “normal” | “maximum”
    • -
    • debugLogger DebugLogger
    • -
    • defaultTarget Array<String>
    • -
    • fileAssociations Array<FileAssociation>
    • -
    • forceCodeSigning Boolean
    • +
    • +

      **<code id="WinPackager-[cscInfo=new Lazy<FileCodeSigningInfo | CertificateFromStoreInfo | null>(() => { +const platformSpecificBuildOptions = this.platformSpecificBuildOptions +if (platformSpecificBuildOptions.certificateSubjectName != null || platformSpecificBuildOptions.certificateSha1 != null) { +return this.vm.value +.then(vm => getCertificateFromStoreInfo(platformSpecificBuildOptions, vm)) +.catch((e: any) => { +// https://github.com/electron-userland/electron-builder/pull/2397 +if (platformSpecificBuildOptions.sign == null) { +throw e +} else { +log.debug({ error: e }, “getCertificateFromStoreInfo error”) +return null +} +}) +}

      +

      const certificateFile = platformSpecificBuildOptions.certificateFile +if (certificateFile != null) { +const certificatePassword = this.getCscPassword() +return Promise.resolve({ +file: certificateFile, +password: certificatePassword == null ? null : certificatePassword.trim(), +}) +}

      +

      const cscLink = this.getCscLink(“WIN_CSC_LINK”) +if (cscLink == null) { +return Promise.resolve(null) +}

      +

      return ( +importCertificate(cscLink, this.info.tempDirManager, this.projectDir) +// before then +.catch((e: any) => { +if (e instanceof InvalidConfigurationError) { +throw new InvalidConfigurationError(Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}) +} else { +throw e +} +}) +.then(path => { +return { +file: path, +password: this.getCscPassword(), +} +}) +) +})]">[cscInfo=new Lazy<FileCodeSigningInfo | CertificateFromStoreInfo | null>(() => { +const platformSpecificBuildOptions = this.platformSpecificBuildOptions +if (platformSpecificBuildOptions.certificateSubjectName != null || platformSpecificBuildOptions.certificateSha1 != null) { +return this.vm.value +.then(vm => getCertificateFromStoreInfo(platformSpecificBuildOptions, vm)) +.catch((e: any) => { +// https://github.com/electron-userland/electron-builder/pull/2397 +if (platformSpecificBuildOptions.sign == null) { +throw e +} else { +log.debug({ error: e }, “getCertificateFromStoreInfo error”) +return null +} +}) +}

      +

      const certificateFile = platformSpecificBuildOptions.certificateFile +if (certificateFile != null) { +const certificatePassword = this.getCscPassword() +return Promise.resolve({ +file: certificateFile, +password: certificatePassword == null ? null : certificatePassword.trim(), +}) +}

      +

      const cscLink = this.getCscLink(“WIN_CSC_LINK”) +if (cscLink == null) { +return Promise.resolve(null) +}

      +

      return ( +importCertificate(cscLink, this.info.tempDirManager, this.projectDir) +// before then +.catch((e: any) => { +if (e instanceof InvalidConfigurationError) { +throw new InvalidConfigurationError(Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}) +} else { +throw e +} +}) +.then(path => { +return { +file: path, +password: this.getCscPassword(), +} +}) +) +})]** Lazy< | FileCodeSigningInfo | CertificateFromStoreInfo>

      +
    • +
    • +

      vm = new Lazy<VmManager>(() => (process.platform === "win32" ? Promise.resolve(new VmManager()) : getWindowsVm(this.debugLogger))) Lazy<module:app-builder-lib/out/vm/vm.VmManager>

      +
    • +
    • +

      **<code id="WinPackager-[computedPublisherName=new Lazy<Array | null>(async () => { +const publisherName = this.platformSpecificBuildOptions.publisherName +if (publisherName === null) { +return null +} else if (publisherName != null) { +return asArray(publisherName) +}

      +

      const certInfo = await this.lazyCertInfo.value +return certInfo == null ? null : [certInfo.commonName] +})]">[computedPublisherName=new Lazy<Array | null>(async () => { +const publisherName = this.platformSpecificBuildOptions.publisherName +if (publisherName === null) { +return null +} else if (publisherName != null) { +return asArray(publisherName) +}

      +

      const certInfo = await this.lazyCertInfo.value +return certInfo == null ? null : [certInfo.commonName] +})]** Lazy< | Array>

      +
    • +
    • +

      **<code id="WinPackager-[lazyCertInfo=new Lazy<CertificateInfo | null>(async () => { +const cscInfo = await this.cscInfo.value +if (cscInfo == null) { +return null +}

      +

      if (“subject” in cscInfo) { +const bloodyMicrosoftSubjectDn = cscInfo.subject +return { +commonName: parseDn(bloodyMicrosoftSubjectDn).get(“CN”)!, +bloodyMicrosoftSubjectDn, +} +}

      +

      const cscFile = cscInfo.file +if (cscFile == null) { +return null +} +return await getCertInfo(cscFile, cscInfo.password || “”) +})]">[lazyCertInfo=new Lazy<CertificateInfo | null>(async () => { +const cscInfo = await this.cscInfo.value +if (cscInfo == null) { +return null +}

      +

      if (“subject” in cscInfo) { +const bloodyMicrosoftSubjectDn = cscInfo.subject +return { +commonName: parseDn(bloodyMicrosoftSubjectDn).get(“CN”)!, +bloodyMicrosoftSubjectDn, +} +}

      +

      const cscFile = cscInfo.file +if (cscFile == null) { +return null +} +return await getCertInfo(cscFile, cscInfo.password || “”) +})]** Lazy< | module:app-builder-lib/out/codeSign/windowsCodeSign.CertificateInfo>

      +
    • +
    • +

      isForceCodeSigningVerification Boolean

      +
    • +
    • +

      defaultTarget Array<String>

      +

    Methods

    +

    +

    winPackager.createTargets(targets, mapper)

    +

    Overrides: createTargets

    + + + + + + + + + + + + + + + + + +
    ParamType
    targetsArray<String>
    mappercallback
    +

    +

    winPackager.getIconPath()Promise< | String>

    +

    Overrides: getIconPath
    +

    +

    winPackager.sign(file, logMessagePrefix)Promise<Boolean>

    + + + + + + + + + + + + + + + + + +
    ParamType
    fileString
    logMessagePrefixString
    +

    +

    winPackager.signAndEditResources(file, arch, outDir, internalName, requestedExecutionLevel)Promise<void>

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParamType
    fileString
    archArch
    outDirString
    internalNameString | “undefined”
    requestedExecutionLevel“asInvoker” | “highestAvailable” | “requireAdministrator” | “undefined”

    -

    platformPackager.artifactPatternConfig(targetSpecificOptions, defaultPattern)module:app-builder-lib/out/platformPackager.__object

    +

    winPackager.artifactPatternConfig(targetSpecificOptions, defaultPattern)module:app-builder-lib/out/platformPackager.__object

    @@ -832,7 +2511,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.computeSafeArtifactName(suggestedName, ext, arch, skipDefaultArch, defaultArch, safePattern)null | String

    +

    winPackager.computeSafeArtifactName(suggestedName, ext, arch, skipDefaultArch, defaultArch, safePattern)null | String

    @@ -867,30 +2546,10 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc
    -

    -

    platformPackager.createTargets(targets, mapper)

    - - - - - - - - - - - - - - - - - -
    ParamType
    targetsArray<String>
    mappercallback

    -

    platformPackager.getDefaultFrameworkIcon()null | String

    +

    winPackager.getDefaultFrameworkIcon()null | String

    -

    platformPackager.dispatchArtifactCreated(file, target, arch, safeArtifactName)Promise<void>

    +

    winPackager.dispatchArtifactCreated(file, target, arch, safeArtifactName)Promise<void>

    @@ -918,7 +2577,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.getElectronDestinationDir(appOutDir)String

    +

    winPackager.getElectronDestinationDir(appOutDir)String

    @@ -934,7 +2593,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.getElectronSrcDir(dist)String

    +

    winPackager.getElectronSrcDir(dist)String

    @@ -950,7 +2609,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.expandArtifactBeautyNamePattern(targetSpecificOptions, ext, arch)String

    +

    winPackager.expandArtifactBeautyNamePattern(targetSpecificOptions, ext, arch)String

    @@ -974,7 +2633,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.expandArtifactNamePattern(targetSpecificOptions, ext, arch, defaultPattern, skipDefaultArch, defaultArch)String

    +

    winPackager.expandArtifactNamePattern(targetSpecificOptions, ext, arch, defaultPattern, skipDefaultArch, defaultArch)String

    @@ -1010,7 +2669,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.expandMacro(pattern, arch, extra, isProductNameSanitized)String

    +

    winPackager.expandMacro(pattern, arch, extra, isProductNameSanitized)String

    @@ -1038,7 +2697,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.generateName2(ext, classifier, deployment)String

    +

    winPackager.generateName2(ext, classifier, deployment)String

    @@ -1061,10 +2720,8 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc
    -

    -

    platformPackager.getIconPath()Promise< | String>

    -

    platformPackager.getMacOsResourcesDir(appOutDir)String

    +

    winPackager.getMacOsResourcesDir(appOutDir)String

    @@ -1080,7 +2737,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.pack(outDir, arch, targets, taskManager)Promise<any>

    +

    winPackager.pack(outDir, arch, targets, taskManager)Promise<any>

    @@ -1108,7 +2765,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.resolveIcon(sources, fallbackSources, outputFormat)Promise<Array<module:app-builder-lib/out/platformPackager.IconInfo>>

    +

    winPackager.resolveIcon(sources, fallbackSources, outputFormat)Promise<Array<module:app-builder-lib/out/platformPackager.IconInfo>>

    @@ -1132,7 +2789,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.getResource(custom, names)Promise< | String>

    +

    winPackager.getResource(custom, names)Promise< | String>

    @@ -1152,7 +2809,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.getResourcesDir(appOutDir)String

    +

    winPackager.getResourcesDir(appOutDir)String

    @@ -1168,7 +2825,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    platformPackager.getTempFile(suffix)Promise<String>

    +

    winPackager.getTempFile(suffix)Promise<String>

    @@ -1183,95 +2840,6 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc
    -

    -

    PublishManager ⇐ module:packages/electron-publish/out/publisher.PublishContext

    -

    Kind: class of app-builder-lib
    -Extends: module:packages/electron-publish/out/publisher.PublishContext
    -Properties

    -
      -
    • isPublish = false Boolean
    • -
    • progress = (process.stdout as TtyWriteStream).isTTY ? new MultiProgress() : null MultiProgress
    • -
    -

    Methods

    - -

    -

    publishManager.awaitTasks()Promise<void>

    -

    -

    publishManager.cancelTasks()

    -

    -

    publishManager.getGlobalPublishConfigurations()Promise< | Array>

    -

    -

    publishManager.scheduleUpload(publishConfig, event, appInfo)

    - - - - - - - - - - - - - - - - - - - - - -
    ParamType
    publishConfigPublishConfiguration
    eventmodule:packages/electron-publish/out/publisher.UploadTask
    appInfoAppInfo
    -

    -

    Target

    -

    Kind: class of app-builder-lib
    -Properties

    - -

    Methods

    - -

    -

    target.build(appOutDir, arch)Promise<any>

    - - - - - - - - - - - - - - - - - -
    ParamType
    appOutDirString
    archArch
    -

    -

    target.finishBuild()Promise<any>

    app-builder-lib.build(options, packager)Promise<Array<String>>

    Kind: method of app-builder-lib

    diff --git a/packages/app-builder-lib/src/electron/ElectronFramework.ts b/packages/app-builder-lib/src/electron/ElectronFramework.ts index d47c64bf18..3c5c467439 100644 --- a/packages/app-builder-lib/src/electron/ElectronFramework.ts +++ b/packages/app-builder-lib/src/electron/ElectronFramework.ts @@ -7,7 +7,7 @@ import { Configuration } from "../configuration" import { BeforeCopyExtraFilesOptions, Framework, PrepareApplicationStageDirectoryOptions } from "../Framework" import { Packager, Platform } from "../index" import { LinuxPackager } from "../linuxPackager" -import MacPackager from "../macPackager" +import { MacPackager } from "../macPackager" import { getTemplatePath } from "../util/pathManager" import { createMacApp } from "./electronMac" import { computeElectronVersion, getElectronVersionFromInstalled } from "./electronVersion" diff --git a/packages/app-builder-lib/src/electron/electronMac.ts b/packages/app-builder-lib/src/electron/electronMac.ts index 960d3271a0..419ebbf6c9 100644 --- a/packages/app-builder-lib/src/electron/electronMac.ts +++ b/packages/app-builder-lib/src/electron/electronMac.ts @@ -5,7 +5,7 @@ import { rename, utimes } from "fs/promises" import * as path from "path" import { filterCFBundleIdentifier } from "../appInfo" import { AsarIntegrity } from "../asar/integrity" -import MacPackager from "../macPackager" +import { MacPackager } from "../macPackager" import { normalizeExt } from "../platformPackager" import { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from "../util/appBuilder" import { createBrandingOpts } from "./ElectronFramework" diff --git a/packages/app-builder-lib/src/frameworks/LibUiFramework.ts b/packages/app-builder-lib/src/frameworks/LibUiFramework.ts index f60c16530f..e8137e8d7f 100644 --- a/packages/app-builder-lib/src/frameworks/LibUiFramework.ts +++ b/packages/app-builder-lib/src/frameworks/LibUiFramework.ts @@ -6,7 +6,7 @@ import { AfterPackContext } from "../configuration" import { Platform } from "../core" import { Framework, PrepareApplicationStageDirectoryOptions } from "../Framework" import { LinuxPackager } from "../linuxPackager" -import MacPackager from "../macPackager" +import { MacPackager } from "../macPackager" import { executeAppBuilderAndWriteJson } from "../util/appBuilder" export class LibUiFramework implements Framework { diff --git a/packages/app-builder-lib/src/index.ts b/packages/app-builder-lib/src/index.ts index c43805afee..b47c3add6a 100644 --- a/packages/app-builder-lib/src/index.ts +++ b/packages/app-builder-lib/src/index.ts @@ -39,6 +39,7 @@ export { SnapOptions, PlugDescriptor, SlotDescriptor } from "./options/SnapOptio export { Metadata, AuthorMetadata, RepositoryInfo } from "./options/metadata" export { AppInfo } from "./appInfo" export { SquirrelWindowsOptions } from "./options/SquirrelWindowsOptions" + export { CustomMacSign, CustomMacSignOptions } from "./macPackager" export { WindowsSignOptions, @@ -54,6 +55,9 @@ export { PublishManager } from "./publish/PublishManager" export { PlatformPackager } from "./platformPackager" export { Framework, PrepareApplicationStageDirectoryOptions } from "./Framework" export { buildForge, ForgeOptions } from "./forge-maker" +export { LinuxPackager } from "./linuxPackager" +export { WinPackager } from "./winPackager" +export { MacPackager } from "./macPackager" const expectedOptions = new Set(["publish", "targets", "mac", "win", "linux", "projectDir", "platformPackagerFactory", "config", "effectiveOptionComputed", "prepackaged"]) diff --git a/packages/app-builder-lib/src/macPackager.ts b/packages/app-builder-lib/src/macPackager.ts index e4e4fdf625..b8dc19f27e 100644 --- a/packages/app-builder-lib/src/macPackager.ts +++ b/packages/app-builder-lib/src/macPackager.ts @@ -31,7 +31,7 @@ import { export type CustomMacSignOptions = SignOptions export type CustomMacSign = (configuration: CustomMacSignOptions, packager: MacPackager) => Promise -export default class MacPackager extends PlatformPackager { +export class MacPackager extends PlatformPackager { readonly codeSigningInfo = new Lazy(() => { const cscLink = this.getCscLink() if (cscLink == null || process.platform !== "darwin") { diff --git a/packages/app-builder-lib/src/packager.ts b/packages/app-builder-lib/src/packager.ts index 52105c5dec..f3ec884943 100644 --- a/packages/app-builder-lib/src/packager.ts +++ b/packages/app-builder-lib/src/packager.ts @@ -473,7 +473,7 @@ export class Packager { switch (platform) { case Platform.MAC: { - const helperClass = (await import("./macPackager")).default + const helperClass = (await import("./macPackager")).MacPackager return new helperClass(this) } diff --git a/packages/app-builder-lib/src/targets/pkg.ts b/packages/app-builder-lib/src/targets/pkg.ts index 70ca1bb214..0e37981fb8 100644 --- a/packages/app-builder-lib/src/targets/pkg.ts +++ b/packages/app-builder-lib/src/targets/pkg.ts @@ -8,7 +8,7 @@ import * as path from "path" import { filterCFBundleIdentifier } from "../appInfo" import { findIdentity, Identity } from "../codeSign/macCodeSign" import { Target } from "../core" -import MacPackager from "../macPackager" +import { MacPackager } from "../macPackager" import { readdirSync } from "fs" const certType = "Developer ID Installer" diff --git a/packages/builder-util/src/7za.ts b/packages/builder-util/src/7za.ts index b8fa1c5934..884f44be50 100644 --- a/packages/builder-util/src/7za.ts +++ b/packages/builder-util/src/7za.ts @@ -1,8 +1,11 @@ import { path7x, path7za } from "7zip-bin" import { chmod } from "fs-extra" +import * as fs from "fs" export async function getPath7za(): Promise { - await chmod(path7za, 0o755) + if (fs.existsSync(path7za)) { + await chmod(path7za, 0o755) + } return path7za } diff --git a/packages/dmg-builder/src/dmg.ts b/packages/dmg-builder/src/dmg.ts index 3504693b70..94b0eed8ac 100644 --- a/packages/dmg-builder/src/dmg.ts +++ b/packages/dmg-builder/src/dmg.ts @@ -1,6 +1,6 @@ import { DmgOptions, Target } from "app-builder-lib" import { findIdentity, isSignAllowed } from "app-builder-lib/out/codeSign/macCodeSign" -import MacPackager from "app-builder-lib/out/macPackager" +import { MacPackager } from "app-builder-lib/out/macPackager" import { createBlockmap } from "app-builder-lib/out/targets/differentialUpdateInfoBuilder" import { executeAppBuilderAsJson } from "app-builder-lib/out/util/appBuilder" import { sanitizeFileName } from "app-builder-lib/out/util/filename" diff --git a/packages/electron-builder/src/index.ts b/packages/electron-builder/src/index.ts index 924cc194f9..a50a67e461 100644 --- a/packages/electron-builder/src/index.ts +++ b/packages/electron-builder/src/index.ts @@ -1,4 +1,4 @@ -export { getArchSuffix, Arch, archFromString } from "builder-util" +export { getArchSuffix, Arch, archFromString, log } from "builder-util" export { build, CliOptions, createTargets } from "./builder" export { publish, publishArtifactsWithOptions } from "./publish" export { @@ -64,6 +64,9 @@ export { PublishManager, PublishOptions, ProgressInfo, + MacPackager, + WinPackager, + LinuxPackager, } from "app-builder-lib" export { buildForge, ForgeOptions } from "app-builder-lib" export { CancellationToken } from "builder-util-runtime" diff --git a/test/src/helpers/CheckingPackager.ts b/test/src/helpers/CheckingPackager.ts index 8f6190449b..79a5d43ad6 100644 --- a/test/src/helpers/CheckingPackager.ts +++ b/test/src/helpers/CheckingPackager.ts @@ -2,7 +2,7 @@ import { AsyncTaskManager } from "builder-util" import { Arch, MacConfiguration, Packager, Target } from "electron-builder" import SquirrelWindowsTarget from "electron-builder-squirrel-windows" import { Identity } from "app-builder-lib/out/codeSign/macCodeSign" -import MacPackager from "app-builder-lib/out/macPackager" +import { MacPackager } from "app-builder-lib/out/macPackager" import { DmgTarget } from "dmg-builder" import { WinPackager } from "app-builder-lib/out/winPackager" import { SignOptions as MacSignOptions } from "@electron/osx-sign/dist/cjs/types"