-
• #2
In deed... listening to you is about re-listening to myself... With a similar background and with the options of shimming/polyfilling/frameworking specific platforms to a common platform, things just work portably perfect. 'Unfortunately' with the resource constraints and a non-ES(X) JavaScript interpreter/vm, things aren't as forthcoming. I recall my first request to have a module to be able to deliver 'class'/constructor and at the same time mentioning browser-side require.js/AMD - because that was the 'thing' I was used to. In the meantime I know that require() looks the same, delivers (almost) the same but works a bit different...
Espruino JavaScript puts as a bit back into the time where it really really mattered in what Browser Web pages with JavaScript had to run in... to not have a run in... ;-). I feel it is amazing how far Espruino came from when I experienced it the first time - and that was already way beyond version 1v00. Just to mention a small detail: Promises. I started out with just callbacks.
Just recently I contemplated to extend require(). With different styles of Web communications and Promises available, AMD is done... and Espruino becomes an IoT/Hardware/Controlling-'Browser' in an M2M environment vs. the original - known for quite some time now - UI/Rendering-Browser in a U2M/C2M environment.
Espruino's frugalness in just everything - power, (eep)rom and ram, and even size (w/ Espruino Pico and now Puck) - except performance and ease-of-use made me reconcile with being put a bit back in time. If mentioned resourcefulness does not matter, no need for Espruino, any other environment of dog bones and xyz berries and ... what ever single board computer you find on the market - in numbers like ants in a hill - would do (btw: rasp means obsolete... because raspberries had to be consumed right away after picking because they mush and rot/ferment quickly... may be that's why the French originally made wine out of them).
Have no answers to your questions(*), because "Was der Bauer nicht kennt, (fr)isst er nicht!" - What the farmer does not know he does not eat!... but I'm willing to learn and become an educated, gourmet farmer... ;)
(*) except for the last one: may be because reality - hardware with sensors to the real world - is involved, which is not that easy to (unit/integration-test-)emulate as what we call real databases (and other emulatable) system, even though I did that serveral time already when (cross) developing (in the Browser only) logic that uses sensor and display and motion sub-systems. The Sensors, Displays and Motions were DOM nodes. Another reason is: doing IoT on MC level, the targeted environment is pretty given and not much changing. The software is dedicated and not intended general and universal, because latter virtues are just not affordable by the available memory resources. Extensibility has to be 'thought in' in a different way.
-
• #3
Take a look here:
-
• #4
Did I miss some docs somewhere or is a CLI like this not available?
You definitely missed something :) In fact literally just typing the command that you posted
npm install espruino -g
will give you a CLI: https://www.npmjs.com/package/espruinoThere's also the ability to watch files so it'll integrate with your editor - just not with the exact syntax you posted :)
In terms of using it with Babel, I'd assume that there is already a framework for running Babel or other CLI tools when the source files change? If so, you could just add the Espruino CLI tool to the end of the list of tools to run - or could watch the output file of babel for upload with the CLI.
But yes, there's also thingsSDK for ESP8266, which wraps the transformations up as well.
-
• #5
I'm a bit late to the party, but I'm new to Espruino and I too, did miss some of the modern features of JS.
I spend some time handpicking Babel plugins and did some sanity testing to see if the resulting code worked as expected in Espruino.
I found some bugs (which I've raised as issues in GitHub), but I'm so far, pretty happy with the result.
I have published a sample project which could be used as a starting point. It can be found here:
https://github.com/andrewwakeling/espruino-webpack-babel-sampleI would love to hear any feedback here or via GitHub. Thanks!
-
• #6
Thanks! I'm on holiday this week, but hopefully I'll get some of those issues sorted next week.
-
• #7
Awesome! Enjoy your holiday! No rush on the fixes.
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:
Object.assign(...
, but Babel can make that syntax available to many environments (mostly browsers of various vintages)Overall thoughts:
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?