-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
fix(ranges): semver group expecting ^
considers eg =9.0.0
valid
#239
Comments
What is the output of There are some things you are doing which I've never seen before: Versions starting with
|
$ SYNCPACK_VERBOSE=true y syncpack list
? cosmiconfig found /Users/frederick/programming/Others/playground/.syncpackrc
? config file found: {"semverGroups":[{"range":"^"}]}
? 3 package.json files found
? dependency types provided by user: []
? enabled dependency types determined to be: [{"_tag":"versionsByName","name":"dev","path":"devDependencies"},{"_tag":"name~version","name":"local","path":"version","namePath":"name"},{"_tag":"versionsByName","name":"overrides","path":"overrides"},{"_tag":"versionsByName","name":"peer","path":"peerDependencies"},{"_tag":"versionsByName","name":"pnpmOverrides","path":"pnpm.overrides"},{"_tag":"versionsByName","name":"prod","path":"dependencies"},{"_tag":"versionsByName","name":"resolutions","path":"resolutions"}]
? VersionsByNameStrategy#overrides found nothing at <package.json>.overrides
? VersionsByNameStrategy#peer found nothing at <package.json>.peerDependencies
? VersionsByNameStrategy#pnpmOverrides found nothing at <package.json>.pnpm.overrides
? VersionsByNameStrategy#resolutions found nothing at <package.json>.resolutions
? found 7 instances in <package.json>
? VersionsByNameStrategy#overrides found nothing at <packages/bar/package.json>.overrides
? VersionsByNameStrategy#peer found nothing at <packages/bar/package.json>.peerDependencies
? VersionsByNameStrategy#pnpmOverrides found nothing at <packages/bar/package.json>.pnpm.overrides
? VersionsByNameStrategy#prod found nothing at <packages/bar/package.json>.dependencies
? VersionsByNameStrategy#resolutions found nothing at <packages/bar/package.json>.resolutions
? found 3 instances in <packages/bar/package.json>
? VersionsByNameStrategy#dev found nothing at <packages/foo/package.json>.devDependencies
? VersionsByNameStrategy#overrides found nothing at <packages/foo/package.json>.overrides
? VersionsByNameStrategy#peer found nothing at <packages/foo/package.json>.peerDependencies
? VersionsByNameStrategy#pnpmOverrides found nothing at <packages/foo/package.json>.pnpm.overrides
? VersionsByNameStrategy#prod found nothing at <packages/foo/package.json>.dependencies
? VersionsByNameStrategy#resolutions found nothing at <packages/foo/package.json>.resolutions
? found 1 instances in <packages/foo/package.json>
= Default Version Group ========================================================
1x @jest/globals: =29.7.0
1x @playground/bar: workspace:^
1x @playground/foo: workspace:^
2x eslint: =9.9.0
1x eslint-config-prettier: =9.1.0
2x jest: =29.7.0
1x playground: 0.0.1
1x syncpack: =12.4.0
1x ts-jest: =29.2.4
What next?
- syncpack list-mismatches to see more detail about mismatching versions
- syncpack fix-mismatches to fix version mismatches automatically
- syncpack format to sort and prettify your package.json files
- syncpack update to choose updates from the npm registry
- syncpack --help for everything else
Oh I came from some languages where It's definitely accepted by npm and yarn: https://github.com/npm/node-semver#versions
I actually got this from I just pushed Frederick888/playground@ad46f54 as an example: $ SYNCPACK_VERBOSE=true y syncpack lint
? cosmiconfig found /Users/frederick/programming/Others/playground/.syncpackrc
? config file found: {"semverGroups":[{"range":"^"}],"versionGroups":[{"label":"Use workspace protocol when developing local packages","dependencies":["@playground/*"],"pinVersion":"workspace:^"}]}
? 3 package.json files found
Versions
? dependency types provided by user: []
? enabled dependency types determined to be: [{"_tag":"versionsByName","name":"dev","path":"devDependencies"},{"_tag":"name~version","name":"local","path":"version","namePath":"name"},{"_tag":"versionsByName","name":"overrides","path":"overrides"},{"_tag":"versionsByName","name":"peer","path":"peerDependencies"},{"_tag":"versionsByName","name":"pnpmOverrides","path":"pnpm.overrides"},{"_tag":"versionsByName","name":"prod","path":"dependencies"},{"_tag":"versionsByName","name":"resolutions","path":"resolutions"}]
? VersionsByNameStrategy#overrides found nothing at <package.json>.overrides
? VersionsByNameStrategy#peer found nothing at <package.json>.peerDependencies
? VersionsByNameStrategy#pnpmOverrides found nothing at <package.json>.pnpm.overrides
? VersionsByNameStrategy#resolutions found nothing at <package.json>.resolutions
? found 7 instances in <package.json>
? VersionsByNameStrategy#overrides found nothing at <packages/bar/package.json>.overrides
? VersionsByNameStrategy#peer found nothing at <packages/bar/package.json>.peerDependencies
? VersionsByNameStrategy#pnpmOverrides found nothing at <packages/bar/package.json>.pnpm.overrides
? VersionsByNameStrategy#prod found nothing at <packages/bar/package.json>.dependencies
? VersionsByNameStrategy#resolutions found nothing at <packages/bar/package.json>.resolutions
? found 3 instances in <packages/bar/package.json>
? VersionsByNameStrategy#dev found nothing at <packages/foo/package.json>.devDependencies
? VersionsByNameStrategy#overrides found nothing at <packages/foo/package.json>.overrides
? VersionsByNameStrategy#peer found nothing at <packages/foo/package.json>.peerDependencies
? VersionsByNameStrategy#pnpmOverrides found nothing at <packages/foo/package.json>.pnpm.overrides
? VersionsByNameStrategy#resolutions found nothing at <packages/foo/package.json>.resolutions
? found 2 instances in <packages/foo/package.json>
= Use workspace protocol when developing local packages ========================
✘ @playground/bar 0.0.1 → workspace:^ packages/bar/package.json > version [PinnedMismatch]
✘ @playground/foo 0.0.1 → workspace:^ packages/foo/package.json > version [PinnedMismatch]
1 ✓ already valid
2 ✓ can be auto-fixed
= Default Version Group ========================================================
9 ✓ already valid
Semver Ranges
? dependency types provided by user: []
? enabled dependency types determined to be: [{"_tag":"versionsByName","name":"dev","path":"devDependencies"},{"_tag":"name~version","name":"local","path":"version","namePath":"name"},{"_tag":"versionsByName","name":"overrides","path":"overrides"},{"_tag":"versionsByName","name":"peer","path":"peerDependencies"},{"_tag":"versionsByName","name":"pnpmOverrides","path":"pnpm.overrides"},{"_tag":"versionsByName","name":"prod","path":"dependencies"},{"_tag":"versionsByName","name":"resolutions","path":"resolutions"}]
= the version property of package.json files must always be exact ==============
✓ 3 valid
= Semver Group 2 ===============================================================
✓ 9 valid
Formatting
✓ package.json
✓ packages/bar/package.json
✓ packages/foo/package.json I used |
Thanks a lot, learned a few things there.
|
Yup worked like a charm!
Gotcha :)
Yes without We can probably do something like |
oh nice, well that's a bonus – I'll leave this open though as syncpack shouldn't be considering it as valid when there is a
Agree yeah, there is similar for normalising eg. |
^
doesn't work as expected^
considers eg =9.0.0
valid
Description
Perhaps I simply have some fundamental misunderstanding towards
^
in SemVer groups, but for example,I expect this to enforce leading
^
s on all dependency versions, but I can actually use exact versions?The full example is at https://github.com/Frederick888/playground/tree/syncpack.
Help Needed
I would like to enforce leading
^
on dependency versions. Is this something that can be achieved through SemVer Groups?The text was updated successfully, but these errors were encountered: