@easysui/sdk 1.0.0 → 1.0.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.js CHANGED
@@ -16366,6 +16366,31 @@ var USDC = class extends Coin {
16366
16366
  });
16367
16367
  }
16368
16368
  };
16369
+ function execCmd(cmd) {
16370
+ return new Promise((resolve3, reject) => {
16371
+ const child = child_process.spawn(cmd, { shell: true });
16372
+ let stdout = "";
16373
+ let stderr = "";
16374
+ child.stdout.on("data", (data) => {
16375
+ stdout += data.toString();
16376
+ });
16377
+ child.stderr.on("data", (data) => {
16378
+ stderr += data.toString();
16379
+ });
16380
+ child.on("error", (err) => reject(err));
16381
+ child.on("close", (code) => {
16382
+ if (code === 0) {
16383
+ resolve3(stdout.trim());
16384
+ } else {
16385
+ const output = [stderr.trim(), stdout.trim()].filter(Boolean).join("\n") || `Process exited with code ${code}`;
16386
+ reject(new Error(`Publish bytes command failed:
16387
+ ${output}`));
16388
+ }
16389
+ });
16390
+ });
16391
+ }
16392
+
16393
+ // src/utils/publish.ts
16369
16394
  var PublishSingleton = class _PublishSingleton {
16370
16395
  constructor(publishResp) {
16371
16396
  this.publishResp = publishResp;
@@ -16442,11 +16467,11 @@ var PublishSingleton = class _PublishSingleton {
16442
16467
  signer ??= ADMIN_KEYPAIR.toSuiAddress();
16443
16468
  const _packagePath = this.getPackagePath(packagePath);
16444
16469
  const cmd = this.getPublishCmd(_packagePath, signer, true);
16445
- return child_process.execSync(cmd, { encoding: "utf-8" }).trim();
16470
+ return execCmd(cmd);
16446
16471
  }
16447
16472
  static async publishPackage(signer, packagePath) {
16448
16473
  const cmd = this.getPublishCmd(packagePath, signer.toSuiAddress());
16449
- const res = child_process.execSync(cmd, { encoding: "utf-8" });
16474
+ const res = await execCmd(cmd);
16450
16475
  const match = res.match(/\{[\s\S]*\}/);
16451
16476
  if (!match) {
16452
16477
  throw new Error(`No JSON found in the publish command output: ${res}`);