@maxelms/create-plugin-cli 1.1.23 → 1.1.25-master.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +4 -4
- package/package.json +2 -2
- package/templates/angular-micro-plugin/.eslintrc.js +3 -0
- package/templates/angular-micro-plugin/README.md +5 -0
- package/templates/angular-micro-plugin/manifest.json.tpl +3 -0
- package/templates/angular-micro-plugin/package.json.tpl +38 -0
- package/templates/angular-micro-plugin/pnpm-lock.yaml +7988 -0
- package/templates/angular-micro-plugin/public/configuration.html +13 -0
- package/templates/angular-micro-plugin/public/configuration.json +34 -0
- package/templates/angular-micro-plugin/public/index.html.tpl +15 -0
- package/templates/angular-micro-plugin/src/app.component.css +22 -0
- package/templates/angular-micro-plugin/src/app.component.html +312 -0
- package/templates/angular-micro-plugin/src/app.component.ts.tpl +33 -0
- package/templates/angular-micro-plugin/src/app.module.ts +10 -0
- package/templates/angular-micro-plugin/src/index.ts.tpl +53 -0
- package/templates/angular-micro-plugin/src/single-spa-props.ts +7 -0
- package/templates/angular-micro-plugin/tsconfig.json +25 -0
- package/templates/angular-micro-plugin/webpack.config.js +112 -0
- package/templates/jQuery-micro-app/src/main.js.tpl +1 -1
- package/templates/playground/dist/main.js +1 -1
- package/templates/react-micro-app/src/index.tsx +1 -1
- package/templates/react-micro-button/configuration/Configuration.tsx +1 -1
- package/templates/react-micro-button/public/configuration.html +1 -1
- package/templates/react-micro-field/configuration/Configuration.tsx +1 -1
- package/templates/react-micro-field/public/configuration.html +1 -1
- package/templates/react-micro-field/public/index.html +1 -1
- package/templates/react-micro-field/src/App.tsx.tpl +4 -4
- package/templates/react-micro-field-umi/src/pages/configuration/index.tsx +1 -1
- package/templates/react-micro-field-umi/src/pages/index.tsx.tpl +4 -4
- package/templates/react-micro-field-umi/src/pages/interface.ts +1 -1
- package/templates/react-micro-plugin/configuration/Configuration.tsx +1 -1
- package/templates/react-micro-plugin/public/configuration.html +11 -8
- package/templates/react-micro-plugin-umi/src/pages/configuration/index.tsx +1 -1
- package/templates/vue-micro-app/src/main.js +1 -1
- package/templates/vue-micro-button/public/configuration.html +1 -1
- package/templates/vue-micro-field/public/configuration.html +1 -1
- package/templates/vue-micro-field/public/index.html +1 -1
- package/templates/vue-micro-field/src/App.vue.tpl +2 -2
- package/templates/vue-micro-plugin/configuration/App.vue +1 -1
- package/templates/vue3-micro-app/src/main.js +2 -2
- package/templates/vue3-micro-app/src/public-path.js +1 -1
- package/templates/vue3-micro-button/public/configuration.html +1 -1
- package/templates/vue3-micro-button/public/index.html +1 -1
- package/templates/vue3-micro-field/public/configuration.html +1 -1
- package/templates/vue3-micro-field/public/index.html +1 -1
- package/templates/vue3-micro-field/src/App.vue.tpl +2 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"propName1": {
|
|
3
|
+
"label": "配置项一",
|
|
4
|
+
"type": "string",
|
|
5
|
+
"defaultValue": "配置项内容"
|
|
6
|
+
},
|
|
7
|
+
"propName2": {
|
|
8
|
+
"label": "配置项二",
|
|
9
|
+
"type": "number",
|
|
10
|
+
"defaultValue": 350
|
|
11
|
+
},
|
|
12
|
+
"propName3": {
|
|
13
|
+
"label": "配置项三",
|
|
14
|
+
"type": "select",
|
|
15
|
+
"options": [
|
|
16
|
+
{
|
|
17
|
+
"label": "选项1",
|
|
18
|
+
"value": "option1"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"label": "选项2",
|
|
22
|
+
"value": "option2"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"label": "选项3",
|
|
26
|
+
"value": "option3"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"externalParams": {
|
|
31
|
+
"label": "外部参数",
|
|
32
|
+
"type": "string"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>Maxelms 页面组件 angular13</title>
|
|
7
|
+
<base href="/">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root-<%= timestamp %>"></div>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
3
|
+
font-size: 14px;
|
|
4
|
+
color: #333;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
-webkit-font-smoothing: antialiased;
|
|
7
|
+
-moz-osx-font-smoothing: grayscale;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
h1,
|
|
11
|
+
h2,
|
|
12
|
+
h3,
|
|
13
|
+
h4,
|
|
14
|
+
h5,
|
|
15
|
+
h6 {
|
|
16
|
+
margin: 8px 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
p {
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.spacer {
|
|
3
|
+
flex: 1;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.toolbar {
|
|
7
|
+
position: absolute;
|
|
8
|
+
top: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
right: 0;
|
|
11
|
+
height: 60px;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
background-color: #1976d2;
|
|
15
|
+
color: white;
|
|
16
|
+
font-weight: 600;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.toolbar img {
|
|
20
|
+
margin: 0 16px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.toolbar #twitter-logo {
|
|
24
|
+
height: 40px;
|
|
25
|
+
margin: 0 16px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.toolbar #twitter-logo:hover {
|
|
29
|
+
opacity: 0.8;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.content {
|
|
33
|
+
display: flex;
|
|
34
|
+
margin: 82px auto 32px;
|
|
35
|
+
padding: 0 16px;
|
|
36
|
+
max-width: 960px;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
align-items: center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
svg.material-icons {
|
|
42
|
+
height: 24px;
|
|
43
|
+
width: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
svg.material-icons:not(:last-child) {
|
|
47
|
+
margin-right: 8px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.card svg.material-icons path {
|
|
51
|
+
fill: #888;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.card-container {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-wrap: wrap;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
margin-top: 16px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.card {
|
|
62
|
+
border-radius: 4px;
|
|
63
|
+
border: 1px solid #eee;
|
|
64
|
+
background-color: #fafafa;
|
|
65
|
+
height: 40px;
|
|
66
|
+
width: 200px;
|
|
67
|
+
margin: 0 8px 16px;
|
|
68
|
+
padding: 16px;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
align-items: center;
|
|
73
|
+
transition: all 0.2s ease-in-out;
|
|
74
|
+
line-height: 24px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.card-container .card:not(:last-child) {
|
|
78
|
+
margin-right: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.card.card-small {
|
|
82
|
+
height: 16px;
|
|
83
|
+
width: 168px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.card-container .card:not(.highlight-card) {
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.card-container .card:not(.highlight-card):hover {
|
|
91
|
+
transform: translateY(-3px);
|
|
92
|
+
box-shadow: 0 4px 17px rgba(black, 0.35);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.card-container .card:not(.highlight-card):hover .material-icons path {
|
|
96
|
+
fill: rgb(105, 103, 103);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.card.highlight-card {
|
|
100
|
+
background-color: #1976d2;
|
|
101
|
+
color: white;
|
|
102
|
+
font-weight: 600;
|
|
103
|
+
border: none;
|
|
104
|
+
width: auto;
|
|
105
|
+
min-width: 30%;
|
|
106
|
+
position: relative;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.card.card.highlight-card span {
|
|
110
|
+
margin-left: 60px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
svg#rocket {
|
|
114
|
+
width: 80px;
|
|
115
|
+
position: absolute;
|
|
116
|
+
left: -10px;
|
|
117
|
+
top: -24px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
svg#rocket-smoke {
|
|
121
|
+
height: calc(100vh - 95px);
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: 10px;
|
|
124
|
+
right: 180px;
|
|
125
|
+
z-index: -10;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
a,
|
|
129
|
+
a:visited,
|
|
130
|
+
a:hover {
|
|
131
|
+
color: #1976d2;
|
|
132
|
+
text-decoration: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
a:hover {
|
|
136
|
+
color: #125699;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.terminal {
|
|
140
|
+
position: relative;
|
|
141
|
+
width: 80%;
|
|
142
|
+
max-width: 600px;
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
padding-top: 45px;
|
|
145
|
+
margin-top: 8px;
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
background-color: rgb(15, 15, 16);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.terminal::before {
|
|
151
|
+
content: "\2022 \2022 \2022";
|
|
152
|
+
position: absolute;
|
|
153
|
+
top: 0;
|
|
154
|
+
left: 0;
|
|
155
|
+
height: 4px;
|
|
156
|
+
background: rgb(58, 58, 58);
|
|
157
|
+
color: #c2c3c4;
|
|
158
|
+
width: 100%;
|
|
159
|
+
font-size: 2rem;
|
|
160
|
+
line-height: 0;
|
|
161
|
+
padding: 14px 0;
|
|
162
|
+
text-indent: 4px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.terminal pre {
|
|
166
|
+
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
|
167
|
+
color: white;
|
|
168
|
+
padding: 0 1rem 1rem;
|
|
169
|
+
margin: 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.circle-link {
|
|
173
|
+
height: 40px;
|
|
174
|
+
width: 40px;
|
|
175
|
+
border-radius: 40px;
|
|
176
|
+
margin: 8px;
|
|
177
|
+
background-color: white;
|
|
178
|
+
border: 1px solid #eeeeee;
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
align-items: center;
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
|
|
184
|
+
transition: 1s ease-out;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.circle-link:hover {
|
|
188
|
+
transform: translateY(-0.25rem);
|
|
189
|
+
box-shadow: 0px 3px 15px rgba(0, 0, 0, 0.2);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
footer {
|
|
193
|
+
margin-top: 8px;
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
line-height: 20px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
footer a {
|
|
200
|
+
display: flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.github-star-badge {
|
|
205
|
+
color: #24292e;
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
font-size: 12px;
|
|
209
|
+
padding: 3px 10px;
|
|
210
|
+
border: 1px solid rgba(27, 31, 35, .2);
|
|
211
|
+
border-radius: 3px;
|
|
212
|
+
background-image: linear-gradient(-180deg, #fafbfc, #eff3f6 90%);
|
|
213
|
+
margin-left: 4px;
|
|
214
|
+
font-weight: 600;
|
|
215
|
+
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.github-star-badge:hover {
|
|
219
|
+
background-image: linear-gradient(-180deg, #f0f3f6, #e6ebf1 90%);
|
|
220
|
+
border-color: rgba(27, 31, 35, .35);
|
|
221
|
+
background-position: -.5em;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.github-star-badge .material-icons {
|
|
225
|
+
height: 16px;
|
|
226
|
+
width: 16px;
|
|
227
|
+
margin-right: 4px;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
svg#clouds {
|
|
231
|
+
position: fixed;
|
|
232
|
+
bottom: -160px;
|
|
233
|
+
left: -230px;
|
|
234
|
+
z-index: -10;
|
|
235
|
+
width: 1920px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* Responsive Styles */
|
|
239
|
+
@media screen and (max-width: 767px) {
|
|
240
|
+
|
|
241
|
+
.card-container>*:not(.circle-link),
|
|
242
|
+
.terminal {
|
|
243
|
+
width: 100%;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.card:not(.highlight-card) {
|
|
247
|
+
height: 16px;
|
|
248
|
+
margin: 8px 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.card.highlight-card span {
|
|
252
|
+
margin-left: 72px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
svg#rocket-smoke {
|
|
256
|
+
right: 120px;
|
|
257
|
+
transform: rotate(-5deg);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@media screen and (max-width: 575px) {
|
|
262
|
+
svg#rocket-smoke {
|
|
263
|
+
display: none;
|
|
264
|
+
visibility: hidden;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
</style>
|
|
268
|
+
|
|
269
|
+
<!-- Toolbar -->
|
|
270
|
+
<div class="toolbar" role="banner">
|
|
271
|
+
<img width="40" alt="Angular Logo"
|
|
272
|
+
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==" />
|
|
273
|
+
<span>Welcome</span>
|
|
274
|
+
<div class="spacer"></div>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
<div class="content" role="main">
|
|
278
|
+
|
|
279
|
+
<!-- Highlight Card -->
|
|
280
|
+
<div class="card highlight-card card-small">
|
|
281
|
+
|
|
282
|
+
<svg id="rocket" alt="Rocket Ship" xmlns="http://www.w3.org/2000/svg" width="101.678" height="101.678"
|
|
283
|
+
viewBox="0 0 101.678 101.678">
|
|
284
|
+
<g id="Group_83" data-name="Group 83" transform="translate(-141 -696)">
|
|
285
|
+
<circle id="Ellipse_8" data-name="Ellipse 8" cx="50.839" cy="50.839" r="50.839" transform="translate(141 696)"
|
|
286
|
+
fill="#dd0031" />
|
|
287
|
+
<g id="Group_47" data-name="Group 47" transform="translate(165.185 720.185)">
|
|
288
|
+
<path id="Path_33" data-name="Path 33"
|
|
289
|
+
d="M3.4,42.615a3.084,3.084,0,0,0,3.553,3.553,21.419,21.419,0,0,0,12.215-6.107L9.511,30.4A21.419,21.419,0,0,0,3.4,42.615Z"
|
|
290
|
+
transform="translate(0.371 3.363)" fill="#fff" />
|
|
291
|
+
<path id="Path_34" data-name="Path 34"
|
|
292
|
+
d="M53.3,3.221A3.09,3.09,0,0,0,50.081,0,48.227,48.227,0,0,0,18.322,13.437c-6-1.666-14.991-1.221-18.322,7.218A33.892,33.892,0,0,1,9.439,25.1l-.333.666a3.013,3.013,0,0,0,.555,3.553L23.985,43.641a2.9,2.9,0,0,0,3.553.555l.666-.333A33.892,33.892,0,0,1,32.647,53.3c8.55-3.664,8.884-12.326,7.218-18.322A48.227,48.227,0,0,0,53.3,3.221ZM34.424,9.772a6.439,6.439,0,1,1,9.106,9.106,6.368,6.368,0,0,1-9.106,0A6.467,6.467,0,0,1,34.424,9.772Z"
|
|
293
|
+
transform="translate(0 0.005)" fill="#fff" />
|
|
294
|
+
</g>
|
|
295
|
+
</g>
|
|
296
|
+
</svg>
|
|
297
|
+
|
|
298
|
+
<span>{{ title }} app is running!</span>
|
|
299
|
+
|
|
300
|
+
<svg id="rocket-smoke" alt="Rocket Ship Smoke" xmlns="http://www.w3.org/2000/svg" width="516.119" height="1083.632"
|
|
301
|
+
viewBox="0 0 516.119 1083.632">
|
|
302
|
+
<path id="Path_40" data-name="Path 40"
|
|
303
|
+
d="M644.6,141S143.02,215.537,147.049,870.207s342.774,201.755,342.774,201.755S404.659,847.213,388.815,762.2c-27.116-145.51-11.551-384.124,271.9-609.1C671.15,139.365,644.6,141,644.6,141Z"
|
|
304
|
+
transform="translate(-147.025 -140.939)" fill="#f5f5f5" />
|
|
305
|
+
</svg>
|
|
306
|
+
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
<p>propName1 = {{ propName1 }}</p>
|
|
310
|
+
<p>propName2 = {{ propName2 }}</p>
|
|
311
|
+
|
|
312
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component, OnDestroy, OnInit } from '@angular/core'
|
|
2
|
+
import { Subscription } from 'rxjs'
|
|
3
|
+
import { singleSpaPropsSubject } from './single-spa-props' // 引用你定义的 Subject
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: '#root-<%= timestamp %>',
|
|
7
|
+
templateUrl: './app.component.html',
|
|
8
|
+
styleUrls: ['./app.component.css'],
|
|
9
|
+
})
|
|
10
|
+
export class AppComponent implements OnInit, OnDestroy {
|
|
11
|
+
|
|
12
|
+
title = 'angular13';
|
|
13
|
+
propName1: string = '';
|
|
14
|
+
propName2: string = '';
|
|
15
|
+
|
|
16
|
+
private propsSub?: any;
|
|
17
|
+
|
|
18
|
+
ngOnInit() {
|
|
19
|
+
console.log('ngOnInit')
|
|
20
|
+
|
|
21
|
+
// 订阅 singleSpaProps
|
|
22
|
+
this.propsSub = singleSpaPropsSubject.subscribe((props: any) => {
|
|
23
|
+
console.log('收到主应用传来的 props: 111', props)
|
|
24
|
+
const { configurations, bizData } = props || {}
|
|
25
|
+
this.propName1 = configurations.propName1
|
|
26
|
+
this.propName2 = configurations.propName2
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ngOnDestroy() {
|
|
31
|
+
this.propsSub?.unsubscribe()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
3
|
+
import { AppComponent } from './app.component';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
declarations: [AppComponent],
|
|
7
|
+
imports: [BrowserModule],
|
|
8
|
+
bootstrap: [AppComponent]
|
|
9
|
+
})
|
|
10
|
+
export class AppModule {}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { enableProdMode } from '@angular/core'
|
|
2
|
+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
|
3
|
+
// import { singleSpaAngular, getSingleSpaExtraProviders } from 'single-spa-angular';
|
|
4
|
+
import { registerPlugin, poweredByMaxelms } from '@maxelms/create-pulgin-api'
|
|
5
|
+
|
|
6
|
+
import { AppModule } from './app.module'
|
|
7
|
+
import { singleSpaPropsSubject } from './single-spa-props'
|
|
8
|
+
|
|
9
|
+
const container = '#root-<%= timestamp %>'
|
|
10
|
+
const environment = process.env.NODE_ENV === 'production'
|
|
11
|
+
|
|
12
|
+
if (environment) {
|
|
13
|
+
enableProdMode()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!poweredByMaxelms) {
|
|
17
|
+
const props = {
|
|
18
|
+
configurations: {
|
|
19
|
+
'propName1': '11',
|
|
20
|
+
'propName2': 3502,
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
console.log(props, 'props poweredByMaxelms')
|
|
24
|
+
render(props)
|
|
25
|
+
} else {
|
|
26
|
+
let $root: any
|
|
27
|
+
|
|
28
|
+
registerPlugin?.({
|
|
29
|
+
bootstrap() {
|
|
30
|
+
},
|
|
31
|
+
mount(props: any) {
|
|
32
|
+
console.log(props, 'props mount')
|
|
33
|
+
render(props)
|
|
34
|
+
$root = document.querySelector(`#${props.containerId} ${container}`)
|
|
35
|
+
},
|
|
36
|
+
update(props: any) {
|
|
37
|
+
console.log(props, 'props update')
|
|
38
|
+
render(props)
|
|
39
|
+
},
|
|
40
|
+
unmount(props: any) {
|
|
41
|
+
const element = document.querySelector(`#${props.containerId} ${container}`) || $root
|
|
42
|
+
// element && ReactDOM.unmountComponentAtNode(element)
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
function render(singleSpaProps: any) {
|
|
49
|
+
singleSpaPropsSubject.next(singleSpaProps)
|
|
50
|
+
return platformBrowserDynamic().bootstrapModule(AppModule, {
|
|
51
|
+
ngZone: 'noop',
|
|
52
|
+
})
|
|
53
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReplaySubject } from 'rxjs'
|
|
2
|
+
|
|
3
|
+
export const singleSpaPropsSubject = new ReplaySubject<SingleSpaProps>(1)
|
|
4
|
+
|
|
5
|
+
// Add any custom single-spa props you have to this type def
|
|
6
|
+
// https://single-spa.js.org/docs/building-applications.html#custom-props
|
|
7
|
+
export type SingleSpaProps = any;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "./",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"sourceMap": true,
|
|
7
|
+
"declaration": false,
|
|
8
|
+
"downlevelIteration": true,
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"importHelpers": true,
|
|
12
|
+
"target": "es2017",
|
|
13
|
+
"module": "es2020",
|
|
14
|
+
"lib": ["es2018", "dom"],
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"noImplicitAny": false,
|
|
17
|
+
"strict": false
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"src/index.ts"
|
|
21
|
+
],
|
|
22
|
+
"include": [
|
|
23
|
+
"src/app/**/*",
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
3
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
4
|
+
const { AngularWebpackPlugin } = require('@ngtools/webpack')
|
|
5
|
+
|
|
6
|
+
const isProduction = process.env.NODE_ENV == 'production'
|
|
7
|
+
|
|
8
|
+
const config = {
|
|
9
|
+
entry: {
|
|
10
|
+
index: './src/index.ts',
|
|
11
|
+
},
|
|
12
|
+
output: {
|
|
13
|
+
publicPath: '',
|
|
14
|
+
path: path.resolve(__dirname, 'dist'),
|
|
15
|
+
filename: isProduction
|
|
16
|
+
? '[name].[contenthash].bundle.js'
|
|
17
|
+
: '[name].bundle.js',
|
|
18
|
+
},
|
|
19
|
+
devServer: {
|
|
20
|
+
open: ['/', '/playground.html'],
|
|
21
|
+
host: 'localhost',
|
|
22
|
+
port: 8080,
|
|
23
|
+
headers: {
|
|
24
|
+
'Access-Control-Allow-Origin': '*',
|
|
25
|
+
},
|
|
26
|
+
proxy: {
|
|
27
|
+
'/api/': {
|
|
28
|
+
target: 'https://max-ai.maxelms.com/',
|
|
29
|
+
changeOrigin: true,
|
|
30
|
+
cookieDomainRewrite: '',
|
|
31
|
+
},
|
|
32
|
+
'/app/api/': {
|
|
33
|
+
target: 'https://max-ai.maxelms.com/',
|
|
34
|
+
changeOrigin: true,
|
|
35
|
+
cookieDomainRewrite: '',
|
|
36
|
+
},
|
|
37
|
+
'/app-admin/api/': {
|
|
38
|
+
target: 'https://max-ai.maxelms.com/',
|
|
39
|
+
changeOrigin: true,
|
|
40
|
+
cookieDomainRewrite: '',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
static: [{
|
|
44
|
+
directory: path.join(__dirname, 'examples/'),
|
|
45
|
+
}, {
|
|
46
|
+
directory: path.join(__dirname, 'public/'),
|
|
47
|
+
}],
|
|
48
|
+
},
|
|
49
|
+
plugins: [
|
|
50
|
+
new HtmlWebpackPlugin({
|
|
51
|
+
inject: true,
|
|
52
|
+
template: 'public/index.html',
|
|
53
|
+
chunks: ['index'],
|
|
54
|
+
filename: 'index.html',
|
|
55
|
+
}),
|
|
56
|
+
new CopyWebpackPlugin({
|
|
57
|
+
patterns: [
|
|
58
|
+
{
|
|
59
|
+
from: 'public',
|
|
60
|
+
globOptions: {
|
|
61
|
+
dot: true,
|
|
62
|
+
gitignore: true,
|
|
63
|
+
ignore: ['**/public/index.html', '**/public/configuration.html'],
|
|
64
|
+
},
|
|
65
|
+
noErrorOnMissing: true,
|
|
66
|
+
},
|
|
67
|
+
{ from: 'README.md' },
|
|
68
|
+
{ from: 'manifest.json' },
|
|
69
|
+
],
|
|
70
|
+
}),
|
|
71
|
+
new AngularWebpackPlugin({
|
|
72
|
+
tsconfig: './tsconfig.json',
|
|
73
|
+
jitMode: true,
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
76
|
+
module: {
|
|
77
|
+
rules: [
|
|
78
|
+
{
|
|
79
|
+
test: /\.ts$/,
|
|
80
|
+
loader: '@ngtools/webpack',
|
|
81
|
+
exclude: /node_modules/,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
test: /\.html$/,
|
|
85
|
+
use: 'raw-loader',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
test: /\.css$/,
|
|
89
|
+
use: ['to-string-loader', 'css-loader'],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
|
|
93
|
+
type: 'asset',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
resolve: {
|
|
98
|
+
extensions: ['.ts', '.js'],
|
|
99
|
+
alias: {
|
|
100
|
+
'@': path.resolve('src'),
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
module.exports = () => {
|
|
106
|
+
if (isProduction) {
|
|
107
|
+
config.mode = 'production'
|
|
108
|
+
} else {
|
|
109
|
+
config.mode = 'development'
|
|
110
|
+
}
|
|
111
|
+
return config
|
|
112
|
+
}
|