From 6d53bbf43b4ceb09feb1a97abfdeba98aceef737 Mon Sep 17 00:00:00 2001 From: Christian Lewis Date: Sat, 23 Jan 2021 20:51:53 -0600 Subject: [PATCH] fix: recognize `netlify dev` and `netlify dev:exec` as distinct commands see also: https://github.com/netlify/netlify-faunadb-example/pull/36 --- src/detectors/utils/jsdetect.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/detectors/utils/jsdetect.js b/src/detectors/utils/jsdetect.js index 0d2d32025b3..0d4646bb863 100644 --- a/src/detectors/utils/jsdetect.js +++ b/src/detectors/utils/jsdetect.js @@ -80,8 +80,11 @@ const scanScripts = function ({ preferredScriptsArr, preferredCommand }) { /** * Throw if trying to call Netlify dev from within Netlify dev. Include * detailed information about the CLI setup in the error text. + * + * Do not include `netlify dev:exec`, etc., as they will not cause the CLI + * to recursively call itself. */ - if (scriptCommand.includes('netlify dev')) { + if (/netlify dev(?!:)/.test(scriptCommand)) { throw new InternalCliError('Cannot call `netlify dev` inside `netlify dev`.', { packageJsonScripts }) } /**