-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathlink-modules.js
More file actions
68 lines (61 loc) · 1.48 KB
/
Copy pathlink-modules.js
File metadata and controls
68 lines (61 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
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
59
60
61
62
63
64
65
66
67
68
const { execSync } = require("child_process");
const path = require("path");
const MODULES = [
"core",
"insuree",
"policy",
"product",
"payment",
"claim",
"contribution",
"individual",
"social_protection",
"home",
"opensearch_reports",
"location",
"medical",
"medical_pricelist",
"payer",
"admin",
"tools",
"profile",
"calculation",
"policyholder",
"tasks_management",
"invoice",
"grievance_social_protection",
"language_fr",
"claim_sampling",
"deduplication",
"payroll",
'payment_cycle',
'contribution_plan',
'claim_batch',
'contract',
'benefit_plan',
'beneficiary'
];
const baseDir = path.resolve(__dirname, ".."); // '/home/user/openIMIS-24-10/frontend'
const feAppDir = path.join(baseDir, "openimis-fe_js");
const run = (cmd, cwd) => {
console.log(`\n➡️ Running "${cmd}" in ${cwd}`);
execSync(cmd, { stdio: "inherit", cwd });
};
try {
for (const mod of MODULES) {
const modDir = path.join(baseDir, `openimis-fe-${mod}_js`);
console.log(`\n=== Processing module: ${mod} ===`);
run("yarn install", modDir);
run("yarn build", modDir);
run("yarn link", modDir);
}
console.log("\n=== Linking modules in main frontend app ===");
for (const mod of MODULES) {
const packageName = `@openimis/fe-${mod}`;
run(`yarn link "${packageName}"`, feAppDir);
}
console.log("\n✅ All modules processed and linked!");
} catch (err) {
console.error("❌ Error occurred:", err.message);
process.exit(1);
}