feat: Refactor service management scripts to use a unified dev script
- Added package.json to manage development scripts. - Updated restart-services.ps1 to call the new dev script for starting services. - Refactored start-admin.ps1, start-backend.ps1, start-frontend.ps1, and start-mcp.ps1 to utilize the dev script for starting respective services. - Enhanced stop-services.ps1 to improve process termination logic by matching command patterns.
This commit is contained in:
@@ -6,6 +6,7 @@ import FilterPill from '../../components/ui/FilterPill.astro';
|
||||
import { api, DEFAULT_SITE_SETTINGS } from '../../lib/api/client';
|
||||
import { getI18n, formatReadTime } from '../../lib/i18n';
|
||||
import type { Post } from '../../lib/types';
|
||||
import { getAccentVars, getCategoryTheme, getPostTypeTheme } from '../../lib/utils';
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
@@ -38,7 +39,7 @@ const latestYear = years[0] || 'all';
|
||||
<TerminalWindow title="~/timeline" class="w-full">
|
||||
<div class="px-4 py-4 space-y-6">
|
||||
<div>
|
||||
<CommandPrompt command="cat timeline.log" path="~" />
|
||||
<CommandPrompt command="tail -n +1 ~/timeline.log" path="~" />
|
||||
<div class="terminal-panel ml-4 mt-4">
|
||||
<div class="terminal-kicker">activity trace</div>
|
||||
<div class="terminal-section-title mt-4">
|
||||
@@ -56,7 +57,7 @@ const latestYear = years[0] || 'all';
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<CommandPrompt command="filter --by-year" path="~/timeline" />
|
||||
<CommandPrompt promptId="timeline-filter-prompt" command="cut -d'-' -f1 timeline.log | sort -ru" path="~/timeline" />
|
||||
<div class="ml-4 mt-4 flex flex-wrap gap-2">
|
||||
<FilterPill
|
||||
class="timeline-filter"
|
||||
@@ -82,7 +83,7 @@ const latestYear = years[0] || 'all';
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<CommandPrompt command="git log --oneline --all" path="~/timeline" />
|
||||
<CommandPrompt promptId="timeline-log-prompt" command="git log --oneline --date=short --all" path="~/timeline" />
|
||||
<div class="ml-4 mt-2 space-y-8">
|
||||
{years.map(year => (
|
||||
<div class="timeline-year-group relative" data-year={year}>
|
||||
@@ -102,7 +103,8 @@ const latestYear = years[0] || 'all';
|
||||
|
||||
<a
|
||||
href={`/articles/${post.slug}`}
|
||||
class="terminal-panel group flex items-start gap-4 p-4 hover:border-[var(--primary)] hover:translate-x-2 transition-all"
|
||||
class="terminal-panel terminal-panel-accent group flex items-start gap-4 p-4 hover:translate-x-2 transition-all"
|
||||
style={getAccentVars(getPostTypeTheme(post.type))}
|
||||
>
|
||||
<div class="terminal-panel-muted shrink-0 min-w-[72px] text-center py-3">
|
||||
<div class="text-[11px] uppercase tracking-[0.2em] text-[var(--text-tertiary)]">
|
||||
@@ -115,17 +117,16 @@ const latestYear = years[0] || 'all';
|
||||
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex flex-wrap items-center gap-2 mb-2">
|
||||
<span
|
||||
class="w-2 h-2 rounded-full"
|
||||
style={`background-color: ${post.type === 'article' ? 'var(--primary)' : 'var(--secondary)'}`}
|
||||
></span>
|
||||
<span class="terminal-chip terminal-chip--accent text-[10px] py-1 px-2" style={getAccentVars(getPostTypeTheme(post.type))}>
|
||||
{post.type === 'article' ? t('common.article') : t('common.tweet')}
|
||||
</span>
|
||||
<h3 class="font-bold text-[var(--title-color)] group-hover:text-[var(--primary)] transition-colors truncate text-lg">
|
||||
{post.title}
|
||||
</h3>
|
||||
</div>
|
||||
<p class="text-sm text-[var(--text-secondary)] line-clamp-2 leading-6">{post.description}</p>
|
||||
<div class="flex items-center gap-2 mt-2 flex-wrap">
|
||||
<span class="terminal-chip text-xs py-1 px-2.5">
|
||||
<span class="terminal-chip terminal-chip--accent text-xs py-1 px-2.5" style={getAccentVars(getCategoryTheme(post.category))}>
|
||||
{post.category}
|
||||
</span>
|
||||
<span class="terminal-chip text-xs py-1 px-2.5">
|
||||
@@ -143,7 +144,7 @@ const latestYear = years[0] || 'all';
|
||||
</div>
|
||||
|
||||
<div class="pt-4 border-t border-[var(--border-color)]">
|
||||
<a href="/" class="inline-flex items-center gap-2 text-[var(--text-secondary)] hover:text-[var(--primary)] transition-colors">
|
||||
<a href="/" class="terminal-subtle-link">
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
<span class="font-mono">cd ~</span>
|
||||
</a>
|
||||
@@ -154,23 +155,52 @@ const latestYear = years[0] || 'all';
|
||||
</Layout>
|
||||
|
||||
<script>
|
||||
declare global {
|
||||
interface Window {
|
||||
__termiCommandPrompt?: {
|
||||
set?: (promptId: string, command: string, options?: { typing?: boolean }) => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const filterButtons = document.querySelectorAll('.timeline-filter');
|
||||
const yearGroups = document.querySelectorAll('.timeline-year-group');
|
||||
const promptApi = window.__termiCommandPrompt;
|
||||
|
||||
function applyTimelineFilter(year: string | null, updateUi = true) {
|
||||
const selectedYear = year || 'all';
|
||||
const filterCommand = selectedYear === 'all'
|
||||
? "cut -d'-' -f1 timeline.log | sort -ru"
|
||||
: `grep '^${selectedYear}-' timeline.log`;
|
||||
const logCommand = selectedYear === 'all'
|
||||
? 'git log --oneline --date=short --all'
|
||||
: `git log --oneline --date=short --since '${selectedYear}-01-01' --until '${selectedYear}-12-31'`;
|
||||
|
||||
if (updateUi) {
|
||||
filterButtons.forEach((item) => {
|
||||
item.classList.toggle('is-active', item.getAttribute('data-year') === selectedYear);
|
||||
});
|
||||
|
||||
yearGroups.forEach((group) => {
|
||||
const matches = selectedYear === 'all' || group.getAttribute('data-year') === selectedYear;
|
||||
group.classList.toggle('hidden', !matches);
|
||||
});
|
||||
}
|
||||
|
||||
promptApi?.set?.('timeline-filter-prompt', filterCommand, { typing: false });
|
||||
promptApi?.set?.('timeline-log-prompt', logCommand, { typing: false });
|
||||
}
|
||||
|
||||
filterButtons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const year = button.getAttribute('data-year');
|
||||
|
||||
filterButtons.forEach(item => {
|
||||
item.classList.remove('is-active');
|
||||
});
|
||||
|
||||
button.classList.add('is-active');
|
||||
|
||||
yearGroups.forEach(group => {
|
||||
const matches = year === 'all' || group.getAttribute('data-year') === year;
|
||||
group.classList.toggle('hidden', !matches);
|
||||
});
|
||||
applyTimelineFilter(year);
|
||||
});
|
||||
});
|
||||
|
||||
const initialActiveYear =
|
||||
document.querySelector('.timeline-filter.is-active')?.getAttribute('data-year') ||
|
||||
new URL(window.location.href).searchParams.get('year') ||
|
||||
'all';
|
||||
applyTimelineFilter(initialActiveYear);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user