Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

heroku-cli-command

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heroku-cli-command - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

lib/mixins/heroku.js

2

lib/command.js

@@ -50,2 +50,3 @@ 'use strict'

if (!this[_flags]) this[_flags] = []
if (!flags) return
this[_flags] = this[_flags].concat(flags)

@@ -61,2 +62,3 @@ }

if (!this[_args]) this[_args] = []
if (!args) return
this[_args] = this[_args].concat(args)

@@ -63,0 +65,0 @@ }

44

lib/http.js

@@ -19,26 +19,7 @@ 'use strict'

function requestMiddleware (options) {
if (!this.debugging) return
this.error(`--> ${options.method} ${options.host}${options.path}`)
if (this.debugging > 1) {
this.error(renderHeaders(options.headers))
// if (body) this.error(`--- BODY\n${util.inspect(body)}\n---`)
}
}
function responseMiddleware ({response, body, options}) {
if (!this.debugging) return
let url = `${response.req._headers.host}${response.req.path}`
this.error(`<-- ${response.req.method} ${url} ${response.statusCode}`)
if (this.debugging > 1) {
this.error(renderHeaders(response.headers))
if (!options.raw) this.error(`--- BODY\n${util.inspect(body)}\n---`)
}
}
this[http] = new HTTP({
requestMiddleware: requestMiddleware.bind(this),
responseMiddleware: responseMiddleware.bind(this),
requestMiddleware: module.exports.requestMiddleware.bind(this),
responseMiddleware: module.exports.responseMiddleware.bind(this),
headers: {
'User-Agent': `heroku-cli/${this.options.version}`
'user-agent': `heroku-cli/${this.options.version}`
}

@@ -50,1 +31,20 @@ })

}
module.exports.requestMiddleware = function (options) {
if (!this.debugging) return
this.error(`--> ${options.method} ${options.host}${options.path}`)
if (this.debugging > 1) {
this.error(renderHeaders(options.headers))
// if (body) this.error(`--- BODY\n${util.inspect(body)}\n---`)
}
}
module.exports.responseMiddleware = function ({response, body, options}) {
if (!this.debugging) return
let url = `${response.req._headers.host}${response.req.path}`
this.error(`<-- ${response.req.method} ${url} ${response.statusCode}`)
if (this.debugging > 1) {
this.error(renderHeaders(response.headers))
if (!options.raw) this.error(`--- BODY\n${util.inspect(body)}\n---`)
}
}

@@ -5,9 +5,25 @@ 'use strict'

const mixins = require('./mixins')
const api = require('./mixins/api')
const app = require('./mixins/app')
const api = superclass => class extends superclass {
async init () {
await super.init()
let password = process.env.HEROKU_API_KEY
if (!password) {
const netrc = require('netrc')()
const host = netrc['api.heroku.com']
if (host) password = host.password
}
if (!password) throw new Error('Not logged in')
this.auth = {password}
}
}
module.exports = command => {
class NewCommand extends Command {
let BaseCommand = Command
if (command.needsApp) BaseCommand = mixins.mix(BaseCommand).with(app())
if (command.needsAuth) BaseCommand = mixins.mix(BaseCommand).with(api)
class NewCommand extends BaseCommand {
async run () {
this.auth = {password: this.auth}
this.debug = this.debugging
await command.run(this)

@@ -22,6 +38,3 @@ }

NewCommand.flags = command.flags
NewCommand.mixins = []
if (command.needsAuth) mixins.mix(NewCommand).with(api())
if (command.needsApp) mixins.mix(NewCommand).with(app())
return NewCommand
}

@@ -16,5 +16,5 @@ 'use strict'

module.exports = {
api: require('./api'),
heroku: require('./heroku'),
app: require('./app'),
mix
}
{
"name": "heroku-cli-command",
"description": "base Heroku CLI command",
"version": "0.1.2",
"version": "0.1.3",
"author": "Jeff Dickey @dickeyxxx",

@@ -13,2 +13,3 @@ "bugs": "https://github.com/heroku/heroku-cli-command/issues",

"heroku-client": "3.0.0",
"http-call": "1.0.3",
"lodash.maxby": "4.6.0",

@@ -15,0 +16,0 @@ "netrc": "0.1.4",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc