Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getLocalPackagePath() {
let packagePath
try {
packagePath = require.resolve('prisma2/package.json')
} catch (e) {
return null
}
if (packagePath) {
const pkg = require('prisma2/package.json')
const photonVersion = require('../package.json').version
if (pkg.version !== photonVersion) {
console.error(
`${c.red('Error')} ${c.bold(
'@prisma/photon',
)} and the locally installed ${c.bold(
'prisma2',
)} must have the same version:
${c.bold(`@prisma/photon@${photonVersion}`)} doesn't match ${c.bold(
`prisma2@${pkg.version}`,
)}`,
)
}
return require.resolve('prisma2')
}
return null
}
} catch (e) {
return null
}
if (packagePath) {
const pkg = require('prisma2/package.json')
const photonVersion = require('../package.json').version
if (pkg.version !== photonVersion) {
console.error(
`${c.red('Error')} ${c.bold(
'@prisma/photon',
)} and the locally installed ${c.bold(
'prisma2',
)} must have the same version:
${c.bold(`@prisma/photon@${photonVersion}`)} doesn't match ${c.bold(
`prisma2@${pkg.version}`,
)}`,
)
}
return require.resolve('prisma2')
}
return null
}