-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Tracking system, number of content types and components per user/project #14900
Conversation
Codecov ReportBase: 59.12% // Head: 47.61% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #14900 +/- ##
===========================================
- Coverage 59.12% 47.61% -11.52%
===========================================
Files 1502 448 -1054
Lines 38340 15756 -22584
Branches 7383 3371 -4012
===========================================
- Hits 22669 7502 -15167
+ Misses 13401 6849 -6552
+ Partials 2270 1405 -865
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
LGTM but we'll wait on someone who knows more about how to tracking system works (and can check in Amplitude) in case there's an issue I'm missing.
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 believe you can simplify your sum operation (or at least make it more readable) by chaining fp operations. Here's an example
const countDynamicZoneAttributes = pipe(
map('attributes'),
flatMap(values),
sumBy(propEq('type', 'dynamiczone'))
);
return { | ||
data: { | ||
useTypescriptOnServer, | ||
useTypescriptOnAdmin, | ||
isHostedOnStrapiCloud, | ||
numberOfAllContentTypes, // TODO: Rename this in Strapi v5 |
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.
Would you mind adding a bit more context in case someone else should handle this in V5?
Maybe a short sentence about what it should be renamed to & why?
example:
(it could probably be phrased better though)
// TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.
const getNumberOfDynamicZones = () => | ||
pipe( | ||
map('attributes'), | ||
flatMap(values), | ||
sumBy(propEq('type', 'dynamiczone')) | ||
)(strapi.contentTypes); |
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 might be a matter of personal preference (feel free to ignore), but I would suggest that for arrow functions of more than one line, consider using {}
and a return statement to better delimit the boundaries of the function 🙂
const getNumberOfDynamicZones = () => | |
pipe( | |
map('attributes'), | |
flatMap(values), | |
sumBy(propEq('type', 'dynamiczone')) | |
)(strapi.contentTypes); | |
const getNumberOfDynamicZones = () => { | |
return pipe( | |
map('attributes'), | |
flatMap(values), | |
sumBy(propEq('type', 'dynamiczone')) | |
)(strapi.contentTypes) | |
}; |
@@ -60,6 +68,9 @@ module.exports = (strapi) => { | |||
useTypescriptOnAdmin: isUsingTypeScriptSync(adminRootPath), | |||
projectId: uuid, | |||
isHostedOnStrapiCloud: env('STRAPI_HOSTING', null) === 'strapi.cloud', | |||
numberOfAllContentTypes: _.size(strapi.contentTypes), // TODO: Rename this in Strapi v5 |
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.
Same as above 🙂
@@ -42,6 +43,13 @@ module.exports = (strapi) => { | |||
const serverRootPath = strapi.dirs.app.root; | |||
const adminRootPath = path.join(strapi.dirs.app.root, 'src', 'admin'); | |||
|
|||
const getNumberOfDynamicZones = () => |
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.
Same as above 🙂
@@ -6,6 +6,7 @@ const { getService } = require('../utils'); | |||
const sendDidInitializeEvent = async () => { | |||
const { isLocalizedContentType } = getService('content-types'); | |||
|
|||
// TODO: Rename this in Strapi v5 |
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.
🙂
What does it do?
It tracks the number of content types, the number of components, and the number of Dynamic Zones that a project has
Why is it needed?
To get more insights about what the final user uses.
How to test it?
On Amplitude
Related issue(s)/PR(s)