Manage email and upload providers from an npm organisation

This commit is contained in:
Jim LAURIE 2019-03-01 17:09:19 +01:00
parent b0c12a3912
commit dac168cedb
2 changed files with 28 additions and 0 deletions

View File

@ -30,6 +30,20 @@ module.exports = async cb => {
return _.startsWith(node_module, 'strapi-provider-email') || _.startsWith(node_module, 'strapi-email');
});
node_modules.filter((node_module) => {
return node_module.startsWith('@');
})
.forEach((orga) => {
const node_modules = fs.readdirSync(path.join(basePath, 'node_modules', orga));
node_modules.forEach((node_module) => {
// DEPRECATED strapi-email-* will be remove in next version
if (_.startsWith(node_module, 'strapi-provider-email') || _.startsWith(node_module, 'strapi-email')) {
emails.push(`${orga}/${node_module}`);
}
});
});
// mount all providers to get configs
_.forEach(emails, (node_module) => {
strapi.plugins.email.config.providers.push(

View File

@ -30,6 +30,20 @@ module.exports = async cb => {
return _.startsWith(node_module, 'strapi-provider-upload') || _.startsWith(node_module, 'strapi-upload');
});
node_modules.filter((node_module) => {
return node_module.startsWith('@');
})
.forEach((orga) => {
const node_modules = fs.readdirSync(path.join(basePath, 'node_modules', orga));
node_modules.forEach((node_module) => {
// DEPRECATED strapi-email-* will be remove in next version
if (_.startsWith(node_module, 'strapi-provider-upload') || _.startsWith(node_module, 'strapi-upload')) {
uploads.push(`${orga}/${node_module}`);
}
});
});
// mount all providers to get configs
_.forEach(uploads, (node_module) => {
strapi.plugins.upload.config.providers.push(