nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could we support corepack enable --yes?

VobileLiuZhiwu opened this issue · comments

What is the problem this feature will solve?

As a frontend lead, when enforcing package management tools for our projects, I've encountered a scenario where team members, who haven't pre-installed the specified version of the package manager, are prompted with a choice similar to this:

Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
? Do you want to continue? [Y/n]
This requires manual input of 'Y' before they can proceed with their work, which is inconvenient.

The trouble arises when someone inadvertently inputs n, preventing them from proceeding with their tasks. Ideally, we seek an automated process that eliminates the need for manual confirmation.

Therefore, I believe the best course of action would be to introduce a --yes flag for the corepack enable command, allowing it to automatically consent to downloading and installing the appropriate package manager without requiring user intervention. This would streamline our workflow and avoid potential disruptions caused by manual confirmations.

I feel that the inclusion of a --yes flag is crucial, and if implemented, it would be immensely appreciated.

What is the feature you are proposing to solve the problem?

corepack enable --yes

@VobileLiuZhiwu I've met the same problem. Do you find the solution?

@inoyakaigor just found out that there's a new COREPACK_ENABLE_DOWNLOAD_PROMPT env var which allows just that 😉

@inoyakaigor @marvinroger Yes, this one works for me.

export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 && corepack enable && yarn -v

@marvinroger @VobileLiuZhiwu thank you guys. After diving into Corepack's source code I solved this problem by simply adding variable CI=1 to environment