How to only check packages listed in versionGroups -- or how to have versionGroups match packages beyond the syncpackrc filter property?
See original GitHub issueDescription
Right now if you specify version groups with specific packages and/or with package patterns (with wildcards), syncpack still checks all packages unless you list each package again in the filter
property of syncpackrc. Eventually, if you want to only match packages in version groups, the filter regex gets fairly unwieldy.
If there were a way to only check packages included in version groups, it would be easier to gradually onboard to syncpack.
Suggested Solution
Would it be possible to have a mode that only matches through version groups, not the filter property? Maybe by setting the filter to the empty string or false?
Another way to look at it would be that versionGroup packages wouldn’t be filtered.
Help Needed
Issue Analytics
- State:
- Created a year ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
JamieMason/syncpack - GitHub
List dependencies which are required by multiple packages, where the version is not the same across every package. See versionGroups if you have...
Read more >How do I find all installed packages that depend on a given ...
I can update my package.json, but I don't want to break something. Is there a way to list all of the installed packages...
Read more >error unexpected while resolving tree within virtual file system ...
See versionGroups if you have advanced requirements. Options -s, --source [pattern] glob pattern for package.json files to read from -p, --prod include ...
Read more >syncpack/README.md - UNPKG
3, > Manage multiple package.json files, such as in Lerna Monorepos and Yarn/Pnpm Workspaces ... 62, # only inspect "devDependencies" and "peerDependencies".
Read more >How to Easily Manage Dependencies in a JS Monorepo
Not far behind it in 2nd place, comes code… ... There is just one set of dependencies that every package in the monorepo...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @dsilvasc, I just took a look at the repro. As I think you might have mentioned:
filter
applies globally, when it is set then only packages whose names match that RegEx will be included.I just want to check before I do it, would something like this work for you?
What this would do is create a catch-all version group which ignores every package which does not match any of the preceding groups.
Thanks.
Thanks @dsilvasc, could you make a small repro to demonstrate this please? I’ll need to see the scenario you’re facing so I can dig into it.
Dependencies are assigned to versionGroups in https://github.com/JamieMason/syncpack/blob/c6db8786f9a117eb9d1d334edc7dfa70b036eeaf/src/lib/get-input/get-instances.ts#L34
In theory it shouldn’t be possible for a given dependency to belong to more than one versionGroup because they’re looped over once and each dependency is partitioned into the first group it matches. If version groups aren’t being used or a dependency matches none of them, it goes into a final catch-all group.
Maybe something else is going on, we will see, if you can create a reproduction please with expected vs actual behaviour, I’ll hopefully be able to figure it out using that.