mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 14:13:08 +00:00
Merge pull request #992 from balena-io/update-dev-tools
Update and improve debug and development tools
This commit is contained in:
commit
27e901320b
@ -72,4 +72,4 @@ HEALTHCHECK --interval=5m --start-period=1m --timeout=30s --retries=3 \
|
||||
|
||||
RUN [ "cross-build-end" ]
|
||||
|
||||
CMD DEBUG=1 ./entry.sh
|
||||
CMD DEBUG=1 ./entry.sh || while true; do echo 'Supervisor runtime exited - waiting for changes'; sleep 100; done;
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -6303,9 +6303,9 @@
|
||||
}
|
||||
},
|
||||
"livepush": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/livepush/-/livepush-1.2.1.tgz",
|
||||
"integrity": "sha512-6BD16S8EtyVsNqI5PHI/MRiho1LhkYR9Gjy2AXWm3S/cssV0TlVJpyhz1nMWxCDGjbJAWjcYwbvSAeBua7RUhA==",
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/livepush/-/livepush-1.2.4.tgz",
|
||||
"integrity": "sha512-AKGlJ+QuelyDoOV0cbGfeskLf2RaYIcHnKogfircvTl9//BNDrGVhrcO6bN3kcVaJnYKnvXwXOtGOyrsl6wI9A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bluebird": "^3.5.1",
|
||||
|
@ -73,7 +73,7 @@
|
||||
"json-mask": "^0.3.8",
|
||||
"knex": "~0.15.2",
|
||||
"lint-staged": "^8.1.0",
|
||||
"livepush": "^1.2.1",
|
||||
"livepush": "^1.2.4",
|
||||
"lockfile": "^1.0.1",
|
||||
"lodash": "^4.17.5",
|
||||
"log-timestamp": "^0.1.2",
|
||||
|
@ -50,9 +50,20 @@ function extractMessage(msgBuf) {
|
||||
return;
|
||||
}
|
||||
|
||||
let changedFiles = [];
|
||||
let deletedFiles = [];
|
||||
|
||||
const performLivepush = _.debounce(async livepush => {
|
||||
await livepush.performLivepush(changedFiles, deletedFiles);
|
||||
changedFiles = [];
|
||||
deletedFiles = [];
|
||||
}, 1000);
|
||||
|
||||
(async () => {
|
||||
console.log('Starting up...');
|
||||
// Get the supervisor container id
|
||||
const container = await docker.getContainer('resin_supervisor').inspect();
|
||||
console.log('Supervisor container id: ', container.Id);
|
||||
const containerId = container.Id;
|
||||
const image = container.Image;
|
||||
|
||||
@ -67,20 +78,22 @@ function extractMessage(msgBuf) {
|
||||
docker,
|
||||
);
|
||||
|
||||
// TODO: Debounce these calls
|
||||
chokidar
|
||||
.watch('.', {
|
||||
ignored: /((^|[\/\\])\..|node_modules.*)/,
|
||||
ignoreInitial: true,
|
||||
ignoreInitial: false,
|
||||
})
|
||||
.on('add', path => {
|
||||
livepush.performLivepush([path], []);
|
||||
changedFiles.push(path);
|
||||
performLivepush(livepush);
|
||||
})
|
||||
.on('change', path => {
|
||||
livepush.performLivepush([path], []);
|
||||
changedFiles.push(path);
|
||||
performLivepush(livepush);
|
||||
})
|
||||
.on('unlink', path => {
|
||||
livepush.performLivepush([], [path]);
|
||||
deletedFiles.push(path);
|
||||
performLivepush(livepush);
|
||||
});
|
||||
|
||||
livepush.on('commandExecute', ({ command }) => {
|
||||
|
Loading…
Reference in New Issue
Block a user