deno icon indicating copy to clipboard operation
deno copied to clipboard

fix(cli): add prefix hint when installing a package globally

Open mbrdg opened this issue 1 year ago • 1 comments

closes #26545

Shows a hint when a package is installed globally, otherwise fallbacks to the existing implementation.

mbrdg avatar Oct 29 '24 22:10 mbrdg

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 29 '24 22:10 CLAassistant

Thanks for the PR @mbrdg, is there any chance you could add a test for this change?

Rookie mistake on my side, but I got a few questions regarding the test.

First, I've tried to add a new test in tests/integration/install_tests.rs to cover this change. Is this the right place to introduce the new test?

Additionally, I've followed the logic from other tests by instantiating a TestContextBuilder but I'm only able to get module not found errors when a try to install a package from npm and another from jsr without their prefixes. I can't obtain prefix errors because context's http server immediately tries to download from localhost. How can I overcome this issue within the test environment?

mbrdg avatar Nov 07 '24 17:11 mbrdg

@mbrdg that's correct, you can call .add_npm_env_vars() and .add_jsr_env_vars() which will set up the test context to use testing registry. Then you should be able to install packages like npm:@denotest/bin and jsr:@denotest/add.

bartlomieju avatar Nov 15 '24 09:11 bartlomieju

I believe that these changes caused a bug for deno install -g for local files. I have opened #26969.

KnorpelSenf avatar Nov 21 '24 14:11 KnorpelSenf