feat(update): migrate flake inputs update script to typescript
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
322aeebd45
commit
262bcedbd2
2 changed files with 26 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
import { parseArgs } from './lib.ts';
|
||||
import { updateFirefoxAddons } from '././firefox.ts';
|
||||
import { updateDocker, updateVuetorrent } from './misc.ts';
|
||||
import { updateDocker, updateFlakeInputs, updateVuetorrent } from './misc.ts';
|
||||
|
||||
|
||||
const args = parseArgs();
|
||||
|
@ -9,6 +9,10 @@ if (args['d'] || args['docker']) {
|
|||
console.log(updateDocker());
|
||||
}
|
||||
|
||||
if (args['i'] || args['inputs']) {
|
||||
console.log(updateFlakeInputs());
|
||||
}
|
||||
|
||||
if (args['f'] || args['firefox']) {
|
||||
console.log(updateFirefoxAddons());
|
||||
}
|
||||
|
@ -18,7 +22,8 @@ if (args['v'] || args['vuetorrent']) {
|
|||
}
|
||||
|
||||
if (args['a'] || args['all']) {
|
||||
console.log(updateVuetorrent());
|
||||
console.log(updateFirefoxAddons());
|
||||
console.log(updateDocker());
|
||||
console.log(updateFlakeInputs());
|
||||
console.log(updateFirefoxAddons());
|
||||
console.log(updateVuetorrent());
|
||||
}
|
||||
|
|
|
@ -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 = '';
|
||||
|
||||
|
|
Loading…
Reference in a new issue