While one can watch a project for changes using dotnet watch, it's relatively slow and it triggers dotnet build instead of the more tailored dotnet ws build command. Furthermore, often times, incremental changes occur only to template HTML files, and one is forced to touch an actual F#/C# source file to trigger recompilation.
This ticket adds the ability to watch various files (single or multiple F# files, design files, project files, etc.) and offer an enhanced version of dotnet ws compile (see ticket #17 ) where appropriate, and otherwise falling back to dotnet ws build for the remaining cases to provide a uniform watch capability.
There a few cases to cover:
Single file compilation - basically, all dotnet ws compile shapes - here, we could just take a watch option at the end. This would take the source file specified, establish a file system watcher, and retrigger the underlying build pipeline on change.
Multi file compilation (new mode) - dotnet ws watch [pattern], where [pattern], if left unspecified, defaults to all .fs[x] and certain .html files (see below) in the current folder and all of its subdirectories.
Project compilation - where dotnet ws watch [pattern] includes .fsproj file(s), separate watches should be set up for each project triggering an ordinary dotnet ws build. The files to watch for each project consist of the project file itself and any source/other files we can reasonably infer to belong to the project using a simple heuristics (as opposed to having to crack the project file via msbuild or introducing a more elaborate project cracking library, for now) by extracting all files from <Compile|None Include="<filename>" /> sections.
To avoid colliding with generated HTML files vs template HTML files, the default search pattern should exclude the likely subfolders where generated HTML files might end up. Examples: bin|obj, dist, out|output, etc.
While one can watch a project for changes using
dotnet watch
, it's relatively slow and it triggersdotnet build
instead of the more tailoreddotnet ws build
command. Furthermore, often times, incremental changes occur only to template HTML files, and one is forced to touch an actual F#/C# source file to trigger recompilation.This ticket adds the ability to watch various files (single or multiple F# files, design files, project files, etc.) and offer an enhanced version of
dotnet ws compile
(see ticket #17 ) where appropriate, and otherwise falling back todotnet ws build
for the remaining cases to provide a uniform watch capability.There a few cases to cover:
dotnet ws compile
shapes - here, we could just take awatch
option at the end. This would take the source file specified, establish a file system watcher, and retrigger the underlying build pipeline on change.dotnet ws watch [pattern]
, where[pattern]
, if left unspecified, defaults to all.fs[x]
and certain.html
files (see below) in the current folder and all of its subdirectories.dotnet ws watch [pattern]
includes.fsproj
file(s), separate watches should be set up for each project triggering an ordinarydotnet ws build
. The files to watch for each project consist of the project file itself and any source/other files we can reasonably infer to belong to the project using a simple heuristics (as opposed to having to crack the project file via msbuild or introducing a more elaborate project cracking library, for now) by extracting all files from<Compile|None Include="<filename>" />
sections.To avoid colliding with generated HTML files vs template HTML files, the default search pattern should exclude the likely subfolders where generated HTML files might end up. Examples:
bin|obj
,dist
,out|output
, etc.