@arkts/image-manager 0.3.0 → 0.3.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/dist/index.cjs +14 -9
- package/dist/index.mjs +14 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ let unzipper = require("unzipper");
|
|
|
38
38
|
unzipper = __toESM(unzipper);
|
|
39
39
|
|
|
40
40
|
//#region package.json
|
|
41
|
-
var version = "0.3.
|
|
41
|
+
var version = "0.3.1";
|
|
42
42
|
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/devices/list.ts
|
|
@@ -647,19 +647,24 @@ var LocalImageImpl = class extends ImageBase {
|
|
|
647
647
|
return createProductPreset(productConfigItem, pascalCaseDeviceType);
|
|
648
648
|
}
|
|
649
649
|
async getDevices() {
|
|
650
|
-
const { path, fs, deployedPath } = this.getImageManager().getOptions();
|
|
650
|
+
const { path, fs, deployedPath, imageBasePath } = this.getImageManager().getOptions();
|
|
651
651
|
const listsJsonPath = path.resolve(deployedPath, "lists.json");
|
|
652
652
|
if (!fs.existsSync(listsJsonPath) || !fs.statSync(listsJsonPath).isFile()) return [];
|
|
653
653
|
const listsJson = JSON.parse(fs.readFileSync(listsJsonPath, "utf-8"));
|
|
654
654
|
if (!Array.isArray(listsJson) || this.imageType !== "local") return [];
|
|
655
655
|
const devices = [];
|
|
656
|
-
for (const listsJsonItem of listsJson)
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
656
|
+
for (const listsJsonItem of listsJson) {
|
|
657
|
+
if (path.resolve(imageBasePath, listsJsonItem.imageDir) !== this.getFsPath()) continue;
|
|
658
|
+
const device = this.createDevice({
|
|
659
|
+
name: listsJsonItem.name,
|
|
660
|
+
cpuNumber: Number(listsJsonItem.cpuNumber),
|
|
661
|
+
diskSize: Number(listsJsonItem.dataDiskSize),
|
|
662
|
+
memorySize: Number(listsJsonItem.memoryRamSize),
|
|
663
|
+
screen: await this.createScreenLike(listsJsonItem)
|
|
664
|
+
});
|
|
665
|
+
if (!fs.existsSync(device.buildList().path) || !fs.statSync(device.buildList().path).isDirectory()) continue;
|
|
666
|
+
devices.push(device);
|
|
667
|
+
}
|
|
663
668
|
return devices;
|
|
664
669
|
}
|
|
665
670
|
toJSON() {
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import progress from "progress-stream";
|
|
|
5
5
|
import unzipper from "unzipper";
|
|
6
6
|
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "0.3.
|
|
8
|
+
var version = "0.3.1";
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/devices/list.ts
|
|
@@ -614,19 +614,24 @@ var LocalImageImpl = class extends ImageBase {
|
|
|
614
614
|
return createProductPreset(productConfigItem, pascalCaseDeviceType);
|
|
615
615
|
}
|
|
616
616
|
async getDevices() {
|
|
617
|
-
const { path, fs, deployedPath } = this.getImageManager().getOptions();
|
|
617
|
+
const { path, fs, deployedPath, imageBasePath } = this.getImageManager().getOptions();
|
|
618
618
|
const listsJsonPath = path.resolve(deployedPath, "lists.json");
|
|
619
619
|
if (!fs.existsSync(listsJsonPath) || !fs.statSync(listsJsonPath).isFile()) return [];
|
|
620
620
|
const listsJson = JSON.parse(fs.readFileSync(listsJsonPath, "utf-8"));
|
|
621
621
|
if (!Array.isArray(listsJson) || this.imageType !== "local") return [];
|
|
622
622
|
const devices = [];
|
|
623
|
-
for (const listsJsonItem of listsJson)
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
623
|
+
for (const listsJsonItem of listsJson) {
|
|
624
|
+
if (path.resolve(imageBasePath, listsJsonItem.imageDir) !== this.getFsPath()) continue;
|
|
625
|
+
const device = this.createDevice({
|
|
626
|
+
name: listsJsonItem.name,
|
|
627
|
+
cpuNumber: Number(listsJsonItem.cpuNumber),
|
|
628
|
+
diskSize: Number(listsJsonItem.dataDiskSize),
|
|
629
|
+
memorySize: Number(listsJsonItem.memoryRamSize),
|
|
630
|
+
screen: await this.createScreenLike(listsJsonItem)
|
|
631
|
+
});
|
|
632
|
+
if (!fs.existsSync(device.buildList().path) || !fs.statSync(device.buildList().path).isDirectory()) continue;
|
|
633
|
+
devices.push(device);
|
|
634
|
+
}
|
|
630
635
|
return devices;
|
|
631
636
|
}
|
|
632
637
|
toJSON() {
|
package/package.json
CHANGED