Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(MNHC-131): setup monorepo #3

Merged
merged 187 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
cb6e40e
avanzamento
Danielecina Dec 6, 2023
96e0d0a
avanzamento
Danielecina Dec 6, 2023
b150e28
avanzamento
Danielecina Dec 6, 2023
fd007ef
avanzamento
Danielecina Dec 6, 2023
1a16000
avanzamento
Danielecina Dec 6, 2023
829c982
avanzamento
Danielecina Dec 6, 2023
204b14e
added: first test
Danielecina Dec 11, 2023
a1ee73b
added: first test
Danielecina Dec 11, 2023
dbb8176
added: vite & webpack console sdk
Danielecina Dec 18, 2023
915223a
added: all tests
Danielecina Dec 21, 2023
0dbc23c
added: tests
Danielecina Dec 21, 2023
37247cf
added: clean package.json
Danielecina Dec 21, 2023
e390d16
Delete package-lock.json
Danielecina Dec 22, 2023
6ab72d5
fix: pipelines
Danielecina Dec 22, 2023
966838f
Merge branch 'feat/MNHC-131-setup' of https://github.com/mia-platform…
Danielecina Dec 22, 2023
d1ad3ad
fix: check license step
Danielecina Dec 22, 2023
a0edd30
test: login internal registry
Danielecina Dec 22, 2023
2cd16aa
test: yarn
Danielecina Dec 22, 2023
4d95391
test: fix dependecies
Danielecina Dec 22, 2023
1baff7b
test: fix packages
Danielecina Dec 22, 2023
a62d8a9
test: fix packages
Danielecina Dec 22, 2023
ae6c668
test: fix yarn lock
Danielecina Dec 22, 2023
a61e494
change: yarn with npm
Danielecina Jan 8, 2024
205e9c4
change: pipeline yarn command with npm
Danielecina Jan 8, 2024
14b39b6
change: workflow
Danielecina Jan 8, 2024
4cec674
change: workflow
Danielecina Jan 8, 2024
0d834b3
change: workflow
Danielecina Jan 8, 2024
b534afa
change: workflow
Danielecina Jan 8, 2024
7f937de
change: workflow
Danielecina Jan 8, 2024
e7df52b
change: workflow
Danielecina Jan 8, 2024
8cb5754
change: workflow
Danielecina Jan 8, 2024
df4516e
change: workflow
Danielecina Jan 8, 2024
073deb8
change: workflow
Danielecina Jan 8, 2024
9c6a318
change: workflow
Danielecina Jan 8, 2024
90dea5f
change: workflow
Danielecina Jan 8, 2024
b2bea7c
change: workflow
Danielecina Jan 8, 2024
04af92d
change: workflow
Danielecina Jan 8, 2024
f075255
change: workflow
Danielecina Jan 8, 2024
17721e1
change: workflow
Danielecina Jan 8, 2024
5f62181
change: workflow
Danielecina Jan 8, 2024
936e8dd
change: workflow
Danielecina Jan 8, 2024
9b3bad3
change: workflow
Danielecina Jan 8, 2024
737b127
change: workflow
Danielecina Jan 8, 2024
4b7e5f5
change: workflow
Danielecina Jan 8, 2024
baf6d7e
change: workflow
Danielecina Jan 8, 2024
25c0db4
change: workflow
Danielecina Jan 8, 2024
bee9cc3
change: workflow
Danielecina Jan 8, 2024
2c6fe52
change: workflow
Danielecina Jan 8, 2024
5d141a3
change: workflow
Danielecina Jan 8, 2024
1f23e7b
change: workflow
Danielecina Jan 8, 2024
73a8294
change: workflow
Danielecina Jan 8, 2024
a95f2ae
change: workflow
Danielecina Jan 8, 2024
7d54fdc
change: workflow
Danielecina Jan 8, 2024
ce1034c
added: license
Danielecina Jan 8, 2024
751006b
changed: licenses headers
Danielecina Jan 8, 2024
ea62a52
changed: licenses headers
Danielecina Jan 8, 2024
745b9c6
changed: licenses headers
Danielecina Jan 8, 2024
cb7bc5d
changed: licenses headers
Danielecina Jan 8, 2024
d35924a
changed: test script for coverage
Danielecina Jan 9, 2024
7c255a7
changed: pipeline for coverage
Danielecina Jan 9, 2024
43074f0
changed: pipeline for coverage
Danielecina Jan 9, 2024
03e9ac3
changed: pipeline for coverage
Danielecina Jan 9, 2024
703d997
changed: pipeline for coverage
Danielecina Jan 9, 2024
1f50e34
changed: pipeline for coverage
Danielecina Jan 9, 2024
8f2bf3f
changed: pipeline for coverage
Danielecina Jan 9, 2024
b297913
changed: pipeline for coverage
Danielecina Jan 9, 2024
689466c
changed: pipeline for coverage
Danielecina Jan 9, 2024
f7bf2b5
changed: pipeline for coverage
Danielecina Jan 9, 2024
072554f
changed: pipeline for coverage
Danielecina Jan 9, 2024
8776122
changed: pipeline for coverage
Danielecina Jan 9, 2024
c3005c7
changed: pipeline for coverage
Danielecina Jan 9, 2024
f21c442
changed: pipeline for coverage
Danielecina Jan 9, 2024
89ded10
changed: pipeline for coverage
Danielecina Jan 9, 2024
f342e5d
changed: pipeline for coverage
Danielecina Jan 9, 2024
3558b23
changed: pipeline for coverage
Danielecina Jan 9, 2024
bac7032
added: global test script
Danielecina Jan 9, 2024
4301657
added: global test script
Danielecina Jan 9, 2024
9ebd11e
fix: coverage step
Danielecina Jan 9, 2024
5e8309a
fix: coverage step
Danielecina Jan 9, 2024
a47665a
fix: coverage step
Danielecina Jan 9, 2024
4f0d7f9
fix: coverage step
Danielecina Jan 9, 2024
3f23844
fix: coverage step
Danielecina Jan 9, 2024
4741327
fix: coverage step
Danielecina Jan 9, 2024
e7ae48a
Merge branch 'main' of https://github.com/mia-platform/console-sdk in…
Danielecina Jan 9, 2024
3e37d73
added: readme
Danielecina Jan 9, 2024
0a12d8a
added: readme
Danielecina Jan 9, 2024
1fab8c2
fixed: mia logo
Danielecina Jan 9, 2024
7265fa9
fixed: readme
Danielecina Jan 9, 2024
d54cdf0
fixed: readme
Danielecina Jan 9, 2024
0f44b42
added titles to internal read me
Danielecina Jan 9, 2024
9beb190
Merge branch 'feat/MNHC-131-setup' of https://github.com/mia-platform…
Danielecina Jan 9, 2024
a5193cc
added titles to internal read me
Danielecina Jan 9, 2024
4857e48
added titles to internal read me
Danielecina Jan 9, 2024
60139c4
added: dependabot
Danielecina Jan 9, 2024
cf64439
added: package json license
Danielecina Jan 9, 2024
7eb1d24
fix: eslintrc
Danielecina Jan 9, 2024
e176b85
fix: eslintrc
Danielecina Jan 9, 2024
9236d28
fix: eslintrc
Danielecina Jan 9, 2024
c1ff511
fix: eslintrc
Danielecina Jan 9, 2024
c69d69c
fix: build
Danielecina Jan 10, 2024
1de6bbe
fix: build
Danielecina Jan 10, 2024
e288923
fix: build
Danielecina Jan 10, 2024
27f5d6b
fix: test
Danielecina Jan 10, 2024
69cfc27
fix: pipeline with pnpm
Danielecina Jan 10, 2024
35b3c82
fix: pipeline with pnpm
Danielecina Jan 10, 2024
2382b4f
fix: pipeline with pnpm
Danielecina Jan 10, 2024
578b44f
fix: pipeline
Danielecina Jan 11, 2024
209dd7b
fix: pipeline?
Danielecina Jan 11, 2024
98a615a
fix: pipeline?
Danielecina Jan 11, 2024
0e1180b
fix: pipeline?
Danielecina Jan 11, 2024
2aaa72b
fix: pipeline?
Danielecina Jan 11, 2024
e63924d
fix: pipeline?
Danielecina Jan 11, 2024
09fd1d2
fix: pipeline?
Danielecina Jan 11, 2024
e97f446
fix: pipeline?ù
Danielecina Jan 11, 2024
c294fbe
fix: pipeline?
Danielecina Jan 11, 2024
191f431
fix: pipeline?
Danielecina Jan 11, 2024
61daf44
fix: pipeline?
Danielecina Jan 11, 2024
3cd288e
fix: test
Danielecina Jan 11, 2024
f7c6601
fix: test
Danielecina Jan 11, 2024
4b93cca
fix: test
Danielecina Jan 11, 2024
901c5ac
fix: test
Danielecina Jan 11, 2024
1899260
fix: pipeline build step
Danielecina Jan 11, 2024
177167d
fix: check-license
Danielecina Jan 11, 2024
42a8dfc
fix: check-license
Danielecina Jan 11, 2024
c5b296e
fix: check-license
Danielecina Jan 11, 2024
71fab7f
fix: check-license
Danielecina Jan 11, 2024
acedd04
fix: check-license
Danielecina Jan 11, 2024
cca5aaa
fix: release
Danielecina Jan 12, 2024
8dd68f1
fix: release
Danielecina Jan 12, 2024
2f0e273
fix: build bundle
Danielecina Jan 12, 2024
99f1c61
fix: bundle
Danielecina Jan 12, 2024
e329162
fix: bundle
Danielecina Jan 12, 2024
ac389c2
update: versions to package.json
Danielecina Jan 12, 2024
ed923fb
update: versions to package.json
Danielecina Jan 12, 2024
a00d90f
update: changelog
Danielecina Jan 12, 2024
652d6a7
added: pkg json types
Danielecina Jan 12, 2024
279bed2
added: pkg json types
Danielecina Jan 12, 2024
8ddcfce
added: exclude gitignore
Danielecina Jan 12, 2024
f32477f
reset: change
Danielecina Jan 12, 2024
ae36ab9
added: npmignore
Danielecina Jan 12, 2024
ffc7c1b
added:tsc --build flag
Danielecina Jan 12, 2024
40b9c43
changed: .npmignore
Danielecina Jan 12, 2024
c3a4214
changed: eslintrc
Danielecina Jan 12, 2024
befcf5e
changed: test.yml
Danielecina Jan 12, 2024
9b06453
fix: lint
Danielecina Jan 12, 2024
8acff3b
fix: lint
Danielecina Jan 12, 2024
7dde0fe
fix: test
Danielecina Jan 12, 2024
54b3b91
fix: test
Danielecina Jan 12, 2024
b4494c1
feat: added scripts
Danielecina Jan 12, 2024
a28a9f6
chore: update LICENSE
fredmaggiowski Jan 12, 2024
63b5df7
fix: pr issues
Danielecina Jan 12, 2024
c74c267
fix: pr issues
Danielecina Jan 12, 2024
ca8b07d
fix: pr issues
Danielecina Jan 12, 2024
5ae0185
fix: pr issues
Danielecina Jan 12, 2024
c795fd9
fix: repository name
Danielecina Jan 12, 2024
596034a
Update packages/webpack-helpers-console-microfrontend/src/renderWebpa…
Danielecina Jan 12, 2024
c747b8e
fix: remove license from github action file
Danielecina Jan 12, 2024
b472cc5
fix: use npm secret for registry url
Danielecina Jan 12, 2024
9fcfa50
Merge branch 'feat/MNHC-131-setup' of https://github.com/mia-platform…
Danielecina Jan 12, 2024
17cb965
change: node-version from public workflow
Danielecina Jan 12, 2024
f60d357
Update tsconfig.json
Danielecina Jan 12, 2024
0e89dda
remove: unused configuration
Danielecina Jan 12, 2024
ade4011
reset: name migration of console-sdk
Danielecina Jan 12, 2024
cf658df
reset: name migration of console-sdk
Danielecina Jan 12, 2024
df1105c
reset: remove useless workspace config
Danielecina Jan 12, 2024
8594aef
rename: console-sdk libs
Danielecina Jan 12, 2024
ea8e9ea
remove: quiankun from console-sdk-micro
Danielecina Jan 12, 2024
a06e3fa
fix: test
Danielecina Jan 12, 2024
b8555bb
change: rename root package name
Danielecina Jan 12, 2024
a814d3c
change: getContext
Danielecina Jan 12, 2024
4261a5e
change: microFE-sdk readmi
Danielecina Jan 12, 2024
815e58f
removed: useless jsdom
Danielecina Jan 12, 2024
025b86d
removed: useless jsdom
Danielecina Jan 12, 2024
5f839c8
change: test work flow
Danielecina Jan 12, 2024
8af1e5c
Update package.json
Danielecina Jan 15, 2024
7f1473c
change: fix package.json
Danielecina Jan 15, 2024
84a3ae0
Merge branch 'feat/MNHC-131-setup' of https://github.com/mia-platform…
Danielecina Jan 15, 2024
f793e6a
change: fix package.json
Danielecina Jan 15, 2024
877f152
change: fix package.json
Danielecina Jan 15, 2024
41843b7
change: issue template
Danielecina Jan 15, 2024
7679af4
change: issue template
Danielecina Jan 15, 2024
731429f
change: decorate Quiankun props with IConsole props
Danielecina Jan 15, 2024
8191f87
change: decorate Quiankun props with IConsole props
Danielecina Jan 15, 2024
0c61bd5
change: decorate Quiankun props with IConsole props
Danielecina Jan 15, 2024
2ce8318
reset: decoration
Danielecina Jan 15, 2024
1eee128
fix: tests
Danielecina Jan 15, 2024
c4ad880
Update tsconfig.json
davidebianchi Jan 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ body:
multiple: true
description: What libraries should be affected by your feature proposal?
options:
- console-microfronent-sdk
- console-console-sdk-microfrontend
Danielecina marked this conversation as resolved.
Show resolved Hide resolved
validations:
required: true
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
version: 8
run_install: false
- name: Install Packages
run: pnpm i; rm -f .npmrc
run: pnpm i
env:
NODE_AUTH_TOKEN: ${{secrets.MIA_NPM_REGISTRY_TOKEN}}
- run: pnpm build
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ See the specific monorepo readme to using this library

### Console SDK.
An abstract interface used within helper repositories.
[Read more](./packages/microfronent-sdk)
[Read more](./packages/console-sdk-microfrontend)

### Vite helpers.
Used to configure the microfrontend with vite.
[Read more](./packages/vite-helpers-console-microfrontend)
[Read more](./packages/console-sdk-vite-helpers)

### Webpack helpers.
Used to configure the microfrontend with webpack.
Expand All @@ -35,9 +35,9 @@ Used to configure the microfrontend with webpack.
To use this repository

```bash
npm install @mia-platform-internal/microfronent-sdk
npm install @mia-platform-internal/vite-helpers-console-microfrontend
npm install @mia-platform-internal/webapack-helpers-console-microfrontend
npm install @mia-platform-internal/console-sdk-microfrontend
npm install @mia-platform-internal/console-sdk-vite-helpers
npm install @mia-platform-internal/console-sdk-webapack-helpers
```

## Local Development
Expand All @@ -49,9 +49,9 @@ npm install && npm test
```


[action-status-svg]: https://github.com/mia-platform/microfronent-sdk/actions/workflows/test.yml/badge.svg
[github-action]: https://github.com/mia-platform/microfronent-sdk/actions/workflows/test.yml
[action-status-svg]: https://github.com/mia-platform/console-sdk-microfrontend/actions/workflows/test.yml/badge.svg
[github-action]: https://github.com/mia-platform/console-sdk-microfrontend/actions/workflows/test.yml
[standard-mia-svg]: https://img.shields.io/badge/code_style-standard--mia-orange.svg
[standard-mia]: https://github.com/mia-platform/eslint-config-mia
[coverall-svg]: https://coveralls.io/repos/github/mia-platform/microfronent-sdk/badge.svg
[coverall-io]: https://coveralls.io/github/mia-platform/microfronent-sdk
[coverall-svg]: https://coveralls.io/repos/github/mia-platform/console-sdk-microfrontend/badge.svg
[coverall-io]: https://coveralls.io/github/mia-platform/console-sdk-microfrontend
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "console-monorepo",
"name": "console-sdk-monorepo",
"license": "Apache-2.0",
"version": "1.0.0",
"private": true,
"sideEffects": false,
"workspaces": [
"packages/microfronent-sdk",
"packages/vite-helpers-console-microfrontend",
"packages/console-sdk-microfrontend",
"packages/console-sdk-vite-helpers",
"packages/webpack-helpers-console-microfrontend"
Danielecina marked this conversation as resolved.
Show resolved Hide resolved
],
"devDependencies": {
Expand All @@ -23,8 +23,8 @@
},
"dependencies": {},
"scripts": {
"sdk": "pnpm --filter @mia-platform/microfronent-sdk",
"vh": "pnpm --filter @mia-platform/vite-helpers-console-microfrontend",
"sdk": "pnpm --filter @mia-platform/console-sdk-microfrontend",
"vh": "pnpm --filter @mia-platform/console-sdk-vite-helpers",
"wh": "pnpm --filter @mia-platform/webpack-helpers-console-microfrontend",

"postinstall": "pnpm sdk build",
Expand Down
3 changes: 3 additions & 0 deletions packages/console-sdk-microfrontend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @mia-platform/console-sdk-microfrontend

## Unreleased
2 changes: 2 additions & 0 deletions packages/console-sdk-microfrontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Microfrontend SDK

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@mia-platform/microfronent-sdk",
"name": "@mia-platform/console-sdk-microfrontend",
"license": "Apache-2.0",
"version": "0.0.0",
"private": true,
"main": "./build/src/index.js",
"main": "./src/index.ts",
Danielecina marked this conversation as resolved.
Show resolved Hide resolved
"module": "./src/index.ts",
"scripts": {
"preinstall": "npx only-allow pnpm",
Expand All @@ -25,20 +25,19 @@
"vite-plugin-qiankun": "1.0.15",
"@types/jest": "^29.5.11",
"@types/jsdom": "21.1.6",
"jsdom": "^23.0.1",
"jest": "^29.7.0",
"ts-jest": "^29.1.1"
},
"engines": {
"node": ">=v18.18.2"
},
"homepage": "https://github.com/mia-platform/microfronent-sdk#readme",
"homepage": "https://github.com/mia-platform/console-sdk-microfrontend#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/mia-platform/microfronent-sdk.git"
"url": "git+https://github.com/mia-platform/console-sdk-microfrontend.git"
},
"bugs": {
"url": "https://github.com/mia-platform/microfronent-sdk/issues"
"url": "https://github.com/mia-platform/console-sdk-microfrontend/issues"
},
"jest": {
"preset": "ts-jest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,67 +16,56 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { JSDOM } from 'jsdom'

import ConsoleSDK, { ContextsType, ISDKProps } from './MicrofrontendIntegrator'
import { Events, EventsTypes } from './types'

const dom = new JSDOM()
const { document } = dom.window

const container = document.createElement('div')
container.id = '__quiankun_container__'
import { ContextsType, Events, EventsTypes, IConsoleProps } from './types'
import ConsoleSDK from './MicrofrontendIntegrator'

const eventBus = jest.fn()
const quiankunProps = { name: 'testMicrofrontend', container }
const SDKPropsMock: ISDKProps = {
const quiankunProps = { name: 'testMicrofrontend' }
const consoleProps: IConsoleProps = {
...quiankunProps,
console: {
writeConfig: jest.fn(),
_signals: { mount: jest.fn() },
eventBus,
configObservables: {
endpoints: {},
collections: {},
configMaps: {},
services: {},
unsecretedVariables: [],

forceConfigUpdateChecksum: '',
microfrontendPluginConfig: {},
eventListener: eventBus,
featureTogglesProxyContext: {},
hotkeysContext: {},
resourceAPI: {
endpoints: {},
collections: {},
configMaps: {},
services: {},
unsecretedVariables: [],

forceConfigUpdateChecksum: '',
microfrontendPluginConfig: {},

selectedEnvironment: {},
selectedProject: {},

selectedEnvironment: {},
selectedProject: {},
writeConfig: jest.fn(),

_version: '0.0.0',
},
contexts: {
featureTogglesProxyContext: {},
hotkeysContext: {},
},
_version: '0.0.0',
_signals: { mount: jest.fn() },
},
}

describe('ConsoleSDK', () => {
it('should get the container id', () => {
const microfrontendIntegrator = new ConsoleSDK(SDKPropsMock)
const microfrontendIntegrator = new ConsoleSDK(consoleProps)
expect(microfrontendIntegrator.getContainerId()).toBe('testMicrofrontend')
})

it('should send an event through the event bus', () => {
const microfrontendIntegrator = new ConsoleSDK(SDKPropsMock)
const microfrontendIntegrator = new ConsoleSDK(consoleProps)
const event: Events = {
payload: { test: 'case' },
publisherId: 'microfrontend-test',
action: EventsTypes.SET_DYNAMIC_ROUTES,
}

microfrontendIntegrator.sendEvent(event)
expect(SDKPropsMock.console.eventBus).toHaveBeenCalledWith(event)
expect(consoleProps.eventListener).toHaveBeenCalledWith(event)
})

it('should get a context', () => {
const microfrontendIntegrator = new ConsoleSDK(SDKPropsMock)
const microfrontendIntegrator = new ConsoleSDK(consoleProps)

const featureToggleContext = microfrontendIntegrator.getContext(ContextsType.FEATURE_TOGGLE_CONTEXT)
const hotkeysContext = microfrontendIntegrator.getContext(ContextsType.HOTKEYS_CONTEXT)
Expand All @@ -88,7 +77,7 @@ describe('ConsoleSDK', () => {
})

it('should get the console config observable', () => {
const microfrontendIntegrator = new ConsoleSDK(SDKPropsMock)
const microfrontendIntegrator = new ConsoleSDK(consoleProps)
const configObservable = microfrontendIntegrator.getConsoleConfigObservable()

expect(configObservable).toHaveProperty('endpoints')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* Copyright 2024 Mia srl
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

import { Subject } from 'rxjs'

import { ContextsType, Events, IConsoleProps, IContexts, ISDKConsoleObservable } from './types'
import { getConsoleProps } from './adaptConsoleProps'

export type IMicrofronendIntegrator = {
getContext(contextType: ContextsType): IContexts[keyof IContexts] | undefined
getContainerId(): string
getConsoleConfigObservable(): ISDKConsoleObservable
sendEvent(event: Events): void
}
export default class MicrofronendIntegrator implements IMicrofronendIntegrator {
private events: Subject<Events>

name: string
contexts: IContexts
configObservable: ISDKConsoleObservable

constructor(mountingProps: IConsoleProps) {
const { name, console } = getConsoleProps(mountingProps)
const { eventBus, contexts } = console

this.name = name
this.contexts = contexts
this.configObservable = console.configObservables

this.events = new Subject()
this.events.subscribe(eventBus)
}

getContext(contextType: ContextsType): IContexts[keyof IContexts] | undefined {
switch (contextType) {
case ContextsType.FEATURE_TOGGLE_CONTEXT: {
const ctx: IContexts['featureTogglesProxyContext'] = {}
return ctx
}
case ContextsType.HOTKEYS_CONTEXT: {
const ctx: IContexts['hotkeysContext'] = {}
return ctx
}
default:
return undefined
}
}

getContainerId(): string {
return this.name
}

getConsoleConfigObservable(): ISDKConsoleObservable {
return this.configObservable
}

sendEvent(event: Events): void {
this.events.next(event)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { QiankunProps } from 'vite-plugin-qiankun/dist/helper'
import { omit } from 'ramda'

import { ISDKProps } from './MicrofrontendIntegrator'
import { IConsoleProps, ISDKProps } from './types'
import pkg from '../package.json'

export function getConsoleProps(props: QiankunProps): ISDKProps {
export function getConsoleProps(props: IConsoleProps): ISDKProps {
const {
eventListener,
resourceAPI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

import ConsoleSDK, { IConsoleSDK, ISDKProps } from './MicrofrontendIntegrator'
import { Events, EventsTypes } from './types'
import ConsoleSDK, { IMicrofronendIntegrator } from './MicrofrontendIntegrator'
import { Events, EventsTypes, IConsoleProps, ISDKProps } from './types'

export type {
ISDKProps,
IConsoleSDK,
IConsoleProps,
IMicrofronendIntegrator,
Events,
EventsTypes,
}
Expand Down
Loading
Loading