@sweebee With very little effort, you can use those libraries in node4. I was able to get the example.js script running without errors in about 4 minutes. So a lack of a current node version shouldn’t stop you from creating plugins. This won’t work with every library out there, but the any, like this one, that have no dependencies, it should be trivial. Just follow these steps:
- Clone the repository locally
- cd into the folder, then
npm install --save-dev babel-cli babel-preset-env
- create a file called
.babelrc
and paste in the following:
{
"presets": [
[
"env",
{
"targets": {
"node": "4"
},
"include": [
"transform-es2015-arrow-functions",
"transform-es2015-classes",
"es6.map"
],
"debug": true
}
]
]
}
- using the node-lumi-aquara repository as an example, run
npx babel src --out-dir build
This will compile the contents of directory src to a node4 friendly version in build.
- Then copy the contents of the directory into your project folder, and require it directly.
That’s it.
if you haven’t already installed npx, just do npm install -g npx
Let me know if you have issues.