@builder.io/dev-tools
Version:
Builder.io Visual CMS Devtools
29 lines (28 loc) • 1.19 kB
TypeScript
import type { DevToolsSys } from "@builder.io/dev-tools/core";
import type { FusionConfig } from "$/ai-utils";
export interface LockFileData {
cwd: string;
projectId?: string;
branchId?: string;
pid: number;
createdAt: number;
port?: number;
}
export type LockConflictBehavior = "replace" | "exit" | "kill";
/**
* Registers a lock file to prevent multiple instances from running.
* - Checks if the lock file already exists
* - Handles conflicts based on the specified behavior:
* - 'exit': Exits with code -10 if lock exists
* - 'replace': Overwrites the existing lock file
* - 'kill': Kills the existing process and overwrites the lock file
* - Creates the lock file with process information
* - Automatically removes the lock file when the process exits
*
* @param sys - DevToolsSys for logging and Sentry integration
* @param lockFilePath - Absolute path where the lock file should be created
* @param conflictBehavior - How to handle existing lock files
* @param projectId - Optional project ID
* @param branchId - Optional branch ID/name
*/
export declare function registerLock(sys: DevToolsSys, fusionConfig: FusionConfig): Promise<void>;