Skip to content

Don't print progress in a non-TTY context #8148

@mgol

Description

@mgol

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions.

@angular/cli: 1.4.5
node: 8.7.0
os: darwin x64
@angular/common: 4.4.4
@angular/compiler: 4.4.4
@angular/core: 4.4.4
@angular/forms: 4.4.4
@angular/http: 4.4.4
@angular/platform-browser: 4.4.4
@angular/platform-browser-dynamic: 4.4.4
@angular/router: 4.4.4
@angular/cli: 1.4.5
@angular/compiler-cli: 4.4.4
typescript: 2.3.4

Repro steps.

Run ng build --prod --aot in a CI environment like Travis CI or GitLab CI. You'll see something like:

0% compiling 10% building modules 0/1 modules 1 active project/src/main.ts 10% building modules 1/1 modules 0 active 10% building modules 1/2 modules 1 active project/src/polyfills.ts 10% building modules 2/2 modules 0 active 10% building modules 2/3 modules 1 active project/src/styles.scss 10% building modules 3/3 modules 0 active 10% building modules 3/4 modules 1 active project/src/styles.scss 10% building modules 4/4 modules 0 active 10% building modules 4/5 modules 1 active ...de_modules/css-loader/lib/css-base.js 10% building modules 5/5 modules 0 active 10% building modules 5/6 modules 1 active project/src/main.ts 10% building modules 5/7 modules 2 active project/src/polyfills.ts 10% building modules 6/7 modules 1 active project/src/polyfills.ts 10% building modules 7/7 modules 0 active 10% building modules 7/8 modules 1 active project/src/environments/environment.ts 10% building modules 8/8 modules 0 active 10% building modules 8/9 modules 1 active ...$$_gendir/app/app.module.ngfactory.ts 11% building modules 9/9 modules 0 active 11% building modules 9/10 modules 1 active project/src/app/app.module.ts 11% building modules 10/10 modules 0 active 11% building modules 10/11 modules 1 active project/src/app/app.component.ts 11% building modules 11/11 modules 0 active 11% building modules 11/12 modules 1 active ...gendir/app/app.component.ngfactory.ts

This can be alleviated by passing the --no-progress flag to ng build but it introduces a mental burden to add that to every command invoked on CI. If you have many such commands or if they're deeply nested in npm scripts this may require duplicating a lot of code.

The log given by the failure.

N/A

Desired functionality.

Angular CLI should not print progress when run in a non-TTY environment. Optionally it could switch its reporter to something like dots that only appends a dot when something happens and doesn't try to rewrite the output, printing a lot of noise.

Mention any other details that might be useful.

Node.js has an API for this exact purpose: process.stdout.isTTY, see https://nodejs.org/api/tty.html

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenteffort1: easy (hours)featureLabel used to distinguish feature request from other issueshelp wantedLabel noting an issue which the team is looking for contribution from the community to fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions