Skip to content

Commit f7ff37f

Browse files
committed
revert to delete frontmatter fields method.
1 parent 3cd5e5b commit f7ff37f

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/cli/translate.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,8 @@ export const translateCommand = new Command('translate')
550550
additionalPrompts: sourceFrontmatter.i18n?.additionalPrompts,
551551
})
552552

553-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
554-
const { i18n: _, ...newFrontmatter } = {
555-
...sourceFrontmatter,
556-
sourceSHA,
557-
}
553+
const newFrontmatter = { ...sourceFrontmatter, sourceSHA }
554+
delete newFrontmatter.i18n
558555

559556
const { data, content } = matter(targetContent)
560557
const typedData = data as I18nFrontmatter
@@ -574,18 +571,13 @@ export const translateCommand = new Command('translate')
574571
}
575572
}
576573

577-
const finalFrontmatter =
578-
typeof newFrontmatter.title === 'string'
579-
? newFrontmatter
580-
: (() => {
581-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
582-
const { title: _, ...rest } = newFrontmatter
583-
return rest
584-
})()
574+
if (typeof newFrontmatter.title !== 'string') {
575+
delete newFrontmatter.title
576+
}
585577

586578
targetContent = matter.stringify(
587579
content.startsWith('\n') ? content : '\n' + content,
588-
finalFrontmatter,
580+
newFrontmatter,
589581
)
590582

591583
await fs.mkdir(targetBase, { recursive: true })

0 commit comments

Comments
 (0)