syncpack icon indicating copy to clipboard operation
syncpack copied to clipboard

syncpack list: support --json

Open idan-at opened this issue 3 years ago • 2 comments

Hey,

What do you think about support a json format instead of what the list method has at the moment?

It can be useful for automatic tools to run the script and collect the result much easily. I saw there's also this, which suggests a node API, which is great too :)

WDYT? I'd be willing to contribute if you find this useful.

Thanks

idan-at avatar Mar 02 '22 14:03 idan-at

hey @idan-at, I like the idea of a Node API. The --json output I'm broadly open to but, like I asked in that linked issue, I'm not sure what the concrete use cases out there are for it and I don't want to maintain it if barely anyone uses it.

The problem with #48 (EDIT: and --json actually, they'll both depend on this) is that it'll need quite a bit of refactoring before it can be made available. The core modules are tightly coupled to writing to the terminal, so that will need to change, they will need to return data instead for both a Node API to use, and some other wrapper which writes to the terminal (to continue the current functionality).

Grateful for the offer of help. Feel free to take a look but I feel like this could be a huge job. I do plan to get this done but I'm working on another of my projects at the moment.

JamieMason avatar Mar 18 '22 09:03 JamieMason

about the --json use case: I had a script wrapping syncpack, and I wanted to extract the output of list-mismatches programmatically. TBH, I've removed the wrapper and now I work with syncpack directly.

But indeed, I find the NodeAPI a great fit. It might be useful in cases where the setup of the repository isn't standard, or where there are proprietary solutions

npm-check-updates has a great node api which we used on a previous project, which syncpack can take inspiration from

idan-at avatar Mar 20 '22 11:03 idan-at

Hi there, we're building something around Syncpack for internal use, and could also make use of a JS API.

A --json flag could work for us too, but a JS API would be much simpler to work with.

mrmckeb avatar Dec 07 '22 06:12 mrmckeb

Going to close this one in favour of #48, please follow #48 for updates if interested – thanks.

/cc @codybrouwers (gave a 👍🏻 to this issue)

JamieMason avatar Feb 03 '23 21:02 JamieMason