@appshell/cli 0.1.5 → 0.1.6-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 CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  Utitliy for generating a `global runtime manifest` for Webpack Module federation micro-frontends.
15
15
 
16
- A working example can be found [here](https://github.com/navaris/appshell/tree/main/examples/appshell-global-configuration).
16
+ Working examples can be found [here](https://github.com/navaris/appshell/tree/main/examples).
17
17
 
18
18
  ## Getting Started
19
19
 
@@ -38,25 +38,39 @@ pnpm add -D @appshell/cli
38
38
  ## Usage
39
39
 
40
40
  ```bash
41
- appshell [command]
41
+ appshell generate [target]
42
+
43
+ Generates a resource
42
44
 
43
45
  Commands:
44
- appshell generate [target] [options] supported targets: 'manifest'
46
+ appshell generate manifest Generate the appshell global runtime manifest
47
+ appshell generate env Generate the runtime environment js file that refl
48
+ ects the current process.env
49
+
50
+ Options:
51
+ --help Show help [boolean]
52
+ --version Show version number [boolean]
53
+ ```
54
+
55
+ ## Generate manifest
56
+
57
+ Generates the appshell global runtime manifest.
58
+
59
+ ```bash
60
+ appshell generate manifest
61
+
62
+ Generate the appshell global runtime manifest
45
63
 
46
64
  Options:
47
- --help Show help [boolean]
48
- --version Show version number [boolean]
49
- -c, --configsDir Path to configs dir to process
50
- [string] [default: "appshell_configs"]
51
- -d, --depth Depth to search for app manifests to include
52
- [number] [default: 1]
53
- -o, --outDir Output location for the appshell manifest
54
- [string] [default: "."]
55
- -f, --outFile Output filename for the appshell manifest
56
- [string] [default: "appshell.manifest.json"]
65
+ --help Show help [boolean]
66
+ --version Show version number [boolean]
67
+ -c, --configsDir Path to the appshell configs dir to process [string] [default: "appshell_configs"]
68
+ -d, --depth Depth to search for app manifests in configsDir [number] [default: 1]
69
+ -o, --outDir Output location for the appshell manifest [string] [default: "."]
70
+ -f, --outFile Output filename for the appshell manifest [string] [default: "appshell.manifest.json"]
57
71
  ```
58
72
 
59
- Sample usage
73
+ ### Sample usage
60
74
 
61
75
  ```bash
62
76
  appshell generate manifest --configsDir /path/to/appshell_configs
@@ -74,7 +88,7 @@ Sample content from APPSHELL_CONFIGS_DIR:
74
88
  {
75
89
  "remotes": {
76
90
  "CraModule/App": {
77
- "url": "${CRA_MFE_URL}/remoteEntry.js",
91
+ "url": "${CRA_MFE_URL}",
78
92
  "metadata": {
79
93
  "route": "/cra",
80
94
  "displayName": "Example App",
@@ -198,3 +212,43 @@ This global runtime manifest can be consumed by your micro-frontend Appshell hos
198
212
  **What if I want to generate the manifest programmatically instead?**
199
213
 
200
214
  > This functionality is exposed by the [@appshell/config](https://www.npmjs.com/package/@appshell/config) package.
215
+
216
+ ## Generate runtime env
217
+
218
+ Generates a runtime env js file that can be consumed by the application at runtime.
219
+
220
+ ```bash
221
+ appshell generate env
222
+
223
+ Generate the runtime environment js file that reflects the current process.env
224
+
225
+ Options:
226
+ --help Show help [boolean]
227
+ --version Show version number [boolean]
228
+ -e, --env The .env file to process [string] [default: ".env"]
229
+ -o, --outDir Output location for the runtime environment js [string] [default: "."]
230
+ -f, --outFile Output filename for the runtime environment js [string] [default: "runtime.env.js"]
231
+ -p, --prefix Only capture environment variables that start with prefix [string] [default: ""]
232
+ -g, --globalName Global variable name window[globalName] used in the output js [string] [default: "appshell_env"]
233
+ ```
234
+
235
+ ### Sample usage
236
+
237
+ ```bash
238
+ appshell generate env -e .env --prefix APPSHELL_ --outDir dist
239
+ ```
240
+
241
+ Sample output `runtime.env.js`
242
+
243
+ ```js
244
+ window.appshell_env = {
245
+ APPSHELL_VAR_1 = 'val 1',
246
+ APPSHELL_VAR_2 = 'val 2'
247
+ };
248
+ ```
249
+
250
+ Include in the public html
251
+
252
+ ```html
253
+ <script src="runtime.env.js"></script>
254
+ ```