From b37af47dca080b3f1d6505602f79c86bde08c57b Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Wed, 8 Oct 2025 01:29:20 +0800 Subject: [PATCH] feat(theme): add collection breaking change log --- theme/src/node/detector/breakingChange.ts | 6 +++--- theme/src/node/detector/index.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/theme/src/node/detector/breakingChange.ts b/theme/src/node/detector/breakingChange.ts index 9cbf7f0d..f2e3c8a4 100644 --- a/theme/src/node/detector/breakingChange.ts +++ b/theme/src/node/detector/breakingChange.ts @@ -26,17 +26,17 @@ export function detectBreakingChange(options: ThemeOptions): void { * @description 博客和笔记已经被删除,迁移到 collections 实现 */ function withBlogAndNotesHaveBeenDelete(options: ThemeOptions): void { - if ('blog' in options && options.collections?.length === 0) { + if ('blog' in options && (!options.collections || options.collections.length === 0)) { logger.warn(t('blog')) } let shouldMigrateNotes = false - if ((options.notes as any)?.length && options.collections?.length === 0) { + if ((options.notes as any)?.length && (!options.collections || options.collections.length === 0)) { shouldMigrateNotes = true } for (const locale of Object.values(options.locales || {})) { - if ((locale.notes as any)?.length && locale.collections?.length === 0) { + if ((locale.notes as any)?.length && (!locale.collections || locale.collections.length === 0)) { shouldMigrateNotes = true } } diff --git a/theme/src/node/detector/index.ts b/theme/src/node/detector/index.ts index eff7375d..a7364d96 100644 --- a/theme/src/node/detector/index.ts +++ b/theme/src/node/detector/index.ts @@ -1,3 +1,4 @@ +export * from './breakingChange.js' export * from './fields.js' export * from './options.js' export * from './versions.js'