mfer 1.2.0 → 1.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 +29 -2
- package/dist/commands/run.js +26 -3
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -110,10 +110,16 @@ Run micro frontend applications concurrently.
|
|
|
110
110
|
**Arguments:**
|
|
111
111
|
- `group_name`: Name of the group to run (defaults to "all")
|
|
112
112
|
|
|
113
|
+
**Options:**
|
|
114
|
+
- `-s, --select`: Prompt to select which micro frontends to run
|
|
115
|
+
- `-f, --filter <pattern>`: Run all MFEs but only show output from those matching the pattern
|
|
116
|
+
|
|
113
117
|
**Example:**
|
|
114
118
|
```bash
|
|
115
|
-
mfer run
|
|
116
|
-
mfer run frontend
|
|
119
|
+
mfer run # Run all micro frontends
|
|
120
|
+
mfer run frontend # Run only frontend group
|
|
121
|
+
mfer run --select # Interactive selection of MFEs to run
|
|
122
|
+
mfer run frontend --filter admin-panel # Run all frontend MFEs but only show admin-panel output
|
|
117
123
|
```
|
|
118
124
|
|
|
119
125
|
### `mfer pull [group_name]`
|
|
@@ -271,6 +277,27 @@ You can currently only customize this by modifying the run command in the source
|
|
|
271
277
|
Adding configurable custom start commands is something I plan on adding in the near future.
|
|
272
278
|
I also welcome anyone to open a PR for that!
|
|
273
279
|
|
|
280
|
+
### Output Filtering
|
|
281
|
+
The `--filter` option allows you to run all micro frontends in a group while only displaying output from specific ones. This is useful when you want to:
|
|
282
|
+
|
|
283
|
+
- Focus on debugging a specific micro frontend while ensuring all dependencies are running
|
|
284
|
+
- Monitor only the admin panel while the entire system is operational
|
|
285
|
+
- Reduce console noise during development
|
|
286
|
+
|
|
287
|
+
**Examples:**
|
|
288
|
+
```bash
|
|
289
|
+
# Run all MFEs but only show admin-panel output
|
|
290
|
+
mfer run --filter admin-panel
|
|
291
|
+
|
|
292
|
+
# Run frontend group but only show shared-components output
|
|
293
|
+
mfer run frontend --filter shared-components
|
|
294
|
+
|
|
295
|
+
# Run all MFEs but only show those containing "api" in their name
|
|
296
|
+
mfer run --filter api
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
The filter uses a simple string inclusion match, so `--filter admin` would match both `admin-panel` and `admin-dashboard`.
|
|
300
|
+
|
|
274
301
|
### Environment Variables
|
|
275
302
|
mfer respects your existing environment setup and will use the same Node.js and npm versions you have configured.
|
|
276
303
|
|
package/dist/commands/run.js
CHANGED
|
@@ -18,6 +18,7 @@ const runCommand = new Command("run")
|
|
|
18
18
|
.description("run micro-frontend applications")
|
|
19
19
|
.argument("[group_name]", "name of the group as specified in the configuration", "all")
|
|
20
20
|
.option("-s, --select", "prompt to select which micro frontends to run")
|
|
21
|
+
.option("-f, --filter <pattern>", "run all MFEs but only show output from those matching the pattern")
|
|
21
22
|
.action((groupName, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
23
|
var _a, _b;
|
|
23
24
|
if (!configExists) {
|
|
@@ -62,12 +63,34 @@ const runCommand = new Command("run")
|
|
|
62
63
|
prefixColor: "blue"
|
|
63
64
|
}));
|
|
64
65
|
const groupText = options.select ? `selected MFEs from group '${groupName}'` : `group '${groupName}'`;
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
if (options.filter) {
|
|
67
|
+
const filteredMFEs = selectedMFEs.filter(mfe => mfe.includes(options.filter));
|
|
68
|
+
if (filteredMFEs.length === 0) {
|
|
69
|
+
console.log(chalk.yellow(`Warning: No micro frontends match the filter pattern '${options.filter}'`));
|
|
70
|
+
console.log(chalk.yellow(`Available MFEs in group '${groupName}': ${selectedMFEs.join(', ')}`));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
console.log(chalk.green(`Running all micro frontends in ${groupText}...`));
|
|
74
|
+
console.log(chalk.blue(`Filtering output to show only: ${filteredMFEs.join(', ')}`));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.log(chalk.green(`Running micro frontends in ${groupText}...`));
|
|
78
|
+
}
|
|
79
|
+
const concurrentlyOptions = {
|
|
67
80
|
prefix: "{name} |",
|
|
68
81
|
killOthersOn: ["failure", "success"],
|
|
69
82
|
restartTries: 0,
|
|
70
|
-
}
|
|
83
|
+
};
|
|
84
|
+
if (options.filter) {
|
|
85
|
+
concurrentlyOptions.prefix = (info) => {
|
|
86
|
+
const mfeName = info.name;
|
|
87
|
+
if (mfeName.includes(options.filter)) {
|
|
88
|
+
return `${mfeName} |`;
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const concurrentlyResult = concurrently(commands, concurrentlyOptions);
|
|
71
94
|
const handleSigint = () => {
|
|
72
95
|
console.log(chalk.yellow("\nReceived SIGINT. Stopping all micro frontends..."));
|
|
73
96
|
concurrentlyResult.commands.forEach(cmd => {
|
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.
|
|
13
|
+
.version("1.3.0", "-v, --version", "mfer CLI version")
|
|
14
14
|
.hook("preAction", (thisCommand, actionCommand) => {
|
|
15
15
|
console.log();
|
|
16
16
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mfer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "CLI tool designed to sensibly run micro-frontends from the terminal.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mfer": "dist/index.js"
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"type": "module",
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/srimel/
|
|
31
|
+
"url": "git+https://github.com/srimel/mfer.git"
|
|
32
32
|
},
|
|
33
33
|
"bugs": {
|
|
34
|
-
"url": "https://github.com/srimel/
|
|
34
|
+
"url": "https://github.com/srimel/mfer/issues"
|
|
35
35
|
},
|
|
36
|
-
"homepage": "https://github.com/srimel/
|
|
36
|
+
"homepage": "https://github.com/srimel/mfer#readme",
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=18"
|
|
39
39
|
},
|