-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathindex.js
41 lines (33 loc) · 1.18 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { config, start, componentFactory } from 'mk-meta-engine'
import * as mkComponents from 'mk-component'
import myConfig from './config'
import markdown from './apps/markdown/index.js'
import mk_app_portal_about from './apps/mk-app-portal/apps/mk-app-portal-about/index.js'
import mk_app_portal_app1 from './apps/mk-app-portal/apps/mk-app-portal-app1/index.js'
import mk_app_portal_app2 from './apps/mk-app-portal/apps/mk-app-portal-app2/index.js'
import mk_app_portal from './apps/mk-app-portal/index.js'
const apps = {
[markdown.name]: markdown,
[mk_app_portal_about.name]: mk_app_portal_about,
[mk_app_portal_app1.name]: mk_app_portal_app1,
[mk_app_portal_app2.name]: mk_app_portal_app2,
[mk_app_portal.name]: mk_app_portal,
}
apps.config = (options) => {
Object.keys(options).forEach(key => {
const reg = new RegExp(`^${key == '*' ? '.*' : key}$`)
Object.keys(apps).forEach(appName => {
if (appName != 'config') {
if (reg.test(appName)) {
apps[appName].config(options[key])
}
}
})
})
}
apps.config({ '*': { apps } })
config(myConfig({ apps }))
Object.keys(mkComponents).forEach(key=>{
componentFactory.registerComponent(key, mkComponents[key])
})
start()