react-mfe-gen 1.1.0 β†’ 1.1.2

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.
@@ -0,0 +1,9 @@
1
+ # Live release🌍 version(x.xx)
2
+
3
+ ## Description:
4
+
5
+ please describe new features introduced in this PR.
6
+
7
+ ## Check list:
8
+ - [ ] Version upgraded in the package.json file.
9
+ - [ ] E2E flow tested in local.
package/README.md CHANGED
@@ -6,11 +6,12 @@ This tool uses the Runtime Integration approach β€” meaning each MFE is built as
6
6
 
7
7
  ## πŸš€ Features:
8
8
 
9
- - Quickly set up a React microfront end base project.
10
- - Follows Runtime Integration best practices.
11
- - Outputs ready-to-execute code with fully dynamic, seamlessly integrated components..
12
- - Dynamically installs additional libraries based on user choices, such as state management, styling, and form handling.
13
- - Automatically cleans up any incomplete code if an unexpected issue occurs during the process.
9
+ - Spin up a React Microfrontend Base in Seconds – No hassle, just code.
10
+ - Built on Runtime Integration Best Practices – Seamless, scalable, and future-proof.
11
+ - Generates Production-Ready Microfrontends – Pre-configured and good to go.
12
+ - Smart Library Installer – Dynamically adds state management, styling, and form tools based on your choices.
13
+ - Self-Healing Setup – Auto-cleans incomplete code if something breaks mid-process.
14
+ - True Cross-Platform Compatibility – Works flawlessly on Windows, macOS, and Linux.
14
15
 
15
16
  ## πŸ“¦ Prerequisites:
16
17
 
@@ -1,6 +1,6 @@
1
1
  import inquirer from "inquirer";
2
2
  import { PROMPT, INFO_MESSAGE, CHOICE_CONSTANTS } from "../constants.js";
3
- import utils from "../utility.js";
3
+ import { utils } from "../utility.js";
4
4
 
5
5
  const containerCreation = async (language) => {
6
6
  // To store different working dir
@@ -72,7 +72,8 @@ const containerCreation = async (language) => {
72
72
  console.log(
73
73
  `${INFO_MESSAGE.SUCCESS.CONTAINER}\n${INFO_MESSAGE.HAPPY_CODING}`
74
74
  );
75
- } catch {
75
+ } catch (e) {
76
+ console.log("Error:", e);
76
77
  utils.cleanupProject(workingDirectories);
77
78
  }
78
79
  };
@@ -6,7 +6,7 @@ import {
6
6
  QUESTION,
7
7
  CHOICE_CONSTANTS,
8
8
  } from "../constants.js";
9
- import utils from "../utility.js";
9
+ import { utils, mfeGenLogger } from "../utility.js";
10
10
 
11
11
  const newProjectCreation = async (language) => {
12
12
  // To store different working dir
@@ -89,7 +89,7 @@ const newProjectCreation = async (language) => {
89
89
  // store working dir
90
90
  const mfeFullPath = path.join(mfeInfo.path, mfeName);
91
91
  workingDirectories.push(mfeFullPath);
92
- // Go inside user specified mfe dir
92
+ // Go inside user specified mfe dir
93
93
  process.chdir(mfeInfo.path);
94
94
  const mfeAppCommand = utils.getLanguageTemplate(mfeName, isTypeScript);
95
95
 
@@ -104,10 +104,9 @@ const newProjectCreation = async (language) => {
104
104
  );
105
105
  }
106
106
 
107
- console.log(
108
- `${INFO_MESSAGE.SUCCESS.NEW_PRO}\n${INFO_MESSAGE.HAPPY_CODING}`
109
- );
110
- } catch {
107
+ mfeGenLogger.successLog(`${INFO_MESSAGE.SUCCESS.NEW_PRO}\n${INFO_MESSAGE.HAPPY_CODING}`);
108
+ } catch (e) {
109
+ mfeGenLogger.ErrorLog(`Error: ${e}`)
111
110
  utils.cleanupProject(workingDirectories);
112
111
  }
113
112
  };
@@ -1,6 +1,6 @@
1
1
  import inquirer from "inquirer";
2
2
  import { PROMPT, INFO_MESSAGE, CHOICE_CONSTANTS } from "../constants.js";
3
- import utils from "../utility.js";
3
+ import { utils } from "../utility.js";
4
4
 
5
5
  const singleMfeCreation = async (language) => {
6
6
  // To store different working dir
@@ -34,15 +34,16 @@ const singleMfeCreation = async (language) => {
34
34
 
35
35
  // Make normal react app into MFE container
36
36
  await utils.configureMfe(
37
- { ...mfeInfo, projectName: mfeName,mfeDescription, isTypeScript },
37
+ { ...mfeInfo, projectName: mfeName, mfeDescription, isTypeScript },
38
38
  mfeName,
39
39
  0
40
40
  );
41
41
 
42
- console.log(
42
+ mfeGenLogger.successLog(
43
43
  `${INFO_MESSAGE.SUCCESS.ONE_MFE}\n${INFO_MESSAGE.HAPPY_CODING}`
44
44
  );
45
- } catch {
45
+ } catch (e) {
46
+ mfeGenLogger.ErrorLog(`Error: ${e}`);
46
47
  utils.cleanupProject(workingDirectories);
47
48
  }
48
49
  };
@@ -0,0 +1,14 @@
1
+
2
+ \x1b[31m β†’ Red
3
+
4
+ \x1b[32m β†’ Green
5
+
6
+ \x1b[33m β†’ Yellow
7
+
8
+ \x1b[34m β†’ Blue
9
+
10
+ \x1b[35m β†’ Magenta
11
+
12
+ \x1b[36m β†’ Cyan
13
+
14
+ \x1b[0m β†’ Reset
package/mfe-gen.js CHANGED
@@ -1,9 +1,14 @@
1
1
  import inquirer from "inquirer";
2
2
  import { PROMPT, INFO_MESSAGE, CHOICE_CONSTANTS } from "./constants.js";
3
- import {newProjectCreation,containerCreation,singleMfeCreation} from "./creation/index.js";
3
+ import {
4
+ newProjectCreation,
5
+ containerCreation,
6
+ singleMfeCreation,
7
+ } from "./creation/index.js";
8
+ import { mfeGenLogger } from "./utility.js";
4
9
 
5
10
  const mfeGen = async () => {
6
- console.log(INFO_MESSAGE.DISCLAIMER);
11
+ mfeGenLogger.notifyLog(INFO_MESSAGE.DISCLAIMER);
7
12
 
8
13
  const { typeOfAction, language } = await inquirer.prompt(PROMPT.USER_NEED);
9
14
  switch (typeOfAction) {
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "react-mfe-gen",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Generate React micro-frontends, containers, and projects using a simple CLI with runtime integration support.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
+ "start": "node ./index.js",
7
8
  "test": "echo \"Error: no test specified\" && exit 1"
8
9
  },
9
10
  "repository": {
@@ -1,10 +1,12 @@
1
- import utils from "../../utility.js";
1
+ import { utils } from "../../utility.js";
2
2
 
3
3
  export const getContainerCompContent = (containerCompName, mfes) => {
4
4
  let containerComp = `import React from "react";\n`;
5
5
 
6
6
  for (let i = 0; i < mfes.length; i++) {
7
- containerComp += `import {${utils.toCompName(mfes[i])}} from "./microfrontends/${utils.toCompName(mfes[i])}";\n`;
7
+ containerComp += `import {${utils.toCompName(
8
+ mfes[i]
9
+ )}} from "./microfrontends/${utils.toCompName(mfes[i])}";\n`;
8
10
  }
9
11
 
10
12
  containerComp += `\n\nfunction ${containerCompName}() {
@@ -15,7 +17,13 @@ export const getContainerCompContent = (containerCompName, mfes) => {
15
17
  <h1>Hello from ${containerCompName}</h1>\n`;
16
18
 
17
19
  for (let i = 0; i < mfes.length; i++) {
18
- containerComp += ` <${utils.toCompName(mfes[i]) } name={"${utils.toCompName(mfes[i])}"} host={getMfeOrigin(process.env.REACT_APP_${mfes[i].toUpperCase()})} />\n`;
20
+ containerComp += ` <${utils.toCompName(
21
+ mfes[i]
22
+ )} name={"${utils.toCompName(
23
+ mfes[i]
24
+ )}"} host={getMfeOrigin(process.env.REACT_APP_${mfes[
25
+ i
26
+ ].toUpperCase()})} />\n`;
19
27
  }
20
28
 
21
29
  containerComp += `</div>
package/utility.js CHANGED
@@ -39,11 +39,11 @@ class utils {
39
39
  static async cleanupProject(dirs) {
40
40
  try {
41
41
  for (let i = 0; i < dirs.length; i++) {
42
- console.log(`Cleaning up the project directory: ${dirs[i]}`);
42
+ mfeGenLogger.notifyLog(`Cleaning up the project directory: ${dirs[i]}`);
43
43
  await rm(dirs[i], { recursive: true });
44
44
  }
45
45
  } catch (err) {
46
- console.log(`Failed to clean project directory\n Error:${err}`);
46
+ mfeGenLogger.ErrorLog(`Failed to clean project directory\n Error:${err}`);
47
47
  }
48
48
  }
49
49
 
@@ -224,4 +224,16 @@ class utils {
224
224
  }
225
225
  }
226
226
 
227
- export default utils;
227
+ class mfeGenLogger {
228
+ static successLog(message) {
229
+ console.log(`\x1b[32m${message}\x1b[0m`);
230
+ }
231
+ static ErrorLog(message) {
232
+ console.log(`\x1b[31m${message}\x1b[0m`);
233
+ }
234
+ static notifyLog(message) {
235
+ console.log(`\x1b[33m${message}\x1b[0m`);
236
+ }
237
+ }
238
+
239
+ export { utils, mfeGenLogger };