Skip to content
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

feat(cli): add option to list every dependency usage without deduping the version #162

Closed
audunolsen opened this issue Sep 22, 2023 · 3 comments

Comments

@audunolsen
Copy link

audunolsen commented Sep 22, 2023

Description

An option to list all dependencies that are listed in two or more workspace packages, regardless of the version mismatch state.
Running syncpack list-mismatches shows all mismatched versions which is great. these can all be autofixed. Syncpack does not however aid you in knowing all packages which are prone to mismatching. When authoring syncpack config it is difficult to know what packages to include in the versionGroups field. You may have dependencies used in multiple workspace packages that already have matched versions, these should be included in the syncpack config as they are prone to mismatching, but they are hard to identify through manually scanning multiple package.json files.

Suggested Solution

A CLI option to show either

  1. All repeated dependencies regardless of mismatch state (easiest to implement)
  2. All repeated dependencies currently not covered in config's versionGroups field. (most helpful but more complex implementation)

CLI commands could look something like
$ syncpack list --repeated (all repeated packages)
$ syncpack list --repeated --uncovered (not covered by config)


(Syncpack is amazing 🔥)

@JamieMason
Copy link
Owner

Thanks @audunolsen,
I see what you mean – if you run syncpack list and you use concurrently in 4 packages, but they all have the same version, all you will see in the output is:

- concurrently ^8.0.1

Even something like this might be an easy addition

- concurrently ^8.0.1 (used 4 times)

But people might not want that by default. I would quite like some way to let people choose different output formats, or even offer a way for people to install and use custom 3rd party plugins, but that's a little way off yet.

@JamieMason JamieMason changed the title CLI option to list all repeated packages regardless of the version mismatch state feat(cli): add option to list every dependency usage without deduping the version Sep 22, 2023
@JamieMason
Copy link
Owner

JamieMason commented Sep 25, 2023

So far I've decided to change the default output of syncpack list. The next release is going to take a while, but it'll be something like the below.

This is from my local build:

Thanks for the idea @audunolsen, I think this is much better.

JamieMason added a commit that referenced this issue Nov 5, 2023
This is the biggest syncpack release to date and has taken a couple of months to complete. There will be other improvements and bug fixes which I've lost track of along the way and are not listed here. The tests have been rewritten to be easier to maintain and bugs were found along the way there.

Given the scale of the changes, this is an alpha release. Please give it a try in a local branch and [submit an issue](https://github.com/JamieMason/syncpack/issues/new/choose) if you find any problems.

There is also a brand new [Getting Started](https://jamiemason.github.io/syncpack/guide/getting-started) guide which I encourage you to read.

Finally, if anyone reading this finds syncpack useful, please tell people about it – it's completely free and has been a ton of work.

Please help spread the word ❤️ Thanks!

## Bug Fixes

- **npm:** update dependencies

## Features

- **cli:** display an error code/reason for every kind of mismatch
- **cli:** output a count of ignored instances
- **docs:** huge [documentation](https://jamiemason.github.io/syncpack/guide/getting-started) overhaul
- **groups:** add support for `$LOCAL` keyword in config, Closes #161
- **groups:** allow `dependencies: ["**"]` and `packages: ["**"]` to be omitted
- **list:** add usage count next to each dependency in `syncpack list`, Closes #162
- **options:** add support for `--indent ‘\t’`
- **update:** group and filter npm updates by major, minor, patch etc
- **update:** show more information while querying npm for updates
- **versions:** add support for `workspace:~` and `workspace:*`
- **versions:** preserve semver group rules when fixing mismatches, Closes #157
- **versions:** support `npm:foo@0.1.0`
- **versions:** support semver boundaries `>=1.0.0 <=3.0.0`
- **versions:** support semver git tags `git://github.com/user/project.git#0.3.0`
- **versions:** support semver tags `4.0.0-alpha.61`

## Breaking Changes

1. `semverRange` has been deprecated in config files, if you'd like to define a global policy for semver ranges you can achieve this with a semver group.

   ```diff
   {
   -  "semverRange": "^",
   +  "semverGroups": [{ "range": "^" }]
   }
   ```

1. There is no longer a default Semver Group. By default, version mismatches will be fixed while leaving the semver ranges as they were. This is intended to make it easier for new users to onboard, but it is recommended that you define Semver Groups yourself which match your project's requirements.

   See the [Getting Started](https://jamiemason.github.io/syncpack/guide/getting-started) guide for a walkthrough on this.
@JamieMason
Copy link
Owner

Released in 12.0.0-alpha.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants