@appshell/cli 0.1.4-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/LICENSE +21 -0
- package/README.md +203 -0
- package/dist/main.js +9 -0
- package/dist/main.js.LICENSE.txt +25 -0
- package/package.json +32 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Navaris Technologies, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://github.com/navaris/appshell">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/navaris/appshell/blob/main/assets/branding/appshell-logo-white_2x.png">
|
|
5
|
+
<img alt="appshell" src="https://github.com/navaris/appshell/blob/main/assets/branding/appshell-logo_2x.png">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
[](https://github.com/navaris/appshell/actions/workflows/pipeline.yml)
|
|
11
|
+
|
|
12
|
+
# @appshell/cli
|
|
13
|
+
|
|
14
|
+
Utitliy for generating a `global runtime manifest` for Webpack Module federation micro-frontends.
|
|
15
|
+
|
|
16
|
+
A working example can be found [here](https://github.com/navaris/appshell/tree/main/examples/appshell-global-configuration).
|
|
17
|
+
Utitliy for generating a `global runtime manifest` for Webpack Module federation micro-frontends.
|
|
18
|
+
|
|
19
|
+
A working example can be found [here](https://github.com/navaris/appshell/tree/main/examples/appshell-global-configuration).
|
|
20
|
+
|
|
21
|
+
## Getting Started
|
|
22
|
+
|
|
23
|
+
To begin, you'll need to install `@appshell/cli`:
|
|
24
|
+
|
|
25
|
+
```console
|
|
26
|
+
npm install @appshell/cli --save-dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
or
|
|
30
|
+
|
|
31
|
+
```console
|
|
32
|
+
yarn add -D @appshell/cli
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
or
|
|
36
|
+
|
|
37
|
+
```console
|
|
38
|
+
pnpm add -D @appshell/cli
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
appshell [command]
|
|
45
|
+
|
|
46
|
+
Commands:
|
|
47
|
+
appshell generate [target] [options] supported targets: 'manifest'
|
|
48
|
+
|
|
49
|
+
Options:
|
|
50
|
+
--help Show help [boolean]
|
|
51
|
+
--version Show version number [boolean]
|
|
52
|
+
-c, --configsDir Path to configs dir to process
|
|
53
|
+
[string] [default: "appshell_configs"]
|
|
54
|
+
-d, --depth Depth to search for app manifests to include
|
|
55
|
+
[number] [default: 1]
|
|
56
|
+
-o, --outDir Output location for the appshell manifest
|
|
57
|
+
[string] [default: "."]
|
|
58
|
+
-f, --outFile Output filename for the appshell manifest
|
|
59
|
+
[string] [default: "appshell.manifest.json"]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Sample usage
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
appshell generate manifest --configsDir /path/to/appshell_configs
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
**Where does the content of APPSHELL_CONFIGS_DIR come from?**
|
|
71
|
+
|
|
72
|
+
> 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.
|
|
73
|
+
|
|
74
|
+
Sample content from APPSHELL_CONFIGS_DIR:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"remotes": {
|
|
79
|
+
"CraModule/App": {
|
|
80
|
+
"url": "${CRA_MFE_URL}/remoteEntry.js",
|
|
81
|
+
"metadata": {
|
|
82
|
+
"route": "/cra",
|
|
83
|
+
"displayName": "Example App",
|
|
84
|
+
"displayGroup": "${CRA_MFE_DISPLAY_GROUP}",
|
|
85
|
+
"order": 10,
|
|
86
|
+
"icon": "ViewList"
|
|
87
|
+
},
|
|
88
|
+
"id": "3eb81a0c"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"module": {
|
|
92
|
+
"exposes": {
|
|
93
|
+
"./App": "./src/App"
|
|
94
|
+
},
|
|
95
|
+
"filename": "remoteEntry.js",
|
|
96
|
+
"name": "CraModule",
|
|
97
|
+
"shared": {
|
|
98
|
+
"react": {
|
|
99
|
+
"singleton": true,
|
|
100
|
+
"requiredVersion": "^18.2.0"
|
|
101
|
+
},
|
|
102
|
+
"react-dom": {
|
|
103
|
+
"singleton": true,
|
|
104
|
+
"requiredVersion": "^18.2.0"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**How does my runtime environment get reflected in the global runtime manifest?**
|
|
112
|
+
|
|
113
|
+
> Note the variable expansion syntax `${CRA_MFE_URL}`. When `generate` is called the actual runtime environment values are injected and all configurations are merged into a global runtime manifest.
|
|
114
|
+
|
|
115
|
+
Sample global runtime manifest produced by the `generate` function:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"remotes": {
|
|
120
|
+
"CraModule/App": {
|
|
121
|
+
"id": "3eb81a0c",
|
|
122
|
+
"url": "http://localhost:3001/remoteEntry.js",
|
|
123
|
+
"scope": "CraModule",
|
|
124
|
+
"module": "./App",
|
|
125
|
+
"metadata": {
|
|
126
|
+
"route": "/cra",
|
|
127
|
+
"displayName": "Example App",
|
|
128
|
+
"displayGroup": "main",
|
|
129
|
+
"order": 10,
|
|
130
|
+
"icon": "ViewList"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"VanillaModule/Vanilla": {
|
|
134
|
+
"id": "8232ce86",
|
|
135
|
+
"url": "http://localhost:3002/remoteEntry.js",
|
|
136
|
+
"scope": "VanillaModule",
|
|
137
|
+
"module": "./Vanilla",
|
|
138
|
+
"metadata": {
|
|
139
|
+
"route": "/vanilla",
|
|
140
|
+
"displayName": "Example React App",
|
|
141
|
+
"displayGroup": "main",
|
|
142
|
+
"order": 10,
|
|
143
|
+
"icon": "ViewList"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"modules": {
|
|
148
|
+
"Appshell": {
|
|
149
|
+
"name": "Appshell",
|
|
150
|
+
"shared": {
|
|
151
|
+
"react": {
|
|
152
|
+
"singleton": true,
|
|
153
|
+
"requiredVersion": "^18.2.0"
|
|
154
|
+
},
|
|
155
|
+
"react-dom": {
|
|
156
|
+
"singleton": true,
|
|
157
|
+
"requiredVersion": "^18.2.0"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"CraModule": {
|
|
162
|
+
"exposes": {
|
|
163
|
+
"./App": "./src/App"
|
|
164
|
+
},
|
|
165
|
+
"filename": "remoteEntry.js",
|
|
166
|
+
"name": "CraModule",
|
|
167
|
+
"shared": {
|
|
168
|
+
"react": {
|
|
169
|
+
"singleton": true,
|
|
170
|
+
"requiredVersion": "^18.2.0"
|
|
171
|
+
},
|
|
172
|
+
"react-dom": {
|
|
173
|
+
"singleton": true,
|
|
174
|
+
"requiredVersion": "^18.2.0"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"VanillaModule": {
|
|
179
|
+
"exposes": {
|
|
180
|
+
"./Vanilla": "./src/App"
|
|
181
|
+
},
|
|
182
|
+
"filename": "remoteEntry.js",
|
|
183
|
+
"name": "VanillaModule",
|
|
184
|
+
"shared": {
|
|
185
|
+
"react": {
|
|
186
|
+
"singleton": true,
|
|
187
|
+
"requiredVersion": "^18.2.0"
|
|
188
|
+
},
|
|
189
|
+
"react-dom": {
|
|
190
|
+
"singleton": true,
|
|
191
|
+
"requiredVersion": "^18.2.0"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
This global runtime manifest can be consumed by your micro-frontend Appshell host and used to configure the Appshell accordingly.
|
|
200
|
+
|
|
201
|
+
**What if I want to generate the manifest programmatically instead?**
|
|
202
|
+
|
|
203
|
+
> This functionality is exposed by the [@appshell/config](https://www.npmjs.com/package/@appshell/config) package.
|