@appshell/cli 0.3.0-alpha.4 → 0.3.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 +14 -35
- package/dist/main.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
# @appshell/cli
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Utility 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
|
|
|
@@ -54,7 +54,7 @@ appshell generate [target]
|
|
|
54
54
|
Generates a resource
|
|
55
55
|
|
|
56
56
|
Commands:
|
|
57
|
-
appshell generate manifest Generate the appshell manifest by processing the template specified by --
|
|
57
|
+
appshell generate manifest Generate the appshell manifest by processing the template specified by --template
|
|
58
58
|
appshell generate env Generate the runtime environment js file that reflects the current process.env
|
|
59
59
|
appshell generate index Generate the appshell index file by merging sources specifed by --registry options
|
|
60
60
|
appshell generate metadata Generate the appshell metadata file by merging sources specifed by --registry options
|
|
@@ -72,23 +72,22 @@ Generate the appshell global runtime manifest
|
|
|
72
72
|
Options:
|
|
73
73
|
--help Show help [boolean]
|
|
74
74
|
--version Show version number [boolean]
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-o, --outDir Output location for the appshell manifest [string] [default: "."]
|
|
75
|
+
-t, --template Path to the appshell manifest template to process [string] [default: "appshell.config.json"]
|
|
76
|
+
-o, --outDir Output location for the appshell manifest [string] [default: "dist"]
|
|
78
77
|
-f, --outFile Output filename for the appshell manifest [string] [default: "appshell.manifest.json"]
|
|
79
78
|
```
|
|
80
79
|
|
|
81
80
|
### Sample usage
|
|
82
81
|
|
|
83
82
|
```bash
|
|
84
|
-
appshell generate manifest --
|
|
83
|
+
appshell generate manifest --template dist/appshell.config.json
|
|
85
84
|
```
|
|
86
85
|
|
|
87
|
-
**Where does the content of
|
|
86
|
+
**Where does the content of APPSHELL_REGISTRY come from?**
|
|
88
87
|
|
|
89
|
-
> Each micro-frontend configured to use [@appshell/manifest-webpack-plugin](https://www.npmjs.com/package/@appshell/manifest-webpack-plugin) emits
|
|
88
|
+
> Each micro-frontend configured to use [@appshell/manifest-webpack-plugin](https://www.npmjs.com/package/@appshell/manifest-webpack-plugin) emits a manifest template, which is subsequently used to generate a manifest for the remote module. This manifest is then registered with the APPSHELL_REGISTRY.
|
|
90
89
|
|
|
91
|
-
Sample
|
|
90
|
+
Sample manifest template `appshell.config.json`:
|
|
92
91
|
|
|
93
92
|
```json
|
|
94
93
|
{
|
|
@@ -131,11 +130,11 @@ Sample content from CONFIGS_DIR:
|
|
|
131
130
|
|
|
132
131
|
**How does my runtime environment get reflected in the appshell manifest?**
|
|
133
132
|
|
|
134
|
-
> Note the variable expansion syntax `${CRA_MFE_URL}`. When `generate` is called the actual runtime environment values are injected
|
|
133
|
+
> Note the variable expansion syntax `${CRA_MFE_URL}`. When `appshell generate manifest` is called the actual runtime environment values are injected in order to produce the remote module's appshell manifest.
|
|
135
134
|
|
|
136
135
|
> **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.
|
|
137
136
|
|
|
138
|
-
Sample
|
|
137
|
+
Sample appshell manifest produced by the `appshell generate manifest` function:
|
|
139
138
|
|
|
140
139
|
```json
|
|
141
140
|
{
|
|
@@ -228,11 +227,11 @@ Sample global appshell manifest produced by the `generate` function:
|
|
|
228
227
|
}
|
|
229
228
|
```
|
|
230
229
|
|
|
231
|
-
This
|
|
230
|
+
This appshell manifest is registered with `APPSHELL_REGISTRY` and subsequently consumed by the Appshell host.
|
|
232
231
|
|
|
233
232
|
## Register a manifest
|
|
234
233
|
|
|
235
|
-
Register
|
|
234
|
+
Register one or more appshell manifests with the global registry.
|
|
236
235
|
|
|
237
236
|
```bash
|
|
238
237
|
appshell register
|
|
@@ -247,26 +246,6 @@ Options:
|
|
|
247
246
|
[string] [default: "appshell_registry"]
|
|
248
247
|
```
|
|
249
248
|
|
|
250
|
-
## Merge manifests
|
|
251
|
-
|
|
252
|
-
Merge one or more appshell manifests to produce one global appshell manifest.
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
appshell merge
|
|
256
|
-
|
|
257
|
-
Merge one or more appshell manifests
|
|
258
|
-
|
|
259
|
-
Options:
|
|
260
|
-
--help Show help [boolean]
|
|
261
|
-
--version Show version number [boolean]
|
|
262
|
-
-o, --outDir Output location for the appshell manifest
|
|
263
|
-
[string] [default: "."]
|
|
264
|
-
-f, --outFile Output filename for the appshell manifest
|
|
265
|
-
[string] [default: "appshell.manifest.json"]
|
|
266
|
-
-m, --manifest One or more manifests to merge into a single appshell manifest
|
|
267
|
-
[array]
|
|
268
|
-
```
|
|
269
|
-
|
|
270
249
|
## Generate runtime env
|
|
271
250
|
|
|
272
251
|
Generates a runtime env js file that can be consumed by the application at runtime.
|
|
@@ -283,7 +262,7 @@ Options:
|
|
|
283
262
|
-o, --outDir Output location for the runtime environment js [string] [default: "."]
|
|
284
263
|
-f, --outFile Output filename for the runtime environment js [string] [default: "runtime.env.js"]
|
|
285
264
|
-p, --prefix Only capture environment variables that start with prefix [string] [default: ""]
|
|
286
|
-
-g, --globalName Global variable name window[globalName] used in the output js [string] [default: "
|
|
265
|
+
-g, --globalName Global variable name window[globalName] used in the output js [string] [default: "__appshell_env__"]
|
|
287
266
|
```
|
|
288
267
|
|
|
289
268
|
### Sample usage
|
|
@@ -295,7 +274,7 @@ appshell generate env -e .env --prefix APPSHELL_ --outDir dist
|
|
|
295
274
|
Sample output `runtime.env.js`
|
|
296
275
|
|
|
297
276
|
```js
|
|
298
|
-
window.
|
|
277
|
+
window.__appshell_env__ = {
|
|
299
278
|
APPSHELL_VAR_1 = 'val 1',
|
|
300
279
|
APPSHELL_VAR_2 = 'val 2'
|
|
301
280
|
};
|