You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Well, Espruino itself is quite smart about getting functions in via the console. It counts brackets and only executes if all open brackets have been closed.

    The WebIDE actually does some relatively simple stuff:

    • It checks for require statements and pulls in any external libraries
    • If you've written any code with slightly odd formatting - eg. where there is a newline in the middle of a statement where there are no open brackets - it changes the newline into a special 'alt-enter' character.
    • It surrounds everything with echo(0);\n and \necho(1);\n and sends it over

    There's maybe some other stuff, but those are the basics.

    I'd started work on a simple command-line tool to use EspruinoTools to this with node.js (see http://www.github.com/espruino/espruino-­tools). That might be a good way of automating everything? It still needs a bit of work to get command-line arguments parsed, but the basics of communication should be there.

    There's also https://www.npmjs.org/package/espruino-c­li which exists right now, but that doesn't use the Web IDE's code, so it could be a bit out of date now.

About

Avatar for Gordon @Gordon started