Repository navigation
Description
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
Activity
filipesilva commentedon Oct 25, 2017
I agree that we should use the API to determine the system default. Would be really helpful.
feat(@angular/cli): disable progress when running outside TTY
feat(@angular/cli): disable progress when running outside TTY
feat(@angular/cli): disable progress when running outside TTY
feat(@angular/cli): disable progress when running outside TTY
mgol commentedon Dec 14, 2017
Something still doesn't work here. In Karma tests run via WebStorm
process.stdout.isTTY === undefined(I checked) and yet the progress is printed, flooding the console. The same happens to me in GitLab CI. Angular CLI1.6.0.devoto13 commentedon Dec 14, 2017
@mgol I don't use GitLab CI, so don't know why it does not work there.
Regarding WebStorm: my PR only changes the default for the
--progressflag of theng testcommand. So if you useKarmarun configuration in WebStorm it will still print progress, because WebStorm runs Karma directly and not usingng testcommand. I think we should also update here - change fromtruetoprocess.stdout.isTTY === true, so this feature will also work when running Karma directly. Can you submit a PR?mgol commentedon Dec 14, 2017
@devoto13 OK, thanks, I know what's happening now.
In GitLab CI
process.stdout.isTTY === undefinedas well, the progress I'm seeing comes from building the universal app according to the Universal CLI story i.e. via:That's a Webpack thing, not CLI one, though so here what's needed is mostly the Karma modification. I'll see what I can do.
fix(@angular/cli): disable progress when running Karma directly outsi…
fix(@angular/cli): disable progress when running Karma directly outsi…
fix(@angular/cli): disable progress when running Karma directly outsi…
fix(@angular/cli): disable progress when running Karma directly outsi…
feat(@angular/cli): disable progress when running outside TTY
fix(@angular/cli): disable progress when running Karma directly outsi…
mgol commentedon Jun 11, 2018
This has regressed in CLI 6, see a new bug report: #11195.
angular-automatic-lock-bot commentedon Sep 8, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
feat(@angular/cli): disable progress when running outside TTY
fix(@angular/cli): disable progress when running Karma directly outsi…