1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Add contentType frontmatter functionality to move-content script (#57050)

This commit is contained in:
Kevin Heis
2025-08-14 10:55:10 -07:00
committed by GitHub
parent b6302d16e7
commit 38427b759b

View File

@@ -505,8 +505,27 @@ function editFiles(files, updateParent, opts) {
}
}
// Add contentType frontmatter to moved files
if (files.length > 0) {
const filePaths = files.map(([oldPath, newPath, oldHref, newHref]) => newPath)
try {
const cmd = ['run', 'add-content-type', '--', '--paths', ...filePaths]
const result = execFileSync('npm', cmd, { cwd: process.cwd(), encoding: 'utf8' })
if (result.trim()) {
console.log(result.trim())
}
} catch (error) {
console.warn(`Warning: Failed to add contentType frontmatter: ${error.message}`)
}
}
if (useGit) {
const cmd = ['commit', '-a', '-m', `set ${REDIRECT_FROM_KEY} on ${files.length} files`]
const cmd = [
'commit',
'-a',
'-m',
`set ${REDIRECT_FROM_KEY} and contentType on ${files.length} files`,
]
execFileSync('git', cmd)
if (verbose) {
console.log(`git commit command: ${chalk.grey(cmd.join(' '))}`)