timer icon indicating copy to clipboard operation
timer copied to clipboard

Update project to get proper ESM export and tests.

Open ScreamZ opened this issue 1 year ago • 3 comments

[!WARNING] Do not merge until clock is released, as it depends on it and i need to update depencies for 1.1 Ping me when ready.

@endel Had issue with your ESM code, so i rewrote full clock and timer (as they depends on each others.)

They both works in commonJS and ESM.

Added CI checks with github workflows Based on work from totaltypescript.com/how-to-create-an-npm-package

ScreamZ avatar Nov 04 '24 11:11 ScreamZ

Hi @ScreamZ, thank you for the pull-request. I'm afraid ESM support is already working since the package rename here: https://github.com/colyseus/timer/commit/07fb476e00c9c83c4561c72ea04013543ae0fdd4

I think the real issue is that @colyseus/core 0.15 is still requiring the previous @gamestdio/timer instead of @colyseus/timer.

I am hesitant to add so many new dependencies as history has shown keeping up-to-date with a number of different tools only adds burden to maintaining such simple package as @colyseus/timer is (although there are quite a few already!)

endel avatar Nov 07 '24 14:11 endel

Hi @ScreamZ, thank you for the pull-request. I'm afraid ESM support is already working since the package rename here: 07fb476

I think the real issue is that @colyseus/core 0.15 is still requiring the previous @gamestdio/timer instead of @colyseus/timer.

I am hesitant to add so many new dependencies as history has shown keeping up-to-date with a number of different tools only adds burden to maintaining such simple package as @colyseus/timer is (although there are quite a few already!)

The change consists on two changes, first change to clock (https://github.com/colyseus/clock/pull/3) then to timer (this one) It might work in colyseus core, but as I said earlier this year, I'm using timer in my own project, and I can confirm that what's currently exported from colyseus/timer is not Typescript/ESM compliant. I've dropped an example on the https://github.com/colyseus/clock/pull/3

I can understand your fears and respect them. I just wanted to share what I've done. So I'll probably make my own fork on npm as I can't use the library right now 😅

I would be pleased to use more things from colyseus, but I've migrated to a simpler protocol to implement without compilation for my IoT Server Kit. I'm already taking a lot of inspiration of your work, thanks! And I contribute whenever i can ;)

ScreamZ avatar Nov 07 '24 14:11 ScreamZ

So @endel any plan on merging that, or you rather prefer if I publish my own fork of this to support true ESM, both are ok for me

ScreamZ avatar Nov 18 '24 15:11 ScreamZ