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

(feature) --json option as output #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

gbmeow
Copy link

@gbmeow gbmeow commented Jul 24, 2021

Hi Brian,

Amazing package you created, I would like to add --json option as output, to connect the output to a Github Action.

Can these changes make it into your npm package?

Thank you

--json flag will generate `filename.json`

```
npx webpack-stats-duplicates --json <filename.json> .\stats.json
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the backslash instead of forwards slash windows? Maybe just remove it to avoid confusion?

- .\stats.json
+ stats.json


var jsonArgHasBeenPassed = argv.json === '';
if(jsonArgHasBeenPassed) {
printDuplicatesToJson(duplicates, 'blanky.json');
Copy link
Contributor

Choose a reason for hiding this comment

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

blanky.json should not be hard-coded


module.exports = function (duplicates, filename) {
if(duplicates) {
duplicates = duplicates.map( dup => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to map the object at all? Can we just write the duplicates object directly? I forget what other properteis are in that object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants