Skip to content
This repository was archived by the owner on Apr 21, 2022. It is now read-only.

Commit a5b73e0

Browse files
committed
fix: do not require s3 credentials to pack
Fixes oclif/oclif#111
1 parent 4d703e0 commit a5b73e0

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/tarballs/build.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {ArchTypes, PlatformTypes} from '@oclif/config'
2+
import * as Errors from '@oclif/errors'
23
import * as path from 'path'
34
import * as qq from 'qqjs'
45

@@ -43,6 +44,8 @@ export async function build(c: IConfig, options: {
4344
qq.cd(c.workspace())
4445
const pjson = await qq.readJSON('package.json')
4546
pjson.version = c.version
47+
pjson.oclif.update = pjson.oclif.update || {}
48+
pjson.oclif.update.s3 = pjson.oclif.update.s3 || {}
4649
pjson.oclif.update.s3.bucket = c.s3Config.bucket
4750
await qq.writeJSON('package.json', pjson)
4851
}
@@ -85,6 +88,7 @@ export async function build(c: IConfig, options: {
8588
if (options.pack === false) return
8689
await pack(workspace, c.dist(key))
8790
if (xz) await pack(workspace, c.dist(config.s3Key('versioned', '.tar.xz', target)))
91+
if (!c.updateConfig.s3.host) return
8892
const manifest: IManifest = {
8993
rollout: (typeof c.updateConfig.autoupdate === 'object' && c.updateConfig.autoupdate.rollout) as number,
9094
version: c.version,
@@ -105,6 +109,10 @@ export async function build(c: IConfig, options: {
105109
if (options.pack === false) return
106110
await pack(c.workspace(), c.dist(config.s3Key('versioned', '.tar.gz')))
107111
if (xz) await pack(c.workspace(), c.dist(config.s3Key('versioned', '.tar.xz')))
112+
if (!c.updateConfig.s3.host) {
113+
Errors.warn('No S3 bucket or host configured. CLI will not be able to update.')
114+
return
115+
}
108116
const manifest: IManifest = {
109117
version: c.version,
110118
baseDir: config.s3Key('baseDir'),

src/tarballs/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export async function buildConfig(root: string): Promise<IConfig> {
5151
const _gitSha = await gitSha(root, {short: true})
5252
const version = config.version.includes('-') ? `${config.version}.${_gitSha}` : config.version
5353
const tmp = await Tmp(config)
54-
const updateConfig = config.pjson.oclif.update
54+
const updateConfig = config.pjson.oclif.update || {}
55+
updateConfig.s3 = updateConfig.s3 || {}
5556
return {
5657
root,
5758
gitSha: _gitSha,

0 commit comments

Comments
 (0)