Migrate project to pnpm monorepo
Restructure the repository into a pnpm workspace under packages/ (core, webui, runtime). Move source files for core and webui into packages/*, add package manifests for @snowluma/core and @snowluma/runtime, and remove the old launcher package.json. Update root package.json to be a monorepo controller (scripts delegate to pnpm filters, set packageManager and Node engine). Configure build outputs to emit into the repo-root dist/ (vite config changes) so the existing release pipeline continues to work. Add .npmrc with mirrors, expand .gitignore for monorepo layout, add tsconfig base and package-level tsconfigs, and add vitest config for the core package. Adjust injector native search paths and update tests import paths to the new package layout. Small CI/workflow comment added to clarify build behavior and README updated with monorepo structure and common commands.
This commit is contained in:
1 parent
6bba36bba6
commit
39f1672b29
122 files changed
+279
-85
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { X } from 'lucide-react';
|
||||
import { motion } from 'framer-motion';
|
||||
|
||||
interface EndpointRowProps {
|
||||
onRemove: () => void;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export function EndpointRow({ onRemove, children }: EndpointRowProps) {
|
||||
return (
|
||||
<div
|
||||
className="flex items-end gap-3 px-5 py-4"
|
||||
style={{ borderBottom: '1px solid var(--border-subtle)', transition: 'var(--transition-fast)' }}
|
||||
>
|
||||
{children}
|
||||
<motion.button
|
||||
whileHover={{ scale: 1.1 }}
|
||||
whileTap={{ scale: 0.9 }}
|
||||
onClick={onRemove}
|
||||
className="size-7 shrink-0 flex items-center justify-center rounded-lg cursor-pointer mb-0.5"
|
||||
style={{ color: 'var(--text-tertiary)', transition: 'var(--transition-fast)' }}
|
||||
onMouseEnter={e => { e.currentTarget.style.color = 'var(--color-danger)'; e.currentTarget.style.background = 'rgba(248,113,113,0.08)'; }}
|
||||
onMouseLeave={e => { e.currentTarget.style.color = 'var(--text-tertiary)'; e.currentTarget.style.background = 'transparent'; }}
|
||||
>
|
||||
<X size={14} />
|
||||
</motion.button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
interface FieldInputProps {
|
||||
label: string;
|
||||
placeholder?: string;
|
||||
value?: string | number;
|
||||
isNum?: boolean;
|
||||
flex?: string;
|
||||
grow?: boolean;
|
||||
onChange: (v: string | number) => void;
|
||||
}
|
||||
|
||||
export function FieldInput({ label, placeholder, value, isNum, flex, grow, onChange }: FieldInputProps) {
|
||||
return (
|
||||
<div className={`flex flex-col gap-1.5 ${grow ? 'flex-1' : flex || ''}`}>
|
||||
<label className="text-xs font-medium pl-0.5" style={{ color: 'var(--text-secondary)' }}>{label}</label>
|
||||
<input
|
||||
type={isNum ? 'number' : 'text'}
|
||||
placeholder={placeholder}
|
||||
value={value ?? ''}
|
||||
onChange={e => onChange(isNum ? (parseInt(e.target.value) || 0) : e.target.value)}
|
||||
className="h-9 px-3 rounded-lg text-sm outline-none"
|
||||
style={{
|
||||
background: 'rgba(0,0,0,0.12)',
|
||||
border: '1px solid var(--border-subtle)',
|
||||
boxShadow: 'inset 0 2px 4px rgba(0,0,0,0.05)',
|
||||
color: 'var(--text-primary)',
|
||||
transition: 'all 0.3s ease',
|
||||
...(isNum ? { fontVariantNumeric: 'tabular-nums', fontFamily: 'var(--font-mono, monospace)' } : {}),
|
||||
}}
|
||||
onFocus={e => { e.target.style.borderColor = 'var(--border-focus)'; e.target.style.boxShadow = '0 0 0 2px var(--accent-subtle)'; }}
|
||||
onBlur={e => { e.target.style.borderColor = 'var(--border-subtle)'; e.target.style.boxShadow = 'inset 0 2px 4px rgba(0,0,0,0.05)'; }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
interface SectionCardProps {
|
||||
title: string;
|
||||
onAdd: () => void;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export function SectionCard({ title, onAdd, children }: SectionCardProps) {
|
||||
const { resolved } = useTheme();
|
||||
const dark = resolved === 'dark';
|
||||
return (
|
||||
<div
|
||||
className="rounded-xl overflow-hidden relative"
|
||||
style={{
|
||||
background: dark ? 'rgba(8,12,19,0.4)' : 'rgba(255,255,255,0.4)',
|
||||
border: '1px solid',
|
||||
borderColor: dark ? 'rgba(255,255,255,0.06)' : 'rgba(255,255,255,0.8)',
|
||||
backdropFilter: 'blur(32px) saturate(1.2)',
|
||||
WebkitBackdropFilter: 'blur(32px) saturate(1.2)',
|
||||
boxShadow: dark
|
||||
? '0 8px 32px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.06)'
|
||||
: '0 8px 24px rgba(15,23,42,0.04), inset 0 1px 1px rgba(255,255,255,0.5)',
|
||||
transition: 'var(--transition-base)',
|
||||
}}
|
||||
>
|
||||
{/* Header */}
|
||||
<div
|
||||
className="flex items-center justify-between px-5 py-3"
|
||||
style={{ borderBottom: '1px solid var(--border-subtle)' }}
|
||||
>
|
||||
<h3 className="text-sm font-medium" style={{ color: 'var(--text-primary)' }}>{title}</h3>
|
||||
<motion.button
|
||||
whileHover={{ scale: 1.1 }}
|
||||
whileTap={{ scale: 0.9 }}
|
||||
onClick={onAdd}
|
||||
className="size-7 flex items-center justify-center rounded-lg cursor-pointer"
|
||||
style={{ color: 'var(--text-secondary)', transition: 'var(--transition-fast)' }}
|
||||
>
|
||||
<Plus size={14} />
|
||||
</motion.button>
|
||||
</div>
|
||||
|
||||
{/* Body */}
|
||||
<div>
|
||||
{!children ? (
|
||||
<p className="text-xs px-5 py-6 text-center" style={{ color: 'var(--text-tertiary)' }}>未配置,点击 + 新增</p>
|
||||
) : children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
interface StatCardProps {
|
||||
label: string;
|
||||
value: string;
|
||||
icon?: ReactNode;
|
||||
accent?: 'default' | 'success' | 'warning' | 'danger';
|
||||
}
|
||||
|
||||
const accentColors: Record<string, { icon: string; value: string; glow: string }> = {
|
||||
default: { icon: 'var(--accent)', value: 'var(--text-primary)', glow: 'var(--accent-glow)' },
|
||||
success: { icon: 'var(--color-success)', value: 'var(--color-success)', glow: 'rgba(52,211,153,0.1)' },
|
||||
warning: { icon: 'var(--color-warning)', value: 'var(--color-warning)', glow: 'rgba(251,191,36,0.1)' },
|
||||
danger: { icon: 'var(--color-danger)', value: 'var(--color-danger)', glow: 'rgba(248,113,113,0.1)' },
|
||||
};
|
||||
|
||||
export function StatCard({ label, value, icon, accent = 'default' }: StatCardProps) {
|
||||
const colors = accentColors[accent];
|
||||
const { resolved } = useTheme();
|
||||
const dark = resolved === 'dark';
|
||||
return (
|
||||
<motion.div
|
||||
whileHover={{ y: -2 }}
|
||||
transition={{ duration: 0.2 }}
|
||||
className="relative rounded-xl p-5 group overflow-hidden"
|
||||
style={{
|
||||
background: dark ? 'rgba(8,12,19,0.4)' : 'rgba(255,255,255,0.4)',
|
||||
border: '1px solid',
|
||||
borderColor: dark ? 'rgba(255,255,255,0.06)' : 'rgba(255,255,255,0.8)',
|
||||
backdropFilter: 'blur(32px) saturate(1.2)',
|
||||
WebkitBackdropFilter: 'blur(32px) saturate(1.2)',
|
||||
boxShadow: dark
|
||||
? '0 8px 32px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.06)'
|
||||
: '0 8px 24px rgba(15,23,42,0.04), inset 0 1px 1px rgba(255,255,255,0.5)',
|
||||
transition: 'var(--transition-base)',
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center justify-between mb-3">
|
||||
<span className="text-xs font-medium uppercase tracking-wider" style={{ color: 'var(--text-secondary)' }}>
|
||||
{label}
|
||||
</span>
|
||||
{icon && (
|
||||
<div
|
||||
className="size-8 rounded-lg flex items-center justify-center"
|
||||
style={{ background: colors.glow, color: colors.icon }}
|
||||
>
|
||||
{icon}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className="text-2xl font-bold tracking-tight"
|
||||
style={{ color: colors.value, fontVariantNumeric: 'tabular-nums' }}
|
||||
>
|
||||
{value}
|
||||
</div>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
interface StatusBadgeProps {
|
||||
status: string;
|
||||
}
|
||||
|
||||
export function StatusBadge({ status }: StatusBadgeProps) {
|
||||
const isOnline = status === '已连接';
|
||||
const isConnecting = status === '连接中';
|
||||
|
||||
const dotColor = isOnline
|
||||
? 'var(--color-success)'
|
||||
: isConnecting
|
||||
? 'var(--color-warning)'
|
||||
: 'var(--text-tertiary)';
|
||||
|
||||
return (
|
||||
<span
|
||||
className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[11px] font-medium"
|
||||
style={{ color: dotColor, background: `color-mix(in srgb, ${dotColor} 10%, transparent)`, border: `1px solid color-mix(in srgb, ${dotColor} 20%, transparent)` }}
|
||||
>
|
||||
<span
|
||||
className={`size-1.5 rounded-full shrink-0 ${isOnline ? 'animate-pulse' : ''}`}
|
||||
style={{ background: dotColor }}
|
||||
/>
|
||||
{status}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user