From 8fa37ed1657039eb486f536ce8c2bff1e34da7db Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Sun, 8 Apr 2018 10:47:26 -0700 Subject: [PATCH] fix: add S3_BUCKET env var --- package.json | 2 +- src/config.ts | 13 +++++++++++++ src/plugin.ts | 11 ----------- yarn.lock | 6 +++--- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index aed9d95e..7494ae36 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/config.ts b/src/config.ts index a7b306ce..588cde7f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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(), diff --git a/src/plugin.ts b/src/plugin.ts index 89f0e93b..70810b86 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -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) diff --git a/yarn.lock b/yarn.lock index e1431f30..d323e4a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"