2024-07-21 01:17:10 -04:00
|
|
|
import { spawnSync } from 'node:child_process';
|
|
|
|
|
2024-07-20 21:06:52 -04:00
|
|
|
import { parseArgs } from './lib.ts';
|
2024-07-20 20:30:43 -04:00
|
|
|
import { updateFirefoxAddons } from '././firefox.ts';
|
2024-07-20 23:40:06 -04:00
|
|
|
import { updateDocker, updateFlakeInputs, updateVuetorrent } from './misc.ts';
|
2024-07-20 20:30:43 -04:00
|
|
|
|
|
|
|
|
2024-07-21 01:17:10 -04:00
|
|
|
/* Constants */
|
|
|
|
const FLAKE = process.env.FLAKE;
|
|
|
|
|
|
|
|
if (!FLAKE) {
|
|
|
|
console.error('Env var FLAKE not found');
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
2024-07-20 21:06:52 -04:00
|
|
|
const args = parseArgs();
|
2024-07-20 20:30:43 -04:00
|
|
|
|
2024-07-20 22:33:14 -04:00
|
|
|
if (args['d'] || args['docker']) {
|
|
|
|
console.log(updateDocker());
|
|
|
|
}
|
|
|
|
|
2024-07-20 23:40:06 -04:00
|
|
|
if (args['i'] || args['inputs']) {
|
|
|
|
console.log(updateFlakeInputs());
|
|
|
|
}
|
|
|
|
|
2024-07-20 20:30:43 -04:00
|
|
|
if (args['f'] || args['firefox']) {
|
|
|
|
console.log(updateFirefoxAddons());
|
|
|
|
}
|
2024-07-20 22:02:22 -04:00
|
|
|
|
2024-07-20 22:33:14 -04:00
|
|
|
if (args['v'] || args['vuetorrent']) {
|
|
|
|
console.log(updateVuetorrent());
|
2024-07-20 22:02:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (args['a'] || args['all']) {
|
2024-07-30 01:45:01 -04:00
|
|
|
// Update this first because of nix run cmd
|
|
|
|
const firefoxOutput = updateFirefoxAddons();
|
|
|
|
|
|
|
|
console.log(firefoxOutput);
|
|
|
|
|
|
|
|
|
2024-07-21 01:17:10 -04:00
|
|
|
const flakeOutput = updateFlakeInputs();
|
|
|
|
|
|
|
|
console.log(flakeOutput);
|
|
|
|
|
|
|
|
|
|
|
|
const dockerOutput = updateDocker();
|
|
|
|
|
|
|
|
console.log(dockerOutput);
|
|
|
|
|
|
|
|
|
|
|
|
const vuetorrentOutput = updateVuetorrent();
|
|
|
|
|
|
|
|
console.log(vuetorrentOutput);
|
|
|
|
|
|
|
|
|
2024-08-06 22:23:42 -04:00
|
|
|
spawnSync('nix-fast-build', ['-f', `${FLAKE}#nixFastChecks`], {
|
2024-07-21 01:17:10 -04:00
|
|
|
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'));
|
2024-07-20 22:02:22 -04:00
|
|
|
}
|
2024-07-21 01:17:10 -04:00
|
|
|
|
|
|
|
spawnSync('alejandra', ['-q', FLAKE], { shell: true });
|