diff --git a/cli/internal/packagemanager/pnpm.go b/cli/internal/packagemanager/pnpm.go index d7a40da192250..1138cd9e502f4 100644 --- a/cli/internal/packagemanager/pnpm.go +++ b/cli/internal/packagemanager/pnpm.go @@ -1,7 +1,9 @@ package packagemanager import ( + "errors" "fmt" + stdfs "io/fs" "strings" "github.com/vercel/turbo/cli/internal/fs" @@ -58,6 +60,10 @@ func getPnpmWorkspaceIgnores(pm PackageManager, rootpath turbopath.AbsoluteSyste } pkgGlobs, err := readPnpmWorkspacePackages(rootpath.UntypedJoin("pnpm-workspace.yaml")) if err != nil { + // If workspace file doesn't exist we shouldn't error as we might be a single package repo + if errors.Is(err, stdfs.ErrNotExist) { + return ignores, nil + } return nil, err } for _, pkgGlob := range pkgGlobs { diff --git a/cli/internal/run/global_hash.go b/cli/internal/run/global_hash.go index 7b4868b519544..ffcacc820d5ed 100644 --- a/cli/internal/run/global_hash.go +++ b/cli/internal/run/global_hash.go @@ -129,7 +129,9 @@ func getGlobalHashInputs( if lockFile == nil { // If we don't have lockfile information available, add the specfile and lockfile to global deps globalDeps.Add(filepath.Join(rootpath.ToStringDuringMigration(), packageManager.Specfile)) - globalDeps.Add(filepath.Join(rootpath.ToStringDuringMigration(), packageManager.Lockfile)) + if rootpath.UntypedJoin(packageManager.Lockfile).Exists() { + globalDeps.Add(filepath.Join(rootpath.ToStringDuringMigration(), packageManager.Lockfile)) + } } // No prefix, global deps already have full paths diff --git a/turborepo-tests/integration/tests/single_package/dry-run-pnpm.t b/turborepo-tests/integration/tests/single_package/dry-run-pnpm.t new file mode 100644 index 0000000000000..5420dca819d0b --- /dev/null +++ b/turborepo-tests/integration/tests/single_package/dry-run-pnpm.t @@ -0,0 +1,6 @@ +Setup + $ . ${TESTDIR}/../../../helpers/setup.sh + $ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd) single_package pnpm@8.0.0 + +We only care about this running sucessfully and not the json output + $ ${TURBO} run build --dry=json > /dev/null