pubspec_parse icon indicating copy to clipboard operation
pubspec_parse copied to clipboard

Can toJson() functionality be included as well?

Open thosakwe opened this issue 7 years ago • 6 comments

It's fantastic to have an official package on Pub for parsing and extracting data from a pubspec.

There is, however, one thing, I'm wondering - would it be bad for createToJson to be true for the models contained in this package?

I'm working on updating the Angel CLI, which uses the old package:pubspec to persist changes to the project files (namely, adding dependencies the user is missing), to pubspec_parse, and if there were some way to just get a toJson method on the PubSpec.

I'll gladly send a PR, but is there is a specific reason this functionality isn't present already? I imagine there's probably a reason I didn't think about.

thosakwe avatar Jul 14 '18 21:07 thosakwe

Hey @thosakwe

I think I avoided toJson because the pubspec is yaml – and the json output wouldn't necessarily round-trip the shape of the source.

There is quite a bit of special handling of dependencies, for instance.

If you want to take a shot, I'd accept a PR, though!

kevmoo avatar Jul 21 '18 04:07 kevmoo

@kevmoo could I work on this issue?

AliAkberAakash avatar Feb 05 '23 16:02 AliAkberAakash

@kevmoo could I work on this issue?

Sure! Just make sure you put in plenty of tests. I want to see that at round trips cleanly, etc.

kevmoo avatar Feb 05 '23 19:02 kevmoo

Is this being worked on? (cc: @AliAkberAakash , @kevmoo )

alestiago avatar Feb 16 '24 10:02 alestiago

Hey @alestiago I completely forgot about this, No it's not being worked on from my side. If you want we can work on this together.

AliAkberAakash avatar Feb 16 '24 11:02 AliAkberAakash

@AliAkberAakash I don't have the bandwidth right now to work on this feature. If I ever have some spare I'll let you know. If you're no longer working on this I recommend asking to get unassigned.

alestiago avatar Jul 09 '24 09:07 alestiago