Skip to content

Is there an option to exclude a package? #27

Open

Description

@chmac

In an old nodejs project, I automatically get +yarnpkg.com added, but I manually added +classic.yarnpkg.com. However, I end up with a conflict. I have both versions of yarn installed, and the latest is the one that gets run from yarn. Can I somehow exclude that package from being picked up by pkgx?

Activity

  1. jhheider commented on Dec 5, 2024

    @jhheider
    Contributor

    You can do env -yarnpkg.com to remove it. As currently constituted:

    https://github.com/pkgxdev/pkgx/blob/f28d9311eac07c0dd0b4c3900eab2420199b6604/src/utils/devenv.ts#L76-L86

    .yarnrc brings in v1, and yarn.lock and .yarnrc.yml bring in berry.

  2. chmac commented on Dec 7, 2024

    @chmac
    Author

    The - trick is neat, I didn't know about it, thanks a lot.

    In this old project I have a yarn.lock, so I'm getting yarnpkg.com. When I try adding "pkgx": "-yarnpkg.com" to my package.json then I get the following error:

    dev
    × nothing provides: -yarnpkg.com
    │ we haven’t pkgd this yet. can you?
    ╰─➤ https://docs.pkgx.sh/pantry
    

    But without it, I get the yarnpkg.com package loaded. Is there a way round this, or am I making another mistake here somewhere?

  3. jhheider commented on Dec 7, 2024

    @jhheider
    Contributor

    I don't believe you can do it in a spec file. Only manually, using the env shell function created by the dev instance.

    I believe ordering should be maintained, so if you put both in you spec file with classic first, that should get you what you want.

  4. chmac commented on Dec 7, 2024

    @chmac
    Author

    @jhheider That's awesome, thanks a lot. You're absolutely right, ordering does fix the issue I'm facing. 🥳 Would be awesome if -foo worked in spec files also, but I'm totally satisfied with the workaround.

    Thanks again for working on pkgx and for all the help you've given me, I really appreciate it. 🧡

  5. transferred this issue frompkgxdev/pkgxon Jan 15, 2025
  6. reopened this on Jan 15, 2025
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