-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Introduce React Scanner for component usage stats #65463
Merged
Merged
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e5e1eaa
Try: React Scanner for componenent usage stats
tyxla b52bd2b
Fix globs and exclude dirs
tyxla 5d44c00
Update glob to avoid native files
tyxla fc33270
Filter out non-component elements
tyxla 89bae62
Add comments and exclude more dirs
tyxla be224fc
Merge experimental and unstable components with canonical names
tyxla 64106cd
Specify processors explicitly
tyxla f71cb9e
Count component usage only
tyxla f514050
Add back omitted comment
tyxla 8ad4f88
Bump react-scanner to v1.2.0
tyxla dc95944
Only count wp/components imports from outside the package
tyxla c78301d
Default to components and props processor
tyxla 99e6c7e
Default to raw-report
tyxla 215ab23
Specify output directory, gitignore it
tyxla a39d4db
Fix globs to properly exclude native files
tyxla ef0407e
Do not merge unstable and experimental stats with canonical ones
tyxla f0d1022
Exclude a few more dirs
tyxla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
// Crawl the entire repo | ||
crawlFrom: './', | ||
// Needed for properly reporting components with dot notation | ||
includeSubComponents: true, | ||
// Exclude usage in tests, stories, and React Native files. | ||
globs: [ '**/!(test|stories)/!(*native).@(js|ts)?(x)' ], | ||
// Exclude any vendor or docs directories | ||
exclude: [ | ||
'bin', | ||
'build', | ||
'build-module', | ||
'docs', | ||
'node_modules', | ||
'patches', | ||
'platform-docs', | ||
'test', | ||
'tools', | ||
'typings', | ||
'vendor', | ||
], | ||
/* | ||
* Filter out any non-component React elements and consider only imports of | ||
* `@wordpress/components` outside of the package. | ||
*/ | ||
importedFrom: '@wordpress/components', | ||
// Merge experimental and unstable stats into the canonical component name | ||
getComponentName: ( { imported, local } ) => { | ||
return ( imported || local ) | ||
.replace( '__experimental', '' ) | ||
.replace( '__unstable', '' ); | ||
}, | ||
tyxla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
processors: [ [ 'raw-report', { outputTo: './results/gutenberg.json' } ] ], | ||
tyxla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I ran the command on my machine and it looks like the report is including some React Native usage information. I don't think that's expected?
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.
Ah, good catch. Seems like the
globs
doesn't work as expected. Seems like under the hood it uses a custom tool for the globbing part with different syntax - I'll fine-tune it next week to make it work.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.
This should be fixed in a39d4db.