Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
module.exports = (key, isSelect) => {
if (key.meta) return;
if (key.meta && key.name !== 'escape') return;
if (key.ctrl) {
if (key.name === 'a') return 'first';
@@ -21,10 +21,14 @@ module.exports = (key, isSelect) => {
if (key.name === 'backspace') return 'delete';
if (key.name === 'delete') return 'deleteForward';
if (key.name === 'abort') return 'abort';
if (key.name === 'escape') return 'abort';
if (key.name === 'escape') return 'exit';
if (key.name === 'tab') return 'next';
if (key.name === 'pagedown') return 'nextPage';
if (key.name === 'pageup') return 'prevPage';
// TODO create home() in prompt types (e.g. TextPrompt)
if (key.name === 'home') return 'home';
// TODO create end() in prompt types (e.g. TextPrompt)
if (key.name === 'end') return 'end';
if (key.name === 'up') return 'up';
if (key.name === 'down') return 'down';

View File

@@ -5,7 +5,11 @@ const { erase, cursor } = require('sisteransi');
const width = str => [...strip(str)].length;
module.exports = function(prompt, perLine = process.stdout.columns) {
/**
* @param {string} prompt
* @param {number} perLine
*/
module.exports = function(prompt, perLine) {
if (!perLine) return erase.line + cursor.to(0);
let rows = 0;
@@ -14,5 +18,5 @@ module.exports = function(prompt, perLine = process.stdout.columns) {
rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
}
return (erase.line + cursor.prevLine()).repeat(rows - 1) + erase.line + cursor.to(0);
return erase.lines(rows);
};

View File

@@ -2,7 +2,11 @@
const strip = require('./strip');
module.exports = function (msg, perLine = process.stdout.columns) {
/**
* @param {string} msg
* @param {number} perLine
*/
module.exports = function (msg, perLine) {
let lines = String(strip(msg) || '').split(/\r?\n/);
if (!perLine) return lines.length;

View File

@@ -16,11 +16,12 @@ const render = type => styles[type] || styles.default;
const symbols = Object.freeze({
aborted: c.red(figures.cross),
done: c.green(figures.tick),
exited: c.yellow(figures.cross),
default: c.cyan('?')
});
const symbol = (done, aborted) =>
aborted ? symbols.aborted : done ? symbols.done : symbols.default;
const symbol = (done, aborted, exited) =>
aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default;
// between the question and the user's input.
const delimiter = completing =>

View File

@@ -2,16 +2,16 @@
/**
* @param {string} msg The message to wrap
* @param {object} [opts]
* @param {object} opts
* @param {number|string} [opts.margin] Left margin
* @param {number} [opts.width] Maximum characters per line including the margin
* @param {number} opts.width Maximum characters per line including the margin
*/
module.exports = (msg, opts = {}) => {
const tab = Number.isSafeInteger(parseInt(opts.margin))
? new Array(parseInt(opts.margin)).fill(' ').join('')
: (opts.margin || '');
const width = opts.width || process.stdout.columns;
const width = opts.width;
return (msg || '').split(/\r?\n/g)
.map(line => line