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

deno.json match subdirectory #57

Closed
Bidek56 opened this issue Jun 3, 2020 · 17 comments
Closed

deno.json match subdirectory #57

Bidek56 opened this issue Jun 3, 2020 · 17 comments
Labels
bug Something isn't working

Comments

@Bidek56
Copy link

Bidek56 commented Jun 3, 2020

Describe the bug
Specifying directory in match section of deno.json does not seem to have an effect.

To Reproduce
Add:
"match": [
".",
"./client/*"
],
to deno.json
start denon using: denon run --allow-read --allow-net server.ts
Change any files in the ./client/ directory but deno does not re-start.

Expected behavior
deno should restart when a file in ./client/ directory is changed.

Configuration or Project
{ "$schema": "https://deno.land/x/denon/schema.json", "scripts": { "start": { "cmd": "server.ts", "desc": "Run the main server.", "allow": [ "env", "net", "write" ], "unstable": true } }, "watcher": { "interval": 350, "exts": [ "jsx", "tsx", "ts", "js", "json", "html" ], "match": [ "*.*", "./client/*" ], "skip": [ "*/.git/*" ], "legacy": false } }

Setup

  • OS: Ubuntu 20.04 on WSL2
  • Deno version: 1.0.4
  • Denon version: 2.0.2
@Bidek56 Bidek56 added the bug Something isn't working label Jun 3, 2020
@notfilippo
Copy link
Collaborator

the client folder you mentioned should be already matched by "*.*" by default, so it seems strange. Denon by default watches all files on the cwd. Also denon operates with glob file patterns with the deno stdlib implementation. You should specify client folder not as "./client/*" but as "client/*"

@Bidek56
Copy link
Author

Bidek56 commented Jun 3, 2020

Specifying "client/*" does not work either. 👎

@eliassjogreen
Copy link
Member

Could you run with the --debug flag and post the logs?

@Bidek56
Copy link
Author

Bidek56 commented Jun 3, 2020

Running: denon run -L debug --allow-read --allow-net server.ts generates a giant log
Running without -L debug generates the following lines:

[denon] v2.0.2
[denon] watching path(s): . client/*
[denon] watching extensions: jsx,tsx,ts,js,json,html
[denon] starting deno run --allow-read --allow-net server.ts
Compile file:///mnt/c/Users/ubuntu/Documents/web/deno-py-websocket/server.ts

@eliassjogreen
Copy link
Member

And what happens after you change a file? (the large debug log might help if you want to send it)

@Bidek56
Copy link
Author

Bidek56 commented Jun 3, 2020

When I change a file in . it works but when I change it in client/* dir nothing happens.

@eliassjogreen
Copy link
Member

Could you run denon run -L debug --allow-read --allow-net server.ts > log.txt and send over the log?

@Bidek56
Copy link
Author

Bidek56 commented Jun 3, 2020

1.log

@Bidek56
Copy link
Author

Bidek56 commented Jun 22, 2020

This still seem to be unresolved in 2.20, does anyone else have this issue? Thx

@Bidek56
Copy link
Author

Bidek56 commented Jun 25, 2020

I believe this is a Deno.watchFs recursive issue

@Bidek56
Copy link
Author

Bidek56 commented Jun 26, 2020

This is a Deno.watchFs on Ubuntu 20.04 on WSL2 issue only, it works on Windows and Linux.
Closing the issue. Thx

@Bidek56 Bidek56 closed this as completed Jun 26, 2020
@notfilippo
Copy link
Collaborator

Thanks for this heads up! We will include a disclaimer on our installation docs.

@Bidek56
Copy link
Author

Bidek56 commented Jun 26, 2020

This is probably a WSL2 issue which MS may fix one day and it will start working, never know.

@Andersonfrfilho
Copy link

I am facing the same problem on windows 10,
denon.json

{
  "$schema": "https://deno.land/x/denon/schema.json",
  "watch": true,
  "scripts": {
    "start": {
      "cmd": "deno run ./src/server.ts",
      "desc": "run my app.ts file",
      "allow": [
        "run",
        "net"
      ],
      "tsconfig": "tsconfig.json"
    }
  },
  "watcher": {
    "interval": 350,
    "exts": ["js", "jsx", "ts", "tsx", "json"],
    "match": ["*.*"],
    "skip": ["*/.git/*"],
    "legacy": false
  }
}

running debug
denon run -L debug --allow-read --allow-net server.ts > log.txt

�[34m[*]�[39m �[90m[�[3mmain�[23m]�[39m �[0mv2.3.3�[0m
�[34m[*]�[39m �[90m[�[3mdaem�[23m]�[39m �[0mwatching path(s): *.*�[0m
�[34m[*]�[39m �[90m[�[3mdaem�[23m]�[39m �[0mwatching extensions: js,jsx,ts,tsx,json�[0m
�[33m[!]�[39m �[90m[�[3m#0�[23m]�[39m �[0mstarting `deno run -L debug --allow-read --allow-net server.ts`�[0m
DEBUG JS - cwd D:\Projetos\Deno\backend-project
DEBUG JS - args []
�[31m[E]�[39m �[90m[�[3mdaem�[23m]�[39m �[0mapp crashed - waiting for file changes before starting ...�[0m
�[34m[*]�[39m �[90m[�[3mdaem�[23m]�[39m �[0mrestarting due to changes...�[0m
�[34m[*]�[39m �[90m[�[3mdaem�[23m]�[39m �[0mwatching path(s): *.*�[0m
�[34m[*]�[39m �[90m[�[3mdaem�[23m]�[39m �[0mwatching extensions: js,jsx,ts,tsx,json�[0m
�[33m[!]�[39m �[90m[�[3m#0�[23m]�[39m �[0mstarting `deno run -L debug --allow-read --allow-net server.ts`�[0m
DEBUG JS - cwd D:\Projetos\Deno\backend-project
DEBUG JS - args []
�[31m[E]�[39m �[90m[�[3mdaem�[23m]�[39m �[0mapp crashed - waiting for file changes before starting ...�[0m

structure project

https://cdn.discordapp.com/attachments/713793300527841411/753659750461472868/unknown.png

@ghost
Copy link

ghost commented Oct 14, 2020

Solved: "match": ["**/*.*"] affects subfolders

The same issue on macOS 10.15.7

"match": ["*.*"] does not affects subfolder changes. No matter if legacy watcher property is true or false.

@eliassjogreen
Copy link
Member

That is because the glob you are using for match is wrong: **/*.* is for matching all files in any subfolder while *.* only matches root level files I believe

@ghost
Copy link

ghost commented Oct 14, 2020

Confirmed. Thanks 🙏

"match": ["**/*.*"] affects subfolders 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants