Skip to content

Latest commit

 

History

History
178 lines (131 loc) · 4.02 KB

doc.md

File metadata and controls

178 lines (131 loc) · 4.02 KB

Here’s a structured and standardized breakdown of the YAML configuration as described, formatted to be clear and aligned with standard documentation practices:


Breakdown of the YAML Configuration

This document provides an overview of the configuration options available in the watch.yml file.

Top-Level Settings

  • 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.

watch Section

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 or dev).

watch.exclude

Specifies directories or files to exclude from watching.

  • exclude:
    • List of directories or files to be excluded from watch operations.
    • Example: node_modules, target.

watch.commands

Commands to execute at various stages.

  • before: Command to run before the main command.
    • Example: echo "Running pre-command".
  • after: Command to run after the main command.
    • Example: echo "Running post-command".

watch.debounce

Debounce time to wait before triggering actions after file changes, specified in milliseconds.

  • debounce:
    • Example: 500.

watch.log_level

Sets the logging level for the application.

  • log_level:
    • Possible values: error, warn, info, debug.
    • Example: info.

watch.environments Section

Contains configurations for different environments such as production (prod) and development (dev).

watch.environments.prod

Configuration for the production environment.

  • command: Command to run in production.
    • Example: node.
  • args: Arguments to pass to the production command.
    • Example: [app.js].
  • env: Environment variables for production.
    • Example:
      env:
        NODE_ENV: production

watch.environments.dev

Configuration for the development environment.

  • command: Command to run in development.
    • Example: ts-node.
  • args: Arguments to pass to the development command.
    • Example: [app.ts].
  • env: Environment variables for development.
    • Example:
      env:
        NODE_ENV: development

watch.aliases Section

Defines custom commands (aliases) for common tasks.

  • build: Custom build command.
    • Example: cargo build.
  • test: Custom test command.
    • Example: cargo test.
  • lint: Custom lint command.
    • Example: cargo fmt -- --check.

watch.aliases.notify_on_success

Enables notifications on successful command completion.

  • notify_on_success:
    • Example: true.

watch.aliases.notify_on_failure

Enables notifications on command failure.

  • notify_on_failure:
    • Example: true.

watch.aliases.ignore_patterns

Patterns for files to ignore in the watch process.

  • ignore_patterns:
    • Example:
      ignore_patterns:
        - "*.tmp"
        - "*.log"

watch.aliases.color_output

Enables colored output in logs and notifications.

  • color_output:
    • Example: true.

Example YAML Configuration

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