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

fix(@ngtools/webpack): log ngcc info messages #14320

Merged
merged 1 commit into from
May 7, 2019

Conversation

filipesilva
Copy link
Contributor

@filipesilva filipesilva commented May 1, 2019

Fix #14194

This PR by itself will address #14194, but needs angular/angular#30232 in order to not be spammy.

@filipesilva
Copy link
Contributor Author

Below is how the logging looks like with this PR.

First build:

$ ng serve
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
  0% compiling
Compiling @angular/core : es2015 as esm2015

Skipping @angular/core : module (already compiled).

Skipping @angular/core : es2015 (already compiled).

Skipping @angular/core : module (already compiled).

Compiling @angular/common : es2015 as esm2015

Skipping @angular/common : module (already compiled).

Compiling @angular/platform-browser : es2015 as esm2015

Skipping @angular/platform-browser : module (already compiled).

Compiling @angular/platform-browser-dynamic : es2015 as esm2015

Skipping @angular/platform-browser-dynamic : module (already compiled).

Date: 2019-05-01T10:31:54.903Z
Hash: 59fc7c2b9028bae08d65
Time: 28327ms
chunk {main} main.js, main.js.map (main) 9.81 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 247 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 380 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.3 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.72 MB [initial] [rendered]
i 「wdm」: Compiled successfully.

Next builds:

$ ng serve
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Date: 2019-05-01T10:32:15.250Z
Hash: 59fc7c2b9028bae08d65
Time: 10861ms
chunk {main} main.js, main.js.map (main) 9.81 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 247 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 380 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.3 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.72 MB [initial] [rendered]
i 「wdm」: Compiled successfully.

@@ -104,6 +104,7 @@ export class NgccProcessor {
}

class NgccLogger implements Logger {
private alreadyProcessMsg = 'The target entry-point has already been processed';
Copy link
Contributor Author

@filipesilva filipesilva May 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If ngcc change its logging messages our filter will break.

@petebacondarwin @gkalpak do you have a suggestion on a better way to log only when something is actually happening?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we just agree to change the info messages that you do not wish to see to debug messages? Then you don't need to filter at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think it would also be fair for CLI to output a message before ngcc is triggered to say something like "Compiling Angular packages with ngcc".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to go down that route because the CLI doesn't know if ngcc will try to compile a package or skip it. If we had such message it would come up on every build, several times.

@filipesilva filipesilva added the target: patch This PR is targeted for the next patch release label May 1, 2019
info(..._args: string[]) {
const msg = _args.join(' ');
if (!msg.includes(this.alreadyProcessMsg)) {
process.stderr.write(`\n${msg}\n`);
Copy link
Collaborator

@alan-agius4 alan-agius4 May 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the standard output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's a progress-like message. The webpack ProgressPlugin uses stderr for progress reporting, and so does Architect CLI.

I remember a discussion with @clydin about this too where I was pretty convinced progress-like messages should go there.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification

info(..._args: string[]) {
const msg = _args.join(' ');
if (!msg.includes(this.alreadyProcessMsg)) {
process.stderr.write(`\n${msg}\n`);
Copy link
Collaborator

@alan-agius4 alan-agius4 May 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should only print the compiling messages.

We should skip all others, such as skipping target already compiled and target entrypoint already compiled.

Something along:
If (msg.startsWith(‘Compiling’)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petebacondarwin should ngcc also log Skipping messages as debug?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you like 🤗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with that approach then. @alan-agius4 WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please send a PR :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR up at angular/angular#30232, PTAL @petebacondarwin. I'll then change this PR to log all info messages instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@filipesilva filipesilva changed the title fix(@ngtools/webpack): log ngcc compilation messages fix(@ngtools/webpack): log ngcc info messages May 2, 2019
@filipesilva filipesilva requested a review from alan-agius4 May 2, 2019 13:23
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ivy opt-in preview should warn about long compile times
5 participants