air icon indicating copy to clipboard operation
air copied to clipboard

Wait X amount of time before looking for new changes

Open randallmlough opened this issue 1 year ago • 1 comments

Is there a way I can delay air from looking for changes after a rebuild? I run code generation (graphql code generation) before each rebuild, and one of the generated directories (resolvers) is non-destructive and intended to be edited. It doesnt overwrite what is currently there, just appends if needed. However, if I dont exclude this directory from being watched, I get stuck in an infinite loop of codegen -> rebuild -> codegen -> rebuild, etc.

Ideally I'm hoping there's a setting or combination of settings where I can tell air to disregard any changes prior to this amount of time thereby allowing code generation to happen without re triggering a rebuild.

I've tried messing with delay, rebuild_delay and a mixture of other combinations without any luck.

randallmlough avatar Feb 10 '24 21:02 randallmlough

It seems that you need to exclude all the generated files from templ like so

exclude_regex = [".*_templ.go"]

and for some reason when putting the templ generate command as a pre_cmd it gives still the error, so I did this

cmd = "templ generate && go build -o ./tmp/main ."

and everything worked perfectly.

Hope it helps

namzug16 avatar Mar 24 '24 11:03 namzug16