diff --git a/packages/core/admin/index.js b/packages/core/admin/index.js index 246050c0bc..74596ca62c 100644 --- a/packages/core/admin/index.js +++ b/packages/core/admin/index.js @@ -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; };