feat(update): migrate flake inputs update script to typescript

This commit is contained in:
matt1432 2024-07-20 23:40:06 -04:00
parent 322aeebd45
commit 262bcedbd2
2 changed files with 26 additions and 3 deletions
apps/update/src

View file

@ -7,6 +7,24 @@ import { parseFetchurl } from './lib.ts';
/* Constants */
const FLAKE = process.env.FLAKE;
export const updateFlakeInputs = () => {
const output = spawnSync(
`nix flake update --flake ${FLAKE} |& grep -v "warning: updating lock file"`,
[],
{ shell: true },
).stdout
.toString()
.split('\n•')
.join('\n\n•')
.split('\n')
.map((l) => l
.replace(/.{33}\?narHash=sha256[^']*/, '')
.replace(/&rev=(.{7})[^'&]*/, (_, backref) => `&rev=${backref}`))
.join('\n');
return output;
};
export const updateDocker = () => {
let updates = '';