vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.3k stars 1.82k forks source link

[turborepo] Update codemod doesn't support custom registries and fails if NPM registry is unavailable #4152

Open denexapp opened 1 year ago

denexapp commented 1 year ago

What version of Turborepo are you using?

1.8.1

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Windows

Describe the Bug

I have an outdated version 1.8.1 of turborepo. When I run turbo commands, it shows me a message to run a codemod to update. However, when I run the codemod to update turborepo it fails. It shows "Unable to fetch the latest version of turbo" error message.

NPM registry is banned by our corporate firewall, and we use a proxy registry. In this scenario the codemod doesn't work.

The reason why it happens is because the registry url is hardcoded in the codemod: https://github.com/vercel/turbo/blob/main/packages/turbo-codemod/src/commands/migrate/steps/getLatestVersion.ts#LL5

Expected Behavior

It should use the same registry as the package manager and shouldn't rely on availability of NPM registry.

To Reproduce

To reproduce this issue, configure your package manager to use custom registry, ban npm registry on a network level and run pnpm dlx @turbo/codemod update.

Reproduction Repo

No response

arlyon commented 1 year ago

Hi! Thanks for raising this. We may be able to get this information from your current package manager instead but obviously the command will need to be reworked to support that. Another alternative is providing a flag to override this value. I will update this issue with any developments. Thanks!