From 577f7ffd5065c8925d823039828546a0119faa1c Mon Sep 17 00:00:00 2001 From: alanmun Date: Thu, 13 Mar 2025 11:42:08 -0400 Subject: [PATCH] Now bubble up until either root dir reached or Pipfile found, if usePipenv is true --- lib/pipenv.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/pipenv.js b/lib/pipenv.js index 1099b651..fdffec98 100644 --- a/lib/pipenv.js +++ b/lib/pipenv.js @@ -40,14 +40,22 @@ async function getPipenvVersion() { } } +function findPipfileDirectory(dir) { + const { root } = path.parse(dir); + while (dir && dir !== root) { + if (fse.existsSync(path.join(dir, 'Pipfile'))) { + return dir; + } + dir = path.dirname(dir); + } + return null; +} + /** * pipenv install */ async function pipfileToRequirements() { - if ( - !this.options.usePipenv || - !fse.existsSync(path.join(this.servicePath, 'Pipfile')) - ) { + if (!this.options.usePipenv || findPipfileDirectory(this.servicePath) == null){ return; }