feat(update): start work on npm updating
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
9612c2a634
commit
f52293ffe3
6 changed files with 100 additions and 3 deletions
|
@ -9,7 +9,7 @@
|
|||
jq,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) concatMapStringsSep getBin;
|
||||
inherit (lib) concatMapStringsSep;
|
||||
inherit (builtins) fromJSON readFile;
|
||||
|
||||
packageJSON = fromJSON (readFile "${src}/package.json");
|
||||
|
@ -31,7 +31,7 @@ in
|
|||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/${pname} \
|
||||
--prefix PATH : ${concatMapStringsSep ":" (p: getBin p) runtimeInputs}
|
||||
--prefix PATH : ${concatMapStringsSep ":" (p: p + "/bin") runtimeInputs}
|
||||
'';
|
||||
|
||||
nodejs = nodejs_latest;
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
{
|
||||
buildApp,
|
||||
callPackage,
|
||||
nodejs_latest,
|
||||
...
|
||||
}:
|
||||
buildApp {
|
||||
src = ./.;
|
||||
npmDepsHash = "sha256-MF5z9QGOdxUKWDP7S4wdszgLrh6f5UyFb9tCn3QSH0k=";
|
||||
npmDepsHash = "sha256-XXc5wCGFGtr1e6URp2yXsWEKVrh5GrXQ/+Eud3W8ks4=";
|
||||
|
||||
runtimeInputs = [
|
||||
nodejs_latest
|
||||
(callPackage ../../nixosModules/docker/updateImage.nix {})
|
||||
];
|
||||
}
|
||||
|
|
47
apps/update-sources/package-lock.json
generated
47
apps/update-sources/package-lock.json
generated
|
@ -18,6 +18,7 @@
|
|||
"eslint": "9.15.0",
|
||||
"eslint-plugin-jsdoc": "50.5.0",
|
||||
"jiti": "2.4.0",
|
||||
"pkg-types": "1.2.1",
|
||||
"typescript": "5.6.3",
|
||||
"typescript-eslint": "8.15.0"
|
||||
}
|
||||
|
@ -1140,6 +1141,13 @@
|
|||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/confbox": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz",
|
||||
"integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
|
@ -1843,6 +1851,19 @@
|
|||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/mlly": {
|
||||
"version": "1.7.3",
|
||||
"resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.3.tgz",
|
||||
"integrity": "sha512-xUsx5n/mN0uQf4V548PKQ+YShA4/IW0KI1dZhrNrPCLG+xizETbHTkOa1f8/xut9JRPp8kQuMnz0oqwkTiLo/A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn": "^8.14.0",
|
||||
"pathe": "^1.1.2",
|
||||
"pkg-types": "^1.2.1",
|
||||
"ufo": "^1.5.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
|
@ -1954,6 +1975,13 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/pathe": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
|
||||
"integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz",
|
||||
|
@ -1967,6 +1995,18 @@
|
|||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/pkg-types": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.2.1.tgz",
|
||||
"integrity": "sha512-sQoqa8alT3nHjGuTjuKgOnvjo4cljkufdtLMnO2LBP/wRwuDlo1tkaEdMxCRhyGRPacv/ztlZgDPm2b7FAmEvw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"confbox": "^0.1.8",
|
||||
"mlly": "^1.7.2",
|
||||
"pathe": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/prelude-ls": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||
|
@ -2251,6 +2291,13 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/ufo": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz",
|
||||
"integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.19.8",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
"eslint": "9.15.0",
|
||||
"eslint-plugin-jsdoc": "50.5.0",
|
||||
"jiti": "2.4.0",
|
||||
"pkg-types": "1.2.1",
|
||||
"typescript": "5.6.3",
|
||||
"typescript-eslint": "8.15.0"
|
||||
}
|
||||
|
|
|
@ -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
Reference in a new issue