feat(update): consolidate update msgs and format at end
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-07-21 01:17:10 -04:00
parent 262bcedbd2
commit 44d56aab0f
2 changed files with 46 additions and 4 deletions

View file

@ -1,8 +1,18 @@
import { spawnSync } from 'node:child_process';
import { parseArgs } from './lib.ts'; import { parseArgs } from './lib.ts';
import { updateFirefoxAddons } from '././firefox.ts'; import { updateFirefoxAddons } from '././firefox.ts';
import { updateDocker, updateFlakeInputs, updateVuetorrent } from './misc.ts'; import { updateDocker, updateFlakeInputs, updateVuetorrent } from './misc.ts';
/* Constants */
const FLAKE = process.env.FLAKE;
if (!FLAKE) {
console.error('Env var FLAKE not found');
process.exit(1);
}
const args = parseArgs(); const args = parseArgs();
if (args['d'] || args['docker']) { if (args['d'] || args['docker']) {
@ -22,8 +32,38 @@ if (args['v'] || args['vuetorrent']) {
} }
if (args['a'] || args['all']) { if (args['a'] || args['all']) {
console.log(updateDocker()); const flakeOutput = updateFlakeInputs();
console.log(updateFlakeInputs());
console.log(updateFirefoxAddons()); console.log(flakeOutput);
console.log(updateVuetorrent());
const dockerOutput = updateDocker();
console.log(dockerOutput);
const firefoxOutput = updateFirefoxAddons();
console.log(firefoxOutput);
const vuetorrentOutput = updateVuetorrent();
console.log(vuetorrentOutput);
spawnSync('nix-fast-build', ['-f', `${FLAKE}#checks`], {
shell: true,
stdio: [process.stdin, process.stdout, process.stderr],
});
console.log([
'chore: update flake.lock',
`Flake Inputs:\n${flakeOutput}`,
`Docker Images:\n${dockerOutput}`,
`Firefox Addons:\n${firefoxOutput}`,
`Misc Sources:\n${vuetorrentOutput}`,
].join('\n\n'));
} }
spawnSync('alejandra', ['-q', FLAKE], { shell: true });

View file

@ -14,8 +14,10 @@ export const updateFlakeInputs = () => {
{ shell: true }, { shell: true },
).stdout ).stdout
.toString() .toString()
// Add an extra blank line between inputs
.split('\n•') .split('\n•')
.join('\n\n•') .join('\n\n•')
// Shorten git revs to help readability
.split('\n') .split('\n')
.map((l) => l .map((l) => l
.replace(/.{33}\?narHash=sha256[^']*/, '') .replace(/.{33}\?narHash=sha256[^']*/, '')