geostyler / geostyler-cli

BSD 2-Clause "Simplified" License
21 stars 8 forks source link

Standalone Binaries cannot be created for Node 20+ #393

Open geographika opened 2 weeks ago

geographika commented 2 weeks ago

The pkg module used to create standalone binaries has been deprecated. It appears it can only build binaries using version 18 of node or lower. The GeoStyler parsers use some newer node functionality such as structuredClone, causing errors such as:

ReferenceError: structuredClone is not defined

This was introduced in Node17 so is included in Node18, so the releases seem fine for now. In order to continue building binaries in newer versions of node beyond v18 a new approach is required. Node itself has a new experimental feature that could be used: https://nodejs.org/api/single-executable-applications.htm

A few other links:

https://github.com/nodejs/single-executable/discussions https://github.com/ChainSafe/lodestar/issues/3633#issuecomment-1826397373 https://github.com/nodejs/single-executable/blob/main/docs/existing-solutions.md https://github.com/mongodb-js/boxednode

KaiVolland commented 1 week ago

I'd also suggest to try https://bun.sh/docs/bundler/executables

geographika commented 1 week ago

Thanks, @KaiVolland - this looks an easier approach than the others. Is there a general move from node to bun across all GeoStyler projects? I presume we could just use bun for making the executables and leave the rest of the CI scripts running on node.

For reference I found some notes on using bun for executables at https://github.com/llimllib/node-esbuild-executable?tab=readme-ov-file#comparison-with-bun

KaiVolland commented 1 week ago

I don't think that there will be a general move to bun. Maybe at some point we will force a change to bun, but as all the build stuff is complex, time consuming and very essentiell i think we should keep the stuff that is already working.

If bun has reached a more stable state I'd love to move the tests to bun as they run like 100 times faster then JEST or vitest.

So your right. We should try if bun can help us with the creation of the exectuables but keep the rest as is.