It looks like it doesn't support communication over sockets?
How does one run this after checking out the code from github? I'm not familiar with node. Looks like there are a lot of dependencies that need to be installed?

FYI, I added support for node sockets and for a --terminal option that pops into the terminal after uploading a file. The socket support doesn't work for multiple sockets and the terminal support is a gross copy&paste of the existing terminal code, so ti should be included more nicely.
To see the changes use: https://github.com/espruino/EspruinoTool­s/compare/gh-pages...tve:gh-pages?w=1 to avoid seeing all the whitespace changes (my editor removes trailing spaces automatically).

At the moment the CLI just sends that command straight to Espruino, so it doesn't really have a way of parsing the result out.

I guess it could change to using .expr() instead (which actually sends 'console.log("<<"+"<<<"+JSON.stringify('­+expressionToExecute+')+">>>"+">>")'), but I wonder if that might cause some problems with code that worked previously.

OK. I can do what I need using the module form with my console.mute() work-around.
I plan on moving my build process to WebStorm and use the integrated gulp tools to upload code and run tasks on the espruino.
I really want the git/gitHub integration that WebStorm gives me as I live in fear I'll lose changes/history using the WebIDE. I've also found it doesn't save/cache the code in the code window once it exceeds a certain size (sorry but I didn't investigate too much), and I get inconsistent errors about not being able to find modules when modules require() other modules.

To complete the integration it would be nice to figure out how to give WebStorm what it needs to be aware of the built-in espruino functions/libraries, especially where they differ from standard javaScript/node, e.g. the E. object and all the global h/w functions like digitalWrite(). I look into it and let you know if I find a solution.

Had a look and it appears WebStorm doesn't read tern files. It likes js files that include JSDocs format comments.

Before I launch into parsing the tern file into something else: is tern your source format you maintain my hand, or is there something behind that like a structured database I might find easier to work with?

I apologise in advance that I haven't got around to doing these a pull-requests on gitHub. I'll get over my laziness soon and start proposing updates that way in future. For now I hope you'll do a diff and choose to integrate the changes if you like them.

These amount to:

serial_nodeserial.js : applies a filter the to available ports and lists only ports that (hopefully) belong to an espruino (based on USB vendorId and productId)

localModules.js : implemented the relevant rules for require.resolve() from node so enable a more complete 'require()' experience with with cli.

Thanks - I've just pulled in the localModules stuff (it's modules because that's what the Web IDE uses for local projects, so it's a bit more compatible).

For the serial stuff, it will work on all Espruino boards via USB - that kind of detection is really handy, but in reality it stops you using Espruino via a USB-TTL converter (eg for ESP8266, or even normal Espruino boards where you're not using USB), or even via bluetooth.

What'd be better is if all the serial modules could report back the path, but also a boolean saying whether they're sure that it's an Espruino.

Then, if you didn't specify a port it could scan all ports, and if it was sure that one of those was Espruino, it'd just choose it.

Hmmm, 2 steps forward, 1 step back.
Happy with my mods, I've tried a build on a 'large' project and I'm having serial comms. problems with the espruino-cli dropping characters in both directions.
When I say large, I mean a combined 26Kb of source.

I have checked it's not the code I am loading: I can capture it with -o and then load this file via the WebIDE successfully

I have forced Espruino.Config.SERIAL_THROTTLE_SEND = true; and verified this is in effect, and it doesn't solve the problem.

When espruino -v source.js sends the code to the Pico there are dropped characters, even if I leave out the -v the result is the same. If I use espruino in terminal mode and do a dump(); on the full set of code (loaded with the WebIDE) then there are dropped characters in what I see. Again, I don't have these problems with the WebIDE.

Any ideas about what to try next? I currently think its somewhere in the 2 different code paths for serial comms. when you compare the WebIDE with espruino-cli.

A build you pointed me at to improve the RTC accuracy without a crystal (under my gitHub personna: dmcnaugh) - as expected its better but not fantastic - averaging +5 seconds every 10 minutes.

From what I can tell I'm not losing characters transmitting to the Pico but who knows. The same file will load then not load, then load. It will almost always load after a power cycle of the Pico, but then again I can make files that won't event do that. If I change the echo(0); to echo(1); in codeWriter.js -> `writeToEspurino then it looks like its the echoed characters that are sometimes being dropped, but I'm not getting syntax errors so I don't think its the transmitted characters. At some point after about 16Kb (changes) of code has been sent then the Pico just freezes and wont talk anymore until it has been power cycled.

As you've got the EspruinoTools source handy, you could try this: github.com/espruino/espruino-tools/issue­s/6#issuecomment-101716152

solved the problem of sending code to the espruino. Is there a permanent fix in the issues queue? Or is this seen as a problem with node-serialport ?

I tracked down the 'dropped characters' problem when the espruino is sending to the terminal a little further and it looks like nothing is dropped in the transmission but different terminals produce different results. The issue occurs only with very long lines, typical when you dump(); and it is sending the content of a large, multi-line function as a single line of text:

iTerm (OSX) shows only as many characters as it can to fill one line and then ignores the remainder of the line, and doesn't wrap

the WebIDE wraps at the righthand end of the terminal and keeps showing everything, over multiple lines (best solution in my opinion)

the terminal in WebStorm does - I don't know? - but you don't see the start of the line; the end of the line; consecutive characters from somewhere in the middle of the line; and sometimes you don't see anything at all for a long line. This is why I thought characters were being dropped.

So I'll try filing a bug with WebStorm but meanwhile I can't find a simple solution to make terminals wrap at the width of the terminal window.

An Option to SetTime ?
Wouldn't it be good to have an option to set espruinos clock to the time of the server.
This should be executed before all the other processing is done so we can have the "right" time.

-s, --settime : Similar to the Web IDE Settings -> Communications -> Set Current Time