Skip to content

feat: enable auto-install to be used in all commands (not only nci) #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 16, 2025

Conversation

albertodeago
Copy link
Contributor

@albertodeago albertodeago commented May 9, 2025

Description

What:
Add a way to turn on autoInstall for all commands.
This is a non breaking change that enable users to do something like this.

NI_AUTO_INSTALL=true nr <my_command>

It should work in all commands, but I need this feature specifically in nr (to run nr in CI without installing the package manager, as I don't know which one will be used)

How:
A new "module" to detect environment variables are added and used in the runner.
The runner now merges the options provided as input with the environment options prioritising the provided input.

I added a little bit of tests also for the runner file, It's not currently testing everything, but considering that there were no test prior to this, it's a starting point.

Linked Issues

fix #247

Additional context

I'm not particularly a fan of the test I added as I'm leveraging the mock of detect to see what options are being passed down.

Copy link

pkg-pr-new bot commented May 16, 2025

Open in StackBlitz

npm i https://pkg.pr.new/antfu-collective/ni/@antfu/ni@277

commit: 12db7e8

@antfu antfu merged commit 05139bf into antfu-collective:main May 16, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for autoinstall in nr command
2 participants