2020-03-06 13:33:07 +01:00
|
|
|
// NOTE TO PLUGINS DEVELOPERS:
|
|
|
|
// If you modify this file by adding new options to the plugin entry point
|
|
|
|
// Here's the file: strapi/docs/3.0.0-beta.x/plugin-development/frontend-field-api.md
|
|
|
|
// Here's the file: strapi/docs/3.0.0-beta.x/guides/registering-a-field-in-admin.md
|
|
|
|
// Also the strapi-generate-plugins/files/admin/src/index.js needs to be updated
|
|
|
|
// IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
|
2019-04-16 18:05:12 +02:00
|
|
|
import pluginPkg from '../../package.json';
|
2020-06-10 14:42:36 +02:00
|
|
|
import pluginPermissions from './permissions';
|
2019-04-16 18:05:12 +02:00
|
|
|
import pluginId from './pluginId';
|
2020-02-11 17:15:53 +01:00
|
|
|
import pluginLogo from './assets/images/logo.svg';
|
2021-05-27 07:46:31 +02:00
|
|
|
import App from './pages/App';
|
2021-06-09 11:22:23 +02:00
|
|
|
// import trads from './translations';
|
2019-04-16 18:05:12 +02:00
|
|
|
|
2021-05-10 10:17:48 +02:00
|
|
|
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
|
|
|
|
const icon = pluginPkg.strapi.icon;
|
|
|
|
const name = pluginPkg.strapi.name;
|
|
|
|
|
|
|
|
export default {
|
|
|
|
register(app) {
|
|
|
|
app.registerPlugin({
|
|
|
|
description: pluginDescription,
|
|
|
|
icon,
|
|
|
|
id: pluginId,
|
|
|
|
isReady: true,
|
|
|
|
isRequired: pluginPkg.strapi.required || false,
|
|
|
|
// TODO
|
|
|
|
mainComponent: App,
|
|
|
|
name,
|
|
|
|
pluginLogo,
|
|
|
|
// TODO
|
2021-06-09 11:22:23 +02:00
|
|
|
// trads,
|
2021-05-10 10:17:48 +02:00
|
|
|
// TODO
|
|
|
|
menu: {
|
|
|
|
pluginsSectionLinks: [
|
|
|
|
{
|
|
|
|
destination: `/plugins/${pluginId}`,
|
|
|
|
icon,
|
|
|
|
label: {
|
|
|
|
id: `${pluginId}.plugin.name`,
|
|
|
|
defaultMessage: 'Documentation',
|
|
|
|
},
|
|
|
|
name,
|
|
|
|
permissions: pluginPermissions.main,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
boot() {},
|
2021-06-09 11:22:23 +02:00
|
|
|
async registerTrads({ locales }) {
|
|
|
|
const importedTrads = await Promise.all(
|
|
|
|
locales.map(locale => {
|
|
|
|
return import(
|
|
|
|
/* webpackChunkName: "documentation-translation-[request]" */ `./translations/${locale}.json`
|
|
|
|
)
|
|
|
|
.then(({ default: data }) => {
|
|
|
|
return {
|
|
|
|
data: Object.keys(data).reduce((acc, current) => {
|
|
|
|
acc[`${pluginId}.${current}`] = data[current];
|
|
|
|
|
|
|
|
return acc;
|
|
|
|
}, {}),
|
|
|
|
locale,
|
|
|
|
};
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
return {
|
|
|
|
data: {},
|
|
|
|
locale,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
return Promise.resolve(importedTrads);
|
|
|
|
},
|
2019-04-16 18:05:12 +02:00
|
|
|
};
|