Skip to content

Commit

Permalink
chore: standard@12
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Aug 29, 2018
1 parent e17a164 commit aad892d
Show file tree
Hide file tree
Showing 428 changed files with 3,196 additions and 3,341 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.0",
"eslint-plugin-standard": "^4.0.0",
"standard": "11.0.1"
"standard": "12.0.0"
},
"standard": {
"env": "mocha",
Expand Down
16 changes: 8 additions & 8 deletions packages/addons-v5/commands/addons/attach.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ function * run (context, heroku) {
function createAttachment (app, as, confirm, credential) {
let body = {
name: as,
app: {name: app},
addon: {name: addon.name},
app: { name: app },
addon: { name: addon.name },
confirm
}
if (credential && credential !== 'default') {
Expand All @@ -40,7 +40,7 @@ function * run (context, heroku) {

yield cli.action(
`Setting ${cli.color.attachment(attachment.name)} config vars and restarting ${cli.color.app(app)}`,
{success: false},
{ success: false },
co(function * () {
let releases = yield heroku.get(`/apps/${app}/releases`, {
partial: true,
Expand All @@ -58,10 +58,10 @@ module.exports = {
needsAuth: true,
needsApp: true,
flags: [
{name: 'as', description: 'name for add-on attachment', hasValue: true},
{name: 'credential', description: 'credential name for scoped access to Heroku Postgres', hasValue: true},
{name: 'confirm', description: 'overwrite existing add-on attachment with same name', hasValue: true}
{ name: 'as', description: 'name for add-on attachment', hasValue: true },
{ name: 'credential', description: 'credential name for scoped access to Heroku Postgres', hasValue: true },
{ name: 'confirm', description: 'overwrite existing add-on attachment with same name', hasValue: true }
],
args: [{name: 'addon_name'}],
run: cli.command({preauth: true}, co.wrap(run))
args: [{ name: 'addon_name' }],
run: cli.command({ preauth: true }, co.wrap(run))
}
24 changes: 12 additions & 12 deletions packages/addons-v5/commands/addons/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ function parseConfig (args) {
function * run (context, heroku) {
let createAddon = require('../../lib/create_addon')

let {app, flags, args} = context
let { app, flags, args } = context
if (args.length === 0) {
throw new Error('Usage: heroku addons:create SERVICE:PLAN')
}

let {name, as} = flags
let { name, as } = flags
let config = parseConfig(args.slice(1))

let addon = yield createAddon(heroku, app, args[0], context.flags.confirm, context.flags.wait, {config, name, as})
let addon = yield createAddon(heroku, app, args[0], context.flags.confirm, context.flags.wait, { config, name, as })

yield context.config.runHook('recache', {type: 'addon', app, addon})
yield context.config.runHook('recache', { type: 'addon', app, addon })
cli.log(`Use ${cli.color.cmd('heroku addons:docs ' + addon.addon_service.name)} to view documentation`)
}

Expand All @@ -52,18 +52,18 @@ const cmd = {
description: 'create a new add-on resource',
needsAuth: true,
needsApp: true,
args: [{name: 'service:plan'}],
args: [{ name: 'service:plan' }],
variableArgs: true,
flags: [
{name: 'name', description: 'name for the add-on resource', hasValue: true},
{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: 'name', description: 'name for the add-on resource', hasValue: true },
{ 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' }
],
run: cli.command({preauth: true}, co.wrap(run))
run: cli.command({ preauth: true }, co.wrap(run))
}

module.exports = [
Object.assign({command: 'create'}, cmd),
Object.assign({command: 'add', hidden: true}, cmd)
Object.assign({ command: 'create' }, cmd),
Object.assign({ command: 'add', hidden: true }, cmd)
]
16 changes: 8 additions & 8 deletions packages/addons-v5/commands/addons/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const co = require('co')

function * run (context, heroku) {
const resolve = require('../../lib/resolve')
const {groupBy, toPairs} = require('lodash')
const { groupBy, toPairs } = require('lodash')

let force = context.flags.force || process.env.HEROKU_FORCE === '1'
if (context.args.length === 0) throw new Error('Missing add-on name')
Expand All @@ -25,8 +25,8 @@ function * run (context, heroku) {
yield cli.action(msg, heroku.request({
method: 'DELETE',
path: `/apps/${addon.app.id}/addons/${addon.id}`,
headers: {'Accept-Expansion': 'plan'},
body: {force}
headers: { 'Accept-Expansion': 'plan' },
body: { force }
}))
}
}
Expand All @@ -39,14 +39,14 @@ let cmd = {
needsAuth: true,
wantsApp: true,
flags: [
{name: 'force', char: 'f', description: 'allow destruction even if connected to other apps'},
{name: 'confirm', char: 'c', hasValue: true}
{ name: 'force', char: 'f', description: 'allow destruction even if connected to other apps' },
{ name: 'confirm', char: 'c', hasValue: true }
],
variableArgs: true,
run: cli.command({preauth: true}, co.wrap(run))
run: cli.command({ preauth: true }, co.wrap(run))
}

module.exports = [
Object.assign({command: 'destroy'}, cmd),
Object.assign({command: 'remove', hidden: true}, cmd)
Object.assign({ command: 'destroy' }, cmd),
Object.assign({ command: 'remove', hidden: true }, cmd)
]
6 changes: 3 additions & 3 deletions packages/addons-v5/commands/addons/detach.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function * run (context, heroku) {

yield cli.action(
`Unsetting ${cli.color.attachment(attachment.name)} config vars and restarting ${cli.color.app(app)}`,
{success: false},
{ success: false },
co(function * () {
let releases = yield heroku.request({
path: `/apps/${app}/releases`,
Expand All @@ -35,6 +35,6 @@ module.exports = {
description: 'detach an existing add-on resource from an app',
needsAuth: true,
needsApp: true,
args: [{name: 'attachment_name'}],
run: cli.command({preauth: true}, co.wrap(run))
args: [{ name: 'attachment_name' }],
run: cli.command({ preauth: true }, co.wrap(run))
}
6 changes: 3 additions & 3 deletions packages/addons-v5/commands/addons/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module.exports = {
command: 'docs',
wantsApp: true,
needsAuth: true,
args: [{name: 'addon'}],
flags: [{name: 'show-url', description: 'show URL, do not open browser'}],
run: cli.command({preauth: true}, co.wrap(run)),
args: [{ name: 'addon' }],
flags: [{ name: 'show-url', description: 'show URL, do not open browser' }],
run: cli.command({ preauth: true }, co.wrap(run)),
description: "open an add-on's Dev Center documentation in your browser"
}
8 changes: 4 additions & 4 deletions packages/addons-v5/commands/addons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ function * run (ctx, api) {
const grandfatheredPrice = util.grandfatheredPrice
const printf = require('printf')

const {groupBy, some, sortBy, values} = require('lodash')
const { groupBy, some, sortBy, values } = require('lodash')

// Gets *all* attachments and add-ons and filters locally because the API
// returns *owned* items not associated items.
function * addonGetter (api, app) {
let attachments, addons

if (app) { // don't disploy attachments globally
addons = api.get(`/apps/${app}/addons`, {headers: {
addons = api.get(`/apps/${app}/addons`, { headers: {
'Accept-Expansion': 'addon_service,plan'
}})
} })

let sudoHeaders = JSON.parse(process.env.HEROKU_HEADERS || '{}')
if (sudoHeaders['X-Heroku-Sudo'] && !sudoHeaders['X-Heroku-Sudo-User']) {
Expand Down Expand Up @@ -276,7 +276,7 @@ module.exports = {
}
],

run: cli.command({preauth: true}, co.wrap(run)),
run: cli.command({ preauth: true }, co.wrap(run)),
usage: `${topic} [--all|--app APP]`,
description: 'lists your add-ons and attachments',
help: `The default filter applied depends on whether you are in a Heroku app
Expand Down
4 changes: 2 additions & 2 deletions packages/addons-v5/commands/addons/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let formatPrice = require('../../lib/util').formatPrice
let formatState = require('../../lib/util').formatState
let style = require('../../lib/util').style

let run = cli.command({preauth: true}, function (ctx, api) {
let run = cli.command({ preauth: true }, function (ctx, api) {
const resolve = require('../../lib/resolve')
return co(function * () {
let addon = yield resolve.addon(api, ctx.app, ctx.args.addon)
Expand Down Expand Up @@ -45,7 +45,7 @@ module.exports = {
command: 'info',
wantsApp: true,
needsAuth: true,
args: [{name: 'addon'}],
args: [{ name: 'addon' }],
run: run,
usage: `${topic}:info ADDON`,
description: 'show detailed add-on resource and attachment information'
Expand Down
6 changes: 3 additions & 3 deletions packages/addons-v5/commands/addons/open.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ module.exports = {
command: 'open',
wantsApp: true,
needsAuth: true,
args: [{name: 'addon'}],
flags: [{name: 'show-url', description: 'show URL, do not open browser'}],
run: cli.command({preauth: true}, co.wrap(run)),
args: [{ name: 'addon' }],
flags: [{ name: 'show-url', description: 'show URL, do not open browser' }],
run: cli.command({ preauth: true }, co.wrap(run)),
description: "open an add-on's dashboard in your browser"
}
12 changes: 6 additions & 6 deletions packages/addons-v5/commands/addons/plans.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ function * run (context, heroku) {
} else {
cli.table(plans, {
columns: [
{key: 'default', label: '', format: (d) => d ? 'default' : ''},
{key: 'name', label: 'slug'},
{key: 'human_name', label: 'name'},
{key: 'price', format: util.formatPrice}
{ key: 'default', label: '', format: (d) => d ? 'default' : '' },
{ key: 'name', label: 'slug' },
{ key: 'human_name', label: 'name' },
{ key: 'price', format: util.formatPrice }
]
})
}
Expand All @@ -28,9 +28,9 @@ module.exports = {
topic: 'addons',
command: 'plans',
description: 'list all available plans for an add-on services',
args: [{name: 'service'}],
args: [{ name: 'service' }],
flags: [
{name: 'json', description: 'output in json format'}
{ name: 'json', description: 'output in json format' }
],
run: cli.command(co.wrap(run))
}
6 changes: 3 additions & 3 deletions packages/addons-v5/commands/addons/rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
let cli = require('heroku-cli-util')
let co = require('co')

let run = cli.command({preauth: true}, function (ctx, api) {
let run = cli.command({ preauth: true }, function (ctx, api) {
return co(function * () {
let addon = yield api.get(`/addons/${ctx.args.addon}`)
let addonUrl = `/apps/${addon.app.id}/addons/${addon.id}`

yield api.patch(addonUrl, {body: {name: ctx.args.name}})
yield api.patch(addonUrl, { body: { name: ctx.args.name } })

let oldName = ctx.args.addon
let newName = cli.color.magenta(ctx.args.name)
Expand All @@ -24,7 +24,7 @@ module.exports = {
command: 'rename',
wantsApp: true,
needsAuth: true,
args: [{name: 'addon'}, {name: 'name'}],
args: [{ name: 'addon' }, { name: 'name' }],
run: run,
usage: `${topic}:rename ADDON NEW_NAME`,
description: 'rename an add-on'
Expand Down
8 changes: 4 additions & 4 deletions packages/addons-v5/commands/addons/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ function * run (context, heroku) {
} else {
cli.table(services, {
columns: [
{key: 'name', label: 'slug'},
{key: 'human_name', label: 'name'},
{key: 'state', label: 'state'}
{ key: 'name', label: 'slug' },
{ key: 'human_name', label: 'name' },
{ key: 'state', label: 'state' }
]
})
cli.log(`
Expand All @@ -26,7 +26,7 @@ module.exports = {
command: 'services',
description: 'list all available add-on services',
flags: [
{name: 'json', description: 'output in json format'}
{ name: 'json', description: 'output in json format' }
],
run: cli.command(co.wrap(run))
}
14 changes: 7 additions & 7 deletions packages/addons-v5/commands/addons/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ${cli.color.cyan('https://devcenter.heroku.com/articles/managing-add-ons')}`)
}

function handlePlanChangeAPIError (err) {
const {sortBy} = require('lodash')
const { sortBy } = require('lodash')

if (err.statusCode === 422 && err.body.message && err.body.message.startsWith("Couldn't find either the add-on")) {
return heroku.get(`/addon-services/${service}/plans`)
Expand Down Expand Up @@ -83,11 +83,11 @@ function * run (c, h) {
service = addon.addon_service.name
app = addon.app.name
plan = `${service}:${plan}`
yield cli.action(`Changing ${cli.color.magenta(addon.name)} on ${cli.color.cyan(app)} from ${cli.color.blue(addon.plan.name)} to ${cli.color.blue(plan)}`, {success: false}, co(function * () {
yield cli.action(`Changing ${cli.color.magenta(addon.name)} on ${cli.color.cyan(app)} from ${cli.color.blue(addon.plan.name)} to ${cli.color.blue(plan)}`, { success: false }, co(function * () {
addon = yield heroku.request({
path: `/apps/${app}/addons/${addon.name}`,
method: 'PATCH',
body: {plan: {name: plan}},
body: { plan: { name: plan } },
headers: {
'Accept-Expansion': 'plan',
'X-Heroku-Legacy-Provider-Messages': 'true'
Expand Down Expand Up @@ -116,11 +116,11 @@ $ heroku addons:upgrade swimming-briskly-123 heroku-redis:premium-2`
],
needsAuth: true,
wantsApp: true,
args: [{name: 'addon'}, {name: 'plan', optional: true}],
run: cli.command({preauth: true}, co.wrap(run))
args: [{ name: 'addon' }, { name: 'plan', optional: true }],
run: cli.command({ preauth: true }, co.wrap(run))
}

module.exports = [
Object.assign({command: 'upgrade'}, cmd),
Object.assign({command: 'downgrade'}, cmd)
Object.assign({ command: 'upgrade' }, cmd),
Object.assign({ command: 'downgrade' }, cmd)
]
6 changes: 3 additions & 3 deletions packages/addons-v5/commands/addons/wait.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ module.exports = {
command: 'wait',
wantsApp: true,
needsAuth: true,
args: [{name: 'addon', optional: true}],
flags: [{name: 'wait-interval', description: 'how frequently to poll in seconds', hasValue: true}],
run: cli.command({preauth: true}, co.wrap(run)),
args: [{ name: 'addon', optional: true }],
flags: [{ name: 'wait-interval', description: 'how frequently to poll in seconds', hasValue: true }],
run: cli.command({ preauth: true }, co.wrap(run)),
usage: `${topic}:wait ADDON`,
description: 'show provisioning status of the add-ons on the app'
}

0 comments on commit aad892d

Please sign in to comment.