Comments (6)
Works perfectly. Thanks!
from yarnhook.
Hi, thanks for reporting the issue!
I'm sorry to see you are having this issue. I've been meaning to do a major refactor for a long time, but I never got around to do it. I have a branch where I was experimenting and wrote some end-to-end tests to ensure correct behavior. (There are no tests in the main branch, unfortunately.)
If you have a quick fix in mind, it'd be more than welcome. My eventual goal is to do away with package manager detection and rely on the engines
field of package.json
. The documentation states that it's the right place to put your package manager (and version) in there.
Sorry for the brain dump, I really want to get back to maintaining and improving this package. But I want to fix your problem first without getting too much into what I ideally want. What do you think would be the least invasive way to support pnpm v7?
from yarnhook.
Thanks for the quick reply.
I think there are two quick ways around this. One is to use pnpm -v
to detect pnpm version once a pnpm-lock.yml
file is detected, but this will add overhead.
The second option is to allow passing the commandline flags to the package manager, configure the package manager to use, or both:
yarnhook --package-manager pnpm --package-manager-version 7.0.2 -- --some-pass-through-flag
Re the future, the engines
field can be used to constrain usage to a version range, e.g., >=3.1.0
, and therefore might not be very helpful in discerning the correct version.
Fortunately, newer versions of node add the packageManager
field, which should be perfect for this use case since its purpose is basically to tell node itself exactly that - what package manager to use and in which version.
The only issue is that it's not very commonly use yet (or even known), so the docs would have to make clear that it is required.
from yarnhook.
Thanks for listing the viable options. I guess I'll go with offering more control to the user. As you mentioned, the other option would make it slightly slower, when it should be unnoticeably fast.
As for the package manager detection, I wasn't aware of packageManager
field or Corepack. This is really interesting, but it seems to be experimental at this point, so basing the API around it might not be a good choice. Interestingly the design document contradicts the readme about the field to check. And it's not clear that <package manager name>@<version>
notation allows for semver or not.
Honestly I'm not trying to debunk the packageManager
field, I'm open to it and excited about Corepack development. But engines
field seems more stable at this time and I would expect the users of yarnhook
to be mindful of providing a sane version range that would not have backwards incompatibility issues.
from yarnhook.
When I checked the pnpm release notes again, I noticed that pnpm-lock.yaml
and prefer-frozen-lockfile
were introduced at the same time, so I wonder why we kept the old config flag at all. I guess there's no point in dwelling in that so I'll just change the config without any invasive refactoring.
from yarnhook.
Cut a new release, can you give it a try? The version is [email protected]
.
from yarnhook.
Related Issues (20)
- Switching from a branch where yarnhook is installed to one where it isn't results in detached head HOT 1
- Support monorepos HOT 7
- Support just messaging, no install HOT 1
- Rename project (lockfilehook?) HOT 7
- Handle shrinkwrap
- Use `npm ci` instead of `npm i` if it's supported HOT 1
- Adoption
- Use yarn install with --prefer-offline and --pure-lockfile ? HOT 4
- Switching from a branch and yarnhook fails result in detached head
- Support appending additional arguments HOT 5
- Support sourcing environment variables from `.env` files HOT 1
- Handle other languages package managers HOT 5
- git error when running yarnhook HOT 1
- Create mrm task
- yarnhook: command not found error HOT 4
- Consider dropping execa HOT 2
- Yarn 2 (berry) support HOT 13
- Consider using `preferred-pm` HOT 1
- Add `bun` support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yarnhook.