parent
9612c2a634
commit
f52293ffe3
6 changed files with 100 additions and 3 deletions
apps/update-sources/src
|
@ -7,6 +7,7 @@ import { updateDocker } from './docker';
|
|||
import { updateFirefoxAddons } from '././firefox';
|
||||
import { updateFlakeInputs } from './flake';
|
||||
import { updateCustomPackage, updateVuetorrent } from './misc';
|
||||
import updateNodeModules from './node-modules';
|
||||
|
||||
|
||||
/* Constants */
|
||||
|
@ -43,6 +44,10 @@ if (args['s'] || args['some-sass-language-server']) {
|
|||
console.log(updateCustomPackage('some-sass-language-server'));
|
||||
}
|
||||
|
||||
if (args['n'] || args['node_modules']) {
|
||||
updateNodeModules();
|
||||
}
|
||||
|
||||
if (args['a'] || args['all']) {
|
||||
// Update this first because of nix run cmd
|
||||
const firefoxOutput = updateFirefoxAddons();
|
||||
|
|
42
apps/update-sources/src/node-modules.ts
Normal file
42
apps/update-sources/src/node-modules.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { readPackageJSON } from 'pkg-types';
|
||||
import { readdirSync } from 'node:fs';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
|
||||
|
||||
/* Constants */
|
||||
const FLAKE = process.env.FLAKE as string;
|
||||
|
||||
export default () => {
|
||||
readdirSync(FLAKE, { withFileTypes: true, recursive: true }).forEach(async(path) => {
|
||||
if (path.name === 'package.json' && !path.parentPath.includes('node_modules')) {
|
||||
const currentWorkspace = path.parentPath;
|
||||
|
||||
const currentPackageJson = await readPackageJSON(`${currentWorkspace}/package.json`);
|
||||
const outdated = JSON.parse(spawnSync(
|
||||
'npm',
|
||||
['outdated', '--json'],
|
||||
{ cwd: currentWorkspace },
|
||||
).stdout.toString());
|
||||
|
||||
Object.keys(currentPackageJson.dependencies ?? {}).forEach((dep) => {
|
||||
const versions = outdated[dep];
|
||||
|
||||
if (!versions?.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`${dep}: ${versions.current} -> ${versions.latest}`);
|
||||
});
|
||||
|
||||
Object.keys(currentPackageJson.devDependencies ?? {}).forEach((dep) => {
|
||||
const versions = outdated[dep];
|
||||
|
||||
if (!versions?.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`${dep}: ${versions.current} -> ${versions.latest}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue