mfer 1.0.3 → 1.2.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 +20 -20
- package/README.md +338 -338
- package/dist/commands/run.js +35 -4
- package/dist/index.js +1 -1
- package/package.json +57 -57
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Stuart Rimel
|
|
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
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Stuart Rimel
|
|
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
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,338 +1,338 @@
|
|
|
1
|
-
# mfer (Micro Frontend Runner)
|
|
2
|
-
|
|
3
|
-
[](https://opensource.org/licenses/MIT)
|
|
4
|
-
|
|
5
|
-
A powerful CLI tool designed to simplify the management and execution of multiple micro frontend applications. mfer helps developers run, update, and organize their micro frontend projects with minimal configuration and maximum efficiency.
|
|
6
|
-
|
|
7
|
-
## 📋 Table of Contents
|
|
8
|
-
|
|
9
|
-
- [🚀 Features](#-features)
|
|
10
|
-
- [📦 Installation](#-installation)
|
|
11
|
-
- [🛠️ Quick Start](#️-quick-start)
|
|
12
|
-
- [📋 Commands](#-commands)
|
|
13
|
-
- [⚙️ Configuration](#️-configuration)
|
|
14
|
-
- [🎯 Use Cases](#-use-cases)
|
|
15
|
-
- [🔧 Advanced Usage](#-advanced-usage)
|
|
16
|
-
- [🐛 Troubleshooting](#-troubleshooting)
|
|
17
|
-
- [🤝 Contributing](#-contributing)
|
|
18
|
-
- [📄 License](#-license)
|
|
19
|
-
- [🙏 Acknowledgments](#-acknowledgments)
|
|
20
|
-
|
|
21
|
-
## 🚀 Features
|
|
22
|
-
|
|
23
|
-
- **Concurrent Execution**: Run multiple micro frontends simultaneously with organized output
|
|
24
|
-
- **Group Management**: Organize micro frontends into logical groups for selective execution
|
|
25
|
-
- **Git Integration**: Pull latest changes from all repositories with a single command
|
|
26
|
-
- **Smart Configuration**: Interactive setup wizard with YAML-based configuration
|
|
27
|
-
- **Cross-Platform**: Works on Windows, macOS, and Linux
|
|
28
|
-
- **Graceful Shutdown**: Clean termination of all processes with Ctrl+C
|
|
29
|
-
|
|
30
|
-
## 📦 Installation
|
|
31
|
-
|
|
32
|
-
### Prerequisites
|
|
33
|
-
- Node.js 18 or higher
|
|
34
|
-
- Git (for repository management)
|
|
35
|
-
|
|
36
|
-
### Install from npm
|
|
37
|
-
```bash
|
|
38
|
-
npm install -g mfer
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Install from source
|
|
42
|
-
```bash
|
|
43
|
-
git clone https://github.com/srimel/mfer.git
|
|
44
|
-
cd mfer
|
|
45
|
-
npm install
|
|
46
|
-
npm run build
|
|
47
|
-
npm install -g .
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## 🛠️ Quick Start
|
|
51
|
-
|
|
52
|
-
### 1. Initialize Configuration
|
|
53
|
-
Start by setting up your mfer configuration:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
mfer init
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
This interactive wizard will guide you through:
|
|
60
|
-
- Setting up your GitHub username
|
|
61
|
-
- Specifying the directory containing your micro frontends
|
|
62
|
-
- Selecting which projects to include in your default group
|
|
63
|
-
|
|
64
|
-
### 2. Run Your Micro Frontends
|
|
65
|
-
```bash
|
|
66
|
-
# Run all micro frontends
|
|
67
|
-
mfer run
|
|
68
|
-
|
|
69
|
-
# Run a specific group
|
|
70
|
-
mfer run frontend
|
|
71
|
-
|
|
72
|
-
# Run with a custom group name
|
|
73
|
-
mfer run shared
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### 3. Update Your Repositories
|
|
77
|
-
```bash
|
|
78
|
-
# Pull latest changes from all repositories
|
|
79
|
-
mfer pull
|
|
80
|
-
|
|
81
|
-
# Pull from a specific group
|
|
82
|
-
mfer pull frontend
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## 📋 Commands
|
|
86
|
-
|
|
87
|
-
### Quick Reference
|
|
88
|
-
- [`mfer init`](#mfer-init) - Interactive setup wizard
|
|
89
|
-
- [`mfer run`](#mfer-run-group_name) - Run micro frontend applications
|
|
90
|
-
- [`mfer pull`](#mfer-pull-group_name) - Pull latest changes from git repositories
|
|
91
|
-
- [`mfer install`](#mfer-install-group_name) - Install dependencies for micro frontends
|
|
92
|
-
- [`mfer clone`](#mfer-clone-group_name) - Clone repositories that don't exist locally
|
|
93
|
-
- [`mfer config`](#mfer-config) - Manage configuration settings
|
|
94
|
-
- [`mfer help`](#mfer-help) - Display help information
|
|
95
|
-
|
|
96
|
-
### `mfer init`
|
|
97
|
-
Interactive setup wizard to create your configuration file.
|
|
98
|
-
|
|
99
|
-
**Options:**
|
|
100
|
-
- `-f, --force`: Force re-initialization even if config exists
|
|
101
|
-
|
|
102
|
-
**Example:**
|
|
103
|
-
```bash
|
|
104
|
-
mfer init --force
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### `mfer run [group_name]`
|
|
108
|
-
Run micro frontend applications concurrently.
|
|
109
|
-
|
|
110
|
-
**Arguments:**
|
|
111
|
-
- `group_name`: Name of the group to run (defaults to "all")
|
|
112
|
-
|
|
113
|
-
**Example:**
|
|
114
|
-
```bash
|
|
115
|
-
mfer run # Run all micro frontends
|
|
116
|
-
mfer run frontend # Run only frontend group
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### `mfer pull [group_name]`
|
|
120
|
-
Pull latest changes from git repositories.
|
|
121
|
-
|
|
122
|
-
**Arguments:**
|
|
123
|
-
- `group_name`: Name of the group to pull from (defaults to "all")
|
|
124
|
-
|
|
125
|
-
**Example:**
|
|
126
|
-
```bash
|
|
127
|
-
mfer pull # Pull from all repositories
|
|
128
|
-
mfer pull shared # Pull from shared components group only
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### `mfer install [group_name]`
|
|
132
|
-
Install dependencies for all micro frontends in a group.
|
|
133
|
-
|
|
134
|
-
**Arguments:**
|
|
135
|
-
- `group_name`: Name of the group to install dependencies for (defaults to "all")
|
|
136
|
-
|
|
137
|
-
**Example:**
|
|
138
|
-
```bash
|
|
139
|
-
mfer install # Install dependencies for all micro frontends
|
|
140
|
-
mfer install frontend # Install dependencies for frontend group only
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### `mfer clone [group_name]`
|
|
144
|
-
Clone repositories that don't exist locally.
|
|
145
|
-
|
|
146
|
-
**Arguments:**
|
|
147
|
-
- `group_name`: Name of the group to clone repositories from (defaults to "all")
|
|
148
|
-
|
|
149
|
-
**Example:**
|
|
150
|
-
```bash
|
|
151
|
-
mfer clone # Clone all repositories
|
|
152
|
-
mfer clone shared # Clone repositories in shared group only
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### `mfer config`
|
|
156
|
-
Manage your configuration settings.
|
|
157
|
-
|
|
158
|
-
**Subcommands:**
|
|
159
|
-
- `mfer config list`: Display current configuration
|
|
160
|
-
- `mfer config edit`: Open configuration file in your default editor
|
|
161
|
-
|
|
162
|
-
**Example:**
|
|
163
|
-
```bash
|
|
164
|
-
mfer config list # Show current configuration
|
|
165
|
-
mfer config edit # Edit configuration in your editor
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### `mfer help`
|
|
169
|
-
Display help information for mfer commands.
|
|
170
|
-
|
|
171
|
-
**Example:**
|
|
172
|
-
```bash
|
|
173
|
-
mfer help # Show general help
|
|
174
|
-
mfer help run # Show help for run command
|
|
175
|
-
mfer help config # Show help for config command
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## ⚙️ Configuration
|
|
179
|
-
|
|
180
|
-
mfer uses a YAML configuration file located at `~/.mfer/config.yaml`. Here's an example structure:
|
|
181
|
-
|
|
182
|
-
```yaml
|
|
183
|
-
base_github_url: "https://github.com/your-username"
|
|
184
|
-
mfe_directory: "/path/to/your/micro-frontends"
|
|
185
|
-
groups:
|
|
186
|
-
all:
|
|
187
|
-
- my-main-app
|
|
188
|
-
- my-admin-panel
|
|
189
|
-
- my-shared-components
|
|
190
|
-
main:
|
|
191
|
-
- my-main-app
|
|
192
|
-
- my-shared-components
|
|
193
|
-
admin:
|
|
194
|
-
- my-admin-panel
|
|
195
|
-
- my-shared-components
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Configuration Options
|
|
199
|
-
|
|
200
|
-
- **`base_github_url`**: Your GitHub base URL for repository operations
|
|
201
|
-
- **`mfe_directory`**: Path to the directory containing all your micro frontend projects
|
|
202
|
-
- **`groups`**: Named collections of micro frontend projects
|
|
203
|
-
- **`all`**: Default group containing all projects (required)
|
|
204
|
-
- **Custom groups**: Any additional groups you want to create
|
|
205
|
-
|
|
206
|
-
### Editing Configuration
|
|
207
|
-
|
|
208
|
-
You can edit your configuration in several ways:
|
|
209
|
-
|
|
210
|
-
1. **Interactive editor** (recommended):
|
|
211
|
-
```bash
|
|
212
|
-
mfer config edit
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
2. **Direct file editing**:
|
|
216
|
-
```bash
|
|
217
|
-
# On macOS/Linux
|
|
218
|
-
nano ~/.mfer/config.yaml
|
|
219
|
-
|
|
220
|
-
# On Windows
|
|
221
|
-
notepad %USERPROFILE%\.mfer\config.yaml
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
## 🎯 Use Cases
|
|
225
|
-
|
|
226
|
-
### Development Workflow
|
|
227
|
-
```bash
|
|
228
|
-
# Start your day
|
|
229
|
-
mfer pull # Get latest changes
|
|
230
|
-
mfer run main # Start main application
|
|
231
|
-
|
|
232
|
-
# Later, switch to admin panel work
|
|
233
|
-
mfer run admin # Start admin panel
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### Project Organization
|
|
237
|
-
Organize your micro frontends into logical groups:
|
|
238
|
-
|
|
239
|
-
```yaml
|
|
240
|
-
groups:
|
|
241
|
-
all:
|
|
242
|
-
- main-app
|
|
243
|
-
- admin-panel
|
|
244
|
-
- user-dashboard
|
|
245
|
-
- shared-components
|
|
246
|
-
- design-system
|
|
247
|
-
core:
|
|
248
|
-
- main-app
|
|
249
|
-
- shared-components
|
|
250
|
-
- design-system
|
|
251
|
-
admin:
|
|
252
|
-
- admin-panel
|
|
253
|
-
- user-dashboard
|
|
254
|
-
- shared-components
|
|
255
|
-
ui:
|
|
256
|
-
- shared-components
|
|
257
|
-
- design-system
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Team Collaboration
|
|
261
|
-
- Share configuration files with your team
|
|
262
|
-
- Standardize development environment setup
|
|
263
|
-
- Ensure everyone runs the same services
|
|
264
|
-
|
|
265
|
-
## 🔧 Advanced Usage
|
|
266
|
-
|
|
267
|
-
### Custom Start Commands
|
|
268
|
-
By default, mfer runs `npm start` in each project directory.
|
|
269
|
-
You can currently only customize this by modifying the run command in the source code.
|
|
270
|
-
|
|
271
|
-
Adding configurable custom start commands is something I plan on adding in the near future.
|
|
272
|
-
I also welcome anyone to open a PR for that!
|
|
273
|
-
|
|
274
|
-
### Environment Variables
|
|
275
|
-
mfer respects your existing environment setup and will use the same Node.js and npm versions you have configured.
|
|
276
|
-
|
|
277
|
-
### Process Management
|
|
278
|
-
- All processes are managed concurrently with organized output
|
|
279
|
-
- Use Ctrl+C to gracefully shut down all running services
|
|
280
|
-
- Failed processes are reported with detailed error information
|
|
281
|
-
|
|
282
|
-
## 🐛 Troubleshooting
|
|
283
|
-
|
|
284
|
-
### Common Issues
|
|
285
|
-
|
|
286
|
-
**"No configuration file detected"**
|
|
287
|
-
```bash
|
|
288
|
-
# Run the initialization wizard
|
|
289
|
-
mfer init
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
**"Group not found"**
|
|
293
|
-
```bash
|
|
294
|
-
# Check available groups
|
|
295
|
-
mfer config list
|
|
296
|
-
|
|
297
|
-
# Edit configuration to add missing group
|
|
298
|
-
mfer config edit
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
**"Directory does not exist"**
|
|
302
|
-
- Ensure the `mfe_directory` path in your configuration is correct
|
|
303
|
-
- Use absolute paths for better reliability
|
|
304
|
-
- Check that the directory exists and is accessible
|
|
305
|
-
|
|
306
|
-
**"Not a git repository"**
|
|
307
|
-
- Ensure all projects in your configuration are valid git repositories
|
|
308
|
-
- Run `mfer clone` to clone missing repositories
|
|
309
|
-
|
|
310
|
-
### Development Mode
|
|
311
|
-
For local development of mfer itself:
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
git clone https://github.com/srimel/mfer.git
|
|
315
|
-
cd mfer
|
|
316
|
-
npm install
|
|
317
|
-
npm run build
|
|
318
|
-
npm install -g .
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
Refer to [local development](./docs/local-development.md) docs for more information.
|
|
322
|
-
|
|
323
|
-
## 🤝 Contributing
|
|
324
|
-
|
|
325
|
-
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
326
|
-
|
|
327
|
-
## 📄 License
|
|
328
|
-
|
|
329
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
330
|
-
|
|
331
|
-
## 🙏 Acknowledgments
|
|
332
|
-
|
|
333
|
-
Built with:
|
|
334
|
-
- [Commander.js](https://github.com/tj/commander.js) - CLI framework
|
|
335
|
-
- [Inquirer](https://github.com/SBoudrias/Inquirer.js) - Interactive prompts
|
|
336
|
-
- [Concurrently](https://github.com/open-cli-tools/concurrently) - Process management
|
|
337
|
-
- [Chalk](https://github.com/chalk/chalk) - Terminal styling
|
|
338
|
-
- [YAML](https://github.com/eemeli/yaml) - Configuration parsing
|
|
1
|
+
# mfer (Micro Frontend Runner)
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
|
|
5
|
+
A powerful CLI tool designed to simplify the management and execution of multiple micro frontend applications. mfer helps developers run, update, and organize their micro frontend projects with minimal configuration and maximum efficiency.
|
|
6
|
+
|
|
7
|
+
## 📋 Table of Contents
|
|
8
|
+
|
|
9
|
+
- [🚀 Features](#-features)
|
|
10
|
+
- [📦 Installation](#-installation)
|
|
11
|
+
- [🛠️ Quick Start](#️-quick-start)
|
|
12
|
+
- [📋 Commands](#-commands)
|
|
13
|
+
- [⚙️ Configuration](#️-configuration)
|
|
14
|
+
- [🎯 Use Cases](#-use-cases)
|
|
15
|
+
- [🔧 Advanced Usage](#-advanced-usage)
|
|
16
|
+
- [🐛 Troubleshooting](#-troubleshooting)
|
|
17
|
+
- [🤝 Contributing](#-contributing)
|
|
18
|
+
- [📄 License](#-license)
|
|
19
|
+
- [🙏 Acknowledgments](#-acknowledgments)
|
|
20
|
+
|
|
21
|
+
## 🚀 Features
|
|
22
|
+
|
|
23
|
+
- **Concurrent Execution**: Run multiple micro frontends simultaneously with organized output
|
|
24
|
+
- **Group Management**: Organize micro frontends into logical groups for selective execution
|
|
25
|
+
- **Git Integration**: Pull latest changes from all repositories with a single command
|
|
26
|
+
- **Smart Configuration**: Interactive setup wizard with YAML-based configuration
|
|
27
|
+
- **Cross-Platform**: Works on Windows, macOS, and Linux
|
|
28
|
+
- **Graceful Shutdown**: Clean termination of all processes with Ctrl+C
|
|
29
|
+
|
|
30
|
+
## 📦 Installation
|
|
31
|
+
|
|
32
|
+
### Prerequisites
|
|
33
|
+
- Node.js 18 or higher
|
|
34
|
+
- Git (for repository management)
|
|
35
|
+
|
|
36
|
+
### Install from npm
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g mfer
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Install from source
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/srimel/mfer.git
|
|
44
|
+
cd mfer
|
|
45
|
+
npm install
|
|
46
|
+
npm run build
|
|
47
|
+
npm install -g .
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 🛠️ Quick Start
|
|
51
|
+
|
|
52
|
+
### 1. Initialize Configuration
|
|
53
|
+
Start by setting up your mfer configuration:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
mfer init
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This interactive wizard will guide you through:
|
|
60
|
+
- Setting up your GitHub username
|
|
61
|
+
- Specifying the directory containing your micro frontends
|
|
62
|
+
- Selecting which projects to include in your default group
|
|
63
|
+
|
|
64
|
+
### 2. Run Your Micro Frontends
|
|
65
|
+
```bash
|
|
66
|
+
# Run all micro frontends
|
|
67
|
+
mfer run
|
|
68
|
+
|
|
69
|
+
# Run a specific group
|
|
70
|
+
mfer run frontend
|
|
71
|
+
|
|
72
|
+
# Run with a custom group name
|
|
73
|
+
mfer run shared
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 3. Update Your Repositories
|
|
77
|
+
```bash
|
|
78
|
+
# Pull latest changes from all repositories
|
|
79
|
+
mfer pull
|
|
80
|
+
|
|
81
|
+
# Pull from a specific group
|
|
82
|
+
mfer pull frontend
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 📋 Commands
|
|
86
|
+
|
|
87
|
+
### Quick Reference
|
|
88
|
+
- [`mfer init`](#mfer-init) - Interactive setup wizard
|
|
89
|
+
- [`mfer run`](#mfer-run-group_name) - Run micro frontend applications
|
|
90
|
+
- [`mfer pull`](#mfer-pull-group_name) - Pull latest changes from git repositories
|
|
91
|
+
- [`mfer install`](#mfer-install-group_name) - Install dependencies for micro frontends
|
|
92
|
+
- [`mfer clone`](#mfer-clone-group_name) - Clone repositories that don't exist locally
|
|
93
|
+
- [`mfer config`](#mfer-config) - Manage configuration settings
|
|
94
|
+
- [`mfer help`](#mfer-help) - Display help information
|
|
95
|
+
|
|
96
|
+
### `mfer init`
|
|
97
|
+
Interactive setup wizard to create your configuration file.
|
|
98
|
+
|
|
99
|
+
**Options:**
|
|
100
|
+
- `-f, --force`: Force re-initialization even if config exists
|
|
101
|
+
|
|
102
|
+
**Example:**
|
|
103
|
+
```bash
|
|
104
|
+
mfer init --force
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### `mfer run [group_name]`
|
|
108
|
+
Run micro frontend applications concurrently.
|
|
109
|
+
|
|
110
|
+
**Arguments:**
|
|
111
|
+
- `group_name`: Name of the group to run (defaults to "all")
|
|
112
|
+
|
|
113
|
+
**Example:**
|
|
114
|
+
```bash
|
|
115
|
+
mfer run # Run all micro frontends
|
|
116
|
+
mfer run frontend # Run only frontend group
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### `mfer pull [group_name]`
|
|
120
|
+
Pull latest changes from git repositories.
|
|
121
|
+
|
|
122
|
+
**Arguments:**
|
|
123
|
+
- `group_name`: Name of the group to pull from (defaults to "all")
|
|
124
|
+
|
|
125
|
+
**Example:**
|
|
126
|
+
```bash
|
|
127
|
+
mfer pull # Pull from all repositories
|
|
128
|
+
mfer pull shared # Pull from shared components group only
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### `mfer install [group_name]`
|
|
132
|
+
Install dependencies for all micro frontends in a group.
|
|
133
|
+
|
|
134
|
+
**Arguments:**
|
|
135
|
+
- `group_name`: Name of the group to install dependencies for (defaults to "all")
|
|
136
|
+
|
|
137
|
+
**Example:**
|
|
138
|
+
```bash
|
|
139
|
+
mfer install # Install dependencies for all micro frontends
|
|
140
|
+
mfer install frontend # Install dependencies for frontend group only
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### `mfer clone [group_name]`
|
|
144
|
+
Clone repositories that don't exist locally.
|
|
145
|
+
|
|
146
|
+
**Arguments:**
|
|
147
|
+
- `group_name`: Name of the group to clone repositories from (defaults to "all")
|
|
148
|
+
|
|
149
|
+
**Example:**
|
|
150
|
+
```bash
|
|
151
|
+
mfer clone # Clone all repositories
|
|
152
|
+
mfer clone shared # Clone repositories in shared group only
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### `mfer config`
|
|
156
|
+
Manage your configuration settings.
|
|
157
|
+
|
|
158
|
+
**Subcommands:**
|
|
159
|
+
- `mfer config list`: Display current configuration
|
|
160
|
+
- `mfer config edit`: Open configuration file in your default editor
|
|
161
|
+
|
|
162
|
+
**Example:**
|
|
163
|
+
```bash
|
|
164
|
+
mfer config list # Show current configuration
|
|
165
|
+
mfer config edit # Edit configuration in your editor
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### `mfer help`
|
|
169
|
+
Display help information for mfer commands.
|
|
170
|
+
|
|
171
|
+
**Example:**
|
|
172
|
+
```bash
|
|
173
|
+
mfer help # Show general help
|
|
174
|
+
mfer help run # Show help for run command
|
|
175
|
+
mfer help config # Show help for config command
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## ⚙️ Configuration
|
|
179
|
+
|
|
180
|
+
mfer uses a YAML configuration file located at `~/.mfer/config.yaml`. Here's an example structure:
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
base_github_url: "https://github.com/your-username"
|
|
184
|
+
mfe_directory: "/path/to/your/micro-frontends"
|
|
185
|
+
groups:
|
|
186
|
+
all:
|
|
187
|
+
- my-main-app
|
|
188
|
+
- my-admin-panel
|
|
189
|
+
- my-shared-components
|
|
190
|
+
main:
|
|
191
|
+
- my-main-app
|
|
192
|
+
- my-shared-components
|
|
193
|
+
admin:
|
|
194
|
+
- my-admin-panel
|
|
195
|
+
- my-shared-components
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Configuration Options
|
|
199
|
+
|
|
200
|
+
- **`base_github_url`**: Your GitHub base URL for repository operations
|
|
201
|
+
- **`mfe_directory`**: Path to the directory containing all your micro frontend projects
|
|
202
|
+
- **`groups`**: Named collections of micro frontend projects
|
|
203
|
+
- **`all`**: Default group containing all projects (required)
|
|
204
|
+
- **Custom groups**: Any additional groups you want to create
|
|
205
|
+
|
|
206
|
+
### Editing Configuration
|
|
207
|
+
|
|
208
|
+
You can edit your configuration in several ways:
|
|
209
|
+
|
|
210
|
+
1. **Interactive editor** (recommended):
|
|
211
|
+
```bash
|
|
212
|
+
mfer config edit
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
2. **Direct file editing**:
|
|
216
|
+
```bash
|
|
217
|
+
# On macOS/Linux
|
|
218
|
+
nano ~/.mfer/config.yaml
|
|
219
|
+
|
|
220
|
+
# On Windows
|
|
221
|
+
notepad %USERPROFILE%\.mfer\config.yaml
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## 🎯 Use Cases
|
|
225
|
+
|
|
226
|
+
### Development Workflow
|
|
227
|
+
```bash
|
|
228
|
+
# Start your day
|
|
229
|
+
mfer pull # Get latest changes
|
|
230
|
+
mfer run main # Start main application
|
|
231
|
+
|
|
232
|
+
# Later, switch to admin panel work
|
|
233
|
+
mfer run admin # Start admin panel
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Project Organization
|
|
237
|
+
Organize your micro frontends into logical groups:
|
|
238
|
+
|
|
239
|
+
```yaml
|
|
240
|
+
groups:
|
|
241
|
+
all:
|
|
242
|
+
- main-app
|
|
243
|
+
- admin-panel
|
|
244
|
+
- user-dashboard
|
|
245
|
+
- shared-components
|
|
246
|
+
- design-system
|
|
247
|
+
core:
|
|
248
|
+
- main-app
|
|
249
|
+
- shared-components
|
|
250
|
+
- design-system
|
|
251
|
+
admin:
|
|
252
|
+
- admin-panel
|
|
253
|
+
- user-dashboard
|
|
254
|
+
- shared-components
|
|
255
|
+
ui:
|
|
256
|
+
- shared-components
|
|
257
|
+
- design-system
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Team Collaboration
|
|
261
|
+
- Share configuration files with your team
|
|
262
|
+
- Standardize development environment setup
|
|
263
|
+
- Ensure everyone runs the same services
|
|
264
|
+
|
|
265
|
+
## 🔧 Advanced Usage
|
|
266
|
+
|
|
267
|
+
### Custom Start Commands
|
|
268
|
+
By default, mfer runs `npm start` in each project directory.
|
|
269
|
+
You can currently only customize this by modifying the run command in the source code.
|
|
270
|
+
|
|
271
|
+
Adding configurable custom start commands is something I plan on adding in the near future.
|
|
272
|
+
I also welcome anyone to open a PR for that!
|
|
273
|
+
|
|
274
|
+
### Environment Variables
|
|
275
|
+
mfer respects your existing environment setup and will use the same Node.js and npm versions you have configured.
|
|
276
|
+
|
|
277
|
+
### Process Management
|
|
278
|
+
- All processes are managed concurrently with organized output
|
|
279
|
+
- Use Ctrl+C to gracefully shut down all running services
|
|
280
|
+
- Failed processes are reported with detailed error information
|
|
281
|
+
|
|
282
|
+
## 🐛 Troubleshooting
|
|
283
|
+
|
|
284
|
+
### Common Issues
|
|
285
|
+
|
|
286
|
+
**"No configuration file detected"**
|
|
287
|
+
```bash
|
|
288
|
+
# Run the initialization wizard
|
|
289
|
+
mfer init
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**"Group not found"**
|
|
293
|
+
```bash
|
|
294
|
+
# Check available groups
|
|
295
|
+
mfer config list
|
|
296
|
+
|
|
297
|
+
# Edit configuration to add missing group
|
|
298
|
+
mfer config edit
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**"Directory does not exist"**
|
|
302
|
+
- Ensure the `mfe_directory` path in your configuration is correct
|
|
303
|
+
- Use absolute paths for better reliability
|
|
304
|
+
- Check that the directory exists and is accessible
|
|
305
|
+
|
|
306
|
+
**"Not a git repository"**
|
|
307
|
+
- Ensure all projects in your configuration are valid git repositories
|
|
308
|
+
- Run `mfer clone` to clone missing repositories
|
|
309
|
+
|
|
310
|
+
### Development Mode
|
|
311
|
+
For local development of mfer itself:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
git clone https://github.com/srimel/mfer.git
|
|
315
|
+
cd mfer
|
|
316
|
+
npm install
|
|
317
|
+
npm run build
|
|
318
|
+
npm install -g .
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Refer to [local development](./docs/local-development.md) docs for more information.
|
|
322
|
+
|
|
323
|
+
## 🤝 Contributing
|
|
324
|
+
|
|
325
|
+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
326
|
+
|
|
327
|
+
## 📄 License
|
|
328
|
+
|
|
329
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
330
|
+
|
|
331
|
+
## 🙏 Acknowledgments
|
|
332
|
+
|
|
333
|
+
Built with:
|
|
334
|
+
- [Commander.js](https://github.com/tj/commander.js) - CLI framework
|
|
335
|
+
- [Inquirer](https://github.com/SBoudrias/Inquirer.js) - Interactive prompts
|
|
336
|
+
- [Concurrently](https://github.com/open-cli-tools/concurrently) - Process management
|
|
337
|
+
- [Chalk](https://github.com/chalk/chalk) - Terminal styling
|
|
338
|
+
- [YAML](https://github.com/eemeli/yaml) - Configuration parsing
|
package/dist/commands/run.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { Command } from "commander";
|
|
2
11
|
import { configExists, currentConfig, warnOfMissingConfig, } from "../utils/config-utils.js";
|
|
3
12
|
import concurrently from "concurrently";
|
|
4
13
|
import chalk from "chalk";
|
|
5
14
|
import path from "path";
|
|
15
|
+
import { checkbox } from "@inquirer/prompts";
|
|
6
16
|
const RUN_COMMAND = "npm start";
|
|
7
17
|
const runCommand = new Command("run")
|
|
8
18
|
.description("run micro-frontend applications")
|
|
9
19
|
.argument("[group_name]", "name of the group as specified in the configuration", "all")
|
|
10
|
-
.
|
|
20
|
+
.option("-s, --select", "prompt to select which micro frontends to run")
|
|
21
|
+
.action((groupName, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
var _a, _b;
|
|
11
23
|
if (!configExists) {
|
|
12
24
|
warnOfMissingConfig();
|
|
13
25
|
return;
|
|
@@ -24,14 +36,33 @@ const runCommand = new Command("run")
|
|
|
24
36
|
console.log(`${messagePrefix}: group '${groupName}' has no micro frontends defined.`);
|
|
25
37
|
return;
|
|
26
38
|
}
|
|
39
|
+
let selectedMFEs = group;
|
|
40
|
+
if (options.select) {
|
|
41
|
+
try {
|
|
42
|
+
console.log(chalk.blue(`Select micro frontends to run from group '${groupName}':`));
|
|
43
|
+
selectedMFEs = yield checkbox({
|
|
44
|
+
message: "Choose which micro frontends to run:",
|
|
45
|
+
choices: group.map(mfe => ({ name: mfe, value: mfe })),
|
|
46
|
+
validate: (arr) => arr.length > 0 ? true : "Select at least one micro frontend"
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error instanceof Error && (((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('SIGINT')) || ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('User force closed')))) {
|
|
51
|
+
console.log(chalk.yellow("\nReceived SIGINT. Stopping..."));
|
|
52
|
+
process.exit(130);
|
|
53
|
+
}
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
27
57
|
const mfeDir = currentConfig.mfe_directory;
|
|
28
|
-
const commands =
|
|
58
|
+
const commands = selectedMFEs.map((mfe) => ({
|
|
29
59
|
command: RUN_COMMAND,
|
|
30
60
|
name: mfe,
|
|
31
61
|
cwd: path.join(mfeDir, mfe),
|
|
32
62
|
prefixColor: "blue"
|
|
33
63
|
}));
|
|
34
|
-
|
|
64
|
+
const groupText = options.select ? `selected MFEs from group '${groupName}'` : `group '${groupName}'`;
|
|
65
|
+
console.log(chalk.green(`Running micro frontends in ${groupText}...`));
|
|
35
66
|
const concurrentlyResult = concurrently(commands, {
|
|
36
67
|
prefix: "{name} |",
|
|
37
68
|
killOthersOn: ["failure", "success"],
|
|
@@ -62,5 +93,5 @@ const runCommand = new Command("run")
|
|
|
62
93
|
console.error(err.message);
|
|
63
94
|
}
|
|
64
95
|
});
|
|
65
|
-
});
|
|
96
|
+
}));
|
|
66
97
|
export default runCommand;
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { loadConfig } from "./utils/config-utils.js";
|
|
|
10
10
|
program
|
|
11
11
|
.name("mfer")
|
|
12
12
|
.description("Micro Frontend Runner (mfer) - A CLI for running your project's micro frontends.")
|
|
13
|
-
.version("1.0
|
|
13
|
+
.version("1.2.0", "-v, --version", "mfer CLI version")
|
|
14
14
|
.hook("preAction", (thisCommand, actionCommand) => {
|
|
15
15
|
console.log();
|
|
16
16
|
})
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mfer",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "CLI tool designed to sensibly run micro-frontends from the terminal.",
|
|
5
|
-
"bin": {
|
|
6
|
-
"mfer": "dist/index.js"
|
|
7
|
-
},
|
|
8
|
-
"main": "index.ts",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "tsc",
|
|
11
|
-
"clean": "rimraf dist",
|
|
12
|
-
"watch": "tsc --watch",
|
|
13
|
-
"test": "vitest run",
|
|
14
|
-
"test:watch": "vitest"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"micro frontends",
|
|
18
|
-
"micro frontend",
|
|
19
|
-
"microfrontend",
|
|
20
|
-
"micro-frontend",
|
|
21
|
-
"micro-frontends",
|
|
22
|
-
"mfe",
|
|
23
|
-
"CLI",
|
|
24
|
-
"runner"
|
|
25
|
-
],
|
|
26
|
-
"author": "Stuart Rimel",
|
|
27
|
-
"license": "MIT",
|
|
28
|
-
"type": "module",
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/srimel/run-mfs.git"
|
|
32
|
-
},
|
|
33
|
-
"bugs": {
|
|
34
|
-
"url": "https://github.com/srimel/run-mfs/issues"
|
|
35
|
-
},
|
|
36
|
-
"homepage": "https://github.com/srimel/run-mfs#readme",
|
|
37
|
-
"engines": {
|
|
38
|
-
"node": ">=18"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@types/node": "^24.0.3",
|
|
42
|
-
"rimraf": "^6.0.1",
|
|
43
|
-
"typescript": "^5.8.3",
|
|
44
|
-
"vitest": "^3.2.4"
|
|
45
|
-
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"@inquirer/prompts": "^7.5.3",
|
|
48
|
-
"chalk": "^5.4.1",
|
|
49
|
-
"commander": "^14.0.0",
|
|
50
|
-
"concurrently": "^9.2.0",
|
|
51
|
-
"yaml": "^2.8.0"
|
|
52
|
-
},
|
|
53
|
-
"files": [
|
|
54
|
-
"dist",
|
|
55
|
-
"README.md"
|
|
56
|
-
]
|
|
57
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mfer",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "CLI tool designed to sensibly run micro-frontends from the terminal.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"mfer": "dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"main": "index.ts",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"clean": "rimraf dist",
|
|
12
|
+
"watch": "tsc --watch",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"micro frontends",
|
|
18
|
+
"micro frontend",
|
|
19
|
+
"microfrontend",
|
|
20
|
+
"micro-frontend",
|
|
21
|
+
"micro-frontends",
|
|
22
|
+
"mfe",
|
|
23
|
+
"CLI",
|
|
24
|
+
"runner"
|
|
25
|
+
],
|
|
26
|
+
"author": "Stuart Rimel",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/srimel/run-mfs.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/srimel/run-mfs/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/srimel/run-mfs#readme",
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^24.0.3",
|
|
42
|
+
"rimraf": "^6.0.1",
|
|
43
|
+
"typescript": "^5.8.3",
|
|
44
|
+
"vitest": "^3.2.4"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@inquirer/prompts": "^7.5.3",
|
|
48
|
+
"chalk": "^5.4.1",
|
|
49
|
+
"commander": "^14.0.0",
|
|
50
|
+
"concurrently": "^9.2.0",
|
|
51
|
+
"yaml": "^2.8.0"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist",
|
|
55
|
+
"README.md"
|
|
56
|
+
]
|
|
57
|
+
}
|