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

Support  for --listEmittedFiles + new message file_emitted #138

Closed
pp0rtal opened this issue Mar 8, 2022 · 3 comments
Closed

Support  for --listEmittedFiles + new message file_emitted #138

pp0rtal opened this issue Mar 8, 2022 · 3 comments

Comments

@pp0rtal
Copy link
Contributor

pp0rtal commented Mar 8, 2022

Summary: watch tsc generated files

I'm using the client and I would like to be notified everytime a new file is written.
This is possible with listEmittedFiles options which list the files emitted https://www.typescriptlang.org/tsconfig#listEmittedFiles

Why? Performance I'm using this lib client inside some compilation flow (there are some post-process after the Ts is compiled)

  • Without: I need to watch the dist folder, which is resource consuming
  • With listEmittedFiles I can unwatch the dist folder :)

RFC: listEmittedFiles support

  • I suggest to activate this ability by an iso tsc-watch --listEmittedFiles new option
  • tsc output will be parsed obviously
  • we trigger a new message file_emitted with the absolute file path

FYI tsc output is trivial:

TSFILE: /home/portal/.../config/config.js
TSFILE: /home/portal/.../config/config.js.map
TSFILE: /home/portal/.../tsconfig.tsbuildinfo

Example of implementation:

tsWatch.start(...);
tsWatch.on("file_emitted", (emittedFile) => {
    console.log({ emittedFile });
});

Impact

no regression at all
(--listEmittedFiles has to be explicitely called)

ℹ️ Note I will do the PR

@gilamran
Copy link
Owner

gilamran commented Mar 8, 2022

Sounds good.
Maybe call the event file_emitted?

@pp0rtal pp0rtal changed the title Support  for --listEmittedFiles + new message emitted_file Support  for --listEmittedFiles + new message file_emitted Mar 8, 2022
@pp0rtal

This comment was marked as off-topic.

@gilamran
Copy link
Owner

published on version 4.6.2

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