mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
[fs-detectors] check turbo versions to allow for tags like "latest" (#9790)
When a project depends on `turbo` at version `latest`, this code was breaking because `latest` is not a valid range for `semver.intersects`.
This commit is contained in:
@@ -22,6 +22,18 @@ export class MissingBuildTarget extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
function supportsRootCommand(turboSemVer: string | undefined) {
|
||||
if (!turboSemVer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!semver.validRange(turboSemVer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !semver.intersects(turboSemVer, '<1.8.0');
|
||||
}
|
||||
|
||||
type MonorepoDefaultSettings = {
|
||||
buildCommand?: string | null;
|
||||
installCommand?: string | null;
|
||||
@@ -91,7 +103,7 @@ export async function getMonorepoDefaultSettings(
|
||||
|
||||
let buildCommand = null;
|
||||
if (projectPath) {
|
||||
if (turboSemVer && !semver.intersects(turboSemVer, '<1.8.0')) {
|
||||
if (supportsRootCommand(turboSemVer)) {
|
||||
buildCommand = `turbo run build`;
|
||||
} else {
|
||||
// We don't know for sure if the local `turbo` supports inference.
|
||||
|
||||
Reference in New Issue
Block a user