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

Terse mode output from tsc --build #25562

Open
4 tasks done
RyanCavanaugh opened this issue Jul 10, 2018 · 4 comments
Open
4 tasks done

Terse mode output from tsc --build #25562

RyanCavanaugh opened this issue Jul 10, 2018 · 4 comments
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@RyanCavanaugh
Copy link
Member

Search Terms

tsc --build mode console logging output verbose

Suggestion

Have a middle-ground between verbose and "nothing" when running tsc -b

Use Cases

Initial feedback was that "tsc -b should print nothing by default (if there are no errors)", which is a reasonable first principle to work from. However, it's nice to have some rough idea of what's going on, especially because a tsc -b invocation might take quite a while, depending on what's up to date.

Users today can get more output by running with --verbose, which prints some fairly detailed spew:

message TS6350: Project 'tsconfig.json' is out of date because oldest output 'lib/fetch.js' is older than newest input 'src/fetch.ts'

The verbose output was written primarily as an "Explain why something is happening"; there is no in-between setting that says simply "Explain what is happening".

This is compounded under --watch where tsc -b prints errors, but doesn't print "No errors", so you can't really know if your compilation succeeded or if tsc simply missed a file change.

Proposal

--terse strikes a middle ground between the default (silent) and verbose. Its short name would be -t which doesn't conflict with anything I can think of adding in the near term.

Examples

> tsc -b -t src
message TS6350: 'src/compiler' is up-to-date
message TS6350: 'src/services' is up-to-date
message TS6351: Building 'src/server'...
message TS6351: Building 'src/tests'...
message TS6352: Build completed
> tsc -b -t -w src
message TS6350: All projects are up to date
message TS6351: 'src/compiler' was modified, building...

src/compiler/parser.ts:21:1 - error TS1128: Declaration or statement expected.

21 ?
   ~

message TS6351: 'src/compiler' was modified, building...
message TS6351: Building 'src/server'...
message TS6351: Building 'src/tests'...
message TS6352: All projects are up to date

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript In Discussion Not yet reached consensus labels Jul 10, 2018
@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jul 10, 2018

Is this the same as #25286? If so, please feel free to close that one.

@simonbuchan
Copy link

The node CLI convention for long-running CLI feedback (I'm thinking of npm and webpack here) seems to be to re-write (eg log-update / ora) the output if stdout.isTTY. Does TS want to avoid introducing this?

In the watch case, it could add then remove the Building ... lines.

In any case, this seems the about the right level of output. As a bikeshed, I prefer the "Building" lines to be more regular so it's easier to scan, e.g. (if I'm reading the example right):

> tsc -b -t -w src
message TS6350: All projects are up to date
message TS6351: Building modified project 'src/compiler'...

src/compiler/parser.ts:21:1 - error TS1128: Declaration or statement expected.

21 ?
   ~

message TS6351: Building modified project 'src/compiler'...
message TS6351: Building dependent project 'src/server'...
message TS6351: Building dependent project 'src/tests'...
message TS6352: All projects are up to date

@SavePointSam
Copy link

SavePointSam commented Apr 25, 2019

I would LOVE this flag. I currently have a build process where I transpile a TS library with Babel showing an output of each file being build / moved. I then use tsc to generate the *.d.ts files for consumption in other packages. I would be awesome to see each output file being built and moved similar to how Babel shows.


EDIT: I actually found that --listEmittedFiles does exactly the behavior I'm looking for. However, It appears that the list is output at the end of processing and not during. It would be nice to have output during processing. Though for now --listEmittedFiles is enough for me.

@tajnymag
Copy link

tajnymag commented Dec 8, 2021

Its been two and half year since the last comment. Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants