Skip to content

Commit d824c68

Browse files
authored
Add module federation (#10)
* Add module federation * Finalize module federation build * Update build pipelines
1 parent 17ecad6 commit d824c68

14 files changed

Lines changed: 4972 additions & 6229 deletions

File tree

.github/workflows/studio-frontend-build.yaml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,41 @@ jobs:
9494
with:
9595
commit_message: Apply eslint-fixer changes
9696

97+
check-types:
98+
needs: install
99+
runs-on: ubuntu-latest
100+
101+
permissions:
102+
contents: write
103+
104+
steps:
105+
- name: Checkout code
106+
uses: actions/checkout@v4
107+
with:
108+
ref: ${{ github.event.pull_request.head.ref }}
109+
repository: ${{ github.event.pull_request.head.repo.full_name }}
110+
111+
- name: Set up Node.js
112+
uses: actions/setup-node@v4
113+
with:
114+
node-version: 18
115+
116+
- name: Cache npm dependencies
117+
uses: actions/cache@v4
118+
with:
119+
path: ./assets/node_modules
120+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
121+
restore-keys: |
122+
${{ runner.os }}-node-
123+
124+
- name: Run type checking
125+
working-directory: ./assets
126+
run: npm run check-types
127+
97128
build:
98-
needs: lint
129+
needs:
130+
- lint
131+
- check-types
99132
runs-on: ubuntu-latest
100133

101134
permissions:

assets/js/src/examples/custom-widgets/components/example-widget.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,31 @@ export const ExampleWidget = (): React.JSX.Element => {
7676
>
7777
<Button
7878
disabled={ areButtonsDisabled }
79+
/* @ts-expect-error - type WidgetManagerTabConfig missing */
7980
onClick={ () => { widgetManager.openMainWidget(selectedWidget) } }
8081
>
8182
Open main widget
8283
</Button>
8384

8485
<Button
8586
disabled={ areButtonsDisabled }
87+
/* @ts-expect-error - type WidgetManagerTabConfig missing */
8688
onClick={ () => { widgetManager.openLeftWidget(selectedWidget) } }
8789
>
8890
Open left widget
8991
</Button>
9092

9193
<Button
9294
disabled={ areButtonsDisabled }
95+
/* @ts-expect-error - type WidgetManagerTabConfig missing */
9396
onClick={ () => { widgetManager.openRightWidget(selectedWidget) } }
9497
>
9598
Open right widget
9699
</Button>
97100

98101
<Button
99102
disabled={ areButtonsDisabled }
103+
/* @ts-expect-error - type WidgetManagerTabConfig missing */
100104
onClick={ () => { widgetManager.openBottomWidget(selectedWidget) } }
101105
>
102106
Open bottom widget

assets/js/src/examples/main-nav-entry/modules/main-nav-entry-extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type AbstractModule, container } from '@pimcore/studio-ui-bundle'
1+
import { container, type AbstractModule } from '@pimcore/studio-ui-bundle'
22
import { serviceIds } from '@pimcore/studio-ui-bundle/app'
33
import { type MainNavRegistry } from '@pimcore/studio-ui-bundle/modules/app'
44
import { type WidgetRegistry } from '@pimcore/studio-ui-bundle/modules/widget-manager'

assets/js/src/main.ts

Whitespace-only changes.
Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
1-
import { Pimcore } from '@pimcore/studio-ui-bundle'
21
import { MainNavEntryPlugin } from './examples/main-nav-entry'
3-
import { LeftSidebarPlugin } from './examples/left-sidebar'
2+
// import { LeftSidebarPlugin } from './examples/left-sidebar'
43
import { AssetEditorToolbarButtonPlugin } from './examples/asset-editor-toolbar-button'
54
import { TabManagerPlugin } from './examples/tab-manager'
65
import { CustomIconPlugin } from './examples/custom-icons'
76
import { CustomWidgetsPlugin } from './examples/custom-widgets'
87
import { DynamicTypePlugin } from './examples/dynamic-types'
98
import { ApiDataPlugin } from './examples/api-data'
109

11-
if (module.hot !== undefined) {
12-
module.hot.accept()
13-
}
14-
15-
const pluginSystem = Pimcore.pluginSystem
16-
1710
// Examples are splitted into separate plugins to create a clear separation for better understanding.
1811
// You can also combine them into one plugin if you want to.
19-
pluginSystem.registerPlugin(MainNavEntryPlugin)
20-
pluginSystem.registerPlugin(LeftSidebarPlugin)
21-
pluginSystem.registerPlugin(AssetEditorToolbarButtonPlugin)
22-
pluginSystem.registerPlugin(TabManagerPlugin)
23-
pluginSystem.registerPlugin(CustomIconPlugin)
24-
pluginSystem.registerPlugin(CustomWidgetsPlugin)
25-
pluginSystem.registerPlugin(DynamicTypePlugin)
26-
pluginSystem.registerPlugin(ApiDataPlugin)
12+
export {
13+
MainNavEntryPlugin,
14+
// LeftSidebarPlugin,
15+
AssetEditorToolbarButtonPlugin,
16+
TabManagerPlugin,
17+
CustomIconPlugin,
18+
CustomWidgetsPlugin,
19+
DynamicTypePlugin,
20+
ApiDataPlugin
21+
}

0 commit comments

Comments
 (0)