Skip to content

Commit

Permalink
fix(cli): when v2 and v3 is found, use most similar path
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Aug 16, 2022
1 parent 2d7a380 commit 176daf1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/@sanity/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,16 @@ async function getCoreModulePath(
const sanityPath = resolveFrom.silent(workDir, 'sanity/_internal')

if (corePath && sanityPath) {
const closest = corePath.startsWith(workDir) ? corePath : sanityPath
const assumedVersion = closest === corePath ? 'v2' : 'v3'

console.warn(
chalk.yellow('Both `@sanity/core` AND `sanity` installed - assuming Sanity v3 project.')
chalk.yellow(
`Both \`@sanity/core\` AND \`sanity\` installed - assuming Sanity ${assumedVersion} project.`
)
)

return sanityPath
return closest
}

if (sanityPath) {
Expand Down

0 comments on commit 176daf1

Please sign in to comment.