Create native executable for macos #974
-
Is it possible to create a native executable using this SDK? I want to create a simple websocket client in Javascript that runs in a mac terminal. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Welcome! (FYI – I converted this question from an Issue report to a Discussion thread) The Moddable SDK is primarily for building executables for microcontrollers, not computers. We do build and run executables on computers for our simulator (mcsim) and for many of our tools (mcconfig is written in JavaScript and executed by our XS JavaScript engine). We have limited support for building command line tools. A good place to start is the the JavaScript REPL example at $MODDABLE/examples/js/repl. To run that on macOS, set-up the Moddable SDK and then:
Note a couple things:
When it starts up, you should see something like:
Use Here's the bad news: the REPL does not currently support network operations. Adding that is possible, but not trivial. The REPL does support network operations on embedded devices, like the ESP32 MCU. There is an outstanding PR from @cmidgley that might be helpful here. |
Beta Was this translation helpful? Give feedback.
-
I am looking for something lightweight in terms of footprint (memory, cpu, etc) that I can distribute as a single executable with no dependencies. |
Beta Was this translation helpful? Give feedback.
-
Hey all - my original need was very similar, but for a different reason. I needed to have a program that would run on a microcontroller as well as a PC/Mac/Linux and it made for a single source code solution for all of them. I ended up going another direction - making a build system where a build can target Node or Moddable and they can share NPMs (it's a complex and custom build setup, dependent on things like Windows using WSL, Rush monorepo, custom Jest testing ... very opinionated and specific to my needs, so not easily shared otherwise I would!) Of note, the PR also supports (supported?) mods. I may have a new need for that PR again, in which case I might crack it open again (it claims it can merge without conflict, so at least that's a start). |
Beta Was this translation helpful? Give feedback.
Welcome!
(FYI – I converted this question from an Issue report to a Discussion thread)
The Moddable SDK is primarily for building executables for microcontrollers, not computers. We do build and run executables on computers for our simulator (mcsim) and for many of our tools (mcconfig is written in JavaScript and executed by our XS JavaScript engine). We have limited support for building command line tools.
A good place to start is the the JavaScript REPL example at $MODDABLE/examples/js/repl. To run that on macOS, set-up the Moddable SDK and then:
Note a couple things: