-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
yarn workspaces: packages found in node_modules are not excluded when using list/fix-mismatches #68
Comments
I ran into the same issue with packages:
- 'apps/**' As a workaround, you can create a For const fs = require('fs')
const glob = require('glob')
const yaml = require('yaml')
let source = ['package.json'] // Include the root package.json
const pnpmWorkspaceFile = fs.readFileSync('pnpm-workspace.yaml', 'utf8')
const workspaces = yaml.parse(pnpmWorkspaceFile)
workspaces.packages.map((workspacePackage) => {
source = source.concat(
glob.sync(`${workspacePackage}/package.json`, {
ignore: `**/node_modules/**`,
})
)
})
module.exports = {
source,
} And similar for const glob = require('glob')
let source = ['package.json'] // Include the root package.json
const packageJson = require('./package.json')
const workspaces = packageJson.workspaces
workspaces.map((workspacePackage) => {
source = source.concat(
glob.sync(`${workspacePackage}/package.json`, {
ignore: `**/node_modules/**`,
})
)
})
module.exports = {
source,
} However, it would be much nicer if |
Thanks @ohana54 and @tom-fletcher – happy to do this but something I want to check, do you have packages you develop which are nested within other packages you develop? So rather than
You potentially have something like this?
|
It is pattern I do use @JamieMason, although the structure tends to look more like this:
Edit to add: So, |
@JamieMason I've seen cases with nesting in my company (app2/packages/app3) although it wasn't in the repo that caused me to open this issue. |
@ohana54 - yes, the nesting As Syncpack is just globbing |
@JamieMason Wondering if it might be possible to merge and release #70? It would be nice to remove the workaround (and associated dependencies) from my monorepo root. Cheers! |
Released in 6.2.1, thanks a lot @tom-fletcher |
Thank you @JamieMason - and thanks for this package, it is great for enforcing a single version policy. 👏 Upgraded to 6.2.1 and verified working. 🎉 🎉 |
Description
Hi,
We're using Yarn Workspaces with the glob pattern
packages/**
, since we have a deep package tree.Some of the packages have their own node_modules folder with packages inside.
Yarn is ok with it and automatically doesn't search for packages in node_modules.
However,
syncpack
has its own resolving mechanism and does include packages from node_modules.Suggested Solution
Automatically exclude node_modules when searching for packages.
Is there a way maybe for a user to exclude it via config? I couldn't find one.
Thanks!!
The text was updated successfully, but these errors were encountered: