[Bug?]: yarn constraints doesn't show errors for all my workspaces
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
I have example project with several workspaces: pack_one, pack_two and pack_three.
I added constraints.pro but not for all dependencies in my workspaces for see errors after yarn constraints:
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, null, dependencies) :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, _, dependencies),
DependencyIdent = '@apollo/react-common',
DependencyIdent = '@apollo/react-components',
...
Runningyarn constraints for my project and see only one error for main package.json:
$ yarn constraints
➤ YN0025: my-monorepo has an extraneous dependency on concurrently (in dependencies)
➤ YN0000: Failed with errors in 0s 36ms
To reproduce
I have public repo with this problem and can clone and run yarn constraints
Or
Main package.json:
{
"private": true,
"name": "my-monorepo",
"workspaces": [
"workspaces/*"
],
"scripts": {},
"dependencies": {
"concurrently": "^6.2.0"
},
"packageManager": "yarn@2.4.2"
}
First workspace package.json:
{
"name": "pack_one",
"version": "0.1.0",
"private": true,
"dependencies": {
"@apollo/react-common": "3.1.4",
"@apollo/react-components": "3.1.5",
"@apollo/react-hooks": "3.1.5",
"@devexpress/dx-react-core": "2.6.1",
"@devexpress/dx-react-grid": "2.6.1",
"@devexpress/dx-react-grid-material-ui": "2.6.1",
"@formatjs/intl-pluralrules": "2.2.6",
"@hookform/resolvers": "1.0.0",
"@loadable/component": "5.15.0",
"@noriginmedia/react-spatial-navigation": "2.12.5",
"@paralleldrive/feature-toggles": "1.0.4",
"@paralleldrive/react-feature-toggles": "2.3.1",
"@tippy.js/react": "2.2.3",
"@vx/group": "0.0.197",
"@vx/point": "0.0.197",
"@vx/responsive": "0.0.197",
"@vx/scale": "0.0.197",
"@vx/shape": "0.0.197",
"@vx/vx": "0.0.197",
"apollo-cache": "1.3.4",
"apollo-cache-inmemory": "1.6.5",
"apollo-client": "2.6.8",
"apollo-link": "1.2.14",
"apollo-link-context": "1.0.19",
"apollo-link-error": "1.1.12",
"apollo-link-http": "1.5.16",
"apollo-link-http-common": "0.2.16",
"array-move": "2.1.0",
"axios": "0.19.0",
"bowser": "2.9.0",
"chart.js": "2.8.0",
"ckeditor4-react": "1.1.1",
"copy-to-clipboard": "3.3.1",
"cryptr": "4.0.2",
"css-tree": "1.0.0-alpha.39",
"d3": "5.16.0",
"dayjs": "1.8.31",
"file-saver": "2.0.2",
"graphql": "14.5.8",
"history": "^4.10.1",
"html2canvas": "1.0.0-rc.1",
"immer": "^5.1.0",
"intersection-observer": "0.7.0",
"js-beautify": "1.10.0",
"jszip": "3.2.2",
"katex": "0.11.1",
"load-script": "1.0.0",
"lodash": "^4.17.15",
"phaser": "3.22.0",
"phaser3-rex-plugins": "1.1.11",
"prismjs": "1.17.1",
"pure-react-carousel": "1.25.2",
"qrcode": "1.4.1",
"qs": "6.9.4",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Second workspace package.json:
{
"name": "pack_three",
"version": "0.1.0",
"private": true,
"dependencies": {
"@apollo/react-common21212": "3.1.4",
"@apollo/react-components": "3.1.5",
"@apollo/react-hooks": "3.1.5",
"@devexpress/dx-react-core": "2.6.1",
"@devexpress/dx-react-grid": "2.6.1",
"@devexpress/dx-react-grid-material-ui": "2.6.1",
"@hookform/resolvers": "1.0.0",
"@loadable/component": "5.15.0",
"@paralleldrive/feature-toggles": "1.0.4",
"@paralleldrive/react-feature-toggles": "2.3.1",
"@visx/axis": "^1.7.0",
"@visx/event": "^1.7.0",
"@visx/grid": "^1.7.0",
"@visx/group": "^1.7.0",
"@visx/scale": "^1.7.0",
"@visx/shape": "^1.7.0",
"@visx/tooltip": "^1.7.2",
"apollo-cache": "1.3.4",
"apollo-cache-inmemory": "1.6.5",
"apollo-client": "2.6.8",
"apollo-link": "1.2.14",
"apollo-link-context": "1.0.19",
"apollo-link-error": "1.1.12",
"apollo-link-http": "1.5.16",
"apollo-link-http-common": "0.2.16",
"apollo-link-ws": "1.0.20",
"apollo-utilities": "1.3.4",
"array-move": "2.1.0",
"axios": "0.19.0",
"bowser": "2.9.0",
"chart.js": "2.8.0",
"ckeditor4-react": "1.1.1",
"copy-to-clipboard": "3.3.1",
"cryptr": "4.0.2",
"css-tree": "1.0.0-alpha.39",
"dayjs": "1.8.31",
"file-saver": "2.0.2",
"graphql": "14.5.8",
"highlight.js": "^9.18.1",
"history1212": "^4.10.1",
"html2canvas": "1.0.0-rc.1",
"immer": "^5.1.0",
"intersection-observer": "0.7.0",
"js-beautify": "1.10.0",
"jszip": "3.2.2",
"katex": "0.11.1",
"lodash": "^4.17.15",
"phaser": "3.22.0",
"phaser3-rex-plugins": "1.1.11",
"prismjs": "1.17.1",
"qrcode": "1.4.1",
"qs": "6.9.4",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Next workspace package.json:
{
"name": "pack_two",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Added constrains.pro:
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, null, dependencies) :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, _, dependencies),
DependencyIdent \= '@apollo/react-common',
DependencyIdent \= '@apollo/react-components',
DependencyIdent \= '@apollo/react-hooks',
DependencyIdent \= '@devexpress/dx-react-core',
DependencyIdent \= '@devexpress/dx-react-grid',
DependencyIdent \= '@devexpress/dx-react-grid-material-ui',
DependencyIdent \= '@formatjs/intl-pluralrules',
DependencyIdent \= '@hookform/resolvers',
DependencyIdent \= '@loadable/component',
DependencyIdent \= '@noriginmedia/react-spatial-navigation',
DependencyIdent \= '@paralleldrive/feature-toggles',
DependencyIdent \= '@paralleldrive/react-feature-toggles',
DependencyIdent \= 'jsonfile',
DependencyIdent \= '@tippy.js/react',
DependencyIdent \= '@vx/group',
DependencyIdent \= '@vx/point',
DependencyIdent \= '@vx/responsive',
DependencyIdent \= '@vx/scale',
DependencyIdent \= '@vx/shape',
DependencyIdent \= '@vx/vx',
DependencyIdent \= 'apollo-cache',
DependencyIdent \= 'apollo-cache-inmemory',
DependencyIdent \= 'apollo-client',
DependencyIdent \= 'apollo-link',
DependencyIdent \= 'apollo-link-context',
DependencyIdent \= 'apollo-link-error',
DependencyIdent \= 'apollo-link-http',
DependencyIdent \= 'apollo-link-http-common',
DependencyIdent \= 'array-move',
DependencyIdent \= 'axios',
DependencyIdent \= 'bowser',
DependencyIdent \= 'chart.js',
DependencyIdent \= 'ckeditor4-react',
DependencyIdent \= 'copy-to-clipboard',
DependencyIdent \= 'cryptr',
DependencyIdent \= 'css-tree',
DependencyIdent \= 'd3',
DependencyIdent \= 'dayjs',
DependencyIdent \= 'file-saver',
DependencyIdent \= 'graphql',
DependencyIdent \= 'history',
DependencyIdent \= 'html2canvas',
DependencyIdent \= 'immer',
DependencyIdent \= 'intersection-observer',
DependencyIdent \= 'js-beautify',
DependencyIdent \= 'jszip',
DependencyIdent \= 'katex',
DependencyIdent \= 'load-script',
DependencyIdent \= 'lodash',
DependencyIdent \= 'phaser',
DependencyIdent \= 'phaser3-rex-plugins',
DependencyIdent \= 'qrcode',
DependencyIdent \= 'qs',
DependencyIdent \= 'rrule',
DependencyIdent \= 'sanitize-html',
DependencyIdent \= 'showdown',
DependencyIdent \= 'showdown-highlight',
DependencyIdent \= 'showdown-katex',
DependencyIdent \= 'simple-encryptor',
DependencyIdent \= 'slick-carousel',
DependencyIdent \= 'smoothscroll-polyfill',
DependencyIdent \= 'styled-components',
DependencyIdent \= 'styled-css-grid',
DependencyIdent \= 'styled-normalize',
DependencyIdent \= 'survey-creator',
DependencyIdent \= 'survey-knockout',
DependencyIdent \= 'surveyjs-widgets',
DependencyIdent \= 'ts-optchain',
DependencyIdent \= 'uuid',
DependencyIdent \= 'validator',
DependencyIdent \= 'xlsx',
DependencyIdent \= 'codemirror',
DependencyIdent \= 'highlight.js',
DependencyIdent \= 'react-codemirror2',
DependencyIdent \= 'swiper',
DependencyIdent \= 'lodash.debounce',
DependencyIdent \= 'axios-mock-adapter',
DependencyIdent \= 'd3-shape',
DependencyIdent \= 'diff-match-patch',
DependencyIdent \= 'ace-builds',
DependencyIdent \= 'easymde',
DependencyIdent \= 'github-markdown-css',
DependencyIdent \= 'react-virtualized-auto-sizer',
DependencyIdent \= 'react-window',
DependencyIdent \= 'react-detect-offline',
DependencyIdent \= 'react-ace',
DependencyIdent \= 'react-simplemde-editor',
DependencyIdent \= 'react-syntax-highlighter',
DependencyIdent \= 'react-dropzone',
DependencyIdent \= 'remark-autolink-headings',
DependencyIdent \= 'remark-gfm',
DependencyIdent \= 'remark-heading-id',
DependencyIdent \= 'remark-slug',
DependencyIdent \= 'konva',
DependencyIdent \= '@formatjs/cli',
DependencyIdent \= 'form-data',
DependencyIdent \= 'node-fetch',
DependencyIdent \= 'ts-node',
DependencyIdent \= 'typescript',
DependencyIdent \= 'yargs',
DependencyIdent \= 'ts-jest',
DependencyIdent \= '@apollo/react-testing',
DependencyIdent \= 'react-draggable',
DependencyIdent \= 'qrcode.react',
DependencyIdent \= 'yup'.
Environment
System: Windows 10
Binaries:
Node: 15.12.0
Yarn: 2.4.2
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Clone the linked my-monorepo reproduction and run yarn constraints with the shown constraints.pro and workspace package.json files. Trace how the constraints command evaluates each workspace; done means it reports the relevant constraint errors from all affected workspaces rather than only the root package.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100