Skip to content

Commit

Permalink
Add PRISMA_GENERATE_SKIP_AUTOINSTALL env var for studio
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolg42 committed Mar 16, 2020
1 parent 4f97c74 commit 50e0648
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cli/sdk/src/predefinedGeneratorResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const predefinedGeneratorResolvers: PredefinedGeneratorResolvers = {
console.log({ prismaClientDir })
}

if (!prismaClientDir) {
if (!prismaClientDir && !process.env.PRISMA_GENERATE_SKIP_AUTOINSTALL) {
if (
!fs.existsSync(path.join(process.cwd(), 'package.json')) &&
!fs.existsSync(path.join(process.cwd(), '../package.json'))
Expand Down Expand Up @@ -91,6 +91,15 @@ Please try to install it by hand with ${chalk.bold.greenBright(
)
}

if (!prismaClientDir) {
throw new Error(
`Could not resolve @prisma/client.
Please try to install it with ${chalk.bold.greenBright(
'npm install @prisma/client',
)} and rerun ${chalk.bold('prisma2 generate')} 🙏.`,
)
}

return {
outputPath: prismaClientDir,
generatorPath: path.resolve(prismaClientDir, 'generator-build/index.js'),
Expand Down

0 comments on commit 50e0648

Please sign in to comment.