@appshell/cli 0.2.1-alpha.2 → 0.3.0-alpha.0
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/README.md +59 -13
- package/dist/main.js +6 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
# @appshell/cli
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Appshell utilities for building micro-frontends with Appshell and Webpack Module federation.
|
|
15
15
|
|
|
16
16
|
Working examples can be found [here](https://github.com/navaris/appshell/tree/main/examples).
|
|
17
17
|
|
|
@@ -43,7 +43,7 @@ appshell generate [target]
|
|
|
43
43
|
Generates a resource
|
|
44
44
|
|
|
45
45
|
Commands:
|
|
46
|
-
appshell generate manifest Generate the appshell
|
|
46
|
+
appshell generate manifest Generate the appshell manifest
|
|
47
47
|
appshell generate env Generate the runtime environment js file that refl
|
|
48
48
|
ects the current process.env
|
|
49
49
|
|
|
@@ -73,16 +73,14 @@ Options:
|
|
|
73
73
|
### Sample usage
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
appshell generate manifest --configsDir
|
|
76
|
+
appshell generate manifest --configsDir $CONFIGS_DIR
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
**Where does the content of APPSHELL_CONFIGS_DIR come from?**
|
|
79
|
+
**Where does the content of CONFIGS_DIR come from?**
|
|
82
80
|
|
|
83
81
|
> Each micro-frontend configured to use [@appshell/manifest-webpack-plugin](https://www.npmjs.com/package/@appshell/manifest-webpack-plugin) emits it's configuration to the configs directory at build time, which is subsequently processed with this utility to reflect the current runtime environment.
|
|
84
82
|
|
|
85
|
-
Sample content from
|
|
83
|
+
Sample content from CONFIGS_DIR:
|
|
86
84
|
|
|
87
85
|
```json
|
|
88
86
|
{
|
|
@@ -115,15 +113,21 @@ Sample content from APPSHELL_CONFIGS_DIR:
|
|
|
115
113
|
"requiredVersion": "^18.2.0"
|
|
116
114
|
}
|
|
117
115
|
}
|
|
116
|
+
},
|
|
117
|
+
"environment": {
|
|
118
|
+
"RUNTIME_ARG_1": "${RUNTIME_ARG_1}",
|
|
119
|
+
"RUNTIME_ARG_2": "${RUNTIME_ARG_2}"
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
```
|
|
121
123
|
|
|
122
|
-
**How does my runtime environment get reflected in the
|
|
124
|
+
**How does my runtime environment get reflected in the appshell manifest?**
|
|
125
|
+
|
|
126
|
+
> Note the variable expansion syntax `${CRA_MFE_URL}`. When `generate` is called the actual runtime environment values are injected and all configurations are ultimately merged into a global appshell manifest.
|
|
123
127
|
|
|
124
|
-
> Note the
|
|
128
|
+
> **Note** the `environment` section defines runtime environment variables that are injected into the global namesapce `window.__appshell_env__[module_name]` when a federated component is loaded. See the examples for a use case.
|
|
125
129
|
|
|
126
|
-
Sample global
|
|
130
|
+
Sample global appshell manifest produced by the `generate` function:
|
|
127
131
|
|
|
128
132
|
```json
|
|
129
133
|
{
|
|
@@ -203,15 +207,57 @@ Sample global runtime manifest produced by the `generate` function:
|
|
|
203
207
|
}
|
|
204
208
|
}
|
|
205
209
|
}
|
|
210
|
+
},
|
|
211
|
+
"environment": {
|
|
212
|
+
"CraModule": {
|
|
213
|
+
"RUNTIME_ARG_1": "Foo",
|
|
214
|
+
"RUNTIME_ARG_2": "Biz"
|
|
215
|
+
},
|
|
216
|
+
"VanillaModule": {
|
|
217
|
+
"RUNTIME_ARG_1": "Bar"
|
|
218
|
+
}
|
|
206
219
|
}
|
|
207
220
|
}
|
|
208
221
|
```
|
|
209
222
|
|
|
210
|
-
This global
|
|
223
|
+
This global appshell manifest can be consumed by your micro-frontend Appshell host and used to configure the Appshell accordingly.
|
|
224
|
+
|
|
225
|
+
## Register a manifest
|
|
226
|
+
|
|
227
|
+
Register on or more appshell manifests with the global registry.
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
appshell register
|
|
231
|
+
|
|
232
|
+
Register one or more appshell manifests
|
|
233
|
+
|
|
234
|
+
Options:
|
|
235
|
+
--help Show help [boolean]
|
|
236
|
+
--version Show version number [boolean]
|
|
237
|
+
-m, --manifest One or more manifests to register [array]
|
|
238
|
+
-r, --registry Registry path for the appshell manifests
|
|
239
|
+
[string] [default: "appshell_registry"]
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Merge manifests
|
|
211
243
|
|
|
212
|
-
|
|
244
|
+
Merge one or more appshell manifests to produce one global appshell manifest.
|
|
213
245
|
|
|
214
|
-
|
|
246
|
+
```bash
|
|
247
|
+
appshell merge
|
|
248
|
+
|
|
249
|
+
Merge one or more appshell manifests
|
|
250
|
+
|
|
251
|
+
Options:
|
|
252
|
+
--help Show help [boolean]
|
|
253
|
+
--version Show version number [boolean]
|
|
254
|
+
-o, --outDir Output location for the appshell manifest
|
|
255
|
+
[string] [default: "."]
|
|
256
|
+
-f, --outFile Output filename for the appshell manifest
|
|
257
|
+
[string] [default: "appshell.manifest.json"]
|
|
258
|
+
-m, --manifest One or more manifests to merge into a single appshell manifest
|
|
259
|
+
[array]
|
|
260
|
+
```
|
|
215
261
|
|
|
216
262
|
## Generate runtime env
|
|
217
263
|
|