MCPcopy
hub / github.com/vercel/next.js / getInstalledReactVersion

Function getInstalledReactVersion

packages/next-codemod/bin/upgrade.ts:445–460  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

443}
444
445function getInstalledReactVersion(): string {
446 try {
447 return require(
448 require.resolve('react/package.json', {
449 paths: [cwd],
450 })
451 ).version
452 } catch (error) {
453 throw new BadInput(
454 `Failed to detect the installed React version in "${cwd}".\nIf you're working in a monorepo, please run this command from the Next.js app directory.`,
455 {
456 cause: error,
457 }
458 )
459 }
460}
461
462function isUsingPagesDir(projectPath: string): boolean {
463 return (

Callers 1

runUpgradeFunction · 0.85

Calls 2

resolveMethod · 0.65
requireFunction · 0.50

Tested by

no test coverage detected