feat: optionally include tarball path as input
MODIFY
src/commands/pack/deb.ts
src/commands/pack/deb.ts
@@ -51,6 +51,7 @@ export default class PackDeb extends Command {
static flags = {
root: Flags.string({char: 'r', description: 'path to oclif CLI root', default: '.', required: true}),
+ tarball: Flags.string({ char: 't', description: 'optionally specify a path to a tarball already generated by NPM', required: false })
}
async run(): Promise<void> {
@@ -58,7 +59,7 @@ export default class PackDeb extends Command {
const {flags} = await this.parse(PackDeb)
const buildConfig = await Tarballs.buildConfig(flags.root)
const {config} = buildConfig
- await Tarballs.build(buildConfig, {platform: 'linux', pack: false})
+ await Tarballs.build(buildConfig, {platform: 'linux', pack: false, tarball: flags.tarball})
const dist = buildConfig.dist('deb')
await qq.emptyDir(dist)
const build = async (arch: Interfaces.ArchTypes) => {

MODIFY
src/commands/pack/macos.ts
src/commands/pack/macos.ts
@@ -109,6 +109,7 @@ export default class PackMacos extends Command {
root: Flags.string({char: 'r', description: 'path to oclif CLI root', default: '.', required: true}),
'additional-cli': Flags.string({description: `an Oclif CLI other than the one listed in config.bin that should be made available to the user
the CLI should already exist in a directory named after the CLI that is the root of the tarball produced by "oclif pack:tarballs"`, hidden: true}),
+ tarball: Flags.string({ char: 't', description: 'optionally specify a path to a tarball already generated by NPM', required: false })
}
async run(): Promise<void> {
@@ -121,7 +122,7 @@ the CLI should already exist in a directory named after the CLI that is the root
if (!c.macos.identifier) this.error('package.json must have oclif.macos.identifier set')
const macos = c.macos
const packageIdentifier = macos.identifier
- await Tarballs.build(buildConfig, {platform: 'darwin', pack: false})
+ await Tarballs.build(buildConfig, {platform: 'darwin', pack: false, tarball: flags.tarball})
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))

MODIFY
src/commands/pack/tarballs.ts
src/commands/pack/tarballs.ts
@@ -16,6 +16,7 @@ This can be used to create oclif CLIs that use the system node or that come prel
default: Tarballs.TARGETS.join(','),
}),
xz: Flags.boolean({description: 'also build xz', allowNo: true, default: true}),
+ tarball: Flags.string({ char: 't', description: 'optionally specify a path to a tarball already generated by NPM', required: false })
}
async run(): Promise<void> {
@@ -28,7 +29,9 @@ This can be used to create oclif CLIs that use the system node or that come prel
throw new Error('Please specify one or more valid targets.')
}
- await Tarballs.build(buildConfig)
+ await Tarballs.build(buildConfig, {
+ tarball: flags.tarball
+ })
qq.cd(prevCwd)
}
}

MODIFY
src/commands/pack/win.ts
src/commands/pack/win.ts
@@ -206,6 +206,7 @@ export default class PackWin extends Command {
root: Flags.string({char: 'r', description: 'path to oclif CLI root', default: '.', required: true}),
'additional-cli': Flags.string({description: `an Oclif CLI other than the one listed in config.bin that should be made available to the user
the CLI should already exist in a directory named after the CLI that is the root of the tarball produced by "oclif pack:tarballs"`, hidden: true}),
+ tarball: Flags.string({ char: 't', description: 'optionally specify a path to a tarball already generated by NPM', required: false })
}
async run(): Promise<void> {
@@ -213,7 +214,7 @@ the CLI should already exist in a directory named after the CLI that is the root
const {flags} = await this.parse(PackWin)
const buildConfig = await Tarballs.buildConfig(flags.root)
const {config} = buildConfig
- await Tarballs.build(buildConfig, {platform: 'win32', pack: false})
+ await Tarballs.build(buildConfig, {platform: 'win32', pack: false, tarball: flags.tarball})
const arches = buildConfig.targets.filter(t => t.platform === 'win32').map(t => t.arch)
for (const arch of arches) {
const installerBase = qq.join(buildConfig.tmp, `windows-${arch}-installer`)

MODIFY
src/tarballs/build.ts
src/tarballs/build.ts
@@ -24,6 +24,7 @@ const pack = async (from: string, to: string) => {
export async function build(c: BuildConfig, options: {
platform?: string;
pack?: boolean;
+ tarball?: string;
} = {}): Promise<void> {
const {xz, config} = c
const prevCwd = qq.cwd()
@@ -147,7 +148,7 @@ export async function build(c: BuildConfig, options: {
}
log(`gathering workspace for ${config.bin} to ${c.workspace()}`)
- await extractCLI(await packCLI())
+ await extractCLI(options.tarball ? options.tarball : await packCLI())
await updatePJSON()
await addDependencies()
await writeBinScripts({config, baseWorkspace: c.workspace(), nodeVersion: c.nodeVersion})

feat: optionally include tarball path as input (#764) (#796)

Co-authored-by: Lucas Shadler <lshadler13@gmail.com>