Skip to content

Commit

Permalink
chore: Include .env of monorepo services in generate-dot-env command
Browse files Browse the repository at this point in the history
  • Loading branch information
angelmadames committed Jul 26, 2024
1 parent bbb8d8e commit d97d0e2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/utils/compose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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}`)
}
}
}

Expand Down

0 comments on commit d97d0e2

Please sign in to comment.