@codemoreira/esad 1.2.0 ā 1.2.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.
- package/bin/esad.js +77 -58
- package/package.json +1 -1
- package/src/cli/commands/init.js +6 -3
package/bin/esad.js
CHANGED
|
@@ -1,58 +1,77 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const { program } = require('commander');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
.
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { program } = require('commander');
|
|
4
|
+
const pkg = require('../package.json');
|
|
5
|
+
|
|
6
|
+
// Import Commands
|
|
7
|
+
const initCommand = require('../src/cli/commands/init');
|
|
8
|
+
const createModuleCommand = require('../src/cli/commands/createModule');
|
|
9
|
+
const createCdnCommand = require('../src/cli/commands/createCdn');
|
|
10
|
+
const deployCommand = require('../src/cli/commands/deploy');
|
|
11
|
+
const devCommand = require('../src/cli/commands/dev');
|
|
12
|
+
const hostCommand = require('../src/cli/commands/host');
|
|
13
|
+
|
|
14
|
+
program
|
|
15
|
+
.version(pkg.version)
|
|
16
|
+
.description('esad - Easy Super App Development Toolkit');
|
|
17
|
+
|
|
18
|
+
// --- COMMMAND: esad init ---
|
|
19
|
+
program
|
|
20
|
+
.command('init <project-name>')
|
|
21
|
+
.description('Scaffold a new ESAD workspace containing the Host App')
|
|
22
|
+
.action(async (name) => {
|
|
23
|
+
await initCommand(name);
|
|
24
|
+
process.exit(0);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// --- COMMAND: esad create-cdn ---
|
|
28
|
+
program
|
|
29
|
+
.command('create-cdn [cdn-name]')
|
|
30
|
+
.description('Scaffold the CDN / Registry backend')
|
|
31
|
+
.action(async (name) => {
|
|
32
|
+
await createCdnCommand(name);
|
|
33
|
+
process.exit(0);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// --- COMMAND: esad host ---
|
|
37
|
+
program
|
|
38
|
+
.command('host <subcommand>')
|
|
39
|
+
.description('Manage the Host App (dev, android, ios)')
|
|
40
|
+
.action(async (sub) => {
|
|
41
|
+
await hostCommand(sub);
|
|
42
|
+
process.exit(0);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// --- COMMAND: esad create-module ---
|
|
46
|
+
program
|
|
47
|
+
.command('create-module <module-name>')
|
|
48
|
+
.description('Scaffold a React Native mini-app automatically configured for Module Federation via ESAD')
|
|
49
|
+
.action(async (name) => {
|
|
50
|
+
await createModuleCommand(name);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// --- COMMAND: esad deploy ---
|
|
55
|
+
program
|
|
56
|
+
.command('deploy')
|
|
57
|
+
.option('-v, --version <semver>', 'Version number (e.g., 1.0.0)')
|
|
58
|
+
.option('-i, --id <moduleId>', 'The Module ID to deploy')
|
|
59
|
+
.option('-e, --entry <entryFileName>', 'The name of the main entry bundle (e.g., index.bundle)', 'index.bundle')
|
|
60
|
+
.description('Zips the local dist directory and uploads it to the configured deployment endpoint')
|
|
61
|
+
.action(async (options) => {
|
|
62
|
+
await deployCommand(options);
|
|
63
|
+
process.exit(0);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// --- COMMAND: esad dev ---
|
|
67
|
+
program
|
|
68
|
+
.command('dev')
|
|
69
|
+
.option('-i, --id <moduleId>', 'The Module ID to run in dev mode')
|
|
70
|
+
.option('-p, --port <port>', 'The port to run the dev server on', '8081')
|
|
71
|
+
.description('Starts the dev server and updates the external registry to bypass CDN')
|
|
72
|
+
.action(async (options) => {
|
|
73
|
+
await devCommand(options);
|
|
74
|
+
// Note: dev command has its own shutdown logic with SIGINT/SIGTERM
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
program.parse(process.argv);
|
package/package.json
CHANGED
package/src/cli/commands/init.js
CHANGED
|
@@ -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
|
-
|
|
73
|
-
...
|
|
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,
|
|
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...`);
|