Comments (5)
I don't think this was a good idea. If someone wants to influence how the package manager is behaving itself, they can just create a config file for that package manager with settings. So if I want to skip optional dependencies, I would create a .npmrc
with this content:
optional=false
Now because the CLI flags have the biggest priority, there is no way to include optional dependencies. I need optional dependencies to be installed. So now I have to always rerun pnpm install
after switching branches. So yarnhook loses its benefits in my case.
from yarnhook.
I think adding --ignore-optional
(or comparable) to the default set of flags makes sense since they're optional and it'll make git operations faster.
I'm on the fence about adding arguments though, since—despite the name—yarnhook is package manager independent. I'm open to changing my mind but I'll make the --ignore-optional
change regardless.
from yarnhook.
@zkochan 100% agreed. In case of nuxt3, esbuild needs to be installed in the correct platform and is done using optionalDependencies
so everytime yarnhook runs, the nuxt3 project cannot be built until a new yarn install
is run.
from yarnhook.
I came back to this and I believe it was not the right call to exclude optional dependencies by default. While it's important that branch switches to be fast, it's more important that yarnhook doesn't change the end result. It should be a core principle that yarnhook doesn't install different dependencies than when you install them manually with default flags.
I reviewed the current default flags and this seems like the only offending one. If we categorize them:
- Preferring offline is fine, having internet connection shouldn't change behavior anyway
- Pure/frozen lockfile is good actually, it should be the default (and it is in many cases)
- No audit (npm only) is also good, it doesn't change the end result
- No save (also npm only) is also good, switching branches shouldn't change files (not sure if
npm install
does it, need to check)
So the first thing I'll do is to remove --no-optional
, adding a way to configure it may come later. Not sure if it'll be needed as @zkochan demonstrated. I had a major refactor in a branch, I can probably add providing the option to that scope.
from yarnhook.
I cut a new release, it's a major one due to the reasons mentioned in the release page. I hope this solves existing problems and please let me know if it breaks anything.
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 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
- pnpm v7 support HOT 6
- 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.