Closed abelmokadem closed 2 years ago
Could you share your project structure and configuration so we can debug it? Thanks
@JamieMason I think the version groups are not working for me at all. I'm using a lerna project and this is my configuration in my package.json:
...
"syncpack": {
"versionGroups": [
{
"packages": [
"aws-cdk",
"@aws-cdk/core",
"@aws-cdk/aws-ssm",
"@aws-cdk/aws-s3",
"@aws-cdk/assert"
],
"dependencies": [
"@account-setup-stacks/cdk-toolkit-stack",
"@account-setup-stacks/parameters-stack"
]
}
]
}
This is my directory structure:
account-setup-stacks
├── lerna.json
├── package-lock.json
├── package.json
├── packages
| ├── cdk-toolkit-stack
| └── parameters-stack
└── scripts
└── npm
cdk-toolkit-stack dependencies
"dependencies": {
"@aws-cdk/core": "1.64.1",
"@aws-cdk/aws-s3": "1.64.0",
"source-map-support": "^0.5.16"
},
"devDependencies": {
"@aws-cdk/assert": "1.64.1",
"@types/jest": "^26.0.10",
"@types/node": "10.17.27",
"aws-cdk": "1.64.1",
"jest": "^26.4.2",
"ts-jest": "^26.2.0",
"ts-node": "^8.1.0",
"typescript": "~3.9.7"
},
parameters-stack dependencies
"dependencies": {
"@aws-cdk/core": "1.64.1",
"@aws-cdk/aws-ssm": "1.64.0",
"source-map-support": "^0.5.16"
},
"devDependencies": {
"@aws-cdk/assert": "1.64.1",
"@types/jest": "^26.0.10",
"@types/node": "10.17.27",
"aws-cdk": "1.64.1",
"jest": "^26.4.2",
"ts-jest": "^26.2.0",
"ts-node": "^8.1.0",
"typescript": "~3.9.7"
},
Which version of syncpack please?
"syncpack": {
"version": "5.6.10",
"resolved": "https://registry.npmjs.org/syncpack/-/syncpack-5.6.10.tgz",
What are the contents of lerna.json
{
"packages": [
"packages/*"
],
"version": "0.0.0"
}
Thanks, and what output are you expecting to see? And what do you see instead?
I have a version mismatch between these 2 packages in the cdk toolkit stack:
"@aws-cdk/core": "1.64.1",
"@aws-cdk/aws-s3": "1.64.0",
But also in the parameters stack:
"@aws-cdk/core": "1.64.1",
"@aws-cdk/aws-ssm": "1.64.0",
I'm expecting the package to complain about this version mismatch.
thanks, what's the output of syncpack list
?
Btw, I tried swapping packages and dependencies field. No luck.
$ npx syncpack list
- @aws-cdk/assert 1.64.1
- @aws-cdk/aws-s3 1.64.0
- @aws-cdk/aws-ssm 1.64.0
- @aws-cdk/core 1.64.1
- @types/jest ^26.0.10
- @types/node 10.17.27
- aws-cdk 1.64.1
- jest ^26.4.2
- lerna ^3.22.1
- source-map-support ^0.5.16
- syncpack ^5.6.10
- ts-jest ^26.2.0
- ts-node ^8.1.0
- typescript ~3.9.7
Correct me if I'm wrong but I think you're expecting behaviour which isn't quite what this tool is designed for, let me know. Are you expecting that these two separate packages "@aws-cdk/core": "1.64.1",
and "@aws-cdk/aws-s3": "1.64.0",
should have the same versions as each other?
I'll review and improve the docs if so, but the goal is only to ensure that multiple packages requiring the same dependency define the same version, so that every package requires eg.
react@16.4.2
, instead of a combination of react@16.4.2
, react@0.15.9
, and react@16.0.0
.
The situation you describe is valid, you do get families of packages which are all versioned in sync with one another, but it's not something syncpack handles at the moment. It's an interesting use case though which I'll think over to see how much effort it would be to account for.
Sorry for the confusion.
Aha, that explains! Yes that's exactly what I was expecting. It would really be a nice feature to have when using dependencies like AWS CDK. AWS CDK only works if all the AWS CDK dependencies are on the same version.
This should now be possible in 6.1.0, thanks for contributing.
@JamieMason Sorry to necro, but is there a way to sync back this update to the syncpackrc? We would like to be able to periodically npm up
these dependencies, but it's a bit irritating to have to manually copy the version into the syncpackrc file every time.
hey @sgarfinkel, there's nothing in syncpack to do that – user config files vary too much (CommonJS/ESM/TS/JSON)
Description
I would expect version group to match packages in the devDependencies, dependencies and peerDependencies field alltogether.
Suggested Solution
Fix mismatches for packages across dev, peer and prod dependencies.
Help Needed