mirror of
https://github.com/wassname/talk.git
synced 2026-06-28 08:08:44 +08:00
044e1c2863
* wip * Adding chokidar and types * specifiying build tasks * new structure, new types, executor and watchers * Adding log * Fully implemented watchers * adapt vscode launc * Add .babelrc.js to toplevel tsconfig project * Typo * Get schema path from .graphqlconfig * Use watcher binary * Add joi validation to watcher * Remove fb-watchman for now * Use correct ignore path * Fix dist folder * Allow setting watcher * Per default only spawn one process at a time * Support runOnInit * Rename RestartingExecutor to LongRunningExecutor * Use debounce instead of throttle * Remove console log * Debounce command execution * Simplify debounce * Watcher name change * Typos * Rename "watcher" root level config to "backend"
51 lines
958 B
TypeScript
51 lines
958 B
TypeScript
import Joi from "joi";
|
|
|
|
export interface WatchOptions {
|
|
ignore?: ReadonlyArray<string>;
|
|
}
|
|
|
|
export interface Watcher {
|
|
watch(
|
|
paths: ReadonlyArray<string>,
|
|
options?: WatchOptions
|
|
): AsyncIterable<string>;
|
|
}
|
|
|
|
export interface Executor {
|
|
onInit?(): void;
|
|
onCleanup?(): void;
|
|
execute(filePath: string): void;
|
|
}
|
|
|
|
export interface Config {
|
|
rootDir?: string;
|
|
backend?: Watcher;
|
|
watchers: {
|
|
[key: string]: WatchConfig;
|
|
};
|
|
}
|
|
|
|
export interface WatchConfig {
|
|
paths: ReadonlyArray<string>;
|
|
ignore?: ReadonlyArray<string>;
|
|
executor: Executor;
|
|
}
|
|
|
|
export const configSchema = Joi.object({
|
|
rootDir: Joi.string().optional(),
|
|
backend: Joi.object().optional(),
|
|
watchers: Joi.object().pattern(
|
|
/.*/,
|
|
Joi.object({
|
|
paths: Joi.array()
|
|
.items(Joi.string())
|
|
.unique(),
|
|
ignore: Joi.array()
|
|
.items(Joi.string())
|
|
.unique()
|
|
.optional(),
|
|
executor: Joi.object(),
|
|
})
|
|
),
|
|
});
|