-
-
Notifications
You must be signed in to change notification settings - Fork 622
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
feat: allow users to store stats as json to a file #1835
Conversation
if (outputOptions.json) { | ||
process.stdout.write(JSON.stringify(stats.toJson(outputOptions), null, 2) + '\n'); | ||
if (outputOptions.json === true) { | ||
logger.raw(JSON.stringify(stats.toJson(outputOptions), null, 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be process.stdout.write
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
41e05cd
to
46d0344
Compare
46d0344
to
b4a2406
Compare
@@ -69,6 +70,15 @@ class Compiler { | |||
statsErrors.push({ name: statErr.message, loc: errLoc }); | |||
}); | |||
} | |||
const JSONStats = JSON.stringify(stats.toJson(outputOptions), null, 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note JSON.stringify
doesn't end with a newline.
/cc @webpack/cli-team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left few suggestions.
8b5d295
to
fc7cb3d
Compare
packages/webpack-cli/README.md
Outdated
@@ -53,7 +53,7 @@ yarn add webpack-cli --dev | |||
--no-hot Disables Hot Module Replacement | |||
-d, --devtool string Controls if and how source maps are generated. | |||
--prefetch string Prefetch this request | |||
-j, --json Prints result as JSON | |||
-j, --json string Prints result as JSON or store it in a file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be string, boolean right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, updated
2803c89
to
bfd480b
Compare
bfd480b
to
fadb077
Compare
I think we can improve docs and replace this out of box https://github.com/FormidableLabs/webpack-stats-plugin |
@snitin315 Thanks for your update. I labeled the Pull Request so reviewers will review it again. @anshumanv Please review the new changes. |
What kind of change does this PR introduce?
feature
Did you add tests for your changes?
Yes
If relevant, did you update the documentation?
Summary
Fixes #1535
Does this PR introduce a breaking change?
No
Other information