Skip to content

Instantly share code, notes, and snippets.

@nhahv
Last active April 11, 2025 08:15
Show Gist options
  • Save nhahv/2f0b885e7bf74e9eb0651169bbf6389a to your computer and use it in GitHub Desktop.
Save nhahv/2f0b885e7bf74e9eb0651169bbf6389a to your computer and use it in GitHub Desktop.
Air-Verse Air
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Air-Verse Air configuration schema",
"description": "Schema for Air-Verse Air live-reload tool configuration files",
"type": "object",
"$defs": {
"colorEnum": {
"oneOf": [
{
"type": "string",
"enum": [
"black",
"red",
"green",
"yellow",
"blue",
"magenta",
"cyan",
"white",
"bright_black",
"bright_red",
"bright_green",
"bright_yellow",
"bright_blue",
"bright_magenta",
"bright_cyan",
"bright_white"
]
},
{
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}$"
}
]
}
},
"properties": {
"root": {
"type": "string",
"description": "Working directory (relative or absolute path)",
"default": "."
},
"tmp_dir": {
"type": "string",
"description": "Temporary directory for build artifacts",
"default": "tmp"
},
"build": {
"type": "object",
"description": "Build configuration for the application",
"properties": {
"pre_cmd": {
"type": "array",
"items": {
"type": "string"
},
"description": "Commands to run before each build",
"examples": [
[
"echo 'Pre-build command'",
"echo 'hello air' > pre_cmd.txt"
]
],
"additional_info": "This can include any shell commands."
},
"cmd": {
"type": "string",
"description": "Command to build the application",
"examples": [
"go build -o app main.go"
]
},
"post_cmd": {
"type": "array",
"items": {
"type": "string"
},
"description": "Commands to run after stopping the application",
"examples": [
[
"echo 'Post-build command'",
"echo 'hello air' > post_cmd.txt"
]
]
},
"bin": {
"type": "string",
"description": "Path to the binary file generated by the build command",
"examples": [
"./tmp/main"
]
},
"full_bin": {
"type": "string",
"description": "Full binary command with environment variables",
"examples": [
"APP_ENV=dev APP_USER=air ./tmp/main"
]
},
"args_bin": {
"type": "array",
"items": {
"type": "string"
},
"description": "Add additional arguments when running binary (bin/full_bin). Will run './tmp/main hello world'",
"examples": [
[
"hello",
"world"
]
]
},
"include_ext": {
"type": "array",
"items": {
"type": "string"
},
"description": "File extensions to watch",
"examples": [
[
"go",
"tpl",
"tmpl",
"html"
]
]
},
"exclude_dir": {
"type": "array",
"items": {
"type": "string"
},
"description": "Directories to exclude from watching",
"examples": [
[
"vendor",
"node_modules"
]
]
},
"include_dir": {
"type": "array",
"items": {
"type": "string"
},
"description": "Specific directories to watch",
"examples": [
[
"src",
"assets"
]
]
},
"include_file": {
"type": "array",
"items": {
"type": "string"
},
"description": "Specific files to watch",
"examples": [
[
"config.json",
"main.go"
]
]
},
"exclude_file": {
"type": "array",
"items": {
"type": "string"
},
"description": "Specific files to exclude from watching",
"examples": [
[
"ignore.txt",
"temp.log"
]
]
},
"exclude_regex": {
"type": "array",
"items": {
"type": "string"
},
"description": "Regular expressions for excluding files",
"examples": [
[
".*\\.log$",
".*\\.tmp$"
]
]
},
"exclude_unchanged": {
"type": "boolean",
"description": "Exclude unchanged files from triggering builds"
},
"follow_symlink": {
"type": "boolean",
"description": "Follow symbolic links for directories",
"default": true
},
"log": {
"type": "string",
"description": "This log file is placed in your tmp_dir",
"examples": [
"air.log"
]
},
"poll": {
"type": "boolean",
"description": "Poll files for changes instead of using fsnotify",
"default": false
},
"poll_interval": {
"type": "integer",
"description": "Poll interval (defaults to the minimum interval of 500ms)",
"default": 500
},
"delay": {
"type": "integer",
"description": "Delay before triggering a build in milliseconds",
"$comment": "It's not necessary to trigger build each time file changes if it's too frequent.",
"default": 0
},
"stop_on_error": {
"type": "boolean",
"description": "Stop running old binary when build errors occur",
"default": true
},
"send_interrupt": {
"type": "boolean",
"description": "Send Interrupt signal before killing process (windows does not support this feature)",
"default": false
},
"kill_delay": {
"type": "integer",
"description": "Delay after sending interrupt signal in nanoseconds",
"default": 500
},
"rerun": {
"type": "boolean",
"description": "Rerun binary after execution",
"default": false
},
"rerun_delay": {
"type": "integer",
"description": "Delay after each execution in milliseconds"
}
},
"required": [
"cmd",
"bin"
]
},
"log": {
"type": "object",
"properties": {
"time": {
"type": "boolean",
"description": "Show log time",
"default": false
},
"main_only": {
"type": "boolean",
"description": "Only show main log (silences watcher, build, runner)",
"default": false
},
"silent": {
"type": "boolean",
"description": "Silence all logs produced by Air",
"default": false
}
}
},
"color": {
"type": "object",
"properties": {
"main": {
"type": "string",
"description": "Color for main logs",
"$ref": "#/$defs/colorEnum"
},
"watcher": {
"type": "string",
"description": "Color for watcher logs",
"$ref": "#/$defs/colorEnum"
},
"build": {
"type": "string",
"description": "Color for build logs",
"$ref": "#/$defs/colorEnum"
},
"runner": {
"type": "string",
"description": "Color for runner logs",
"$ref": "#/$defs/colorEnum"
}
}
},
"misc": {
"type": "object",
"properties": {
"clean_on_exit": {
"type": "boolean",
"description": "Delete temporary directory on exit"
}
}
},
"screen": {
"type": "object",
"properties": {
"clear_on_rebuild": {
"type": "boolean",
"description": "Clear screen on rebuild"
},
"keep_scroll": {
"type": "boolean",
"description": "Keep scroll position after rebuild"
}
}
},
"proxy": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "Enable live-reloading on the browser"
},
"proxy_port": {
"type": "integer",
"description": "Port for the proxy server"
},
"app_port": {
"type": "integer",
"description": "Port for the application server"
}
}
}
},
"required": [
"build"
]
}
{
"$schema": "https://json.schemastore.org/schema-catalog",
"version": 1.0,
"schemas": [
{
"name": "🟢 Air Verse Live Reload Config",
"description": "Schema for .air.toml configuration used by github.com/air-verse/air",
"fileMatch": [".air.toml"],
"url": "./air-verse-air-schema.json"
},
{
"name": "🟠 Air Verse Live Reload Config Fixed",
"description": "Schema for .air.toml configuration used by github.com/air-verse/air",
"fileMatch": [".air.toml"],
"url": "https://gist.githubusercontent.com/nhahv/2f0b885e7bf74e9eb0651169bbf6389a/raw/b3fdd6fe11e699ed63feed86a898122db67ace0a/air-verse-air-schema.json"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment