node-seeli icon indicating copy to clipboard operation
node-seeli copied to clipboard

Migrate to ESM and Typescript support

Open DeVoresyah opened this issue 10 months ago • 13 comments

I was looking for a JS framework to build CLI apps alternatively from gluegun because gluegun cannot be compiled into single-file executable. I've tried Seeli using Bun, and it works fine for the Single-file Executable compilation. Except, seeli is not using ESM and doesn't have typescript support.

I will open bounties using Algora for this issue. Hopefully the maintainer or anyone else can pick up this

DeVoresyah avatar Mar 09 '25 20:03 DeVoresyah

💎 cloudgakkai is offering a $50 bounty for this issue 👉 Got a pull request resolving this? Claim the bounty by adding @algora-pbc /claim #135 in the PR body and joining algora.io

algora-pbc avatar Mar 09 '25 20:03 algora-pbc

is this still relevant?

KagChi avatar Aug 04 '25 04:08 KagChi

/attempt #135

KagChi avatar Aug 04 '25 05:08 KagChi

I don't have much interest in direct bun support. If type script means adding some type definitions, I don't mind that

esatterwhite avatar Aug 04 '25 11:08 esatterwhite

I've tried Seeli using Bun, and it works fine for the Single-file Executable compilation. Except, seeli is not using ESM and doesn't have typescript support.

@DeVoresyah If it works, can you help me to understand why it is necessary to rewrite the project?

esatterwhite avatar Aug 04 '25 11:08 esatterwhite

if you wish to add support backward compability for cjs user, typescript rewrite is necessary. otherwise we can just refactor the entire codebase to esm and add typings.

with typescript we can support both esm and cjs

KagChi avatar Aug 04 '25 11:08 KagChi

with typescript we can support both esm and cjs

migrating to esm will accomplish that as require supports both esm and cjs. I don't think there is a need for typescript here

esatterwhite avatar Aug 04 '25 12:08 esatterwhite

My concern with backward / forward compatibility is largely constrained to the previous LTS, and the next LTS of node core.

currently that is Node.JS 20 (previous LTS), 22 (current LTS) and the 24 (next LTS).

all of those versions to my knowledge support what we are talking about here without introducing 3rd party packages, or a complex build / compile phase

esatterwhite avatar Aug 04 '25 12:08 esatterwhite

with typescript we can support both esm and cjs

migrating to esm will accomplish that as require supports both esm and cjs. I don't think there is a need for typescript here

esm doesnt support require, but esm does support importing cjs package. cjs doesnt support esm package (technically you can but it must be async).

for example if you wanted to support cjs only or esm only we dont have refactor entire codebase. we just change the build options.

rewriting to typescript is easier to write the type definition than adding type definition to exising code base.

KagChi avatar Aug 04 '25 12:08 KagChi

backward compability here are meant for previous node-seeli version not nodejs version.

KagChi avatar Aug 04 '25 12:08 KagChi

anyway, i will contribute if the bounty are stil relevant.

KagChi avatar Aug 04 '25 12:08 KagChi

esm doesnt support require, but esm does support importing cjs package. cjs doesnt support esm package (technically you can but it must be async).

correct, it is the lowest common denominator. If its written in ESM, you can use this package in either a CJS project via require() or await import() or you can use it in an ESM project via import. That is acceptable.

rewriting to typescript is easier to write the type definition than adding type definition to exising code base.

Maybe. But the change I'll accept is adding type definitions, or a conversion to ESM. or both

esatterwhite avatar Aug 04 '25 12:08 esatterwhite

sure thats fine, ill wait for the author response.

KagChi avatar Aug 04 '25 12:08 KagChi