You are reading a single comment by @KevinJ and its replies. Click here to read the full conversation.
  • There are a couple other posts that have talked about NPM and Webpack, some that mention Babel, but I thought I would start a new post. I'm relative noob to espruino stuff, but an experienced web developer, so I thought I would share my thoughts about the toolchain.

    A little about Babel for those who don't know it:

    • Its primary usage is a polyfill for ES standards that don't exist in whatever environment you're running your code on. For instance, some browsers don't understand Object.assign(..., but Babel can make that syntax available to many environments (mostly browsers of various vintages)
    • Has a rich ecosystem of presets and plugins that do various transforms on javascript code before it gets run or sent to production.
    • Very well supported, an absolutely insensible tool for almost every modern web company, including Facebook, AirBnB, Reddit, and where I work, Redfin.
    • Babel has a CLI that is fast and runs on node and in the browser, this opens many possibilities for the Espruino ecosystem.

    Overall thoughts:

    • Im a big baby and want to be able to work in the tools I'm familiar with. I'm sure I'll offend someone by saying this, but the Espruino IDE is a bit lacking, compared to what tools are available to web developers such as Atom or Sublime.
    • When I started on Espruino, I had expected that I would just be able to create a new file on my local disk, use my editor of choice to write code, and have a bulletproof CLI to send it to the device and get logging back. For instance React Native (a project that runs Javascript on iOS and Android) has very simple tools to build and watch local files and move them to the device. I want this for espruino.
    • A babel-preset-espruino would be extremely useful and amazing. Moving from my day job where I write JS thats run through babel, then coming home and playing with espruino, I feel like I walked into a time machine that took me back a few years. No module syntax, no async/await, persistent fear of using a language feature that is going to blow up on my target environment. Its not optimal.

    Actual question:

    After reading through the docs I'm actually a bit suprised that I didn't find a simple single command to just deploy and run a static JS file on a board plugged in via usb and get a non interactive log back.
    Hello world:
    $ npm install espruino -g
    $ touch index.js
    edit file, write a simple blink app
    plug in board via usb
    $ espruino run index.js (with options to specify a port if you need to to that)
    then the terminal shows the std out from the app as it runs

    I also expected a good watch mode for local files, which would look like such
    $ espruino watch index.js
    cli starts the app, and runs it
    then you make changes, hit save in your editor and the terminal window shows:
    changes found, restarting
    then the terminal shows the std out from the app as it runs

    Did I miss some docs somewhere or is a CLI like this not available?

About

Avatar for KevinJ @KevinJ started