From c28f787c399b40cdce3b9f980eb1c9c8d2bf6a15 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 13:29:39 +0200 Subject: [PATCH] [docs] Use date library version from package dev dependencies for sandboxes (@LukasTy) (#15767) Signed-off-by: Lukas Tyla Co-authored-by: Lukas Tyla --- docs/src/modules/utils/postProcessImport.test.ts | 9 +++++---- docs/src/modules/utils/postProcessImport.ts | 14 +++----------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/docs/src/modules/utils/postProcessImport.test.ts b/docs/src/modules/utils/postProcessImport.test.ts index b582e1df32d17..33caa66823e3b 100644 --- a/docs/src/modules/utils/postProcessImport.test.ts +++ b/docs/src/modules/utils/postProcessImport.test.ts @@ -1,5 +1,6 @@ import { expect } from 'chai'; -import { DATE_ADAPTER_VERSIONS, ADAPTER_TO_LIBRARY, postProcessImport } from './postProcessImport'; +import pickersPackageJson from '../../../../packages/x-date-pickers/package.json'; +import { ADAPTER_TO_LIBRARY, postProcessImport } from './postProcessImport'; describe('postProcessImport', () => { const ADAPTERS = ['AdapterDateFns', 'AdapterDayjs', 'AdapterLuxon', 'AdapterMoment']; @@ -11,7 +12,7 @@ describe('postProcessImport', () => { const expectedLibrary = ADAPTER_TO_LIBRARY[adapter]; expect(resolvedDep).to.deep.equal({ - [expectedLibrary]: DATE_ADAPTER_VERSIONS[expectedLibrary], + [expectedLibrary]: pickersPackageJson.devDependencies[expectedLibrary], }); }); }); @@ -30,7 +31,7 @@ describe('postProcessImport', () => { const expectedLibrary = ADAPTER_TO_LIBRARY[adapter]; expect(resolvedDep).to.deep.equal({ - [expectedLibrary]: DATE_ADAPTER_VERSIONS[expectedLibrary], + [expectedLibrary]: pickersPackageJson.devDependencies[expectedLibrary], }); }); }); @@ -49,7 +50,7 @@ describe('postProcessImport', () => { const expectedLibrary = ADAPTER_TO_LIBRARY[adapter]; expect(resolvedDep).to.deep.equal({ - [expectedLibrary]: DATE_ADAPTER_VERSIONS[expectedLibrary], + [expectedLibrary]: pickersPackageJson.devDependencies[expectedLibrary], }); }); }); diff --git a/docs/src/modules/utils/postProcessImport.ts b/docs/src/modules/utils/postProcessImport.ts index 6366a0be16c04..696bad5a56b7a 100644 --- a/docs/src/modules/utils/postProcessImport.ts +++ b/docs/src/modules/utils/postProcessImport.ts @@ -1,14 +1,6 @@ -export const DATE_ADAPTER_VERSIONS: Record = { - 'date-fns': '^2.30.0', - 'date-fns-jalali': '^2.30.0-0', - dayjs: '^1.11.10', - luxon: '^3.4.4', - moment: '^2.29.4', - 'moment-hijri': '^2.1.2', - 'moment-jalaali': '^0.10.0', -} as const; +import pickersPackageJson from '../../../../packages/x-date-pickers/package.json'; -export const ADAPTER_TO_LIBRARY: Record = { +export const ADAPTER_TO_LIBRARY: Record = { AdapterDateFns: 'date-fns', AdapterDateFnsJalali: 'date-fns-jalali', AdapterDayjs: 'dayjs', @@ -34,7 +26,7 @@ export const postProcessImport = (importName: string): Record | `Can't determine required npm package for adapter '${dateAdapterMatch[1]}'`, ); } - return { [packageName]: DATE_ADAPTER_VERSIONS[packageName] ?? 'latest' }; + return { [packageName]: pickersPackageJson.devDependencies[packageName] ?? 'latest' }; } return null; };