From a45ff60db49370167252be38f8ec8f39a9cf4f64 Mon Sep 17 00:00:00 2001 From: Liran Tal Date: Mon, 28 Aug 2023 20:48:11 +0300 Subject: [PATCH] fix: glob always expecting path to be provided --- packages/lockfile-lint/bin/lockfile-lint.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/lockfile-lint/bin/lockfile-lint.js b/packages/lockfile-lint/bin/lockfile-lint.js index c7eeda1..dfdec9b 100755 --- a/packages/lockfile-lint/bin/lockfile-lint.js +++ b/packages/lockfile-lint/bin/lockfile-lint.js @@ -49,7 +49,10 @@ const supportedValidators = new Map([ ['validate-integrity', 'validateIntegrity'] ]) -const lockfilesList = glob.sync(config.path) +let lockfilesList = [] +if (config.path) { + lockfilesList = glob.sync(config.path) +} for (const lockfilePath of lockfilesList) { if (lockfilesList.length > 1) { @@ -113,38 +116,38 @@ for (const lockfilePath of lockfilesList) { } } -function success(message) { +function success (message) { const m = [ isPrettyFormat ? GREEN : '', isPrettyFormat ? symbols.success : '', message, '\n', isPrettyFormat ? RESET : '' - ].filter((e) => !!e) + ].filter(e => !!e) console.info(m.join(' ')) } -function warn(message) { +function warn (message) { const m = [ isPrettyFormat ? YELLOW : '', isPrettyFormat ? symbols.info : '', message, '\n', isPrettyFormat ? RESET : '' - ].filter((e) => !!e) + ].filter(e => !!e) console.error(m.join(' ')) } -function error(message) { +function error (message) { const m = [ isPrettyFormat ? RED : '', isPrettyFormat ? symbols.error : '', message, '\n', isPrettyFormat ? RESET : '' - ].filter((e) => !!e) + ].filter(e => !!e) console.error(m.join(' ')) }