From c0f5ada92263882a6c9d1d9c10b1940705b9821f Mon Sep 17 00:00:00 2001 From: "Adam J. Hines" Date: Tue, 1 Mar 2022 10:09:02 -0700 Subject: [PATCH] feat(yarn-pnp): adding support for turbo run w/ yarn pnp More specifically this removes the general check for yarn pnp and moves it into the prune command instead as this is the part that likely has remaining issues with pnp. --- cli/internal/backends/nodejs/nodejs.go | 7 ------- cli/internal/prune/prune.go | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cli/internal/backends/nodejs/nodejs.go b/cli/internal/backends/nodejs/nodejs.go index e9368017c19ff..8cd1c16b3e49d 100644 --- a/cli/internal/backends/nodejs/nodejs.go +++ b/cli/internal/backends/nodejs/nodejs.go @@ -115,13 +115,6 @@ var NodejsBerryBackend = api.LanguageBackend{ } if isBerry { - isNMLinker, err := util.IsNMLinker(cwd) - if err != nil { - return false, fmt.Errorf("could not determine if yarn is using `nodeLinker: node-modules`: %w", err) - } else if !isNMLinker { - return false, fmt.Errorf("only yarn v2/v3 with `nodeLinker: node-modules` is supported at this time") - } - return true, nil } } else { diff --git a/cli/internal/prune/prune.go b/cli/internal/prune/prune.go index b939336ed1aa2..12ac19f762ee7 100644 --- a/cli/internal/prune/prune.go +++ b/cli/internal/prune/prune.go @@ -116,6 +116,15 @@ func (c *PruneCommand) Run(args []string) int { if !util.IsYarn(ctx.Backend.Name) { c.logError(c.Config.Logger, "", fmt.Errorf("this command is not yet implemented for %s", ctx.Backend.Name)) return 1 + } else if ctx.Backend.Name == "nodejs-berry" { + isNMLinker, err := util.IsNMLinker(pruneOptions.cwd) + if err != nil { + c.logError(c.Config.Logger, "", fmt.Errorf("could not determine if yarn is using `nodeLinker: node-modules`: %w", err)) + return 1 + } else if !isNMLinker { + c.logError(c.Config.Logger, "", fmt.Errorf("only yarn v2/v3 with `nodeLinker: node-modules` is supported at this time")) + return 1 + } } logger.Printf("Generating pruned monorepo for %v in %v", ui.Bold(pruneOptions.scope), ui.Bold(filepath.Join(pruneOptions.cwd, "out")))