@codemoreira/esad 1.2.0 → 1.2.1

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/bin/esad.js CHANGED
@@ -18,25 +18,37 @@ program
18
18
  program
19
19
  .command('init <project-name>')
20
20
  .description('Scaffold a new ESAD workspace containing the Host App')
21
- .action(initCommand);
21
+ .action(async (name) => {
22
+ await initCommand(name);
23
+ process.exit(0);
24
+ });
22
25
 
23
26
  // --- COMMAND: esad create-cdn ---
24
27
  program
25
28
  .command('create-cdn [cdn-name]')
26
29
  .description('Scaffold the CDN / Registry backend')
27
- .action(createCdnCommand);
30
+ .action(async (name) => {
31
+ await createCdnCommand(name);
32
+ process.exit(0);
33
+ });
28
34
 
29
35
  // --- COMMAND: esad host ---
30
36
  program
31
37
  .command('host <subcommand>')
32
38
  .description('Manage the Host App (dev, android, ios)')
33
- .action(hostCommand);
39
+ .action(async (sub) => {
40
+ await hostCommand(sub);
41
+ process.exit(0);
42
+ });
34
43
 
35
44
  // --- COMMAND: esad create-module ---
36
45
  program
37
46
  .command('create-module <module-name>')
38
47
  .description('Scaffold a React Native mini-app automatically configured for Module Federation via ESAD')
39
- .action(createModuleCommand);
48
+ .action(async (name) => {
49
+ await createModuleCommand(name);
50
+ process.exit(0);
51
+ });
40
52
 
41
53
  // --- COMMAND: esad deploy ---
42
54
  program
@@ -45,14 +57,20 @@ program
45
57
  .option('-i, --id <moduleId>', 'The Module ID to deploy')
46
58
  .option('-e, --entry <entryFileName>', 'The name of the main entry bundle (e.g., index.bundle)', 'index.bundle')
47
59
  .description('Zips the local dist directory and uploads it to the configured deployment endpoint')
48
- .action(deployCommand);
60
+ .action(async (options) => {
61
+ await deployCommand(options);
62
+ process.exit(0);
63
+ });
49
64
 
50
65
  // --- COMMAND: esad dev ---
51
66
  program
52
67
  .command('dev')
53
- .requiredOption('-i, --id <moduleId>', 'The Module ID to run in dev mode')
68
+ .option('-i, --id <moduleId>', 'The Module ID to run in dev mode')
54
69
  .option('-p, --port <port>', 'The port to run the dev server on', '8081')
55
70
  .description('Starts the dev server and updates the external registry to bypass CDN')
56
- .action(devCommand);
71
+ .action(async (options) => {
72
+ await devCommand(options);
73
+ // Note: dev command has its own shutdown logic with SIGINT/SIGTERM
74
+ });
57
75
 
58
76
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemoreira/esad",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Easy Super App Development - Zero-Config CLI and DevTools for React Native Module Federation",
5
5
  "main": "src/plugin/index.js",
6
6
  "exports": {
@@ -27,4 +27,4 @@
27
27
  "fs-extra": "^11.2.0"
28
28
  },
29
29
  "devDependencies": {}
30
- }
30
+ }
@@ -68,15 +68,18 @@ module.exports = async (projectName) => {
68
68
  ];
69
69
  await runProcess('npm', ['install', ...deps], hostDir);
70
70
 
71
+ // Re-read package.json to get the version after npm install updated it
72
+ const updatedPkg = fs.readJsonSync(hostPkgPath);
73
+
71
74
  // Update package.json scripts to delegate to ESAD CLI
72
- hostPkg.scripts = {
73
- ...hostPkg.scripts,
75
+ updatedPkg.scripts = {
76
+ ...updatedPkg.scripts,
74
77
  "start": "esad host start",
75
78
  "android": "esad host android",
76
79
  "ios": "esad host ios",
77
80
  "dev": "esad host dev"
78
81
  };
79
- fs.writeJsonSync(hostPkgPath, hostPkg, { spaces: 2 });
82
+ fs.writeJsonSync(hostPkgPath, updatedPkg, { spaces: 2 });
80
83
  console.log(`āœ… Abstracted package.json scripts to use ESAD CLI.`);
81
84
 
82
85
  console.log(`\nšŸŽØ Configuring NativeWind & Tailwind...`);