mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-17 15:58:54 +00:00
Fix 'npm help' SyntaxError on Node 8 (invalid 's' regex flag)
Change-type: patch Signed-off-by: Paulo Castro <paulo@balena.io>
This commit is contained in:
parent
e8325e8268
commit
3387f8f656
@ -27,7 +27,9 @@ export function getOclifHelpLinePairs(): [[string, string]] {
|
||||
function getCmdUsageDescriptionLinePair(cmd: typeof Command): [string, string] {
|
||||
const usage = (cmd.usage || '').toString().toLowerCase();
|
||||
let description = '';
|
||||
const matches = /\s*(.+?)\n.*/s.exec(cmd.description || '');
|
||||
// note: [^] matches any characters (including line breaks), achieving the
|
||||
// same effect as the 's' regex flag which is only supported by Node 9+
|
||||
const matches = /\s*([^]+?)\n[^]*/.exec(cmd.description || '');
|
||||
if (matches && matches.length > 1) {
|
||||
description = _.lowerFirst(_.trimEnd(matches[1], '.'));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user