Skip to content

Commit

Permalink
feat: add 'target' argument when packing/uploading macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwebbio committed Nov 22, 2022
1 parent 6c7250b commit b4adf48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/commands/pack/macos.ts
Expand Up @@ -141,12 +141,15 @@ the CLI should already exist in a directory named after the CLI that is the root
description: 'optionally specify a path to a tarball already generated by NPM',
required: false,
}),
targets: Flags.string({
description: 'comma-separated targets to upload (e.g.: darwin-x64, darwin-arm64)',
}),
}

async run(): Promise<void> {
if (process.platform !== 'darwin') this.error('must be run from macos')
const {flags} = await this.parse(PackMacos)
const buildConfig = await Tarballs.buildConfig(flags.root)
const buildConfig = await Tarballs.buildConfig(flags.root, {targets: flags?.targets?.split(',')})
const {config} = buildConfig
const c = config.pjson.oclif as OclifConfig
if (!c.macos) this.error('package.json is missing an oclif.macos config')
Expand Down
3 changes: 2 additions & 1 deletion src/commands/upload/macos.ts
Expand Up @@ -13,11 +13,12 @@ export default class UploadMacos extends Command {

static flags = {
root: Flags.string({char: 'r', description: 'path to oclif CLI root', default: '.', required: true}),
targets: Flags.string({char: 't', description: 'comma-separated targets to upload (e.g.: darwin-x64, darwin-arm64)'}),
}

async run(): Promise<void> {
const {flags} = await this.parse(UploadMacos)
const buildConfig = await Tarballs.buildConfig(flags.root)
const buildConfig = await Tarballs.buildConfig(flags.root, {targets: flags?.targets?.split(',')})
const {s3Config, config, dist} = buildConfig
const S3Options = {
Bucket: s3Config.bucket!,
Expand Down

0 comments on commit b4adf48

Please sign in to comment.