Update dependencies

This commit is contained in:
schroda
2026-05-15 16:30:57 +02:00
parent c19f7164e0
commit 32b22bbf3c
3 changed files with 1426 additions and 1188 deletions

View File

@@ -41,15 +41,15 @@
"@emotion/react": "11.14.0",
"@emotion/styled": "11.14.1",
"@juggle/resize-observer": "3.4.0",
"@lingui/core": "6.0.0",
"@lingui/react": "6.0.0",
"@lingui/core": "6.0.1",
"@lingui/react": "6.0.1",
"@loadable/component": "5.16.7",
"@mantine/hooks": "9.1.0",
"@mui/icons-material": "9.0.0",
"@mui/material": "9.0.0",
"@mui/system": "9.0.0",
"@mui/utils": "9.0.0",
"@mui/x-date-pickers": "9.0.2",
"@mantine/hooks": "9.2.1",
"@mui/icons-material": "9.0.1",
"@mui/material": "9.0.1",
"@mui/system": "9.0.1",
"@mui/utils": "9.0.1",
"@mui/x-date-pickers": "9.2.0",
"@redux-devtools/extension": "4.0.0",
"@vibrant/color": "4.0.4",
"apollo-upload-client": "19.0.0",
@@ -58,11 +58,11 @@
"dayjs": "1.11.20",
"fast-average-color": "9.5.2",
"file-selector": "2.1.2",
"graphql": "16.13.2",
"graphql": "16.14.0",
"graphql-sock": "1.0.1",
"graphql-tag": "2.12.6",
"graphql-ws": "6.0.8",
"immer": "11.1.4",
"immer": "11.1.8",
"jsonrepair": "3.14.0",
"koration": "1.0.0",
"lodash": "4.18.1",
@@ -72,29 +72,29 @@
"notistack": "3.0.2",
"p-limit": "7.3.0",
"polished": "4.3.1",
"react": "19.2.5",
"react-dom": "19.2.5",
"react-hotkeys-hook": "5.2.4",
"react": "19.2.6",
"react-dom": "19.2.6",
"react-hotkeys-hook": "5.3.2",
"react-lazily": "0.9.2",
"react-router-dom": "6.26.1",
"react-virtuoso": "4.18.6",
"react-virtuoso": "4.18.7",
"rxjs": "7.8.2",
"stylis": "4.4.0",
"stylis-plugin-rtl": "2.1.1",
"use-long-press": "3.3.0",
"use-query-params": "2.2.2",
"webfontloader": "1.6.28",
"zustand": "5.0.12"
"zustand": "5.0.13"
},
"devDependencies": {
"@graphql-codegen/cli": "6.3.1",
"@graphql-codegen/client-preset": "5.3.0",
"@graphql-codegen/typescript-apollo-client-helpers": "4.0.1",
"@graphql-codegen/typescript-operations": "5.1.0",
"@lingui/cli": "6.0.0",
"@lingui/format-po": "6.0.0",
"@lingui/cli": "6.0.1",
"@lingui/format-po": "6.0.1",
"@lingui/swc-plugin": "6.0.0",
"@lingui/vite-plugin": "6.0.0",
"@lingui/vite-plugin": "6.0.1",
"@tony.ganchev/eslint-plugin-header": "3.4.4",
"@types/lodash": "4.17.24",
"@types/node": "24.10.1",
@@ -105,27 +105,27 @@
"@types/stylis": "4.2.7",
"@types/webfontloader": "1.6.38",
"@types/yargs": "17.0.35",
"@typescript/native-preview": "7.0.0-dev.20260425.1",
"@vitejs/plugin-legacy": "8.0.1",
"@typescript/native-preview": "7.0.0-dev.20260514.1",
"@vitejs/plugin-legacy": "8.0.2",
"@vitejs/plugin-react-swc": "4.3.0",
"dotenv": "17.4.2",
"eslint": "9.39.4",
"eslint-plugin-lingui": "0.13.1",
"eslint-plugin-no-only-tests": "3.3.0",
"eslint-plugin-no-only-tests": "3.4.0",
"eslint-plugin-no-relative-import-paths": "1.6.1",
"eslint-plugin-unused-imports": "4.4.1",
"husky": "9.1.7",
"lint-staged": "16.4.0",
"oxfmt": "0.46.0",
"oxlint": "1.61.0",
"terser": "5.46.2",
"tsx": "4.21.0",
"typescript": "5.9.3",
"vite": "8.0.10",
"lint-staged": "17.0.4",
"oxfmt": "0.49.0",
"oxlint": "1.64.0",
"terser": "5.47.1",
"tsx": "4.22.0",
"typescript": "6.0.3",
"vite": "8.0.13",
"vite-plugin-node-polyfills": "0.26.0",
"vite-plugin-pwa": "1.2.0",
"workbox-build": "7.4.0",
"workbox-window": "7.4.0",
"vite-plugin-pwa": "1.3.0",
"workbox-build": "7.4.1",
"workbox-window": "7.4.1",
"yargs": "18.0.0"
},
"resolutions": {

2465
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,31 +12,35 @@ import { writeFileSync } from 'node:fs';
import packageJson from '../../package.json';
type TPackageJson = typeof packageJson;
type PackageType = keyof Pick<TPackageJson, 'dependencies' | 'devDependencies'>;
type DependencyType = keyof Pick<TPackageJson, 'dependencies' | 'devDependencies'>;
type CaretMode = 'add' | 'remove';
type OutdatedPayload = {
current: string;
latest: string;
wanted: string;
isDeprecated: boolean;
dependencyType: DependencyType;
};
type OutdatedDependency = {
type OutdatedDependency = OutdatedPayload & {
name: string;
packageType: PackageType;
isMajorUpdate: boolean;
};
const PACKAGE_TYPES: PackageType[] = ['dependencies', 'devDependencies'];
const PACKAGE_TYPES: DependencyType[] = ['dependencies', 'devDependencies'];
const setCaretForDependency = <DependencyType extends PackageType>(
caretMode: CaretMode,
type: DependencyType,
dependency: keyof TPackageJson[DependencyType],
const updateVersionInPackageJson = <TDependencyType extends DependencyType>(
type: TDependencyType,
dependency: keyof TPackageJson[TDependencyType],
version: string,
) => {
const versionRange = caretMode === 'add' ? '^' : '';
// maybe something is typed wrong, but typescript is not able to infer that the value of a dependency is of type string
packageJson[type][dependency] = `${versionRange}${packageJson[type][dependency]}` as any;
// @ts-ignore - TS2322: Type string is not assignable to type (packageJson[type][dependency])
packageJson[type][dependency] = version;
};
const setCaretForDependencies = (caretMode: CaretMode, dependencies: OutdatedDependency[]) => {
dependencies.forEach(({ name, packageType }) =>
setCaretForDependency(caretMode, packageType, name as keyof TPackageJson[typeof packageType]),
const updateVersionsInPackageJson = (dependencies: OutdatedDependency[]) => {
dependencies.forEach(({ name, dependencyType, latest }) =>
updateVersionInPackageJson(dependencyType, name as keyof TPackageJson[typeof dependencyType], latest),
);
writeFileSync('package.json', `${JSON.stringify(packageJson, null, 2)}\n`);
@@ -46,11 +50,11 @@ const setCaretForDependencies = (caretMode: CaretMode, dependencies: OutdatedDep
* @param asJson
* @param stdio - only considered in case asJson is falsy
*/
const execYarnOutdated = ({ asJson = false, stdio }: { asJson?: boolean; stdio?: ExecSyncOptions['stdio'] } = {}):
const execOutdatedCmd = ({ asJson = false, stdio }: { asJson?: boolean; stdio?: ExecSyncOptions['stdio'] } = {}):
| string
| null => {
try {
execSync(`pnpm outdated ${asJson ? '--json' : ''}`, { stdio: !asJson ? stdio : undefined }).toString();
execSync(`pnpm outdated ${asJson ? '--json' : ''}`, { stdio: !asJson ? stdio : undefined })?.toString();
return null;
} catch (e: any) {
if (e?.stdout === null) {
@@ -66,33 +70,26 @@ const execYarnOutdated = ({ asJson = false, stdio }: { asJson?: boolean; stdio?:
};
const getOutdatedDependencies = (): OutdatedDependency[] => {
const output = execYarnOutdated({ asJson: true });
const output = execOutdatedCmd({ asJson: true });
if (output === null) {
return [];
}
const lines = output.split('\n');
const outdatedPackages = lines
.map((line) => {
try {
return JSON.parse(line);
} catch (error) {
return null;
}
})
.filter(Boolean)
.filter((item) => item.type === 'table')
.flatMap((item) => item.data.body);
const outdatedPayload = JSON.parse(output) as Record<string, OutdatedPayload>;
const outdatedPackages = Object.entries(outdatedPayload).map(([name, info]) => ({
name,
...info,
}));
return outdatedPackages
.map(([name, current, , latest, packageType]) => ({
name,
packageType,
isMajorUpdate: current.split('.')[0] !== latest.split('.')[0],
.map((dependency) => ({
...dependency,
isMajorUpdate: dependency.current.split('.')[0] !== dependency.latest.split('.')[0],
}))
.filter(({ packageType }) => PACKAGE_TYPES.includes(packageType))
.toSorted((a, b) => a.packageType.localeCompare(b.packageType));
.filter(({ dependencyType }) => PACKAGE_TYPES.includes(dependencyType))
.toSorted((a, b) => a.dependencyType.localeCompare(b.dependencyType));
};
const log = (...args: Parameters<typeof console.log>) => console.log('updateDependencies:', ...args);
@@ -108,7 +105,7 @@ const updateDependencies = () => {
return;
}
execYarnOutdated({ stdio: 'inherit' });
execOutdatedCmd({ stdio: 'inherit' });
if (!autoUpdatableDependencies.length) {
log('no automatically updatable dependencies found');
@@ -117,25 +114,17 @@ const updateDependencies = () => {
log('updating dependencies with non breaking changes...');
setCaretForDependencies('add', autoUpdatableDependencies);
updateVersionsInPackageJson(autoUpdatableDependencies);
execSync('pnpm', { stdio: 'inherit' });
log('syncing package.json with yarn.lock...');
execSync('pnpm up --latest --lockfile-only', { stdio: 'inherit' });
log('updating yarn.lock after syncing package.json...');
execSync('pnpm', { stdio: 'inherit' });
execSync('pnpm i', { stdio: 'inherit' });
log('commiting changes...');
execSync('git add package.json yarn.lock && git commit -m "Update dependencies"', { stdio: 'inherit' });
execSync('git add package.json pnpm-lock.yaml && git commit -m "Update dependencies"', { stdio: 'inherit' });
log('updated dependencies with non breaking changes. Check dependencies with breaking changes listed below:');
execYarnOutdated({ stdio: 'inherit' });
execOutdatedCmd({ stdio: 'inherit' });
};
updateDependencies();