-
Notifications
You must be signed in to change notification settings - Fork 2k
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 component usage stats #96882
base: trunk
Are you sure you want to change the base?
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
3738f8c
to
ebed2a8
Compare
@@ -28,6 +28,7 @@ test-results*.xml | |||
/client/chart.json | |||
/client/style.json | |||
*xunit_*.xml | |||
/results |
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.
Ignoring the result dir.
We're going with the same naming choice as in the Gutenberg repo.
@@ -313,7 +315,7 @@ | |||
"stacktrace-gps": "^3.0.3", | |||
"stylelint": "^16.8.2", | |||
"tslib": "^2.3.0", | |||
"typescript": "^5.3.3", | |||
"typescript": "5.3.3", |
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.
React Scanner comes with a newer TS version, so I'm pinning the current one.
@@ -413,7 +415,8 @@ | |||
"@wordpress/viewport": "6.8.0", | |||
"@wordpress/warning": "3.8.0", | |||
"@wordpress/widgets": "4.8.0", | |||
"@wordpress/wordcount": "4.8.0" | |||
"@wordpress/wordcount": "4.8.0", | |||
"typescript": "5.3.3" |
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.
In order for React Scanner to pick our TS version up, we need to specifically pin the resolution version here.
While the script generates a 32k lines
Using |
Yeah, that's expected. Just like in the other repos we ran IMHO we should be good to go if that's your only concern. |
My only worry is that if the number of files continues to grow, it may eventually skew stats. Maybe we could also track the files that are not parsed (or at least the number of files), so that we can monitor the stat and act on it in case the number keeps growing? Otherwise I'm good with merging this PR and iterating on it. |
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.
Working as expected 👍
And with the suggested config changes, there are no parse failures and the JSON output is identical.
// Consider only imports of `@wordpress/components` | ||
importedFrom: '@wordpress/components', | ||
// Full usage report | ||
processors: [ [ 'raw-report', { outputTo: './results/calypso.json' } ] ], |
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 understand this is mostly just for automated execution on a server somewhere, but it might be helpful to have components-usage
or components-usage-stats
in the folder name, instead of just results
.
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 agree - I got this feedback multiple times and I'll be addressing it, first in Gutenberg and in the related script, then here and in the Jetpack PR.
Co-authored-by: Lena Morita <[email protected]>
Co-authored-by: Lena Morita <[email protected]>
No further feedback left on my end |
What?
This PR introduces
react-scanner
to keep an eye on component usage stats.Why?
It can be useful to track the adoption of our components over time, and we're automating that as part of our work on design systems (bjpUB-p2).
See WordPress/gutenberg#65463 for the same in Gutenberg itelf.
How?
Running
react-scanner
with the default config to count components and props yields a result like this:Testing Instructions
yarn install
yarn run component-usage-stats
Testing Instructions for Keyboard
Same
Screenshots or screencast
None