heroku-cli-addons
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -5,3 +5,2 @@ 'use strict' | ||
const co = require('co') | ||
let waitForAddonProvisioning = require('../../lib/addons_wait') | ||
@@ -12,3 +11,3 @@ function parseConfig (args) { | ||
let key = args.shift() | ||
if (!key.startsWith('--')) { throw new Error(`Unexpected argument ${key}`) } | ||
if (!key.startsWith('--')) throw new Error(`Unexpected argument ${key}`) | ||
key = key.replace(/^--/, '') | ||
@@ -35,13 +34,2 @@ let val | ||
function formatConfigVarsMessage (addon) { | ||
let configVars = (addon.config_vars || []) | ||
if (configVars.length > 0) { | ||
configVars = configVars.map(c => cli.color.configVar(c)).join(', ') | ||
return `Created ${cli.color.addon(addon.name)} as ${configVars}` | ||
} else { | ||
return `Created ${cli.color.addon(addon.name)}` | ||
} | ||
} | ||
function * run (context, heroku) { | ||
@@ -72,19 +60,9 @@ const util = require('../../lib/util') | ||
if (addon.provision_message) { cli.log(addon.provision_message) } | ||
if (addon.state === 'provisioning') { | ||
if (context.flags.wait) { | ||
cli.log(`Waiting for ${cli.color.addon(addon.name)}...`) | ||
addon = yield waitForAddonProvisioning(context, heroku, addon, 5) | ||
cli.log(formatConfigVarsMessage(addon)) | ||
} else { | ||
cli.log(`${cli.color.addon(addon.name)} is being created in the background. The app will restart when complete...`) | ||
cli.log(`Use ${cli.color.cmd('heroku addons:info ' + addon.name)} to check creation progress`) | ||
} | ||
} else if (addon.state === 'deprovisioned') { | ||
throw new Error(`The add-on was unable to be created, with status ${addon.state}`) | ||
if (addon.config_vars.length) { | ||
let configVars = addon.config_vars.map(c => cli.color.configVar(c)).join(', ') | ||
cli.log(`Created ${cli.color.addon(addon.name)} as ${configVars}`) | ||
} else { | ||
cli.log(formatConfigVarsMessage(addon)) | ||
cli.log(`Created ${cli.color.addon(addon.name)}`) | ||
} | ||
if (addon.provision_message) cli.log(addon.provision_message) | ||
cli.log(`Use ${cli.color.cmd('heroku addons:docs ' + addon.addon_service.name)} to view documentation`) | ||
@@ -103,4 +81,3 @@ } | ||
{name: 'as', description: 'name for the initial add-on attachment', hasValue: true}, | ||
{name: 'confirm', description: 'overwrite existing config vars or existing add-on attachments', hasValue: true}, | ||
{name: 'wait', description: 'watch add-on creation status and exit when complete'} | ||
{name: 'confirm', description: 'overwrite existing config vars or existing add-on attachments', hasValue: true} | ||
], | ||
@@ -107,0 +84,0 @@ run: cli.command({preauth: true}, co.wrap(run)) |
@@ -11,3 +11,2 @@ 'use strict' | ||
const formatPrice = util.formatPrice | ||
const formatState = util.formatState | ||
const printf = require('printf') | ||
@@ -126,18 +125,2 @@ | ||
} | ||
}, { | ||
key: 'state', | ||
label: 'State', | ||
format: function (state) { | ||
switch (state) { | ||
case 'provisioned': | ||
state = 'created' | ||
break | ||
case 'provisioning': | ||
state = 'creating' | ||
break | ||
case 'deprovisioned': | ||
state = 'errored' | ||
} | ||
return state | ||
} | ||
}] | ||
@@ -214,3 +197,3 @@ }) | ||
format: function (name) { | ||
if (name === undefined) { return style('dim', '?') } | ||
if (name === undefined) return style('dim', '?') | ||
return name.replace(/^[^:]+:/, '') | ||
@@ -227,6 +210,2 @@ } | ||
} | ||
}, { | ||
label: 'State', | ||
key: 'state', | ||
format: formatState | ||
}], | ||
@@ -233,0 +212,0 @@ |
@@ -7,3 +7,2 @@ 'use strict' | ||
let formatPrice = require('../../lib/util').formatPrice | ||
let formatState = require('../../lib/util').formatState | ||
let style = require('../../lib/util').style | ||
@@ -32,4 +31,3 @@ | ||
'Owning app': style('app', addon.app.name), | ||
'Installed at': (new Date(addon.created_at)).toString(), | ||
State: formatState(addon.state) | ||
'Installed at': (new Date(addon.created_at)).toString() | ||
}) | ||
@@ -36,0 +34,0 @@ }) |
@@ -22,6 +22,5 @@ 'use strict' | ||
require('./commands/addons/services'), | ||
require('./commands/addons/upgrade'), | ||
require('./commands/addons/wait') | ||
require('./commands/addons/upgrade') | ||
]) | ||
exports.resolve = require('./lib/resolve') |
@@ -29,4 +29,4 @@ 'use strict' | ||
if (!price) { return } | ||
if (price.cents === 0) { return 'free' } | ||
if (!price) return | ||
if (price.cents === 0) return 'free' | ||
@@ -37,19 +37,2 @@ let fmt = price.cents % 100 === 0 ? '$%.0f/%s' : '$%.02f/%s' | ||
formatState: function (state) { | ||
switch (state) { | ||
case 'provisioned': | ||
state = 'created' | ||
break | ||
case 'provisioning': | ||
state = 'creating' | ||
break | ||
case 'deprovisioned': | ||
state = 'errored' | ||
break | ||
default: | ||
state = '' | ||
} | ||
return state | ||
}, | ||
trapConfirmationRequired: function * (context, fn) { | ||
@@ -63,3 +46,2 @@ return yield fn(context.flags.confirm) | ||
} | ||
} |
{ | ||
"name": "heroku-cli-addons", | ||
"description": "`heroku addons:*` commands", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"author": "Bo Jeanes @bjeanes", | ||
@@ -11,3 +11,2 @@ "bugs": { | ||
"co": "4.6.0", | ||
"co-wait": "0.0.0", | ||
"heroku-cli-util": "6.0.15", | ||
@@ -26,3 +25,2 @@ "lodash.flatten": "4.3.0", | ||
"chai": "^3.2.0", | ||
"lolex": "^1.5.1", | ||
"mocha": "3.0.2", | ||
@@ -29,0 +27,0 @@ "nock": "8.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
11
7
5
37127
21
903
- Removedco-wait@0.0.0
- Removedco-wait@0.0.0(transitive)