You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+107Lines changed: 107 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,113 @@ This script processes a `solution.json` file and combines the `menus` key from m
4
4
5
5
## How It Works
6
6
7
+
### ⚠️ Requirements
8
+
9
+
-**Node.js v18 or higher is required**
10
+
- This version is necessary for modern features like `Blob` and `arrayBuffer()` support used during ZIP creation.
11
+
- You can verify your version with:
12
+
```bash
13
+
node -v
14
+
```
15
+
---
16
+
17
+
### 🚀 What It Does
18
+
19
+
The `workbench.js` script:
20
+
1. **Reads** a solution configuration JSON (e.g., `HF.json`).
21
+
2. **Generates** supporting files like:
22
+
- `fe-openimis.json`
23
+
- `generated-menu.json`
24
+
- `generated-roles.json`
25
+
- `compose.yml`
26
+
3. **Creates** a ZIP archive (`output.zip`) containing the above outputs.
27
+
4. **(Optional)** Pushes the generated solution to a new branch in the `openimis/solutions` GitHub repo.
28
+
29
+
### Usage
30
+
31
+
#### 📦 Basic: Generate ZIP Only
32
+
33
+
```bash
34
+
node workbench.js
35
+
```
36
+
37
+
This will create `output.zip`in the project root with the generated solution files.
38
+
39
+
---
40
+
41
+
#### 🚀 Publish to GitHub
42
+
43
+
```bash
44
+
node workbench.js --publish
45
+
```
46
+
47
+
This generates the ZIP and:
48
+
49
+
* Clones the [openimis/solutions](https://github.com/openimis/solutions) repository.
50
+
* Creates a new branch based on `develop`.
51
+
* Pushes the solution into a subfolder matching the default name (`default-solution`).
52
+
53
+
---
54
+
55
+
#### 📝 Publish with Custom Folder Name
56
+
57
+
```bash
58
+
node workbench.js --publish --folder=coreMIS-test
59
+
```
60
+
61
+
This behaves like the previous command but publishes the solution inside a subfolder called `coreMIS-test`.
62
+
63
+
---
64
+
65
+
### Example Output Structure
66
+
67
+
After running, you will see:
68
+
69
+
```
70
+
output.zip
71
+
solution/
72
+
├— fe-openimis.json
73
+
├— generated-menu.json
74
+
├— generated-roles.json
75
+
└— compose.yml
76
+
```
77
+
78
+
---
79
+
80
+
### 🚼 Cleanup
81
+
82
+
Temporary folders (`temp_solutions_repo` and `unzipped_output`) are automatically cleaned between runs.
83
+
84
+
---
85
+
86
+
### 📁 Default Config Path
87
+
88
+
Ensure your `<solution>.json` is located at:
89
+
90
+
```
91
+
./solution/solutions/<solution>.json
92
+
```
93
+
94
+
You can customize this path in the script if needed.
95
+
96
+
---
97
+
98
+
### 🔥 Dependencies
99
+
100
+
Install dependencies using:
101
+
102
+
```bash
103
+
npm install jszip simple-git yaml unzipper
104
+
```
105
+
106
+
---
107
+
108
+
### 📬 Contributing
109
+
110
+
Merge to `develop` in `openimis/solutions` is disabled. This script creates a **new branch** like `solution/coreMIS-test` and **pushes only that branch**.
0 commit comments