mongoose-tsgen icon indicating copy to clipboard operation
mongoose-tsgen copied to clipboard

feat: expose generateDefinitions method as api

Open 10kc-emilyk opened this issue 2 years ago • 3 comments

I would like to use mongoose-tsgen from within another script, and so, I'd like to expose a method that performs the same actions the cli would. I called the method generateDefinitions, although we can bikeshed on the name.

Also, if this change is desired, I can update the readme to document this feature.

I've also added some complex typings to infer the parameters type from the oclif configuration, and I think I could upstream that (although, we would need to upgrade to the latest oclif, as it looks like they've deprecated the package youre using).

10kc-emilyk avatar Sep 23 '22 00:09 10kc-emilyk

Hey @10kc-emilyk, thanks for the submission! Looks good to me, I like the method name generateDefinitions.

Also, if this change is desired, I can update the readme to document this feature.

Would be great, thanks!

I've also added some complex typings to infer the parameters type from the oclif configuration, and I think I could upstream that (although, we would need to upgrade to the latest oclif, as it looks like they've deprecated the package youre using).

Do you mean that the typings you added are exported directly from oclif in newer versions? Any breaking changes we'd need to handle to upgrade oclif?

francescov1 avatar Sep 23 '22 15:09 francescov1

Do you mean that the typings you added are exported directly from oclif in newer versions? Any breaking changes we'd need to handle to upgrade oclif?

No, oclif's newer versions also don't have the typings I've added, they have the same typings as the version we're currently depending on. If/when I submit those typings to oclif, they would only land in the newest version; that's what I'm trying to say.

forivall avatar Sep 23 '22 15:09 forivall

Ahh got it. Okay sounds good, if they make it in then I'd be happy to upgrade oclif here.

francescov1 avatar Sep 23 '22 15:09 francescov1

Ok, finally got back to this: oclif's latest version does have the types i needed, so i've gone ahead and made the upgrade (see also: https://github.com/francescov1/mongoose-tsgen/pull/112 , if you want it in a separate PR )

forivall avatar Feb 13 '23 19:02 forivall

Hey @forivall thanks for the submission, apologies for the delay I've been on vacation. Will take a look at this sometime this week.

francescov1 avatar Feb 20 '23 17:02 francescov1

@forivall Lets merge in #112 first and then these changes separately. I added a few questions on #112.

francescov1 avatar Feb 21 '23 22:02 francescov1

Now that #112 is merged, do you mind rebasing here now so that this PR doesnt contain the same changes?

francescov1 avatar Feb 25 '23 23:02 francescov1

@francescov1 done, also updated the readme.

forivall avatar Feb 28 '23 19:02 forivall

Thanks for the great work @forivall !

francescov1 avatar Mar 02 '23 01:03 francescov1