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

fix: 🐛 resolve binaries from current package location and memoize costly operations #154

Merged
merged 3 commits into from
Jan 11, 2021

Conversation

remorses
Copy link
Contributor

@remorses remorses commented Jan 8, 2021

The commands using -r were failing in yarn berry workspaces because the binaries were resolved from process.cwd(), now they are resolved from the current package location instead

The commands with -r were also very slow because some costly operation like getInstallState were executed for every package, now they are memoized

After the changes below everything works as expected 😀

@remorses
Copy link
Contributor Author

Hey @folke, can you take a look?

@folke folke merged commit 8c5ed2a into folke:master Jan 11, 2021
@folke
Copy link
Owner

folke commented Jan 11, 2021

Thank you for working on this!

I merged this about an hour ago, but hadn't checked first 😬.

The changes currently give a TS error on the import of the pnpapi.

Haven't really looked too much into it, but I assume you only want the types?

If so, just change it to an import type instead.

If that is the part that imports a package's pnpapi.js file, then you should either use a dynamic import with proper filename (is async) or use require.

Otherwise, this might possibly break using ultra in packages not using yarn.

Would be great if you could look into this and create a new PR from the current main branch (your previous changes or on that already).

You can do ultra build to see if everything is OK.

Also, just ignore the lint errors for reduce. I already fixed that on my laptop, but didn't push it yet. On mobile right now.

Thanks again!

@remorses
Copy link
Contributor Author

remorses commented Jan 11, 2021

I import the pnpapi just for the type, I also installed ‘@types/pnpapi’ so typescript should be ok, I think the problem is just the linter, maybe using import type will remove it, I will try tomorrow

@folke
Copy link
Owner

folke commented Jan 11, 2021

Thank you for the info! Had a look at the code and fixed the linting errors. Will push a new release in a bit.

folke pushed a commit that referenced this pull request Jan 11, 2021
### [3.8.1](v3.8.0...v3.8.1) (2021-01-11)

### Bug Fixes

* 🐛  resolve binaries from current package location and memoize costly operations ([#154](#154)) ([8c5ed2a](8c5ed2a))
* 🐛 fixed linting errors related to pnpapi ([0d32d08](0d32d08))

### Other

* 📦️ disable unicorn/import-reduce rule ([392a5ae](392a5ae))
* **deps:** pin dependency @types/pnpapi to 0.0.1 ([#156](#156)) ([581714b](581714b))
* **deps:** update all non-major dependencies ([#151](#151)) ([f5b10f6](f5b10f6))
* **deps:** update dependency eslint-plugin-unicorn to v26 ([#152](#152)) ([f801087](f801087))
@folke
Copy link
Owner

folke commented Jan 11, 2021

🎉 This PR is included in version 3.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@folke folke added the released label Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants