Skip to content

Validation should be configurable based on operation #406

Open

Description

@GeoffreyBooth

It should be possible to define package manager constraints separately for certain operations, for example install/uninstall operations could get validation but run would allow any package manager. This would allow mixing and matching of package managers, for example pnpm to install packages but then Bun to run scripts.

Split off from #402.

Activity

  1. aduh95 commented on Feb 27, 2024

    @aduh95
    Contributor

    Currently you can use an env variable to disable validation, but I think you’re asking about something else. Do you have a specific format for the configuration in mind?

  2. arcanis commented on Feb 27, 2024

    @arcanis
    Contributor

    This would allow mixing and matching of package managers, for example pnpm to install packages but then Bun to run scripts.

    Fwiw as a package manager author that's exactly why I'd prefer Corepack to not support this.

    Mixing package managers together has been a relatively frequent source of issues, going from crashes (since the loader hooks aren't setup) to subtly incorrect behaviour (since the Yarn configuration and internal hooks are skipped).

    If this feature was supported, we'd likely strongly advise our users against it - perhaps even making it a warning or error if we detected this pattern.

  3. GeoffreyBooth commented on Feb 27, 2024

    @GeoffreyBooth
    MemberAuthor

    Most packages managers don't install loader hooks. Like npm for install and Bun for run should work perfectly well together I'd think. Maybe Yarn would advise against it and that's fine, but I don't think that's universal.

    Most people seem to version pin to avoid corrupting lockfiles. That only matters for adding or removing dependencies. If those are the only operations those users need version pinning for, it would open up other use cases to allow validation to be enforced only for those operations.

  4. darcyclarke commented on Feb 27, 2024

    @darcyclarke
    Member

    Mixing package managers together has been a relatively frequent source of issues, going from crashes (since the loader hooks aren't setup) to subtly incorrect behaviour (since the Yarn configuration and internal hooks are skipped).

    If this feature was supported, we'd likely strongly advise our users against it - perhaps even making it a warning or error if we detected this pattern.

    So you might say one of Corepack's goals is to ensure package managers do not work together?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions