From d97d0e2fde232d17fa7287d55185585a224fb111 Mon Sep 17 00:00:00 2001 From: "Angel M. Adames" Date: Fri, 26 Jul 2024 11:18:53 -0400 Subject: [PATCH] chore: Include .env of monorepo services in generate-dot-env command --- src/utils/compose.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/utils/compose.ts b/src/utils/compose.ts index 11c1644..11d2639 100644 --- a/src/utils/compose.ts +++ b/src/utils/compose.ts @@ -36,7 +36,7 @@ export function composeFiles({ prefix = 'compose' }: ComposeFilesParams) { } export function composeExecParams() { - const { projectName, envFile } = projectConfig.load() + const { projectName, envFile, projectType, monoRepoServices } = projectConfig.load() const reposPath = projectConfig.reposPaths() const params = [] @@ -45,9 +45,17 @@ export function composeExecParams() { params.push(`--env-file ${envFile}`) for (const repo of reposPath) { - const envFile = join(repo, '.env') - if (isFile(envFile)) { - params.push(`--env-file ${envFile}`) + if (projectType === 'MonoRepo' && monoRepoServices) { + for (const path of projectConfig.repoServicesPaths()) { + if (isFile(join(path, '.env'))) { + params.push(`--env-file ${join(path, '.env')}`) + } + } + } else { + const envFile = join(repo, '.env') + if (isFile(envFile)) { + params.push(`--env-file ${envFile}`) + } } }