@arkts/image-manager 0.3.3 → 0.3.5

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 CHANGED
@@ -40,7 +40,7 @@ let unzipper = require("unzipper");
40
40
  unzipper = __toESM(unzipper);
41
41
 
42
42
  //#region package.json
43
- var version = "0.3.3";
43
+ var version = "0.3.5";
44
44
 
45
45
  //#endregion
46
46
  //#region src/devices/list.ts
@@ -302,12 +302,11 @@ var DeviceImpl = class {
302
302
  return `${Object.entries(this.buildDeviceIni()).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${key}=${value}`).join("\n")}\n`;
303
303
  }
304
304
  async deploy() {
305
- if (await this.isDeployed()) return;
305
+ if (await this.isDeployed()) throw new DeployError(DeployError.Code.DEVICE_ALREADY_DEPLOYED, `Image ${this.options.name} already deployed`);
306
306
  const { fs, path, deployedPath } = this.image.getImageManager().getOptions();
307
307
  if (!fs.existsSync(deployedPath)) fs.mkdirSync(deployedPath, { recursive: true });
308
308
  const listsPath = path.join(deployedPath, "lists.json");
309
309
  const listConfig = this.buildList();
310
- if (fs.existsSync(listConfig.path)) throw new DeployError(DeployError.Code.DEVICE_ALREADY_DEPLOYED, `Image ${listConfig.name} already deployed`);
311
310
  if (!fs.existsSync(listsPath)) return fs.writeFileSync(listsPath, JSON.stringify([listConfig], null, 2));
312
311
  const lists = JSON.parse(fs.readFileSync(listsPath, "utf-8")) ?? [];
313
312
  if (!Array.isArray(lists)) throw new DeployError(DeployError.Code.LIST_JSON_NOT_AN_ARRAY, "Lists is not an array");
package/dist/index.d.cts CHANGED
@@ -22,6 +22,7 @@ interface LocalImage extends BaseImage, Stringifiable<LocalImage.Stringifiable>
22
22
  stop(device: Device): Promise<node_child_process0.ChildProcess>;
23
23
  buildStartCommand(device: Device): Promise<string>;
24
24
  buildStopCommand(device: Device): Promise<string>;
25
+ getPascalCaseDeviceType(): Promise<PascalCaseDeviceType | undefined>;
25
26
  getProductConfig(): Promise<ProductConfigItem[]>;
26
27
  }
27
28
  declare namespace LocalImage {
package/dist/index.d.mts CHANGED
@@ -22,6 +22,7 @@ interface LocalImage extends BaseImage, Stringifiable<LocalImage.Stringifiable>
22
22
  stop(device: Device): Promise<node_child_process0.ChildProcess>;
23
23
  buildStartCommand(device: Device): Promise<string>;
24
24
  buildStopCommand(device: Device): Promise<string>;
25
+ getPascalCaseDeviceType(): Promise<PascalCaseDeviceType | undefined>;
25
26
  getProductConfig(): Promise<ProductConfigItem[]>;
26
27
  }
27
28
  declare namespace LocalImage {
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import progress from "progress-stream";
6
6
  import unzipper from "unzipper";
7
7
 
8
8
  //#region package.json
9
- var version = "0.3.3";
9
+ var version = "0.3.5";
10
10
 
11
11
  //#endregion
12
12
  //#region src/devices/list.ts
@@ -268,12 +268,11 @@ var DeviceImpl = class {
268
268
  return `${Object.entries(this.buildDeviceIni()).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${key}=${value}`).join("\n")}\n`;
269
269
  }
270
270
  async deploy() {
271
- if (await this.isDeployed()) return;
271
+ if (await this.isDeployed()) throw new DeployError(DeployError.Code.DEVICE_ALREADY_DEPLOYED, `Image ${this.options.name} already deployed`);
272
272
  const { fs, path, deployedPath } = this.image.getImageManager().getOptions();
273
273
  if (!fs.existsSync(deployedPath)) fs.mkdirSync(deployedPath, { recursive: true });
274
274
  const listsPath = path.join(deployedPath, "lists.json");
275
275
  const listConfig = this.buildList();
276
- if (fs.existsSync(listConfig.path)) throw new DeployError(DeployError.Code.DEVICE_ALREADY_DEPLOYED, `Image ${listConfig.name} already deployed`);
277
276
  if (!fs.existsSync(listsPath)) return fs.writeFileSync(listsPath, JSON.stringify([listConfig], null, 2));
278
277
  const lists = JSON.parse(fs.readFileSync(listsPath, "utf-8")) ?? [];
279
278
  if (!Array.isArray(lists)) throw new DeployError(DeployError.Code.LIST_JSON_NOT_AN_ARRAY, "Lists is not an array");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arkts/image-manager",
3
3
  "type": "module",
4
- "version": "0.3.3",
4
+ "version": "0.3.5",
5
5
  "description": "OpenHarmony/HarmonyOS qemu image manager.",
6
6
  "author": "Naily Zero <zero@naily.cc> (https://naily.cc)",
7
7
  "license": "MIT",