Merge pull request #2918 from strapi/enhancement/file-email-provider-orga

Manage email and upload providers from an npm organisation
This commit is contained in:
Jim LAURIE 2019-03-06 18:02:04 +01:00 committed by GitHub
commit 5924ed2f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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(