feat(update): migrate docker update script to typescript

This commit is contained in:
matt1432 2024-07-20 22:02:22 -04:00
parent 970a380805
commit 60bc645ae0
5 changed files with 73 additions and 33 deletions
apps/update/src

21
apps/update/src/misc.ts Normal file
View file

@ -0,0 +1,21 @@
import { readdirSync } from 'node:fs';
import { spawnSync } from 'node:child_process';
/* Constants */
const FLAKE = process.env.FLAKE;
export const updateDocker = () => {
let updates = '';
const FILE = `${FLAKE}/devices/nos/modules/arion`;
readdirSync(FILE, { withFileTypes: true, recursive: true }).forEach((path) => {
if (path.name === 'compose.nix') {
updates += spawnSync('updateImages', [path.parentPath], { shell: true })
.stdout.toString();
}
});
return updates;
};