Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/trueberryless/the-thinking-hub. The central knowledge hub for 8 key Computer Science thinking modes. the-thinking-hub.felixs.dev
Something went wrong. Try again.
1.4 kB · 46 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/usr/bin/env tsx
/** * Update theme from upstream repository * Usage: pnpm update-theme */
import { execSync } from 'node:child_process'import fs from 'node:fs'import path from 'node:path'import process from 'node:process'
// Check and set up the upstream remote repositorytry { execSync('git remote get-url upstream', { stdio: 'ignore' })} catch { execSync('git remote add upstream https://github.com/the3ash/astro-chiri.git', { stdio: 'inherit' })}
// Update theme from upstream repositorytry { execSync('git fetch upstream', { stdio: 'inherit' })
const currentCommit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim() execSync('git merge upstream/main --allow-unrelated-histories', { stdio: 'inherit' }) const newCommit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim()
if (currentCommit === newCommit) { console.log('🤗 No updates available, already up to date') } else { console.log('✅ Theme updated') }} catch (error) { // Check if there's a merge conflict const gitDirectory = execSync('git rev-parse --git-dir', { encoding: 'utf8' }).trim() const mergeHeadFile = path.join(gitDirectory, 'MERGE_HEAD')
if (fs.existsSync(mergeHeadFile)) { console.log('⚠️ Update fetched with merge conflicts. Please resolve manually') } else { console.error('❌ Update failed:', error) process.exit(1) }}