Add comments

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2022-01-11 17:27:53 +01:00
parent d7fffe9742
commit 1763c66e23

View File

@ -330,10 +330,19 @@ const hasCustomAdminCode = async dir => {
return hasCustomConfigFile || hasCustomWebpackFile;
};
/**
* Checks if the project's installed plugins are not the same as a default one.
* @param {Object} plugins
* @returns {boolean}
*/
const hasNonDefaultPlugins = plugins => {
const diff = Object.keys(plugins)
.filter(x => !DEFAULT_PLUGINS.includes(x))
.concat(DEFAULT_PLUGINS.filter(x => !Object.keys(plugins).includes(x)));
// List of plugins that are not the ones installed in a generated app
const installedPlugins = Object.keys(plugins).filter(x => !DEFAULT_PLUGINS.includes(x));
// List of default plugins uninstalled from a generated app
const missingPlugins = DEFAULT_PLUGINS.filter(x => !Object.keys(plugins).includes(x));
const diff = [...installedPlugins, ...missingPlugins];
return diff.length > 0;
};