@arkts/image-manager 0.0.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/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/default-product-config.cjs +370 -0
- package/dist/default-product-config.d.cts +5 -0
- package/dist/default-product-config.d.mts +6 -0
- package/dist/default-product-config.mjs +369 -0
- package/dist/index.cjs +663 -0
- package/dist/index.d.cts +264 -0
- package/dist/index.d.mts +264 -0
- package/dist/index.mjs +629 -0
- package/dist/product-config-BbaYsaoV.d.mts +250 -0
- package/dist/product-config-Dk21FD9U.d.cts +250 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arkcode
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @arkts/image-manager
|
|
2
|
+
|
|
3
|
+
OpenHarmony/HarmonyOS qemu image manager.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createImageManager, RequestUrlError } from '@arkts/image-manager'
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
const imageManager = createImageManager({ /** options */ })
|
|
12
|
+
|
|
13
|
+
// Get all local and remote images
|
|
14
|
+
const images = await imageManager.getImages()
|
|
15
|
+
console.log(images)
|
|
16
|
+
|
|
17
|
+
// We choice the first image to deploy
|
|
18
|
+
const image = images[0]
|
|
19
|
+
// Download the image
|
|
20
|
+
const downloader = await image.createDownloader()
|
|
21
|
+
if (downloader instanceof RequestUrlError)
|
|
22
|
+
return console.error(downloader)
|
|
23
|
+
|
|
24
|
+
// Listen to the download and extract progress
|
|
25
|
+
downloader.on('download-progress', progress => console.warn(progress))
|
|
26
|
+
downloader.on('extract-progress', progress => console.warn(progress))
|
|
27
|
+
|
|
28
|
+
// Start download
|
|
29
|
+
await downloader.startDownload()
|
|
30
|
+
|
|
31
|
+
// When the download is complete, we can check the checksum
|
|
32
|
+
const checksum = await downloader.checkChecksum()
|
|
33
|
+
console.warn(`Checksum: ${checksum}`)
|
|
34
|
+
if (!checksum)
|
|
35
|
+
return console.error('Checksum is not valid')
|
|
36
|
+
|
|
37
|
+
// Start extract the image
|
|
38
|
+
await downloader.extract()
|
|
39
|
+
|
|
40
|
+
// Clean the download cache
|
|
41
|
+
await downloader.clean()
|
|
42
|
+
|
|
43
|
+
// Start to deploy the image
|
|
44
|
+
// We must find the product config item if you don't want to customize the deployed image options,
|
|
45
|
+
// like `screenWidth`, `screenHeight`, `screenDiagonal`, `screenDensity`, etc.
|
|
46
|
+
const productConfig = await image.getProductConfig()
|
|
47
|
+
const mateBookFold = productConfig.find(item => item.name === 'MateBook Fold')
|
|
48
|
+
if (!mateBookFold)
|
|
49
|
+
throw new Error('MateBook Fold not found')
|
|
50
|
+
|
|
51
|
+
// Create the deployer
|
|
52
|
+
const deployer = image.createDeployer('MateBook Fold', createDeployedImageConfig(image))
|
|
53
|
+
.setCpuNumber(4)
|
|
54
|
+
.setMemoryRamSize(4096)
|
|
55
|
+
.setDataDiskSize(6144)
|
|
56
|
+
|
|
57
|
+
// We can get the final deployed image options,
|
|
58
|
+
// it will be written to the `imageBasePath/lists.json` file when deployed.
|
|
59
|
+
const list = await deployer.buildList()
|
|
60
|
+
console.warn(list)
|
|
61
|
+
|
|
62
|
+
// We can get the `config.ini` object,
|
|
63
|
+
// it will be written to the `deployedPath/MateBook Fold/config.ini` file when deployed.
|
|
64
|
+
const config = await deployer.buildIni()
|
|
65
|
+
console.warn(config)
|
|
66
|
+
// You also can get the `config.ini` string version:
|
|
67
|
+
const iniString = await deployer.toIniString()
|
|
68
|
+
console.warn(iniString)
|
|
69
|
+
|
|
70
|
+
// Deploy the image
|
|
71
|
+
await deployer.deploy()
|
|
72
|
+
console.warn('Image deployed successfully')
|
|
73
|
+
|
|
74
|
+
// Start the emulator
|
|
75
|
+
await image.start(deployer)
|
|
76
|
+
|
|
77
|
+
await new Promise<void>(resolve => setTimeout(resolve, 1000 * 60))
|
|
78
|
+
// Stop the emulator
|
|
79
|
+
image.stop(deployer)
|
|
80
|
+
}
|
|
81
|
+
```
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/default-product-config.ts
|
|
3
|
+
var default_product_config_default = {
|
|
4
|
+
"Phone": [
|
|
5
|
+
{
|
|
6
|
+
name: "Mate 80 Pro Max、Mate 80 RS",
|
|
7
|
+
screenWidth: "1320",
|
|
8
|
+
screenHeight: "2848",
|
|
9
|
+
screenDiagonal: "6.9",
|
|
10
|
+
screenDensity: "540",
|
|
11
|
+
visible: true,
|
|
12
|
+
devModel: "PHEMU-FD00"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "Mate 80、Mate 80 Pro",
|
|
16
|
+
screenWidth: "1280",
|
|
17
|
+
screenHeight: "2832",
|
|
18
|
+
screenDiagonal: "6.75",
|
|
19
|
+
screenDensity: "560",
|
|
20
|
+
visible: true,
|
|
21
|
+
devModel: "PHEMU-FD00"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "Mate 70 Pro、Mate 70 Pro+、Mate 70 RS",
|
|
25
|
+
screenWidth: "1316",
|
|
26
|
+
screenHeight: "2832",
|
|
27
|
+
screenDiagonal: "6.9",
|
|
28
|
+
screenDensity: "560",
|
|
29
|
+
visible: true,
|
|
30
|
+
devModel: "PHEMU-FD00"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Mate 70",
|
|
34
|
+
screenWidth: "1216",
|
|
35
|
+
screenHeight: "2688",
|
|
36
|
+
screenDiagonal: "6.7",
|
|
37
|
+
screenDensity: "520",
|
|
38
|
+
visible: true,
|
|
39
|
+
devModel: "PHEMU-FD00"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "Mate 70 Air",
|
|
43
|
+
screenWidth: "1320",
|
|
44
|
+
screenHeight: "2760",
|
|
45
|
+
screenDiagonal: "6.96",
|
|
46
|
+
screenDensity: "520",
|
|
47
|
+
visible: true,
|
|
48
|
+
devModel: "PHEMU-FD00"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "Mate 60 Pro、Mate 60 Pro+、Mate 60 RS",
|
|
52
|
+
screenWidth: "1260",
|
|
53
|
+
screenHeight: "2720",
|
|
54
|
+
screenDiagonal: "6.82",
|
|
55
|
+
screenDensity: "520",
|
|
56
|
+
visible: true,
|
|
57
|
+
devModel: "PHEMU-FD00"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "Mate 60",
|
|
61
|
+
screenWidth: "1216",
|
|
62
|
+
screenHeight: "2688",
|
|
63
|
+
screenDiagonal: "6.69",
|
|
64
|
+
screenDensity: "520",
|
|
65
|
+
visible: true,
|
|
66
|
+
devModel: "PHEMU-FD00"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "Pura 80 Pro、Pura 80 Pro+、Pura 80 Ultra",
|
|
70
|
+
screenWidth: "1276",
|
|
71
|
+
screenHeight: "2848",
|
|
72
|
+
screenDiagonal: "6.8",
|
|
73
|
+
screenDensity: "560",
|
|
74
|
+
visible: true,
|
|
75
|
+
devModel: "PHEMU-FD00"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "Pura 80",
|
|
79
|
+
screenWidth: "1256",
|
|
80
|
+
screenHeight: "2760",
|
|
81
|
+
screenDiagonal: "6.6",
|
|
82
|
+
screenDensity: "560",
|
|
83
|
+
visible: true,
|
|
84
|
+
devModel: "PHEMU-FD00"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "Pura 70 Pro、Pura 70 Pro+、Pura 70 Ultra",
|
|
88
|
+
screenWidth: "1260",
|
|
89
|
+
screenHeight: "2844",
|
|
90
|
+
screenDiagonal: "6.8",
|
|
91
|
+
screenDensity: "540",
|
|
92
|
+
visible: true,
|
|
93
|
+
devModel: "PHEMU-FD00"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "Pura 70",
|
|
97
|
+
screenWidth: "1256",
|
|
98
|
+
screenHeight: "2760",
|
|
99
|
+
screenDiagonal: "6.6",
|
|
100
|
+
screenDensity: "540",
|
|
101
|
+
visible: true,
|
|
102
|
+
devModel: "PHEMU-FD00"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "nova 14 Ultra",
|
|
106
|
+
screenWidth: "1272",
|
|
107
|
+
screenHeight: "2860",
|
|
108
|
+
screenDiagonal: "6.81",
|
|
109
|
+
screenDensity: "560",
|
|
110
|
+
visible: true,
|
|
111
|
+
devModel: "PHEMU-FD00"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "nova 14 Pro",
|
|
115
|
+
screenWidth: "1224",
|
|
116
|
+
screenHeight: "2776",
|
|
117
|
+
screenDiagonal: "6.78",
|
|
118
|
+
screenDensity: "540",
|
|
119
|
+
visible: true
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "nova 14",
|
|
123
|
+
screenWidth: "1084",
|
|
124
|
+
screenHeight: "2412",
|
|
125
|
+
screenDiagonal: "6.7",
|
|
126
|
+
screenDensity: "480",
|
|
127
|
+
visible: true,
|
|
128
|
+
devModel: "PHEMU-FD00"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "nova 13 Pro",
|
|
132
|
+
screenWidth: "1224",
|
|
133
|
+
screenHeight: "2776",
|
|
134
|
+
screenDiagonal: "6.76",
|
|
135
|
+
screenDensity: "540",
|
|
136
|
+
visible: true,
|
|
137
|
+
devModel: "PHEMU-FD00"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "nova 13",
|
|
141
|
+
screenWidth: "1084",
|
|
142
|
+
screenHeight: "2412",
|
|
143
|
+
screenDiagonal: "6.7",
|
|
144
|
+
screenDensity: "480",
|
|
145
|
+
visible: true,
|
|
146
|
+
devModel: "PHEMU-FD00"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "nova 12 Pro、nova 12 Ultra",
|
|
150
|
+
screenWidth: "1224",
|
|
151
|
+
screenHeight: "2776",
|
|
152
|
+
screenDiagonal: "6.76",
|
|
153
|
+
screenDensity: "540",
|
|
154
|
+
visible: true,
|
|
155
|
+
devModel: "PHEMU-FD00"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "nova 12",
|
|
159
|
+
screenWidth: "1084",
|
|
160
|
+
screenHeight: "2412",
|
|
161
|
+
screenDiagonal: "6.7",
|
|
162
|
+
screenDensity: "480",
|
|
163
|
+
visible: true,
|
|
164
|
+
devModel: "PHEMU-FD00"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "Pocket 2",
|
|
168
|
+
screenWidth: "1136",
|
|
169
|
+
screenHeight: "2690",
|
|
170
|
+
screenDiagonal: "6.94",
|
|
171
|
+
screenDensity: "500",
|
|
172
|
+
visible: true,
|
|
173
|
+
devModel: "PHEMU-FD00"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "nova flip、nova flip S",
|
|
177
|
+
screenWidth: "1136",
|
|
178
|
+
screenHeight: "2690",
|
|
179
|
+
screenDiagonal: "6.94",
|
|
180
|
+
screenDensity: "500",
|
|
181
|
+
visible: true,
|
|
182
|
+
devModel: "PHEMU-FD00"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "Customize",
|
|
186
|
+
screenWidth: "1316",
|
|
187
|
+
screenHeight: "2832",
|
|
188
|
+
screenDiagonal: "6.9",
|
|
189
|
+
screenDensity: "560",
|
|
190
|
+
visible: true,
|
|
191
|
+
devModel: "PHEMU-FD00"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"Tablet": [
|
|
195
|
+
{
|
|
196
|
+
name: "MatePad Pro 11",
|
|
197
|
+
screenWidth: "2560",
|
|
198
|
+
screenHeight: "1600",
|
|
199
|
+
screenDiagonal: "11",
|
|
200
|
+
screenDensity: "360",
|
|
201
|
+
visible: true
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "MatePad Pro 12",
|
|
205
|
+
screenWidth: "2800",
|
|
206
|
+
screenHeight: "1840",
|
|
207
|
+
screenDiagonal: "12.2",
|
|
208
|
+
screenDensity: "360",
|
|
209
|
+
visible: true
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "MatePad Pro 13",
|
|
213
|
+
screenWidth: "2880",
|
|
214
|
+
screenHeight: "1920",
|
|
215
|
+
screenDiagonal: "13.2",
|
|
216
|
+
screenDensity: "320",
|
|
217
|
+
visible: true
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "MatePad 11 S",
|
|
221
|
+
screenWidth: "2800",
|
|
222
|
+
screenHeight: "1840",
|
|
223
|
+
screenDiagonal: "11.5",
|
|
224
|
+
screenDensity: "400",
|
|
225
|
+
visible: true
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: "MatePad Air 12",
|
|
229
|
+
screenWidth: "2800",
|
|
230
|
+
screenHeight: "1840",
|
|
231
|
+
screenDiagonal: "12",
|
|
232
|
+
screenDensity: "360",
|
|
233
|
+
visible: true
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: "Customize",
|
|
237
|
+
screenWidth: "2560",
|
|
238
|
+
screenHeight: "1600",
|
|
239
|
+
screenDiagonal: "11",
|
|
240
|
+
screenDensity: "360",
|
|
241
|
+
visible: true
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"2in1": [{
|
|
245
|
+
name: "MateBook Pro",
|
|
246
|
+
screenWidth: "3120",
|
|
247
|
+
screenHeight: "2080",
|
|
248
|
+
screenDiagonal: "14.2",
|
|
249
|
+
screenDensity: "304",
|
|
250
|
+
visible: true,
|
|
251
|
+
devModel: "PHEMU-FD00"
|
|
252
|
+
}, {
|
|
253
|
+
name: "Customize",
|
|
254
|
+
screenWidth: "3120",
|
|
255
|
+
screenHeight: "2080",
|
|
256
|
+
screenDiagonal: "14.2",
|
|
257
|
+
screenDensity: "304",
|
|
258
|
+
visible: true,
|
|
259
|
+
devModel: "PHEMU-FD00"
|
|
260
|
+
}],
|
|
261
|
+
"Foldable": [
|
|
262
|
+
{
|
|
263
|
+
name: "Mate X5",
|
|
264
|
+
screenWidth: "2224",
|
|
265
|
+
screenHeight: "2496",
|
|
266
|
+
screenDiagonal: "7.85",
|
|
267
|
+
screenDensity: "500",
|
|
268
|
+
outerScreenWidth: "1080",
|
|
269
|
+
outerScreenHeight: "2504",
|
|
270
|
+
outerScreenDiagonal: "6.4",
|
|
271
|
+
visible: true,
|
|
272
|
+
devModel: "PHEMU-FD01"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
name: "Mate X6",
|
|
276
|
+
screenWidth: "2240",
|
|
277
|
+
screenHeight: "2440",
|
|
278
|
+
screenDiagonal: "7.93",
|
|
279
|
+
screenDensity: "500",
|
|
280
|
+
outerScreenWidth: "1080",
|
|
281
|
+
outerScreenHeight: "2440",
|
|
282
|
+
outerScreenDiagonal: "6.45",
|
|
283
|
+
visible: true,
|
|
284
|
+
devModel: "PHEMU-FD01"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: "Mate X7",
|
|
288
|
+
screenWidth: "2210",
|
|
289
|
+
screenHeight: "2416",
|
|
290
|
+
screenDiagonal: "8",
|
|
291
|
+
screenDensity: "500",
|
|
292
|
+
outerScreenWidth: "1080",
|
|
293
|
+
outerScreenHeight: "2444",
|
|
294
|
+
outerScreenDiagonal: "6.49",
|
|
295
|
+
visible: true,
|
|
296
|
+
devModel: "PHEMU-FD01"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: "Customize",
|
|
300
|
+
screenWidth: "2224",
|
|
301
|
+
screenHeight: "2496",
|
|
302
|
+
screenDiagonal: "7.85",
|
|
303
|
+
screenDensity: "500",
|
|
304
|
+
outerScreenWidth: "1080",
|
|
305
|
+
outerScreenHeight: "2504",
|
|
306
|
+
outerScreenDiagonal: "6.4",
|
|
307
|
+
visible: true,
|
|
308
|
+
devModel: "PHEMU-FD01"
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
"WideFold": [{
|
|
312
|
+
name: "Pura X",
|
|
313
|
+
screenWidth: "1320",
|
|
314
|
+
screenHeight: "2120",
|
|
315
|
+
screenDiagonal: "6.3",
|
|
316
|
+
screenDensity: "480",
|
|
317
|
+
outerScreenWidth: "980",
|
|
318
|
+
outerScreenHeight: "980",
|
|
319
|
+
outerScreenDiagonal: "3.5",
|
|
320
|
+
visible: false,
|
|
321
|
+
devModel: "PHEMU-FD02"
|
|
322
|
+
}],
|
|
323
|
+
"TripleFold": [{
|
|
324
|
+
name: "Mate XT",
|
|
325
|
+
screenWidth: "1008",
|
|
326
|
+
screenHeight: "2232",
|
|
327
|
+
screenDiagonal: "6.4",
|
|
328
|
+
screenDensity: "460",
|
|
329
|
+
outerScreenWidth: "2048",
|
|
330
|
+
outerScreenHeight: "2232",
|
|
331
|
+
outerScreenDiagonal: "7.9",
|
|
332
|
+
outerDoubleScreenWidth: "3184",
|
|
333
|
+
outerDoubleScreenHeight: "2232",
|
|
334
|
+
outerDoubleScreenDiagonal: "10.2",
|
|
335
|
+
visible: false,
|
|
336
|
+
devModel: "PHEMU-FD06"
|
|
337
|
+
}],
|
|
338
|
+
"2in1 Foldable": [{
|
|
339
|
+
name: "MateBook Fold",
|
|
340
|
+
screenWidth: "3296",
|
|
341
|
+
screenHeight: "2472",
|
|
342
|
+
screenDiagonal: "18",
|
|
343
|
+
screenDensity: "288",
|
|
344
|
+
outerScreenWidth: "2472",
|
|
345
|
+
outerScreenHeight: "1648",
|
|
346
|
+
outerScreenDiagonal: "13",
|
|
347
|
+
visible: false,
|
|
348
|
+
devModel: "PCEMU-FD05"
|
|
349
|
+
}],
|
|
350
|
+
"TV": [{
|
|
351
|
+
name: "TV",
|
|
352
|
+
screenWidth: "3840",
|
|
353
|
+
screenHeight: "2160",
|
|
354
|
+
screenDiagonal: "98",
|
|
355
|
+
screenDensity: "480",
|
|
356
|
+
visible: false
|
|
357
|
+
}],
|
|
358
|
+
"Wearable": [{
|
|
359
|
+
name: "Wearable",
|
|
360
|
+
screenWidth: "466",
|
|
361
|
+
screenHeight: "466",
|
|
362
|
+
screenDiagonal: "1.6",
|
|
363
|
+
screenDensity: "320",
|
|
364
|
+
visible: false,
|
|
365
|
+
devModel: "MCHEMU-AL00CN"
|
|
366
|
+
}]
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
//#endregion
|
|
370
|
+
module.exports = default_product_config_default;
|