Change logic of the command slightly to make the operation more explicit in case telemetryDisabled is undefined

This commit is contained in:
ivanThePleasant 2022-06-22 11:31:38 +03:00
parent 2cc5037e8a
commit e1a58c4675

View File

@ -79,13 +79,11 @@ module.exports = async function optInTelemetry() {
const packageObj = await readPackageJSON(packageJSONPath);
if (
packageObj.strapi &&
packageObj.strapi.uuid &&
packageObj.strapi.telemetryDisabled === false
) {
console.log(`${chalk.yellow('Warning:')} telemetry is already enabled`);
process.exit(0);
if (packageObj.strapi && packageObj.strapi.uuid) {
if (packageObj.strapi.telemetryDisabled === false) {
console.log(`${chalk.yellow('Warning:')} telemetry is already enabled`);
process.exit(0);
}
}
const updatedPackageJSON = generateNewPackageJSON(packageObj);