Here’s a structured and standardized breakdown of the YAML configuration as described, formatted to be clear and aligned with standard documentation practices:
This document provides an overview of the configuration options available in the watch.yml
file.
- name: The name of the application.
- version: The version number of the application.
- description: A brief description of the application.
- index: The main entry file of the application.
This section contains settings related to file watching and environment configuration.
- prod: Command to run for the production environment.
- dev: Command to run for the development environment.
- default: The default environment to use (e.g.,
prod
ordev
).
Specifies directories or files to exclude from watching.
- exclude:
- List of directories or files to be excluded from watch operations.
- Example:
node_modules
,target
.
Commands to execute at various stages.
- before: Command to run before the main command.
- Example:
echo "Running pre-command"
.
- Example:
- after: Command to run after the main command.
- Example:
echo "Running post-command"
.
- Example:
Debounce time to wait before triggering actions after file changes, specified in milliseconds.
- debounce:
- Example:
500
.
- Example:
Sets the logging level for the application.
- log_level:
- Possible values:
error
,warn
,info
,debug
. - Example:
info
.
- Possible values:
Contains configurations for different environments such as production (prod
) and development (dev
).
Configuration for the production environment.
- command: Command to run in production.
- Example:
node
.
- Example:
- args: Arguments to pass to the production command.
- Example:
[app.js]
.
- Example:
- env: Environment variables for production.
- Example:
env: NODE_ENV: production
- Example:
Configuration for the development environment.
- command: Command to run in development.
- Example:
ts-node
.
- Example:
- args: Arguments to pass to the development command.
- Example:
[app.ts]
.
- Example:
- env: Environment variables for development.
- Example:
env: NODE_ENV: development
- Example:
Defines custom commands (aliases) for common tasks.
- build: Custom build command.
- Example:
cargo build
.
- Example:
- test: Custom test command.
- Example:
cargo test
.
- Example:
- lint: Custom lint command.
- Example:
cargo fmt -- --check
.
- Example:
Enables notifications on successful command completion.
- notify_on_success:
- Example:
true
.
- Example:
Enables notifications on command failure.
- notify_on_failure:
- Example:
true
.
- Example:
Patterns for files to ignore in the watch process.
- ignore_patterns:
- Example:
ignore_patterns: - "*.tmp" - "*.log"
- Example:
Enables colored output in logs and notifications.
- color_output:
- Example:
true
.
- Example:
Here's an example configuration (watch.yml
):
name: Test App
version: 1
description: A test app
index: main.rs
watch:
prod: node
dev: ts-node
default: dev
exclude:
- "node_modules"
- "target"
commands:
before: echo "Running pre-command"
after: echo "Running post-command"
debounce: 500
log_level: info
environments:
prod:
command: node
args: [app.js]
env:
NODE_ENV: production
dev:
command: ts-node
args: [app.ts]
env:
NODE_ENV: development
aliases:
build: cargo build
test: cargo test
lint: cargo fmt -- --check
notify_on_success: true
notify_on_failure: true
ignore_patterns:
- "*.tmp"
- "*.log"
color_output: true