Nest-cli: Permit ignored watch folders

Created on 17 Feb 2020  路  3Comments  路  Source: nestjs/nest-cli

I'm submitting a...

[X] Feature request

Current behavior

I have a service that starts an ffmpeg process which creates file that end in .ts under a public folder served by Nest. In production, this is fine, but testing is a pain, as every time a stream file is created, NestJS rebuilds. I already attempted to use tsconfig.json to "ignore" those files, which kept them from being compiled, but not from being watched.

Expected behavior

My stream files would be ignored, if for instance, I passed a flag like --ignore public/ or something.

Minimal reproduction of the problem with instructions

Setup a base NestJS project, stream an RTSP stream like so:

$ cat stream.sh
 ffmpeg -rtsp_transport tcp \
       -loglevel error \
       -hwaccel auto \
       -i "$1" \
       -strict \
       -2 \
       -crf 18 \
       -c:v copy \
       -preset ultrafast \
       -flags \
       -global_header \
       -fflags flush_packets \
       -tune zerolatency \
       -hls_time 1 \
       -hls_list_size 3 \
       -hls_wrap 4 \
       -hls_flags delete_segments \
       -start_number 0 \
       ./public/streams/"$2"/"$2".m3u8
$ ./stream.sh rstp://blah stream-name

Start the NestJS compiler:

$ npm run build:dev

Watch NestJS reload every time something is streamed.

What is the motivation / use case for changing the behavior?

I'd just like to easily specify which files NestJS watches

Environment

 _   _             _      ___  _____  _____  _     _____
| \ | |           | |    |_  |/  ___|/  __ \| |   |_   _|
|  \| |  ___  ___ | |_     | |\ `--. | /  \/| |     | |
| . ` | / _ \/ __|| __|    | | `--. \| |    | |     | |
| |\  ||  __/\__ \| |_ /\__/ //\__/ /| \__/\| |_____| |_
\_| \_/ \___||___/ \__|\____/ \____/  \____/\_____/\___/


[System Information]
OS Version     : macOS Catalina
NodeJS Version : v13.0.1
NPM Version    : 6.13.7 

[Nest CLI]
Nest CLI Version : 6.14.2 

[Nest Platform Information]
platform-socket.io version : 6.11.7
platform-express version   : 6.11.7
serve-static version       : 1.0.2
websockets version         : 6.11.7
common version             : 6.10.14
config version             : 0.2.2
core version               : 6.10.14

Most helpful comment

You just need to add include to tsconfig.

"include": ["src"],
"exclude": ["node_modules", "dist"]

All 3 comments

Nest CLI is using TypeScript tsc --watch underneath, so you should rather report this issue in the TypeScript repository/look for a respective option in the tsconfig.json file.

You just need to add include to tsconfig.

"include": ["src"],
"exclude": ["node_modules", "dist"]
Was this page helpful?
0 / 5 - 0 ratings