mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
Add small changes to improve context
This commit is contained in:
parent
c7f048918e
commit
6f2e86e562
@ -101,19 +101,20 @@ module.exports = {
|
||||
const numberOfAllContentTypes = _.size(strapi.contentTypes);
|
||||
const numberOfComponents = _.size(strapi.components);
|
||||
|
||||
const getNumberOfDynamicZones = () =>
|
||||
pipe(
|
||||
const getNumberOfDynamicZones = () => {
|
||||
return pipe(
|
||||
map('attributes'),
|
||||
flatMap(values),
|
||||
sumBy(propEq('type', 'dynamiczone'))
|
||||
)(strapi.contentTypes);
|
||||
};
|
||||
|
||||
return {
|
||||
data: {
|
||||
useTypescriptOnServer,
|
||||
useTypescriptOnAdmin,
|
||||
isHostedOnStrapiCloud,
|
||||
numberOfAllContentTypes, // TODO: Rename this in Strapi v5
|
||||
numberOfAllContentTypes, // 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.
|
||||
numberOfComponents,
|
||||
numberOfDynamicZones: getNumberOfDynamicZones(),
|
||||
},
|
||||
|
||||
@ -43,12 +43,13 @@ module.exports = (strapi) => {
|
||||
const serverRootPath = strapi.dirs.app.root;
|
||||
const adminRootPath = path.join(strapi.dirs.app.root, 'src', 'admin');
|
||||
|
||||
const getNumberOfDynamicZones = () =>
|
||||
pipe(
|
||||
const getNumberOfDynamicZones = () => {
|
||||
return pipe(
|
||||
map('attributes'),
|
||||
flatMap(values),
|
||||
sumBy(propEq('type', 'dynamiczone'))
|
||||
)(strapi.contentTypes);
|
||||
};
|
||||
|
||||
const anonymousUserProperties = {
|
||||
environment: strapi.config.environment,
|
||||
@ -68,7 +69,7 @@ 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
|
||||
numberOfAllContentTypes: _.size(strapi.contentTypes), // 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.
|
||||
numberOfComponents: _.size(strapi.components),
|
||||
numberOfDynamicZones: getNumberOfDynamicZones(),
|
||||
};
|
||||
|
||||
@ -6,7 +6,7 @@ const { getService } = require('../utils');
|
||||
const sendDidInitializeEvent = async () => {
|
||||
const { isLocalizedContentType } = getService('content-types');
|
||||
|
||||
// TODO: Rename this in Strapi v5
|
||||
// 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 numberOfContentTypes = reduce(
|
||||
(sum, contentType) => (isLocalizedContentType(contentType) ? sum + 1 : sum),
|
||||
0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user