feat(update): add results of nix-update executions
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-22 16:15:39 -05:00
parent a473fb7412
commit 0720d37fe0
2 changed files with 42 additions and 7 deletions

View file

@ -92,7 +92,19 @@ const main = async() => {
'scopedPackages.x86_64-linux.lovelace-components.custom-sidebar',
));
console.log(updateCustomPackage('some-sass-language-server'));
console.log(runNixUpdate('homepage'));
// nix-update executions
let nixUpdateOutputs = '';
const updatePackage = (pkg: string): void => {
const execution = runNixUpdate(pkg);
nixUpdateOutputs += execution.stdout;
console.log(execution.stderr);
console.log(execution.stdout);
};
updatePackage('homepage');
spawnSync('nixFastBuild', [], {
@ -121,7 +133,10 @@ const main = async() => {
output.push(`Node modules:\n${indentOutput(nodeModulesOutput)}\n`);
}
if (vuetorrentOutput.length > 5) {
output.push(`Misc Sources:\n${indentOutput(vuetorrentOutput)}\n`);
output.push(`Misc Sources:\n${indentOutput(vuetorrentOutput)}\n\n`);
}
if (nixUpdateOutputs.length > 5) {
output.push(`nix-update executions:\n${indentOutput(nixUpdateOutputs)}\n`);
}
if (args['f']) {

View file

@ -40,14 +40,34 @@ export const updateVuetorrent = () => {
return OLD_VERSION !== VERSION ? `Vuetorrent: ${OLD_VERSION} -> ${VERSION}` : '';
};
export const updateCustomPackage = (pkg: string) => spawnSync(
`nix run ${FLAKE}#${pkg}.update`,
[],
{ shell: true },
).stderr.toString();
export const runNixUpdate = (attr: string, options: string[] = []) => spawnSync(
'nix-update',
['--flake', attr, ...options],
const getAttrVersion = (attr: string): string => spawnSync('nix',
['eval', '--raw', `${FLAKE}#${attr}.version`],
{ shell: true }).stdout.toString();
export const runNixUpdate = (
attr: string,
options: string[] = [],
): { stdout: string, stderr: string } => {
const OLD_VERSION = getAttrVersion(attr);
const execution = spawnSync(
`nix-update --flake ${attr} --write-commit-message >(head -n 1 -) > /dev/null`,
options,
{ shell: true, cwd: FLAKE },
).stderr.toString();
);
const NEW_VERSION = getAttrVersion(attr);
return {
stdout: OLD_VERSION !== NEW_VERSION ? execution.stdout.toString() : '',
stderr: execution.stderr.toString(),
};
};