Skip to content

Commit

Permalink
better dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Nov 14, 2019
1 parent 4f01517 commit fbfd9d6
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cli/sdk/src/predefinedGeneratorResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ export const predefinedGeneratorResolvers: PredefinedGeneratorResolvers = {
if (!process.stdout.isTTY) {
throw new PhotonFacadeMissingError()
} else {
console.log(
`In order to use the ${chalk.underline(
'"photonjs"',
)} generator, you need to install ${chalk.bold(
'@prisma/photon',
)} to your project.`,
)
const { value } = await prompts({
type: 'confirm',
name: 'value',
message:
'@prisma/photon needs to be installed to use "photonjs". Do you want to install it now?',
message: 'Do you want to install it now?',
initial: true,
})

Expand Down Expand Up @@ -63,7 +69,9 @@ class PhotonFacadeMissingError extends Error {
constructor() {
super(`In order to use the ${chalk.underline(
'"photonjs"',
)} generator, you need to install @prisma/photon to your project:
)} generator, you need to install ${chalk.bold(
'@prisma/photon',
)} to your project:
${chalk.bold.green('npm add @prisma/photon')}`)
}
}
Expand All @@ -76,6 +84,10 @@ async function installPackage(baseDir: string, pkg: string): Promise<void> {
await execa.command(`${cmdName} add ${pkg}`, {
cwd: baseDir,
stdio: 'inherit',
env: {
...process.env,
SKIP_GENERATE: 'true',
},
})
}

Expand Down

0 comments on commit fbfd9d6

Please sign in to comment.