fix(update): get rid of shell deprecation msg

This commit is contained in:
matt1432 2025-05-10 14:16:55 -04:00
commit 1c22784064
9 changed files with 30 additions and 32 deletions

View file

@ -148,11 +148,11 @@ const main = async() => {
updatePackage('scopedPackages', 'lovelace-components', 'material-rounded-theme'); updatePackage('scopedPackages', 'lovelace-components', 'material-rounded-theme');
spawnSync('alejandra', ['-q', FLAKE], { shell: true }); spawnSync(`alejandra -q ${FLAKE}`, [], { shell: true });
spawnSync('nixFastBuild', [], { spawnSync('nixFastBuild', [], {
shell: true, shell: true,
stdio: [process.stdin, process.stdout, process.stderr], stdio: 'inherit',
}); });
const indentOutput = (output: string): string => { const indentOutput = (output: string): string => {
@ -198,7 +198,7 @@ const main = async() => {
} }
} }
else { else {
spawnSync('alejandra', ['-q', FLAKE], { shell: true }); spawnSync(`alejandra -q ${FLAKE}`, [], { shell: true });
} }
}; };

View file

@ -52,9 +52,9 @@ export default (): string | null => {
{ shell: true, cwd: '/tmp' }, { shell: true, cwd: '/tmp' },
); );
const plugins = JSON.parse(spawnSync('nix', const plugins = JSON.parse(spawnSync(
['eval', '-f', `${dir}/plugins.nix`, '--json'], ['nix', 'eval', '-f', `${dir}/plugins.nix`, '--json'].join(' '), [], { shell: true },
{ shell: true }).stdout.toString()).plugins as Record<string, Plugin>; ).stdout.toString()).plugins as Record<string, Plugin>;
// Get most recent versions of plugins // Get most recent versions of plugins
Object.entries(plugins).forEach(([key, value]) => { Object.entries(plugins).forEach(([key, value]) => {

View file

@ -9,7 +9,7 @@ const FLAKE = process.env.FLAKE;
const updateImages = (imagePath: string): string | undefined => { const updateImages = (imagePath: string): string | undefined => {
console.log(`Updating ${imagePath.split('/').at(-1)} images`); console.log(`Updating ${imagePath.split('/').at(-1)} images`);
const out = spawnSync('updateImages', [imagePath], { shell: true }).stdout.toString(); const out = spawnSync(`updateImages ${imagePath}`, [], { shell: true }).stdout.toString();
if (out.length > 1) { if (out.length > 1) {
return out; return out;

View file

@ -26,13 +26,14 @@ export default (): string | null => {
y.type == "derivation") (attrValues x)) y.type == "derivation") (attrValues x))
'`; '`;
const OLD_VERS = Object.fromEntries([...JSON.parse(spawnSync('nix', [ const OLD_VERS = Object.fromEntries([...JSON.parse(spawnSync([
'nix',
'eval', 'eval',
'.#scopedPackages.x86_64-linux.firefoxAddons', '.#scopedPackages.x86_64-linux.firefoxAddons',
'--apply', '--apply',
nixExpr, nixExpr,
'--json', '--json',
], { shell: true }).stdout.toString())] ].join(' '), [], { shell: true }).stdout.toString())]
.map((p) => { .map((p) => {
const pname = p.replace(/-[0-9].*$/, ''); const pname = p.replace(/-[0-9].*$/, '');
@ -40,12 +41,9 @@ export default (): string | null => {
}) })
.filter((pinfo) => pinfo[0] !== 'frankerfacez')); .filter((pinfo) => pinfo[0] !== 'frankerfacez'));
const NEW_VERS = Object.fromEntries(spawnSync( const NEW_VERS = Object.fromEntries(spawnSync([
'nix', 'nix', 'run', 'sourcehut:~rycee/mozilla-addons-to-nix', SLUGS, GENERATED_FILE,
['run', 'sourcehut:~rycee/mozilla-addons-to-nix', ].join(' '), [], { shell: true }).stdout
SLUGS, GENERATED_FILE],
{ shell: true },
).stdout
.toString() .toString()
.split('\n') .split('\n')
.map((p) => { .map((p) => {

View file

@ -32,8 +32,8 @@ export const parseArgs = (): Args => {
}; };
export const parseFetchurl = (url: string): string => JSON.parse(spawnSync( export const parseFetchurl = (url: string): string => JSON.parse(spawnSync(
'nix', ['store', 'prefetch-file', '--refresh', '--json', ['nix', 'store', 'prefetch-file', '--refresh', '--json',
'--hash-type', 'sha256', url, '--name', '"escaped"'], { shell: true }, '--hash-type', 'sha256', url, '--name', '"escaped"'].join(' '), [], { shell: true },
).stdout.toString()).hash; ).stdout.toString()).hash;
export const replaceInFile = (replace: RegExp, replacement: string, file: string): void => { export const replaceInFile = (replace: RegExp, replacement: string, file: string): void => {

View file

@ -13,9 +13,9 @@ export default (): string | null => {
const OLD_VERSION = readFileSync(`${FOLDER}/.version`).toString().replace('\n', ''); const OLD_VERSION = readFileSync(`${FOLDER}/.version`).toString().replace('\n', '');
const VERSION = JSON.parse(spawnSync('curl', const VERSION = JSON.parse(spawnSync([
['-s', 'https://api.github.com/repos/net-daemon/netdaemon/releases/latest'], 'curl', '-s', 'https://api.github.com/repos/net-daemon/netdaemon/releases/latest',
{ shell: true }).stdout.toString()).tag_name.replace('v', ''); ].join(' '), [], { shell: true }).stdout.toString()).tag_name.replace('v', '');
if (OLD_VERSION !== VERSION) { if (OLD_VERSION !== VERSION) {
writeFileSync(`${FOLDER}/.version`, `${VERSION}\n`); writeFileSync(`${FOLDER}/.version`, `${VERSION}\n`);

View file

@ -5,9 +5,9 @@ import { styleText } from 'node:util';
/* Constants */ /* Constants */
const FLAKE = process.env.FLAKE; const FLAKE = process.env.FLAKE;
const getAttrVersion = (attr: string): string => spawnSync('nix', const getAttrVersion = (attr: string): string => spawnSync(
['eval', '--raw', `${FLAKE}#${attr}.version`], ['nix', 'eval', '--raw', `${FLAKE}#${attr}.version`].join(' '), [], { shell: true },
{ shell: true }).stdout.toString(); ).stdout.toString();
export default ( export default (
attr: string, attr: string,

View file

@ -19,9 +19,9 @@ const updatePackageJson = async(workspaceDir: string, updates: object) => {
const updateDeps = (deps: string) => { const updateDeps = (deps: string) => {
Object.keys(currentPackageJson[deps]).forEach(async(dep) => { Object.keys(currentPackageJson[deps]).forEach(async(dep) => {
if (dep === 'astal') { if (dep === 'astal') {
const latestCommit = JSON.parse(spawnSync('curl', const latestCommit = JSON.parse(spawnSync(
['-s', 'https://api.github.com/repos/Aylur/astal/commits/main'], ['curl', '-s', 'https://api.github.com/repos/Aylur/astal/commits/main'].join(' '), [], { shell: true },
{ shell: true }).stdout.toString()).sha; ).stdout.toString()).sha;
currentPackageJson[deps][dep] = `https://gitpkg.vercel.app/Aylur/astal/lang/gjs/src?${latestCommit}`; currentPackageJson[deps][dep] = `https://gitpkg.vercel.app/Aylur/astal/lang/gjs/src?${latestCommit}`;

View file

@ -25,13 +25,13 @@ export default (): string | null => {
const FILE = `${FLAKE}/configurations/nos/modules/qbittorrent/vuetorrent.nix`; const FILE = `${FLAKE}/configurations/nos/modules/qbittorrent/vuetorrent.nix`;
const OLD_VERSION = JSON.parse(spawnSync('nix', const OLD_VERSION = JSON.parse(spawnSync(
['eval', '-f', FILE, '--json'], ['nix', 'eval', '-f', FILE, '--json'].join(' '), [], { shell: true },
{ shell: true }).stdout.toString()).version; ).stdout.toString()).version;
const VERSION = JSON.parse(spawnSync('curl', const VERSION = JSON.parse(spawnSync(
['-s', 'https://api.github.com/repos/VueTorrent/VueTorrent/releases/latest'], ['curl', '-s', 'https://api.github.com/repos/VueTorrent/VueTorrent/releases/latest'].join(' '), [], { shell: true },
{ shell: true }).stdout.toString()).tag_name.replace('v', ''); ).stdout.toString()).tag_name.replace('v', '');
const URL = `https://github.com/VueTorrent/VueTorrent/releases/download/v${VERSION}/vuetorrent.zip`; const URL = `https://github.com/VueTorrent/VueTorrent/releases/download/v${VERSION}/vuetorrent.zip`;
const HASH = parseFetchurl(URL); const HASH = parseFetchurl(URL);