heroku-cli-buildpacks
Advanced tools
Comparing version 0.0.10-beta.2 to 0.0.11-beta.1
@@ -1,62 +0,48 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _nodeFetch = require('node-fetch'); | ||
var _nodeFetch2 = _interopRequireDefault(_nodeFetch); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fetch = require('node-fetch'); | ||
class BuildpackRegistryApi { | ||
constructor(t) { | ||
this.token = t; | ||
} | ||
static url() { | ||
if (process.env.HEROKU_BUILDPACK_REGISTRY_URL === undefined) { | ||
return 'https://buildpack-registry.heroku.com'; | ||
} else { | ||
return process.env.HEROKU_BUILDPACK_REGISTRY_URL; | ||
static url() { | ||
if (process.env.HEROKU_BUILDPACK_REGISTRY_URL === undefined) { | ||
return 'https://buildpack-registry.heroku.com'; | ||
} | ||
else { | ||
return process.env.HEROKU_BUILDPACK_REGISTRY_URL; | ||
} | ||
} | ||
} | ||
static create(token) { | ||
return new BuildpackRegistryApi(token); | ||
} | ||
headers(secondFactor) { | ||
let defaultHeaders = { | ||
'Authorization': `Bearer ${this.token}`, | ||
'Accept': 'application/vnd.heroku+json; version=3.buildpack-registry', | ||
'Content-Type': 'application/json' | ||
}; | ||
if (secondFactor) { | ||
defaultHeaders['Heroku-Two-Factor-Code'] = secondFactor; | ||
static create() { | ||
return new BuildpackRegistryApi(); | ||
} | ||
if (process.env.HEROKU_HEADERS) { | ||
return Object.assign({}, defaultHeaders, JSON.parse(process.env.HEROKU_HEADERS)); | ||
} else { | ||
return defaultHeaders; | ||
headers(options = {}) { | ||
let defaultHeaders = { | ||
Accept: 'application/vnd.heroku+json; version=3.buildpack-registry', | ||
'Content-Type': 'application/json' | ||
}; | ||
if (options.token !== undefined) { | ||
defaultHeaders.Authorization = `Bearer ${options.token}`; | ||
} | ||
if (options.secondFactor) { | ||
defaultHeaders['Heroku-Two-Factor-Code'] = options.secondFactor; | ||
} | ||
if (process.env.HEROKU_HEADERS) { | ||
let herokuHeaders = JSON.parse(process.env.HEROKU_HEADERS); | ||
return Object.assign({}, defaultHeaders, { herokuHeaders }); | ||
} | ||
else { | ||
return defaultHeaders; | ||
} | ||
} | ||
} | ||
async post(path, body, headers) { | ||
return (0, _nodeFetch2.default)(`${BuildpackRegistryApi.url()}/${path}`, { | ||
method: 'POST', | ||
headers: headers ? headers : this.headers(), | ||
body: JSON.stringify(body) | ||
}); | ||
} | ||
async get(path) { | ||
return (0, _nodeFetch2.default)(`${BuildpackRegistryApi.url()}/${path}`, { | ||
headers: this.headers() | ||
}); | ||
} | ||
async post(path, body, headers) { | ||
return fetch(`${BuildpackRegistryApi.url()}/${path}`, { | ||
method: 'POST', | ||
headers: headers ? headers : this.headers(), | ||
body: JSON.stringify(body) | ||
}); | ||
} | ||
async get(path) { | ||
return fetch(`${BuildpackRegistryApi.url()}/${path}`, { | ||
headers: this.headers() | ||
}); | ||
} | ||
} | ||
exports.default = BuildpackRegistryApi; | ||
exports.BuildpackRegistryApi = BuildpackRegistryApi; |
@@ -1,84 +0,71 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _buildpackRegistryApi = require('./buildpack-registry-api'); | ||
var _buildpackRegistryApi2 = _interopRequireDefault(_buildpackRegistryApi); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const buildpack_registry_api_1 = require("./buildpack-registry-api"); | ||
const BUILDPACK_FORMATTING_MESSAGE = "To specify a buildpack, please format it like the following: namespace/name (e.g. heroku/ruby). Also names can only contain letters, numbers, '_', and '-'."; | ||
class BuildpackRegistry { | ||
constructor(token) { | ||
this.api = _buildpackRegistryApi2.default.create(token); | ||
} | ||
static encodeBuildpackId(buildpackId) { | ||
return buildpackId.replace('/', '%2F'); | ||
} | ||
static isValidBuildpack(buildpack) { | ||
let nameParts = buildpack.split('/'); | ||
if (nameParts.length === 2 && nameParts[0].length > 0 && nameParts[1].length > 0) { | ||
return true; | ||
static isValidBuildpackSlug(buildpack) { | ||
let nameParts = buildpack.split('/'); | ||
if (nameParts.length === 2 && nameParts[0].length > 0 && nameParts[1].length > 0 && /^[a-z0-9][a-z0-9_\-]*$/i.exec(nameParts[1])) { | ||
return { result: true }; | ||
} | ||
return { | ||
result: false, | ||
error: BUILDPACK_FORMATTING_MESSAGE | ||
}; | ||
} | ||
return false; | ||
} | ||
static buildHeaders(secondFactor) { | ||
let headers = {}; | ||
if (secondFactor) { | ||
headers['Heroku-Two-Factor-Code'] = secondFactor; | ||
static buildHeaders(secondFactor) { | ||
let headers = {}; | ||
if (secondFactor) { | ||
headers['Heroku-Two-Factor-Code'] = secondFactor; | ||
} | ||
return headers; | ||
} | ||
return headers; | ||
} | ||
async requiresTwoFactor(buildpack) { | ||
let response = await this.api.get(`/buildpacks/${BuildpackRegistry.encodeBuildpackId(buildpack)}`); | ||
let body = await response.json(); | ||
return body.two_factor_authentication; | ||
} | ||
async publish(buildpack, ref, secondFactor) { | ||
return await this.api.post(`/buildpacks/${BuildpackRegistry.encodeBuildpackId(buildpack)}/revisions`, { ref }, this.api.headers(secondFactor)); | ||
} | ||
async rollback(buildpack, secondFactor) { | ||
return await this.api.post(`/buildpacks/${BuildpackRegistry.encodeBuildpackId(buildpack)}/actions/rollback`, {}, this.api.headers(secondFactor)); | ||
} | ||
async search(namespace, name, description) { | ||
let queryParams = []; | ||
let queryString = ''; | ||
if (namespace) { | ||
queryParams = namespace.split(',').map(namespace => `in[namespace][]=${namespace}`); | ||
constructor() { | ||
this.api = buildpack_registry_api_1.BuildpackRegistryApi.create(); | ||
} | ||
if (name) { | ||
queryParams = queryParams.concat(name.split(',').map(name => `in[name][]=${name}`)); | ||
async requiresTwoFactor(buildpack) { | ||
let response = await this.api.get(`/buildpacks/${encodeURIComponent(buildpack)}`); | ||
let body = await response.json(); | ||
return body.two_factor_authentication; | ||
} | ||
if (description) { | ||
queryParams = queryParams.concat(`like[description]=${encodeURIComponent(description)}`); | ||
async publish(buildpack, ref, token, secondFactor) { | ||
let options = { token }; | ||
if (secondFactor !== undefined) { | ||
options.secondFactor = secondFactor; | ||
} | ||
return this.api.post(`/buildpacks/${encodeURIComponent(buildpack)}/revisions`, { ref }, this.api.headers(options)); | ||
} | ||
if (queryParams.length > 0) { | ||
queryString = `?${queryParams.join('&')}`; | ||
async rollback(buildpack, token, secondFactor) { | ||
let options = { token }; | ||
if (secondFactor !== undefined) { | ||
options.secondFactor = secondFactor; | ||
} | ||
return this.api.post(`/buildpacks/${encodeURIComponent(buildpack)}/actions/rollback`, {}, this.api.headers(options)); | ||
} | ||
return await this.api.get(`/buildpacks${queryString}`); | ||
} | ||
async buildpackExists(buildpack) { | ||
return await this.api.get(`/buildpacks/${BuildpackRegistry.encodeBuildpackId(buildpack)}`); | ||
} | ||
async listVersions(buildpack) { | ||
return await this.api.get(`/buildpacks/${BuildpackRegistry.encodeBuildpackId(buildpack)}/revisions`); | ||
} | ||
async search(namespace, name, description) { | ||
let queryParams = []; | ||
let queryString = ''; | ||
if (namespace) { | ||
queryParams = namespace.split(',') | ||
.map(namespace => `in[namespace][]=${namespace}`); | ||
} | ||
if (name) { | ||
queryParams = queryParams.concat(name.split(',') | ||
.map(name => `in[name][]=${name}`)); | ||
} | ||
if (description) { | ||
queryParams = queryParams.concat(`like[description]=${encodeURIComponent(description)}`); | ||
} | ||
if (queryParams.length > 0) { | ||
queryString = `?${queryParams.join('&')}`; | ||
} | ||
return this.api.get(`/buildpacks${queryString}`); | ||
} | ||
async buildpackExists(buildpack) { | ||
return this.api.get(`/buildpacks/${encodeURIComponent(buildpack)}`); | ||
} | ||
async listVersions(buildpack) { | ||
return this.api.get(`/buildpacks/${encodeURIComponent(buildpack)}/revisions`); | ||
} | ||
} | ||
exports.default = BuildpackRegistry; | ||
BuildpackRegistry.invalidBuildpackMessage = "the buildpack is invalid. To specify a buildpack, please format it like the following: namespace/name (e.g. heroku/ruby)."; | ||
exports.BuildpackRegistry = BuildpackRegistry; |
@@ -1,207 +0,147 @@ | ||
'use strict'; | ||
var _herokuCliUtil = require('heroku-cli-util'); | ||
var _herokuCliUtil2 = _interopRequireDefault(_herokuCliUtil); | ||
var _push = require('./push'); | ||
var _push2 = _interopRequireDefault(_push); | ||
var _validUrl = require('valid-url'); | ||
var _validUrl2 = _interopRequireDefault(_validUrl); | ||
var _buildpackRegistry = require('./buildpack-registry'); | ||
var _buildpackRegistry2 = _interopRequireDefault(_buildpackRegistry); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function BuildpackCommand(context, heroku, command, action) { | ||
this.app = context.app; | ||
this.heroku = heroku; | ||
if (context.flags && context.flags.index) { | ||
let index = parseInt(context.flags.index); | ||
if (isNaN(index) || index <= 0) { | ||
_herokuCliUtil2.default.exit(1, 'Invalid index. Must be greater than 0.'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const color_1 = require("@heroku-cli/color"); | ||
const cli_ux_1 = require("cli-ux"); | ||
const lodash_1 = require("lodash"); | ||
const buildpack_registry_1 = require("./buildpack-registry"); | ||
const push = require('./push'); | ||
const validUrl = require('valid-url'); | ||
class BuildpackCommand { | ||
constructor(heroku) { | ||
this.heroku = heroku; | ||
this.registry = new buildpack_registry_1.BuildpackRegistry(); | ||
} | ||
this.index = index; | ||
} else { | ||
this.index = null; | ||
} | ||
this.url = context.args && context.args.url; | ||
this.action = action; | ||
this.command = command; | ||
this.context = context; | ||
this.registry = new _buildpackRegistry2.default(context.auth.password); | ||
} | ||
BuildpackCommand.prototype.mapBuildpackResponse = function (buildpacks) { | ||
return buildpacks.map(function (bp) { | ||
bp.buildpack.url = bp.buildpack.url.replace(/^urn:buildpack:/, ''); | ||
return bp; | ||
}); | ||
}; | ||
BuildpackCommand.prototype.get = function () { | ||
let buildpackCommand = this; | ||
return this.heroku.request({ | ||
path: `/apps/${this.app}/buildpack-installations`, | ||
headers: { Range: '' } | ||
}).then(function (buildpacks) { | ||
return buildpackCommand.mapBuildpackResponse(buildpacks); | ||
}); | ||
}; | ||
BuildpackCommand.prototype.put = function (buildpackUpdates) { | ||
let app = this.app; | ||
let buildpackCommand = this; | ||
return this.heroku.request({ | ||
path: `/apps/${app}/buildpack-installations`, | ||
headers: { Range: '' }, | ||
method: 'PUT', | ||
body: { updates: buildpackUpdates } | ||
}).then(function (buildpacks) { | ||
return buildpackCommand.mapBuildpackResponse(buildpacks); | ||
}); | ||
}; | ||
BuildpackCommand.prototype.clear = function* () { | ||
let res = yield { | ||
config: this.heroku.request({ | ||
path: `/apps/${this.app}/config-vars` | ||
}), | ||
clear: this.put([]) | ||
}; | ||
let configVars = res.config; | ||
let message = `Buildpack${this.command === 'clear' ? 's' : ''} ${this.action}.`; | ||
if (configVars.hasOwnProperty('BUILDPACK_URL')) { | ||
_herokuCliUtil2.default.log(message); | ||
_herokuCliUtil2.default.warn('The BUILDPACK_URL config var is still set and will be used for the next release'); | ||
} else if (configVars.hasOwnProperty('LANGUAGE_PACK_URL')) { | ||
_herokuCliUtil2.default.log(message); | ||
_herokuCliUtil2.default.warn('The LANGUAGE_PACK_URL config var is still set and will be used for the next release'); | ||
} else { | ||
_herokuCliUtil2.default.log(`${message} Next release on ${this.app} will detect buildpack normally.`); | ||
} | ||
}; | ||
BuildpackCommand.prototype.findIndex = function (buildpacks) { | ||
const findIndex = require('lodash.findindex'); | ||
let index = this.index; | ||
if (index) { | ||
return findIndex(buildpacks, function (b) { | ||
return b.ordinal + 1 === index; | ||
}); | ||
} else { | ||
return -1; | ||
} | ||
}; | ||
BuildpackCommand.prototype.findUrl = async function findUrl(buildpacks) { | ||
const findIndex = require('lodash.findindex'); | ||
let url = this.url; | ||
let mappedUrl = await this.registryNameToUrl(url); | ||
return findIndex(buildpacks, function (b) { | ||
return b.buildpack.url === url || b.buildpack.url === mappedUrl; | ||
}); | ||
}; | ||
BuildpackCommand.prototype.display = function (buildpacks, indent) { | ||
if (buildpacks.length === 1) { | ||
_herokuCliUtil2.default.log(buildpacks[0].buildpack.url); | ||
} else { | ||
buildpacks.forEach(function (b, i) { | ||
_herokuCliUtil2.default.log(`${indent}${i + 1}. ${b.buildpack.url}`); | ||
}); | ||
} | ||
}; | ||
BuildpackCommand.prototype.displayUpdate = function (buildpacks) { | ||
if (buildpacks.length === 1) { | ||
_herokuCliUtil2.default.log(`Buildpack ${this.action}. Next release on ${this.app} will use ${this.registryUrlToName(buildpacks[0].buildpack.url)}.`); | ||
_herokuCliUtil2.default.log(`Run ${_herokuCliUtil2.default.color.magenta((0, _push2.default)(this.context.flags.remote))} to create a new release using this buildpack.`); | ||
} else { | ||
_herokuCliUtil2.default.log(`Buildpack ${this.action}. Next release on ${this.app} will use:`); | ||
this.display(buildpacks, ' '); | ||
_herokuCliUtil2.default.log(`Run ${_herokuCliUtil2.default.color.magenta((0, _push2.default)(this.context.flags.remote))} to create a new release using these buildpacks.`); | ||
} | ||
}; | ||
BuildpackCommand.prototype.registryNameToUrl = async function (buildpack) { | ||
if (_validUrl2.default.isWebUri(buildpack)) { | ||
return buildpack; | ||
} | ||
if (!_buildpackRegistry2.default.isValidBuildpack(buildpack)) { | ||
_herokuCliUtil2.default.exit(1, `Could not find the buildpack since ${_buildpackRegistry2.default.invalidBuildpackMessage}`); | ||
} | ||
try { | ||
let response = await this.registry.buildpackExists(buildpack); | ||
let body = await response.json(); | ||
return body.blob_url; | ||
} catch (err) { | ||
if (err.statusCode == 404) { | ||
_herokuCliUtil2.default.exit(1, `${buildpack} is not in the buildpack registry.`); | ||
} else if (err.statusCode) { | ||
_herokuCliUtil2.default.exit(1, `${err.statusCode}: ${err.message}`); | ||
} else { | ||
_herokuCliUtil2.default.exit(1, err.message); | ||
async fetch(app) { | ||
let buildpacks = await this.heroku.get(`/apps/${app}/buildpack-installations`); | ||
return this.mapBuildpackResponse(buildpacks); | ||
} | ||
} | ||
}; | ||
BuildpackCommand.prototype.registryUrlToName = function (buildpack) { | ||
let match = /^https:\/\/([\w\-]+\/[\w\-]+)\.s3\.amazonaws\.com\/buildpacks\/([\w\-]+\/[\w\-]+).tgz$/.exec(buildpack); | ||
if (match) { | ||
return match[1]; | ||
} else { | ||
return buildpack; | ||
} | ||
}; | ||
BuildpackCommand.prototype.mutate = async function (buildpacksGet, spliceIndex) { | ||
let buildpackUpdates = buildpacksGet.map(function (b) { | ||
return { buildpack: b.buildpack.url }; | ||
}); | ||
let howmany = this.command === 'add' ? 0 : 1; | ||
let urls = this.command === 'remove' ? [] : [{ buildpack: await this.registryNameToUrl(this.url) }]; | ||
Array.prototype.splice.apply(buildpackUpdates, [spliceIndex, howmany].concat(urls)); | ||
let bp = this; | ||
return this.put(buildpackUpdates).then(function (buildpackPut) { | ||
bp.displayUpdate(buildpackPut); | ||
}); | ||
}; | ||
BuildpackCommand.prototype.validateUrlNotSet = async function (buildpacks) { | ||
if ((await this.findUrl(buildpacks, this.url)) !== -1) { | ||
_herokuCliUtil2.default.exit(1, `The buildpack ${this.url} is already set on your app.`); | ||
} | ||
}; | ||
BuildpackCommand.prototype.validateUrlPassed = function () { | ||
if (this.url) { | ||
return this.url; | ||
} | ||
_herokuCliUtil2.default.exit(1, `Usage: heroku buildpacks:${this.command} BUILDPACK_URL. | ||
Must specify target buildpack URL.`); | ||
}; | ||
BuildpackCommand.prototype.validateIndexInRange = function (buildpacks) { | ||
if (this.index < 0 || this.index > buildpacks.length) { | ||
if (buildpacks.length === 1) { | ||
_herokuCliUtil2.default.exit(1, 'Invalid index. Only valid value is 1.'); | ||
} else { | ||
_herokuCliUtil2.default.exit(1, `Invalid index. Please choose a value between 1 and ${buildpacks.length}`); | ||
mapBuildpackResponse(buildpacks) { | ||
let body = buildpacks.body; | ||
return body.map((bp) => { | ||
bp.buildpack.url = bp.buildpack.url.replace(/^urn:buildpack:/, ''); | ||
return bp; | ||
}); | ||
} | ||
} | ||
}; | ||
module.exports = BuildpackCommand; | ||
display(buildpacks, indent) { | ||
if (buildpacks.length === 1) { | ||
cli_ux_1.cli.log(buildpacks[0].buildpack.url); | ||
} | ||
else { | ||
buildpacks.forEach((b, i) => { | ||
cli_ux_1.cli.log(`${indent}${i + 1}. ${b.buildpack.url}`); | ||
}); | ||
} | ||
} | ||
async registryNameToUrl(buildpack) { | ||
if (validUrl.isWebUri(buildpack)) { | ||
return buildpack; | ||
} | ||
let buildpackValidity = buildpack_registry_1.BuildpackRegistry.isValidBuildpackSlug(buildpack); | ||
if (!buildpackValidity.result) { | ||
cli_ux_1.cli.error(`Could not find the buildpack: ${buildpack}. ${buildpackValidity.error}`, { exit: 1 }); | ||
} | ||
try { | ||
let response = await this.registry.buildpackExists(buildpack); | ||
let body = await response.json(); | ||
return body.blob_url; | ||
} | ||
catch (err) { | ||
if (err.statusCode === 404) { | ||
cli_ux_1.cli.error(`${buildpack} is not in the buildpack registry.`, { exit: 1 }); | ||
} | ||
else if (err.statusCode) { | ||
cli_ux_1.cli.error(`${err.statusCode}: ${err.message}`, { exit: 1 }); | ||
} | ||
else { | ||
cli_ux_1.cli.error(err.message, { exit: 1 }); | ||
} | ||
} | ||
return ''; | ||
} | ||
async findUrl(buildpacks, buildpack) { | ||
let mappedUrl = await this.registryNameToUrl(buildpack); | ||
return lodash_1.findIndex(buildpacks, (b) => { | ||
return b.buildpack.url === buildpack || b.buildpack.url === mappedUrl; | ||
}); | ||
} | ||
async validateUrlNotSet(buildpacks, buildpack) { | ||
if (await this.findUrl(buildpacks, buildpack) !== -1) { | ||
cli_ux_1.cli.error(`The buildpack ${buildpack} is already set on your app.`, { exit: 1 }); | ||
} | ||
} | ||
findIndex(buildpacks, index) { | ||
if (index) { | ||
return lodash_1.findIndex(buildpacks, function (b) { | ||
return b.ordinal + 1 === index; | ||
}); | ||
} | ||
else { | ||
return -1; | ||
} | ||
} | ||
async mutate(app, buildpacks, spliceIndex, buildpack, command) { | ||
let buildpackUpdates = buildpacks.map(function (b) { | ||
return { buildpack: b.buildpack.url }; | ||
}); | ||
let howmany = (command === 'add') ? 0 : 1; | ||
let urls = (command === 'remove') ? [] : [{ buildpack: await this.registryNameToUrl(buildpack) }]; | ||
let indexes = [spliceIndex, howmany]; | ||
let array = indexes.concat(urls); | ||
Array.prototype.splice.apply(buildpackUpdates, array); | ||
return this.put(app, buildpackUpdates); | ||
} | ||
async put(app, buildpackUpdates) { | ||
let buildpacks = await this.heroku.put(`/apps/${app}/buildpack-installations`, { | ||
headers: { Range: '' }, | ||
body: { updates: buildpackUpdates } | ||
}); | ||
return this.mapBuildpackResponse(buildpacks); | ||
} | ||
displayUpdate(app, remote, buildpacks, action) { | ||
if (buildpacks.length === 1) { | ||
cli_ux_1.cli.log(`Buildpack ${action}. Next release on ${app} will use ${this.registryUrlToName(buildpacks[0].buildpack.url)}.`); | ||
cli_ux_1.cli.log(`Run ${color_1.default.magenta(push(remote))} to create a new release using this buildpack.`); | ||
} | ||
else { | ||
cli_ux_1.cli.log(`Buildpack ${action}. Next release on ${app} will use:`); | ||
this.display(buildpacks, ' '); | ||
cli_ux_1.cli.log(`Run ${color_1.default.magenta(push(remote))} to create a new release using these buildpacks.`); | ||
} | ||
} | ||
registryUrlToName(buildpack) { | ||
let match = /^https:\/\/([\w\-]+\/[\w\-]+)\.s3\.amazonaws\.com\/buildpacks\/([\w\-]+\/[\w\-]+).tgz$/.exec(buildpack); | ||
if (match) { | ||
return match[1]; | ||
} | ||
else { | ||
return buildpack; | ||
} | ||
} | ||
async clear(app, command, action) { | ||
await this.put(app, []); | ||
let configVars = await this.heroku.get(`/apps/${app}/config-vars`); | ||
let message = `Buildpack${command === 'clear' ? 's' : ''} ${action}.`; | ||
if (configVars.hasOwnProperty('BUILDPACK_URL')) { | ||
cli_ux_1.cli.log(message); | ||
cli_ux_1.cli.warn('The BUILDPACK_URL config var is still set and will be used for the next release'); | ||
} | ||
else if (configVars.hasOwnProperty('LANGUAGE_PACK_URL')) { | ||
cli_ux_1.cli.log(message); | ||
cli_ux_1.cli.warn('The LANGUAGE_PACK_URL config var is still set and will be used for the next release'); | ||
} | ||
else { | ||
cli_ux_1.cli.log(`${message} Next release on ${app} will detect buildpack normally.`); | ||
} | ||
} | ||
validateIndexInRange(buildpacks, index) { | ||
if (index < 0 || index > buildpacks.length) { | ||
if (buildpacks.length === 1) { | ||
cli_ux_1.cli.error('Invalid index. Only valid value is 1.', { exit: 1 }); | ||
} | ||
else { | ||
cli_ux_1.cli.error(`Invalid index. Please choose a value between 1 and ${buildpacks.length}`, { exit: 1 }); | ||
} | ||
} | ||
} | ||
} | ||
exports.BuildpackCommand = BuildpackCommand; |
@@ -1,24 +0,3 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.commands = exports.topic = undefined; | ||
var _fsExtra = require('fs-extra'); | ||
var _fsExtra2 = _interopRequireDefault(_fsExtra); | ||
var _path = require('path'); | ||
var _path2 = _interopRequireDefault(_path); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const topic = exports.topic = { | ||
name: 'buildpacks', | ||
description: 'toolkit for working with buildpacks' | ||
}; | ||
let dir = _path2.default.join(__dirname, 'commands'); | ||
const commands = exports.commands = _fsExtra2.default.readdirSync(dir).filter(f => _path2.default.extname(f) === '.js' && !f.endsWith('.test.js')).map(f => require('./commands/' + f).default); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = {}; |
{ | ||
"name": "heroku-cli-buildpacks", | ||
"version": "0.0.10-beta.2", | ||
"version": "0.0.11-beta.1", | ||
"description": "", | ||
@@ -16,34 +16,56 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"build": "babel src -d lib --ignore '*.test.js'", | ||
"clean": "rimraf lib/", | ||
"prepare": "npm run clean && npm run build", | ||
"test": "eslint . && jest", | ||
"release": "np" | ||
"postpack": "rm -f oclif.manifest.json", | ||
"posttest": "tsc -p test --noEmit && tslint -p test -t stylish", | ||
"prepack": "rm -rf lib && tsc && oclif-dev manifest && oclif-dev readme", | ||
"test": "nyc mocha --forbid-only \"test/**/*.test.ts\"", | ||
"version": "oclif-dev readme && git add README.md" | ||
}, | ||
"dependencies": { | ||
"babel-plugin-module-alias": "^1.6.0", | ||
"cli-engine-command": "9.0.7", | ||
"cli-engine-config": "3.4.0", | ||
"cli-engine-heroku": "5.0.3", | ||
"@heroku-cli/color": "^1.1.5", | ||
"@heroku-cli/command": "^8.1.15", | ||
"@oclif/config": "^1.6.17", | ||
"@oclif/plugin-legacy": "^1.0.15", | ||
"@types/ansi-styles": "^3.2.0", | ||
"@types/lodash": "^4.14.108", | ||
"@types/supports-color": "^5.3.0", | ||
"cli-ux": "^4.2.1", | ||
"heroku-cli-util": "^8.0.0", | ||
"http-call": "^5.1.2", | ||
"lodash": "^4.14.0", | ||
"lodash.findindex": "^4.6.0", | ||
"node-fetch": "^2.1.2", | ||
"lodash.findindex": "^4.6.0", | ||
"valid-url": "^1.0.9" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-eslint": "^7.2.3", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", | ||
"eslint": "^4.0.0", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-plugin-flowtype": "^2.34.0", | ||
"eslint-plugin-import": "^2.5.0", | ||
"eslint-plugin-jest": "^20.0.3", | ||
"eslint-plugin-node": "^5.0.0", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"jest": "^20.0.4", | ||
"rimraf": "^2.6.1" | ||
"@oclif/dev-cli": "^1", | ||
"@oclif/plugin-help": "^1", | ||
"@oclif/test": "^1", | ||
"@oclif/tslint": "^1", | ||
"@types/chai": "^4", | ||
"@types/mocha": "^5", | ||
"@types/node": "^10.0.8", | ||
"chai": "^4", | ||
"globby": "^8", | ||
"mocha": "^5", | ||
"nyc": "^11", | ||
"tmp": "^0.0.33", | ||
"ts-node": "^6", | ||
"tslib": "^1", | ||
"tslint": "^5", | ||
"typescript": "^2.8" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.0" | ||
}, | ||
"files": [ | ||
"/lib", | ||
"/oclif.manifest.json" | ||
], | ||
"oclif": { | ||
"commands": "./lib/commands", | ||
"bin": "oclif-example", | ||
"devPlugins": [ | ||
"@oclif/plugin-help" | ||
] | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
44535
33
956
5
14
16
3
+ Added@heroku-cli/color@^1.1.5
+ Added@heroku-cli/command@^8.1.15
+ Added@oclif/config@^1.6.17
+ Added@oclif/plugin-legacy@^1.0.15
+ Added@types/ansi-styles@^3.2.0
+ Added@types/lodash@^4.14.108
+ Added@types/supports-color@^5.3.0
+ Addedcli-ux@^4.2.1
+ Addedhttp-call@^5.1.2
+ Addedlodash@^4.14.0
+ Added@heroku-cli/command@8.5.0(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Added@oclif/color@0.1.2(transitive)
+ Added@oclif/command@1.8.36(transitive)
+ Added@oclif/config@1.18.161.18.17(transitive)
+ Added@oclif/errors@1.3.6(transitive)
+ Added@oclif/help@1.0.15(transitive)
+ Added@oclif/linewrap@1.0.0(transitive)
+ Added@oclif/parser@3.8.17(transitive)
+ Added@oclif/plugin-legacy@1.3.6(transitive)
+ Added@oclif/screen@1.0.4(transitive)
+ Added@types/ansi-styles@3.2.1(transitive)
+ Added@types/color-name@2.0.0(transitive)
+ Added@types/lodash@4.17.13(transitive)
+ Added@types/supports-color@5.3.0(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedarray-union@2.1.0(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedchalk@3.0.04.1.2(transitive)
+ Addedclean-stack@2.2.03.0.1(transitive)
+ Addedcli-ux@4.9.3(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addeddir-glob@3.0.1(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedextract-stack@1.0.0(transitive)
+ Addedfast-glob@3.3.2(transitive)
+ Addedfastq@1.18.0(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedfs-extra@7.0.18.1.0(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedglobby@11.1.0(transitive)
+ Addedhas-flag@2.0.04.0.0(transitive)
+ Addedhttp-call@5.3.0(transitive)
+ Addedhyperlinker@1.0.0(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedindent-string@3.2.04.0.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-docker@2.2.1(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedis-stream@2.0.1(transitive)
+ Addedis-wsl@1.1.02.2.0(transitive)
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedopen@6.4.0(transitive)
+ Addedparse-json@4.0.0(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedslash@3.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedsupports-hyperlinks@1.0.1(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedtreeify@1.1.0(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addeduuid@8.3.2(transitive)
+ Addedwidest-line@3.1.0(transitive)
+ Addedwrap-ansi@6.2.07.0.0(transitive)
- Removedbabel-plugin-module-alias@^1.6.0
- Removedcli-engine-command@9.0.7
- Removedcli-engine-config@3.4.0
- Removedcli-engine-heroku@5.0.3
- Removed@cli-engine/screen@0.0.0(transitive)
- Removed@heroku/linewrap@1.0.0(transitive)
- Removedansicolors@0.2.1(transitive)
- Removedbabel-plugin-module-alias@1.6.0(transitive)
- Removedcardinal@1.0.0(transitive)
- Removedcli-engine-command@9.0.7(transitive)
- Removedcli-engine-config@3.4.0(transitive)
- Removedcli-engine-heroku@5.0.3(transitive)
- Removedcli-ux@2.1.1(transitive)
- Removedesprima@3.0.0(transitive)
- Removedfs-extra@4.0.35.0.0(transitive)
- Removedhttp-call@3.0.24.0.8(transitive)
- Removedlex@1.7.9(transitive)
- Removedlodash.maxby@4.6.0(transitive)
- Removedmoment@2.30.1(transitive)
- Removednetrc-parser@2.0.6(transitive)
- Removedredeyed@1.0.1(transitive)
- Removedstring@3.3.3(transitive)
- Removedts-lodash@4.0.11(transitive)
- Removeduuid@3.4.0(transitive)