mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-18 08:10:06 +00:00
Merge pull request #1292 from balena-io/1291-regex-s-flag
Fix 'npm help' SyntaxError on Node 8 (invalid 's' regex flag)
This commit is contained in:
commit
f75ffb53f5
@ -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