message: feat: Add support to build darwin-arm64 for `oclif pack macos`
diff: import {Command, Flags} from '@oclif/core'
  import {Interfaces} from '@oclif/core'
  -import * as path from 'path'
  +import * as _ from 'lodash'
  import * as qq from 'qqjs'
  import * as Tarballs from '../../tarballs'
  @@ -145,11 +145,13 @@ the CLI should already exist in a directory named after the CLI that is the root
  const macos = c.macos
  const packageIdentifier = macos.identifier
  await Tarballs.build(buildConfig, {platform: 'darwin', pack: false, tarball: flags.tarball})
  + const scriptsDir = qq.join(buildConfig.tmp, 'macos/scripts')
  + await qq.emptyDir(buildConfig.dist('macos'))
  +
  + const build = async (arch: Interfaces.ArchTypes) => {
  const templateKey = templateShortKey('macos', {bin: config.bin, version: config.version, sha: buildConfig.gitSha})
  const dist = buildConfig.dist(`macos/${templateKey}`)
  - await qq.emptyDir(path.dirname(dist))
  - const scriptsDir = qq.join(buildConfig.tmp, 'macos/scripts')
  - const rootDir = buildConfig.workspace({platform: 'darwin', arch: 'x64'})
  + const rootDir = buildConfig.workspace({platform: 'darwin', arch})
  const writeScript = async (script: 'preinstall' | 'postinstall' | 'uninstall') => {
  const path = script === 'uninstall' ? [rootDir, 'bin'] : [scriptsDir]
  path.push(script)
  @@ -176,4 +178,11 @@ the CLI should already exist in a directory named after the CLI that is the root
  args.push(dist)
  await qq.x('pkgbuild', args as string[])
  }
  +
  + const arches = _.uniq(buildConfig.targets
  + .filter(t => t.platform === 'darwin')
  + .map(t => t.arch))
  + // eslint-disable-next-line no-await-in-loop
  + for (const a of arches) await build(a)
  + }
  }
  