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

Feature request - Allow passing patterns to watch #80

Open
bebraw opened this issue Sep 22, 2021 · 3 comments
Open

Feature request - Allow passing patterns to watch #80

bebraw opened this issue Sep 22, 2021 · 3 comments

Comments

@bebraw
Copy link

bebraw commented Sep 22, 2021

It would be good to support patterns for watch. I.e.

scripts.json

{
  "scripts": {
    "start": {
      "cmd": "deno run --unstable mod.ts",
      "watch": "*.ts,*.json"
    },
  }
}

Based on denoland/deno#2401 (comment) Deno supports deno run --watch=./**/*.ts,./**/*.tsx server.ts kind of syntax.

Looking at the code, the command builder would have to be extended to support strings beyond booleans (case DenoOptions.watch: { in code).

@umbopepato
Copy link
Member

Hi @bebraw, thanks for the suggestion! 🙂

It looks like the --watch options is still a boolean flag though. You can verify this by passing a file to --watch which is not part of the entry point module graph and then edit that file. You'll see that only the entry point and its dependencies are watched. The example in the issue you linked is probably working because the watched .ts files are already part of the module graph (and the value of the boolean flag is ignored I guess?).

@bebraw
Copy link
Author

bebraw commented Sep 23, 2021

@umbopepato Thanks for the heads up. I opened a feature request at denoland/deno#12197 .

I guess another option would be to leverage https://deno.land/x/[email protected] . I wonder if I could do that in user space even. In this case I would have to trigger whatever Deno's watch is triggering right now and if we're lucky there's a programmatic hook for that.

@umbopepato
Copy link
Member

Awesome, thank you @bebraw! Let's see what they say and sure, if the flag is not going to change we can evaluate a custom implementation.

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

No branches or pull requests

2 participants