mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-15 19:22:52 +02:00
✨ feat: add new post creation script and theme update script, remove git-protect.list and sync-upstream.sh
- Deleted `README-zh.md` and `README.md` as they are no longer needed. - Removed `git-protect.list` to streamline the synchronization process. - Introduced `new-post.ts` script for easier blog post creation with default metadata. - Added `update-theme.ts` script to simplify theme updates from the upstream repository. - Updated content configuration to handle optional updated dates correctly. - Adjusted pin values in theme guide documents to allow a range from 0-99 instead of 1-99.
This commit is contained in:
parent
886c959183
commit
2f80ab9523
17 changed files with 494 additions and 573 deletions
32
scripts/update-theme.ts
Executable file
32
scripts/update-theme.ts
Executable file
|
@ -0,0 +1,32 @@
|
|||
import { execSync } from 'node:child_process'
|
||||
import process from 'node:process'
|
||||
|
||||
// pnpm update-theme
|
||||
|
||||
// Check and set up the remote repository
|
||||
try {
|
||||
execSync('git remote get-url upstream', { stdio: 'ignore' })
|
||||
}
|
||||
catch {
|
||||
execSync('git remote add upstream https://github.com/radishzzz/astro-theme-retypeset.git', { stdio: 'inherit' })
|
||||
}
|
||||
|
||||
// Update theme from upstream repository
|
||||
try {
|
||||
execSync('git fetch upstream', { stdio: 'inherit' })
|
||||
|
||||
const beforeHash = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim()
|
||||
execSync('git merge upstream/main', { stdio: 'inherit' })
|
||||
const afterHash = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim()
|
||||
|
||||
if (beforeHash === afterHash) {
|
||||
console.log('✅ Already up to date')
|
||||
}
|
||||
else {
|
||||
console.log('✨ Updated successfully')
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error('❌ Update failed:', error)
|
||||
process.exit(1)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue