BREAKING CHANGE(tswatch): refactor tswatch to a config-driven design (load config from npmextra.json) and add interactive init wizard; change TsWatch public API and enhance Watcher behavior
This commit is contained in:
61
ts/interfaces/interfaces.config.ts
Normal file
61
ts/interfaces/interfaces.config.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 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';
|
||||
}
|
||||
Reference in New Issue
Block a user