Skip to content

Commit

Permalink
chore(cli-helpers): loadEnvFiles cleanup (#10935)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored Jul 10, 2024
1 parent f10c8d5 commit bcd0f7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/cli-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@redwoodjs/telemetry": "workspace:*",
"chalk": "4.1.2",
"dotenv": "16.4.5",
"dotenv-defaults": "5.0.2",
"execa": "5.1.1",
"listr2": "6.6.1",
"lodash": "4.17.21",
Expand All @@ -55,7 +56,6 @@
"@types/lodash": "4.17.5",
"@types/pascalcase": "1.0.3",
"@types/yargs": "17.0.32",
"dotenv-defaults": "5.0.2",
"tsx": "4.15.6",
"typescript": "5.4.5",
"vitest": "1.6.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/cli-helpers/src/lib/loadEnvFiles.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'path'
import fs from 'node:fs'
import path from 'node:path'

import { config as dotenvConfig } from 'dotenv'
import { config as dotenvDefaultsConfig } from 'dotenv-defaults'
import fs from 'fs-extra'
import { hideBin, Parser } from 'yargs/helpers'

import { getPaths } from '@redwoodjs/project-config'
Expand Down Expand Up @@ -59,7 +59,7 @@ export function loadNodeEnvDerivedEnvFile(cwd: string) {
export function loadUserSpecifiedEnvFiles(cwd: string, loadEnvFiles: string[]) {
for (const suffix of loadEnvFiles) {
const envPath = path.join(cwd, `.env.${suffix}`)
if (!fs.pathExistsSync(envPath)) {
if (!fs.existsSync(envPath)) {
throw new Error(
`Couldn't find an .env file at '${envPath}' as specified by '--load-env-files'`,
)
Expand Down

0 comments on commit bcd0f7b

Please sign in to comment.