mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 13:47:54 +00:00
63d9d8df38
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
32 lines
902 B
JavaScript
Executable File
32 lines
902 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
// Sync changes in the javascript code to a running supervisor on a device in the local network
|
|
//
|
|
// Usage:
|
|
// ./sync.js <device IP>
|
|
//
|
|
// The script will first build a non-optimized version of the js code and sync the resulting app.js
|
|
// onto the supervisor container at the specified IP. It will also restart the supervisor container.
|
|
// The device must be a development variant of balenaOS and the supervisor must be running.
|
|
|
|
fs = require('fs');
|
|
|
|
doSync = require('balena-sync').sync('local-balena-os-device').sync;
|
|
|
|
// Avoid a super confusing error where the cwd doesn't exist
|
|
dir = __dirname + '/dist';
|
|
if (!fs.existsSync(dir)) {
|
|
fs.mkdirSync(dir);
|
|
}
|
|
|
|
opts = {
|
|
deviceIp: process.argv[2],
|
|
baseDir: dir,
|
|
destination: '/usr/src/app/dist',
|
|
appName: 'resin_supervisor',
|
|
skipGitignore: true,
|
|
before: 'npm install && npm run build -- --env.noOptimize',
|
|
};
|
|
|
|
doSync(opts);
|