dependabot/npm_and_yarn/prettier-3.7.4
copilot/add-i18n-support-for-english
dependabot/npm_and_yarn/astro-5.16.4
dependabot/npm_and_yarn/katex-0.16.27
dependabot/npm_and_yarn/prettier-3.7.4
dependabot/npm_and_yarn/tailwindcss-4.1.16
dependabot/npm_and_yarn/tailwindcss/vite-4.1.16
dependabot/npm_and_yarn/typescript-eslint-8.46.2
dependabot/npm_and_yarn/typescript-eslint/parser-8.46.2
development
main
| 1 | #!/usr/bin/env tsx |
| 2 | |
| 3 | /** |
| 4 | * Update theme from upstream repository |
| 5 | * Usage: pnpm update-theme |
| 6 | */ |
| 7 | |
| 8 | import { execSync } from 'node:child_process' |
| 9 | import fs from 'node:fs' |
| 10 | import path from 'node:path' |
| 11 | import process from 'node:process' |
| 12 | |
| 13 | // Check and set up the upstream remote repository |
| 14 | try { |
| 15 | execSync('git remote get-url upstream', { stdio: 'ignore' }) |
| 16 | } catch { |
| 17 | execSync('git remote add upstream https://github.com/the3ash/astro-chiri.git', { |
| 18 | stdio: 'inherit' |
| 19 | }) |
| 20 | } |
| 21 | |
| 22 | // Update theme from upstream repository |
| 23 | try { |
| 24 | execSync('git fetch upstream', { stdio: 'inherit' }) |
| 25 | |
| 26 | const currentCommit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim() |
| 27 | execSync('git merge upstream/main --allow-unrelated-histories', { stdio: 'inherit' }) |
| 28 | const newCommit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim() |
| 29 | |
| 30 | if (currentCommit === newCommit) { |
| 31 | console.log('🤗 No updates available, already up to date') |
| 32 | } else { |
| 33 | console.log('✅ Theme updated') |
| 34 | } |
| 35 | } catch (error) { |
| 36 | // Check if there's a merge conflict |
| 37 | const gitDirectory = execSync('git rev-parse --git-dir', { encoding: 'utf8' }).trim() |
| 38 | const mergeHeadFile = path.join(gitDirectory, 'MERGE_HEAD') |
| 39 | |
| 40 | if (fs.existsSync(mergeHeadFile)) { |
| 41 | console.log('⚠️ Update fetched with merge conflicts. Please resolve manually') |
| 42 | } else { |
| 43 | console.error('❌ Update failed:', error) |
| 44 | process.exit(1) |
| 45 | } |
| 46 | } |