Skip to content
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

Do not auto pin by default COREPACK_ENABLE_AUTO_PIN=0 is now the default #552

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ same major line. Should you need to upgrade to a new major, use an explicit
package manager, and to not update the Last Known Good version when it
downloads a new version of the same major line.

- `COREPACK_ENABLE_AUTO_PIN` can be set to `0` to prevent Corepack from
updating the `packageManager` field when it detects that the local package
- `COREPACK_ENABLE_AUTO_PIN` can be set to `1` to allow Corepack to
update the `packageManager` field when it detects that the local package
doesn't list it. In general we recommend to always list a `packageManager`
field (which you can easily set through `corepack use [name]@[version]`), as
it ensures that your project installs are always deterministic.
Expand Down
8 changes: 5 additions & 3 deletions sources/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class Engine {
return fallbackDescriptor;

case `NoSpec`: {
if (process.env.COREPACK_ENABLE_AUTO_PIN !== `0`) {
if (process.env.COREPACK_ENABLE_AUTO_PIN === `1`) {
const resolved = await this.resolveDescriptor(fallbackDescriptor, {allowTags: true});
if (resolved === null)
throw new UsageError(`Failed to successfully resolve '${fallbackDescriptor.range}' to a valid ${fallbackDescriptor.name} release`);
Expand All @@ -275,9 +275,11 @@ export class Engine {
console.error();

await specUtils.setLocalPackageManager(path.dirname(result.target), installSpec);
} else {
debugUtils.log(`Falling back to ${fallbackDescriptor.name}@${fallbackDescriptor.range} in the absence of "packageManage" field in ${result.target}.`);
Lectem marked this conversation as resolved.
Show resolved Hide resolved
debugUtils.log(`It could be added for you automatically by setting the environment variable COREPACK_ENABLE_AUTO_PIN=1`);
debugUtils.log(`For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager`);
}

debugUtils.log(`Falling back to ${fallbackDescriptor.name}@${fallbackDescriptor.range} in the absence of "packageManage" field in ${result.target}`);
return fallbackDescriptor;
}

Expand Down