Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.


## Unreleased


### Bug Fixes

* fix `util._extend` deprecation warning when running `heroku local` ([#3742](https://github.com/heroku/cli/pull/3742))


### Code Refactoring

* vendor node-foreman, used by `heroku local`, into the CLI as an internal dependency ([#3742](https://github.com/heroku/cli/pull/3742))

## [11.4.0](https://github.com/heroku/cli/compare/v11.3.0...v11.4.0) (2026-05-13)


Expand Down
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"**/package-lock.json",
"**/node_modules/**",
"**/coverage/**",
"**/fixtures/**"
"**/fixtures/**",
"src/lib/local/foreman/**"
]
}
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ export default [
},
// Ignore patterns (in addition to shared ignores)
{
ignores: ['**/test/**/*.js', '**/*.d.ts', '.github/**'],
ignores: ['**/test/**/*.js', '**/*.d.ts', '.github/**', 'src/lib/local/foreman/**'],
},
]
77 changes: 0 additions & 77 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"eventsource": "^4",
"execa": "^9.6.1",
"filesize": "^10.1",
"foreman": "^3.0.1",

"fs-extra": "^11.3.0",
"glob": "^13.0.2",
"got": "^13.0.0",
Expand Down
45 changes: 45 additions & 0 deletions src/lib/local/foreman/colors.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright IBM Corp. 2012,2016. All Rights Reserved.
// Node module: foreman
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var reset = '\x1B[0m';
var colors = {
magenta: '\x1B[35m',
blue: '\x1B[34m',
cyan: '\x1B[36m',
green: '\x1B[32m',
yellow: '\x1B[33m',
red: '\x1B[31m',
bright_magenta: '\x1B[35m',
bright_cyan: '\x1B[36m',
bright_blue: '\x1B[34m',
bright_green: '\x1B[32m',
bright_yellow: '\x1B[33m',
bright_red: '\x1B[31m',
};

function identity(self) {
return self;
}

function colorizer(color) {
if (process.stdout.isTTY) {
return function (str) {
return colors[color] + str + reset;
};
} else {
return identity;
}
}

module.exports.colors = [];

var colorKeys = Object.keys(colors);
colorKeys.forEach(function(name) {
var colorFn = colorizer(name);
module.exports[name] = colorFn;
module.exports.colors.push(colorFn);
});

module.exports.colors_max = module.exports.colors.length;
123 changes: 123 additions & 0 deletions src/lib/local/foreman/console.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// Copyright IBM Corp. 2012,2016. All Rights Reserved.
// Node module: foreman
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var util = require('util');
var colors = require('./colors.cjs');

function wrap(log, length, res) {
if(!res) { res = []; }
if(log.length <= length) {
res.push(log);
return res;
} else {
res.push(log.substr(0, length));
return wrap(log.substr(length), length, res);
}
}

var trimEnd = '\u2026';
var ansiEscapes = /\x1b\[(\d+([A-GJKSTm]|;\d+[Hf])|6n|s|u|\?25[lh])/g;

function stripANSI(str) {
return str.replace(ansiEscapes, '');
}

function trim(line, n) {
line = line.replace(/\s+$/, '');
var stripped = stripANSI(line);
if (stripped.length <= n) {
return line;
} else {
return stripped.substr(0, n) + trimEnd;
}
}

function Console(logger) {
logger = logger || console;
this.padding = 25;

this.trimline = 10;
this.wrapline = 500;

this.fmt = function fmt() {
return util.format.apply(null, arguments);
};

this.pad = function pad(string, n) {
var l = string.length;
var o = string;
for(var i = l; i < n; i++) {
o += " ";
}
return o;
};

this.trim = trim;

this.info = function info(key, proc, string) {
var stamp = (new Date().toLocaleTimeString()) + " " + key;
logger.log(proc.color(this.pad(stamp,this.padding)), colors.cyan(string));
};

this.error = function error(key, proc, string) {
var stamp = (new Date().toLocaleTimeString()) + " " + key;
logger.error(proc.color(this.pad(stamp,this.padding)), colors.red(string));
};

this.log = function log(key, proc, string) {
var self = this;

if(self.raw) {
logger.log(string);
return;
}

string.split(/\n/).forEach(function(line) {

if (line.trim().length === 0) { return; }

var stamp = (new Date().toLocaleTimeString()) + " " + key;

if(self.trimline>0){
line = self.trim(line,self.trimline);
}

var delimiter = " | ";

var wrapline;
if(self.wrapline === 0) {
wrapline = line.length;
} else {
wrapline = self.wrapline;
}

wrap(line, wrapline).forEach(function(l) {
logger.log(proc.color(self.pad(stamp,self.padding) + delimiter), l);
delimiter = " | > ";
});

});
};

this.Alert = function Alert() {
logger.log(colors.green('[OKAY] '+ this.fmt.apply(null, arguments)));
};

this.Done = function Info() {
logger.log(colors.cyan('[DONE] ' + this.fmt.apply(null, arguments)));
};

this.Warn = function Warn() {
logger.warn(colors.yellow('[WARN] ' + this.fmt.apply(null, arguments)));
};

this.Error = function Error() {
logger.error(colors.bright_red('[FAIL] ' + this.fmt.apply(null,arguments)));
};

}

module.exports = Console;
Console.Console = new Console();
Loading
Loading