Josh 116339ad86
refactor: admin build pipeline (#18539)
* chore(admin): refactor admin develop/build pipeline

chore: remove `webpackChunkName` comments

chore: reuse admin tsconfig where possible

chore: add .strapi to gitignore

chore(admin): pack-up

feat(admin): inject commands into strapi from admin for building

feat(admin): move watch command to admin

chore: keep backward compat API available

Update packages/core/admin/_internal/cli/index.ts

docs(admin): document the build & develop process and pipeline

test(admin): fix StrapiApp tests

chore: fix build

* Update skipped_tests.yml

* test(e2e): fix e2e setup

feat: add dependency installation

fix: mjs webpack resolution

* chore: fix server exports

* fix: typescript project type generation

* fix: development watch mode

* fix: connect to hot middleware – anywhere

* Update packages/core/admin/_internal/node/core/monorepo.ts

Co-authored-by: Marc Roig <marc12info@gmail.com>

* fix(admin): theme toggle type export

* chore: fixes

* chore: pr amends

Co-Authored-By: Ben Irvin <ben@innerdvations.com>

---------

Co-authored-by: Marc Roig <marc12info@gmail.com>
Co-authored-by: Ben Irvin <ben@innerdvations.com>
2023-10-30 11:36:16 +00:00

83 lines
2.4 KiB
JavaScript

// 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
import { prefixPluginTranslations } from '@strapi/helper-plugin';
import pluginPkg from '../../package.json';
import { MediaLibraryDialog } from './components/MediaLibraryDialog';
import { MediaLibraryInput } from './components/MediaLibraryInput';
import PluginIcon from './components/PluginIcon';
import { PERMISSIONS } from './constants';
import pluginId from './pluginId';
import getTrad from './utils/getTrad';
const name = pluginPkg.strapi.name;
export default {
register(app) {
app.addMenuLink({
to: `/plugins/${pluginId}`,
icon: PluginIcon,
intlLabel: {
id: `${pluginId}.plugin.name`,
defaultMessage: 'Media Library',
},
permissions: PERMISSIONS.main,
async Component() {
const component = await import('./pages/App');
return component;
},
});
app.addFields({ type: 'media', Component: MediaLibraryInput });
app.addComponents([{ name: 'media-library', Component: MediaLibraryDialog }]);
app.registerPlugin({
id: pluginId,
name,
});
},
bootstrap(app) {
app.addSettingsLink('global', {
id: 'media-library-settings',
intlLabel: {
id: getTrad('plugin.name'),
defaultMessage: 'Media Library',
},
to: '/settings/media-library',
async Component() {
const component = await import('./pages/SettingsPage');
return component;
},
permissions: PERMISSIONS.settings,
});
},
async registerTrads({ locales }) {
const importedTrads = await Promise.all(
locales.map((locale) => {
return import(`./translations/${locale}.json`)
.then(({ default: data }) => {
return {
data: prefixPluginTranslations(data, pluginId),
locale,
};
})
.catch(() => {
return {
data: {},
locale,
};
});
})
);
return Promise.resolve(importedTrads);
},
};