mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
Track content types, dzs, and components per user
This commit is contained in:
parent
b5e75847ca
commit
c0c8570c36
@ -1,6 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
const { map, get, values, isEqual, sumBy, sum } = require('lodash/fp');
|
||||||
const execa = require('execa');
|
const execa = require('execa');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const { exists } = require('fs-extra');
|
const { exists } = require('fs-extra');
|
||||||
@ -96,11 +98,23 @@ module.exports = {
|
|||||||
);
|
);
|
||||||
const isHostedOnStrapiCloud = env('STRAPI_HOSTING', null) === 'strapi.cloud';
|
const isHostedOnStrapiCloud = env('STRAPI_HOSTING', null) === 'strapi.cloud';
|
||||||
|
|
||||||
|
const numberOfContentTypes = _.size(strapi.contentTypes);
|
||||||
|
const numberOfComponents = _.size(strapi.components);
|
||||||
|
const numberOfDynamicZones = sum(
|
||||||
|
map(
|
||||||
|
(ct) => sumBy(isEqual('dynamiczone'), map(get('type'), values(get('attributes', ct)))),
|
||||||
|
strapi.contentTypes
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
useTypescriptOnServer,
|
useTypescriptOnServer,
|
||||||
useTypescriptOnAdmin,
|
useTypescriptOnAdmin,
|
||||||
isHostedOnStrapiCloud,
|
isHostedOnStrapiCloud,
|
||||||
|
numberOfContentTypes,
|
||||||
|
numberOfComponents,
|
||||||
|
numberOfDynamicZones,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
const os = require('os');
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
const { map, get, values, isEqual, sumBy, sum } = require('lodash/fp');
|
||||||
const isDocker = require('is-docker');
|
const isDocker = require('is-docker');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const ciEnv = require('ci-info');
|
const ciEnv = require('ci-info');
|
||||||
@ -42,6 +43,14 @@ module.exports = (strapi) => {
|
|||||||
const serverRootPath = strapi.dirs.app.root;
|
const serverRootPath = strapi.dirs.app.root;
|
||||||
const adminRootPath = path.join(strapi.dirs.app.root, 'src', 'admin');
|
const adminRootPath = path.join(strapi.dirs.app.root, 'src', 'admin');
|
||||||
|
|
||||||
|
const getNumberOfDynamicZones = () =>
|
||||||
|
sum(
|
||||||
|
map(
|
||||||
|
(ct) => sumBy(isEqual('dynamiczone'), map(get('type'), values(get('attributes', ct)))),
|
||||||
|
strapi.contentTypes
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
const anonymousMetadata = {
|
const anonymousMetadata = {
|
||||||
environment: strapi.config.environment,
|
environment: strapi.config.environment,
|
||||||
os: os.type(),
|
os: os.type(),
|
||||||
@ -56,6 +65,9 @@ module.exports = (strapi) => {
|
|||||||
useTypescriptOnServer: isUsingTypeScriptSync(serverRootPath),
|
useTypescriptOnServer: isUsingTypeScriptSync(serverRootPath),
|
||||||
useTypescriptOnAdmin: isUsingTypeScriptSync(adminRootPath),
|
useTypescriptOnAdmin: isUsingTypeScriptSync(adminRootPath),
|
||||||
isHostedOnStrapiCloud: env('STRAPI_HOSTING', null) === 'strapi.cloud',
|
isHostedOnStrapiCloud: env('STRAPI_HOSTING', null) === 'strapi.cloud',
|
||||||
|
numberOfContentTypes: _.size(strapi.contentTypes),
|
||||||
|
numberOfComponents: _.size(strapi.components),
|
||||||
|
numberOfDynamicZones: getNumberOfDynamicZones(),
|
||||||
};
|
};
|
||||||
|
|
||||||
addPackageJsonStrapiMetadata(anonymousMetadata, strapi);
|
addPackageJsonStrapiMetadata(anonymousMetadata, strapi);
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
const { map, get, values, isEqual, sumBy, sum } = require('lodash/fp');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const sentry = require('@sentry/node');
|
const sentry = require('@sentry/node');
|
||||||
|
|
||||||
@ -53,6 +54,14 @@ function captureStderr(name, error) {
|
|||||||
return captureError(name);
|
return captureError(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getNumberOfDynamicZones = () =>
|
||||||
|
sum(
|
||||||
|
map(
|
||||||
|
(ct) => sumBy(isEqual('dynamiczone'), map(get('type'), values(get('attributes', ct)))),
|
||||||
|
strapi.contentTypes
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
const getProperties = (scope, error) => ({
|
const getProperties = (scope, error) => ({
|
||||||
error: typeof error === 'string' ? error : error && error.message,
|
error: typeof error === 'string' ? error : error && error.message,
|
||||||
os: os.type(),
|
os: os.type(),
|
||||||
@ -67,6 +76,9 @@ const getProperties = (scope, error) => ({
|
|||||||
useTypescriptOnAdmin: scope.useTypescript,
|
useTypescriptOnAdmin: scope.useTypescript,
|
||||||
isHostedOnStrapiCloud: process.env.STRAPI_HOSTING === 'strapi.cloud',
|
isHostedOnStrapiCloud: process.env.STRAPI_HOSTING === 'strapi.cloud',
|
||||||
noRun: (scope.runQuickstartApp !== true).toString(),
|
noRun: (scope.runQuickstartApp !== true).toString(),
|
||||||
|
numberOfContentTypes: _.size(strapi.contentTypes),
|
||||||
|
numberOfComponents: _.size(strapi.components),
|
||||||
|
numberOfDynamicZones: getNumberOfDynamicZones(),
|
||||||
});
|
});
|
||||||
|
|
||||||
function trackEvent(event, body) {
|
function trackEvent(event, body) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user