From 7389cd6fe2a385f11d7d61add7fb17e14c64d936 Mon Sep 17 00:00:00 2001 From: Simon Garner Date: Sat, 16 Mar 2024 09:46:20 +1300 Subject: [PATCH 1/2] fix: prevent looking for a package.json file infinitely --- utils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils.js b/utils.js index 297d512..8f7acfc 100644 --- a/utils.js +++ b/utils.js @@ -15,7 +15,9 @@ const getConfigWithDir = () => { if (config) return { config, dir }; } - dir = path.join(dir, '..'); + const parentDir = path.resolve(dir, '..'); + if (parentDir === dir) break; + dir = parentDir; } console.log( From 7372f740c498bed26bfba4a9263de0195f9fd828 Mon Sep 17 00:00:00 2001 From: Simon Garner Date: Sat, 16 Mar 2024 09:47:12 +1300 Subject: [PATCH 2/2] fix: default selected DBs to valid DBs when no config --- utils.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils.js b/utils.js index 8f7acfc..9c1b03e 100644 --- a/utils.js +++ b/utils.js @@ -58,10 +58,11 @@ const getLicense = () => { }; const getSelectedDbs = () => { - const config = getConfig(); - const selected = config['selected-dbs']; const valids = ['City', 'Country', 'ASN']; - if (!selected) return valids; + + const config = getConfig(); + const selected = config?.['selected-dbs'] ?? valids; + if (!Array.isArray(selected)) { console.error('selected-dbs property must have be an array.'); process.exit(1);