feat(theme): add collection breaking change log

This commit is contained in:
pengzhanbo 2025-10-08 01:29:20 +08:00
parent 2a8385f3aa
commit b37af47dca
2 changed files with 4 additions and 3 deletions

View File

@ -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
}
}

View File

@ -1,3 +1,4 @@
export * from './breakingChange.js'
export * from './fields.js'
export * from './options.js'
export * from './versions.js'