- Allow to run semantic-release (via API) from anywhere passing the current working directory. - Allows to simplify the tests and to run them in parallel in both the core and plugins.
30 lines
768 B
JavaScript
30 lines
768 B
JavaScript
const chalk = require('chalk');
|
|
|
|
/**
|
|
* Logger with `log` and `error` function.
|
|
*/
|
|
module.exports = {
|
|
log(...args) {
|
|
const [format, ...rest] = args;
|
|
console.log(
|
|
`${chalk.grey('[Semantic release]:')}${
|
|
typeof format === 'string' ? ` ${format.replace(/%[^%]/g, seq => chalk.magenta(seq))}` : ''
|
|
}`,
|
|
...(typeof format === 'string' ? [] : [format]).concat(rest)
|
|
);
|
|
},
|
|
error(...args) {
|
|
const [format, ...rest] = args;
|
|
console.error(
|
|
`${chalk.grey('[Semantic release]:')}${typeof format === 'string' ? ` ${chalk.red(format)}` : ''}`,
|
|
...(typeof format === 'string' ? [] : [format]).concat(rest)
|
|
);
|
|
},
|
|
stdout(...args) {
|
|
console.log(args);
|
|
},
|
|
stderr(...args) {
|
|
console.error(args);
|
|
},
|
|
};
|