From 5e534e78b1b71c666f3da66a71b55c47039333f2 Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Tue, 5 Mar 2024 15:38:34 +0000 Subject: [PATCH] Fix to validate `nunjucksPaths` as a string --- lib/plugins/plugin-validator.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/plugins/plugin-validator.js b/lib/plugins/plugin-validator.js index c6b029b400..1564180b60 100644 --- a/lib/plugins/plugin-validator.js +++ b/lib/plugins/plugin-validator.js @@ -40,9 +40,13 @@ function checkNunjucksMacroExists (executionPath, nunjucksFileName, nunjucksPath // set up a flag for the existance of a nunjucks path let nunjucksPathExists = false - if (nunjucksPaths === undefined) { - // Check if the nunjucksMacros are at the root level of the project - if (fse.existsSync(path.join(executionPath, nunjucksFileName))) nunjucksPathExists = true + if (!nunjucksPaths || typeof nunjucksPaths === 'string') { + const pathToCheck = typeof nunjucksPaths === 'string' + ? path.join(executionPath, nunjucksPaths, nunjucksFileName) + : path.join(executionPath, nunjucksFileName) // root level + + // Check if the nunjucksMacros are at a single path in the project + if (fse.existsSync(pathToCheck)) nunjucksPathExists = true } else { // Combine the file path name for each nunjucks path and check if any one of them exists for (const nunjucksPath of nunjucksPaths) {