Skip to content

Commit

Permalink
fix(cli): revert broken dotenv loading change
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolg42 committed Jul 13, 2020
1 parent 9437d01 commit dfbebf7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
},
"scripts": {
"test:generate": "./node_modules/.bin/mocha src/__tests__/integrate.generate.test.ts --require ts-mocha src/__tests__/integrate.generate.test.ts --timeout 10s",
"test:dotenv": "./node_modules/.bin/mocha src/__tests__/dotenv.test.ts --require ts-mocha src/__tests__/dotenv.test.ts --timeout 10s",
"test:format": "./node_modules/.bin/mocha src/__tests__/format.test.ts --require ts-mocha src/__tests__/format.test.ts --timeout 5s",
"test:doctor": "./node_modules/.bin/mocha src/__tests__/doctor.test.ts --require ts-mocha src/__tests__/doctor.test.ts --timeout 5s",
"test:sqlite": "./node_modules/.bin/mocha src/__tests__/integrate.sqlite.test.ts --require ts-mocha src/__tests__/integrate.sqlite.test.ts --timeout 10s",
Expand Down
12 changes: 0 additions & 12 deletions src/packages/cli/src/__tests__/dotenv.test.ts

This file was deleted.

7 changes: 5 additions & 2 deletions src/packages/cli/src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ if (process.argv.length > 2) {
debug('Environment variables not loaded (--schema was provided)')
}
} // Check current directory
else if (fs.existsSync('.env')) {
else if (fs.existsSync('schema.prisma') && fs.existsSync('.env')) {
dotenvResult = dotenv.config()
console.log(
chalk.dim('Environment variables loaded from current directory'),
)
} // Check ./prisma directory
else if (fs.existsSync('prisma/.env')) {
else if (
fs.existsSync('prisma/schema.prisma') &&
fs.existsSync('prisma/.env')
) {
dotenvResult = dotenv.config({ path: 'prisma/.env' })
// needed for Windows
const relative = path.relative('.', './prisma/.env')
Expand Down

0 comments on commit dfbebf7

Please sign in to comment.