Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to watch source files #22

Open
granicz opened this issue Sep 20, 2023 · 1 comment
Open

Add ability to watch source files #22

granicz opened this issue Sep 20, 2023 · 1 comment
Assignees
Labels
Projects

Comments

@granicz
Copy link
Member

granicz commented Sep 20, 2023

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:

  1. 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.
  2. 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.
  3. 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.

@granicz
Copy link
Member Author

granicz commented Oct 19, 2023

Still TODO: Current version doesn't have support for triggering builds if changes occur in transitive project dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants