Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: add S3_BUCKET env var
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Apr 8, 2018
1 parent 4b035f4 commit 8fa37ed
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"debug": "^3.1.0"
},
"devDependencies": {
"@oclif/errors": "^1.0.3",
"@oclif/errors": "^1.0.4",
"@oclif/parser": "^3.2.11",
"@oclif/tslint": "^1.1.0",
"@types/chai": "^4.1.2",
Expand Down
13 changes: 13 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,19 @@ export class Config implements IConfig {

this.npmRegistry = this.scopedEnvVar('NPM_REGISTRY') || this.pjson.oclif.npmRegistry || 'https://registry.yarnpkg.com'

this.pjson.oclif.update = this.pjson.oclif.update || {}
this.pjson.oclif.update.node = this.pjson.oclif.update.node || {}
const s3 = this.pjson.oclif.update.s3 = this.pjson.oclif.update.s3 || {}
s3.bucket = this.scopedEnvVar('S3_BUCKET') || s3.bucket
if (s3.bucket && !s3.host) s3.host = `https://${s3.bucket}.s3.amazonaws.com`
s3.templates = {
platformTarball: '<%- name %>/channels/<%- channel %>/<%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>-<%- platform %>-<%- arch %>',
vanillaTarball: '<%- name %>/channels/<%- channel %>/<%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>',
platformManifest: '<%- name %>/channels/<%- channel %>/<%- platform %>-<%- arch %>',
vanillaManifest: '<%- name %>/channels/<%- channel %>/version',
...s3.templates,
}

await Promise.all([
this.loadCorePlugins(),
this.loadUserPlugins(),
Expand Down
11 changes: 0 additions & 11 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,6 @@ export class Plugin implements IPlugin {
}

this.hooks = mapValues(this.pjson.oclif.hooks || {}, i => Array.isArray(i) ? i : [i])
this.pjson.oclif.update = this.pjson.oclif.update || {}
this.pjson.oclif.update.node = this.pjson.oclif.update.node || {}
const s3 = this.pjson.oclif.update.s3 = this.pjson.oclif.update.s3 || {}
if (s3.bucket && !s3.host) s3.host = `https://${s3.bucket}.s3.amazonaws.com`
s3.templates = {
platformTarball: '<%- name %>/channels/<%- channel %>/<%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>-<%- platform %>-<%- arch %>',
vanillaTarball: '<%- name %>/channels/<%- channel %>/<%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>',
platformManifest: '<%- name %>/channels/<%- channel %>/<%- platform %>-<%- arch %>',
vanillaManifest: '<%- name %>/channels/<%- channel %>/version',
...s3.templates,
}

this.manifest = await this._manifest(!!this.options.ignoreManifest, !!this.options.errorOnManifestCreate)
this.commands = Object.entries(this.manifest.commands)
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
version "1.0.0"
resolved "https://registry.yarnpkg.com/@heroku/linewrap/-/linewrap-1.0.0.tgz#a9d4e99f0a3e423a899b775f5f3d6747a1ff15c6"

"@oclif/errors@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.3.tgz#f23c024075855c7d116d041ee158f99bd51175af"
"@oclif/errors@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.4.tgz#8e34386ede530484ae3c98bc21d818c416214c66"
dependencies:
clean-stack "^1.3.0"
fs-extra "^5.0.0"
Expand Down

0 comments on commit 8fa37ed

Please sign in to comment.