Repository: electron-userland/electron-builder
File: packages/app-builder-lib/src/electron/electronMac.ts (TypeScript)

Code before:
  const helperNPPlist = plistContent[3]
  const helperRendererPlist = plistContent[4]
  const helperPluginPlist = plistContent[5]
  const helperGPUPlist = plistContent[6]
  const helperLoginPlist = plistContent[7]

  // if an extend-info file was supplied, copy its contents in first
  if (plistContent[8] != null) {
    Object.assign(appPlist, plistContent[8])
  }

  const buildMetadata = packager.config

  /**
   * Configure bundleIdentifier for the generic Electron Helper process
   *
   * This was the only Helper in Electron 5 and before. Allow users to configure
   * the bundleIdentifier for continuity.
   */

  const oldHelperBundleId = (buildMetadata as any)["helper-bundle-id"]
  if (oldHelperBundleId != null) {
    log.warn("build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId")
  }

  const cfBundleIdentifier = filterCFBundleIdentifier((isMas ? packager.config.mas?.appId : packager.platformSpecificBuildOptions.appId) || appInfo.macBundleIdentifier)

  const helperBundleIdentifier = filterCFBundleIdentifier(
    (isMas ? packager.config.mas?.helperBundleId : packager.platformSpecificBuildOptions.helperBundleId) || oldHelperBundleId || `${cfBundleIdentifier}.helper`
  )

  appPlist.CFBundleIdentifier = cfBundleIdentifier

  await packager.applyCommonInfo(appPlist, contentsPath)

  // required for electron-updater proxy
  if (!isMas) {
    configureLocalhostAts(appPlist)
  }

  helperPlist.CFBundleExecutable = `${appFilename} Helper`
  helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`
  helperPlist.CFBundleIdentifier = helperBundleIdentifier
  helperPlist.CFBundleVersion = appPlist.CFBundleVersion

  /**
   * Configure bundleIdentifier for Electron 5+ Helper processes
   *
   * In Electron 6, parts of the generic Electron Helper process were split into
   * individual helper processes. Allow users to configure the bundleIdentifiers
   * for continuity, specifically because macOS keychain access relies on

Review comment (bug):
This will break previous logic if `isMas = true` & `mas?.appId = null`
```
(isMas ? packager.config.mas?.appId : packager.platformSpecificBuildOptions.appId)
```

I think it needs be
```
const defaultAppId = packager.platformSpecificBuildOptions.appId
const cfBundleIdentifier = filterCFBundleIdentifier((isMas ? packager.config.mas?.appId : defaultAppId) || defaultAppId || appInfo.macBundleIdentifier)

const defaultHelperId = packager.platformSpecificBuildOptions.helperBundleId
const helperBundleIdentifier = filterCFBundleIdentifier(
    (isMas ? packager.config.mas?.helperBundleId : defaultHelperId) || defaultHelperId || oldHelperBundleId || `${cfBundleIdentifier}.helper`
  )
```
I honestly don't like the way to write it, but `defaultAppId` is required twice, unfortunately.


Code after:
  const helperNPPlist = plistContent[3]
  const helperRendererPlist = plistContent[4]
  const helperPluginPlist = plistContent[5]
  const helperGPUPlist = plistContent[6]
  const helperLoginPlist = plistContent[7]

  // if an extend-info file was supplied, copy its contents in first
  if (plistContent[8] != null) {
    Object.assign(appPlist, plistContent[8])
  }

  const buildMetadata = packager.config

  /**
   * Configure bundleIdentifier for the generic Electron Helper process
   *
   * This was the only Helper in Electron 5 and before. Allow users to configure
   * the bundleIdentifier for continuity.
   */

  const oldHelperBundleId = (buildMetadata as any)["helper-bundle-id"]
  if (oldHelperBundleId != null) {
    log.warn("build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId")
  }

  const defaultAppId = packager.platformSpecificBuildOptions.appId
  const cfBundleIdentifier = filterCFBundleIdentifier((isMas ? packager.config.mas?.appId : defaultAppId) || defaultAppId || appInfo.macBundleIdentifier)

  const defaultHelperId = packager.platformSpecificBuildOptions.helperBundleId
  const helperBundleIdentifier = filterCFBundleIdentifier(
    (isMas ? packager.config.mas?.helperBundleId : defaultHelperId) || defaultHelperId || oldHelperBundleId || `${cfBundleIdentifier}.helper`
  )

  appPlist.CFBundleIdentifier = cfBundleIdentifier

  await packager.applyCommonInfo(appPlist, contentsPath)

  // required for electron-updater proxy
  if (!isMas) {
    configureLocalhostAts(appPlist)
  }

  helperPlist.CFBundleExecutable = `${appFilename} Helper`
  helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`
  helperPlist.CFBundleIdentifier = helperBundleIdentifier
  helperPlist.CFBundleVersion = appPlist.CFBundleVersion

  /**
   * Configure bundleIdentifier for Electron 5+ Helper processes
   *
   * In Electron 6, parts of the generic Electron Helper process were split into