Transform ES6+ to ruff runable code

Ruff is an ESMAScript IoT runtime, you can use ECMAScript to develop IoT rapidly.

It also have a cloud and networking solution: Sluff IoT Core Reference Architecture

Usage

To install babel, connect to wifi with internet access, run:

rap install && npm install && rap layoutCopy the code

Note that rap layout is mostly for automatically download main board drivers.

Write codes in /src with index.js as an entry.

Then connect to ruff’s wifi, run:

npm run deployCopy the code

Wifi

If there are any connection issue, please check out which wifi are you in first!

Syntax check

Ruff’s rap will check all files excludes what mentioned in the .rapignore file.

So I add /src/** to .rapignore to preventthe checking of source file. That’s why you should introduce eslint to your project for static checking.

And babel-plugin-typecheck is not supported yet, since it will use Symbol.

Size

1kb code will trans to approximately 400kb, mostly polyfill and bluebird.

But this is worthwhile since you are happy writing ES6+ and using way more powerful Promise.

But js size larger than 1M is currently not supported by ruff1.6. So if you are not using bluebird features, you can safely remove it from package.json:

{" ruff ": {" boards" : {" ruff - MBD - v1 ":" ^ 4.1.4 ", "*" : "* *"}, "dependencies" : {" regenerator - runtime ": "NPM :^0 "," NPM :^0 ", "NPM :^0 "," NPM :^0 ", "devDependencies": {}}Copy the code