62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
/**
|
|
* Configuration for a single watcher
|
|
*/
|
|
export interface IWatcherConfig {
|
|
/** Name for this watcher (used in logging) */
|
|
name: string;
|
|
/** Glob pattern(s) to watch */
|
|
watch: string | string[];
|
|
/** Shell command to execute on changes */
|
|
command?: string;
|
|
/** If true, kill previous process before restarting (default: true) */
|
|
restart?: boolean;
|
|
/** Debounce delay in ms (default: 300) */
|
|
debounce?: number;
|
|
/** If true, run the command immediately on start (default: true) */
|
|
runOnStart?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Configuration for the development server
|
|
*/
|
|
export interface IServerConfig {
|
|
/** Whether the server is enabled */
|
|
enabled: boolean;
|
|
/** Server port (default: 3002) */
|
|
port?: number;
|
|
/** Directory to serve (default: ./dist_watch/) */
|
|
serveDir?: string;
|
|
/** Whether to inject live reload script (default: true) */
|
|
liveReload?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Configuration for a bundle operation
|
|
*/
|
|
export interface IBundleConfig {
|
|
/** Name for this bundle (used in logging) */
|
|
name?: string;
|
|
/** Entry point file */
|
|
from: string;
|
|
/** Output file */
|
|
to: string;
|
|
/** Additional patterns to watch that trigger this bundle */
|
|
watchPatterns?: string[];
|
|
/** If true, trigger server reload after bundling (default: true) */
|
|
triggerReload?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Main tswatch configuration
|
|
*/
|
|
export interface ITswatchConfig {
|
|
/** Array of watcher configurations */
|
|
watchers?: IWatcherConfig[];
|
|
/** Development server configuration */
|
|
server?: IServerConfig;
|
|
/** Bundle configurations */
|
|
bundles?: IBundleConfig[];
|
|
/** Use a preset configuration (overridden by explicit watchers/server/bundles) */
|
|
preset?: 'element' | 'website' | 'npm' | 'service' | 'test';
|
|
}
|