style: 将 biome lineWidth 从默认 80 调整为 120
This commit is contained in:
@@ -28,8 +28,7 @@ const sidecar = createSidecarRuntime({
|
||||
},
|
||||
})
|
||||
|
||||
const toErrorMessage = (error: unknown): string =>
|
||||
error instanceof Error ? error.message : String(error)
|
||||
const toErrorMessage = (error: unknown): string => (error instanceof Error ? error.message : String(error))
|
||||
|
||||
const canOpenExternally = (url: string): boolean => {
|
||||
try {
|
||||
|
||||
@@ -29,12 +29,9 @@ type SidecarRuntime = {
|
||||
stop: () => void
|
||||
}
|
||||
|
||||
const sleep = (ms: number): Promise<void> =>
|
||||
new Promise((resolve) => setTimeout(resolve, ms))
|
||||
const sleep = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms))
|
||||
|
||||
const isProcessAlive = (
|
||||
processToCheck: ChildProcess | null,
|
||||
): processToCheck is ChildProcess => {
|
||||
const isProcessAlive = (processToCheck: ChildProcess | null): processToCheck is ChildProcess => {
|
||||
if (!processToCheck || !processToCheck.pid) {
|
||||
return false
|
||||
}
|
||||
@@ -81,11 +78,7 @@ const isServerReady = async (url: string): Promise<boolean> => {
|
||||
return false
|
||||
}
|
||||
|
||||
const waitForServer = async (
|
||||
url: string,
|
||||
isQuitting: () => boolean,
|
||||
processRef?: ChildProcess,
|
||||
): Promise<boolean> => {
|
||||
const waitForServer = async (url: string, isQuitting: () => boolean, processRef?: ChildProcess): Promise<boolean> => {
|
||||
const start = Date.now()
|
||||
while (Date.now() - start < SERVER_READY_TIMEOUT_MS && !isQuitting()) {
|
||||
if (processRef && processRef.exitCode !== null) {
|
||||
@@ -119,9 +112,7 @@ const formatUnexpectedStopMessage = (
|
||||
return `Server process exited unexpectedly (code ${code ?? 'unknown'}, signal ${signal ?? 'none'}).`
|
||||
}
|
||||
|
||||
export const createSidecarRuntime = (
|
||||
options: SidecarRuntimeOptions,
|
||||
): SidecarRuntime => {
|
||||
export const createSidecarRuntime = (options: SidecarRuntimeOptions): SidecarRuntime => {
|
||||
const state: SidecarState = {
|
||||
process: null,
|
||||
startup: null,
|
||||
@@ -162,9 +153,7 @@ export const createSidecarRuntime = (
|
||||
resetState(processRef)
|
||||
|
||||
if (!options.isQuitting() && hadReadyServer) {
|
||||
options.onUnexpectedStop(
|
||||
'The background service crashed unexpectedly. Please restart the app.',
|
||||
)
|
||||
options.onUnexpectedStop('The background service crashed unexpectedly. Please restart the app.')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -180,9 +169,7 @@ export const createSidecarRuntime = (
|
||||
resetState(processRef)
|
||||
|
||||
if (!options.isQuitting() && hadReadyServer) {
|
||||
options.onUnexpectedStop(
|
||||
formatUnexpectedStopMessage(options.isPackaged, code, signal),
|
||||
)
|
||||
options.onUnexpectedStop(formatUnexpectedStopMessage(options.isPackaged, code, signal))
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -222,11 +209,7 @@ export const createSidecarRuntime = (
|
||||
state.process = processRef
|
||||
attachLifecycleHandlers(processRef)
|
||||
|
||||
const ready = await waitForServer(
|
||||
nextServerUrl,
|
||||
options.isQuitting,
|
||||
processRef,
|
||||
)
|
||||
const ready = await waitForServer(nextServerUrl, options.isQuitting, processRef)
|
||||
if (ready && isProcessAlive(processRef)) {
|
||||
state.url = nextServerUrl
|
||||
return nextServerUrl
|
||||
@@ -253,9 +236,7 @@ export const createSidecarRuntime = (
|
||||
|
||||
const ready = await waitForServer(options.devServerUrl, options.isQuitting)
|
||||
if (!ready) {
|
||||
throw new Error(
|
||||
'Dev server not responding. Run `bun dev` in apps/server first.',
|
||||
)
|
||||
throw new Error('Dev server not responding. Run `bun dev` in apps/server first.')
|
||||
}
|
||||
|
||||
return options.devServerUrl
|
||||
|
||||
@@ -13,12 +13,7 @@ export const SplashApp = () => {
|
||||
ease: [0.16, 1, 0.3, 1],
|
||||
}}
|
||||
>
|
||||
<img
|
||||
alt="Logo"
|
||||
className="h-20 w-auto object-contain"
|
||||
draggable={false}
|
||||
src={logoImage}
|
||||
/>
|
||||
<img alt="Logo" className="h-20 w-auto object-contain" draggable={false} src={logoImage} />
|
||||
|
||||
<div className="relative h-[4px] w-36 overflow-hidden rounded-full bg-zinc-100">
|
||||
<motion.div
|
||||
|
||||
Reference in New Issue
Block a user