feat(update): add results of nix-update executions
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
a473fb7412
commit
0720d37fe0
2 changed files with 42 additions and 7 deletions
|
@ -92,7 +92,19 @@ const main = async() => {
|
||||||
'scopedPackages.x86_64-linux.lovelace-components.custom-sidebar',
|
'scopedPackages.x86_64-linux.lovelace-components.custom-sidebar',
|
||||||
));
|
));
|
||||||
console.log(updateCustomPackage('some-sass-language-server'));
|
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', [], {
|
spawnSync('nixFastBuild', [], {
|
||||||
|
@ -121,7 +133,10 @@ const main = async() => {
|
||||||
output.push(`Node modules:\n${indentOutput(nodeModulesOutput)}\n`);
|
output.push(`Node modules:\n${indentOutput(nodeModulesOutput)}\n`);
|
||||||
}
|
}
|
||||||
if (vuetorrentOutput.length > 5) {
|
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']) {
|
if (args['f']) {
|
||||||
|
|
|
@ -40,14 +40,34 @@ export const updateVuetorrent = () => {
|
||||||
return OLD_VERSION !== VERSION ? `Vuetorrent: ${OLD_VERSION} -> ${VERSION}` : '';
|
return OLD_VERSION !== VERSION ? `Vuetorrent: ${OLD_VERSION} -> ${VERSION}` : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const updateCustomPackage = (pkg: string) => spawnSync(
|
export const updateCustomPackage = (pkg: string) => spawnSync(
|
||||||
`nix run ${FLAKE}#${pkg}.update`,
|
`nix run ${FLAKE}#${pkg}.update`,
|
||||||
[],
|
[],
|
||||||
{ shell: true },
|
{ shell: true },
|
||||||
).stderr.toString();
|
).stderr.toString();
|
||||||
|
|
||||||
export const runNixUpdate = (attr: string, options: string[] = []) => spawnSync(
|
|
||||||
'nix-update',
|
const getAttrVersion = (attr: string): string => spawnSync('nix',
|
||||||
['--flake', attr, ...options],
|
['eval', '--raw', `${FLAKE}#${attr}.version`],
|
||||||
{ shell: true, cwd: FLAKE },
|
{ shell: true }).stdout.toString();
|
||||||
).stderr.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 },
|
||||||
|
);
|
||||||
|
|
||||||
|
const NEW_VERSION = getAttrVersion(attr);
|
||||||
|
|
||||||
|
return {
|
||||||
|
stdout: OLD_VERSION !== NEW_VERSION ? execution.stdout.toString() : '',
|
||||||
|
stderr: execution.stderr.toString(),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue