nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers
MIT License
2.52k stars 165 forks source link

Download yarn from custom npm registry #396

Closed zhyupe closed 7 months ago

zhyupe commented 7 months ago

339 uses custom npm registry to resolve package manager versions. However, it still downloads from npm since spec.url is set to repo.yarnpkg.com.

This PR trys to resolve a tarball from npm registry when COREPACK_NPM_REGISTRY is set. Moreover, as configured spec.bin for yarn berry only support package manager downloaded as .js file, the bin config for custom package managers is used and now has higher priority than spec.bin.

This should completely fix #337

aduh95 commented 7 months ago

I don't know how reasonable it is to ask, but it'd be nice to have a test that emulates a custom registry so we can validate we don't introduce regressions with future changes.

zhyupe commented 7 months ago

I don't know how reasonable it is to ask, but it'd be nice to have a test that emulates a custom registry so we can validate we don't have regressions.

Okay, I'll add a test case later today.

aduh95 commented 7 months ago

It looks like tests are failing, you probably need to update the nock db – you’d need to run the tests with NOCK_ENV=record and commit the updated db file.