Merge pull request #12171 from strapi/fix/12163

Fixes admin build when removing optional plugins
This commit is contained in:
cyril lopez 2022-01-12 15:33:56 +01:00 committed by GitHub
commit d8acb3df67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -330,8 +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 = _.difference(Object.keys(plugins), DEFAULT_PLUGINS);
// 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;
};