Deploys JavaScript code to microcontrollers using build and upload strategies.
$ npm install thingssdk-deployer
If you have you're own JavaScript runtime and you want to build you're own deployment strategy here's an example way
const devices = {
devices: {
COM7: {
runtime: "microjs",
baud_rate: 115200
}
}
};
const payload: {
entry: "index.js"
};
const createDeployer = require('thingssdk-deployer');
const deployer = createDeployer();
deployer.prepare(devices, payload);
//Build Process
deployer.use('microjs', (devices, payload, next) => {
someTranspileFunction(payload.entry, (err, code) => {
payload.code = code;
next();
});
});
//Upload Process
deployer.use('microjs', (devices, payload, next) => {
someUploadFunction(devices, payload.code, (err) => {
next();
});
});
deployer.deploy();