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

Is there an option to exclude a package? #27

Open
chmac opened this issue Dec 5, 2024 · 4 comments
Open

Is there an option to exclude a package? #27

chmac opened this issue Dec 5, 2024 · 4 comments

Comments

@chmac
Copy link

chmac commented Dec 5, 2024

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?

@jhheider
Copy link
Contributor

jhheider commented Dec 5, 2024

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.

@chmac
Copy link
Author

chmac commented Dec 7, 2024

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?

@jhheider
Copy link
Contributor

jhheider commented Dec 7, 2024

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.

@chmac
Copy link
Author

chmac commented Dec 7, 2024

@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. 🧡

@chmac chmac closed this as completed Dec 7, 2024
@mxcl mxcl transferred this issue from pkgxdev/pkgx Jan 15, 2025
@mxcl mxcl reopened this Jan 15, 2025
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

No branches or pull requests

3 participants