davidparsson / junit-report-builder

Making it easier to build Jenkins compatible JUnit XML reports
MIT License
21 stars 14 forks source link

Consider adding typescript definitions #24

Open daniel-white opened 3 years ago

daniel-white commented 3 years ago

Your package looks awesome. Would it be possible to add typescript definitions to your package and/or to definitelytyped? Thanks!

davidparsson commented 3 years ago

Hi!

That sounds like a good idea, but I don't currently have the time to provide that. Are there any tools for that may assist in that matter?

Pull requests would be appreciated, if applicable here. The API is rather simple and it is well defined by the tests.

davidparsson commented 2 years ago

I'm glad to let you know that I've now started working on this.

cweatureapps commented 2 years ago

That would be amazing! Our codebase is in TypeScript and this is what is holding us back from adopting this framework. Keep up the great work!

dakoenig commented 1 year ago

I just added type definitions via https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64004. Those should be available via npm soon and can be used while the TS rewrite is in progress.

davidparsson commented 1 year ago

Thanks a million @dakoenig!

My ambition is still to convert this to TypeScript, but I got stuck on a few minor issues, and then my personal life got in the way.

davidparsson commented 5 months ago

I'm not sure if this helps any TypeScript users, but JSDoc type information was added in #61 and released today in 3.2.0.

HarelM commented 2 months ago

In general, the easiest solution would be to take the file from definitely typed, add it to this repo and update the package json to have it in the npm package and publish a new release. I can open a PR to do it if needed.

A more complex way would be to convert the code written here from javascript to typescript (it shouldn't take more than an hour I believe looking at the amount of code in this repo) and generate the typings at build time using rollup with typescript and dts or in any other way. I did it for a package that I maintain, it's not a lot of work: https://github.com/maplibre/maplibre-gl-inspect/pull/10

davidparsson commented 2 months ago

@HarelM, I started writing this:

I'd gladly accept a pull request with that. Are there any tools that can help making a best effort guess of whether the types match or not?

But I still have the ambition to convert this to TypeScript at some point, and hopefully sooner than later, although I'm not sure if it's tomorrow or in two years. I guess it boils down to how eager you are to get this. Any improvement is welcome!

HarelM commented 2 months ago

I can help with the conversion to typescript if this is the direction you are aiming for. Is rollup an option too to do the bundling and typescript definition generation from your perspective?

davidparsson commented 2 months ago

Awesome! That would be very much appreciated!

It has been a few years since i shifted my primary professional focus away from JavaScript/TypeScript, so I'm no longer keeping track of the best practices and which tools to use. That said, Rollup seems like a perfectly fine alternative for this.

It might also be worth mentioning that I've been wanting to transition away from using Grunt in favor of plain npm scripts, and possibly from Jasmine to Jest (or something else) for tests, so there is no need to keep any of them if they are in the way of this transition. Finally, I would like to keep the backwards compatibility if it's possible with a reasonable effort. If I recall correctly, I had some problems with that and the exported variable instance in src/index.js.

HarelM commented 2 months ago

I've created a PR with most of the above required changes (jest, typescript, etc). I didn't end up using rollup as I simply did a one-to-one typescript to javascript conversion, which seems to work as expected, I think, so I kept things as simple as I could. PR is here:

Let me know if there's anything I can help with.

I also added the ability to report coverage, so feel free to use that with codecov and any other service you'd like. I think the coverage is good, but I haven't dug into it, just made sure the tests pass basically.