@dpuse/dpuse-development 0.3.817 → 0.3.818

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.
@@ -20,6 +20,7 @@ export declare function getDirectoryEntries(path: string): Promise<string[]>;
20
20
  export declare function getDirectoryEntries(path: string, options: ObjectEncodingOptions): Promise<Dirent[]>;
21
21
  export declare function execCommand(label: string | undefined, command_: string, arguments_: string[], outputFilePath?: string): Promise<void>;
22
22
  export declare function spawnCommand(label: string, command: string, arguments_: string[], isErrorIgnored?: boolean, isShellUsed?: boolean): Promise<void>;
23
+ export declare function spawnCommandForOutput(label: string, command: string, arguments_: string[]): Promise<string>;
23
24
  export declare function spawnCommandToFile(label: string, command: string, arguments_: string[], outputPath: string, isErrorIgnored?: boolean): Promise<void>;
24
25
  export declare function migrateGovernanceSection(): Promise<void>;
25
26
  export declare function readJSONFile<T>(path: string): Promise<T>;
@@ -686,7 +686,24 @@ async function Te(e, t, n, r = !1, a = !1) {
686
686
  });
687
687
  });
688
688
  }
689
- async function Ee(n, r, a, o, s = !1) {
689
+ async function Ee(e, t, n) {
690
+ return X(`${e} - spawn(${t} ${n.join(" ")})`), new Promise((e, r) => {
691
+ let a = i(t, n, {
692
+ shell: !1,
693
+ stdio: [
694
+ "inherit",
695
+ "pipe",
696
+ "inherit"
697
+ ]
698
+ }), o = "";
699
+ a.stdout.on("data", (e) => {
700
+ o += String(e);
701
+ }), a.on("error", r), a.on("close", () => {
702
+ e(o);
703
+ });
704
+ });
705
+ }
706
+ async function De(n, r, a, o, s = !1) {
690
707
  return X(`${n} - spawn(${r} ${a.join(" ")}) > ${o}`), new Promise((n, c) => {
691
708
  let l = i(r, a, {
692
709
  shell: !1,
@@ -709,7 +726,7 @@ async function Ee(n, r, a, o, s = !1) {
709
726
  });
710
727
  });
711
728
  }
712
- async function De() {
729
+ async function Oe() {
713
730
  let e = await K("./README.md"), t = e.indexOf(H), n = e.indexOf(ve);
714
731
  if (t === -1 || n === -1) return;
715
732
  let r = `${W}\n${U}\n\n${V}\n${B}`;
@@ -732,27 +749,27 @@ async function q(t) {
732
749
  async function J(n, r) {
733
750
  await e.mkdir(t.dirname(n), { recursive: !0 }), await e.writeFile(n, `${JSON.stringify(r, void 0, 4)}\n`, "utf-8");
734
751
  }
735
- async function Oe(e, t, n) {
736
- await Y("README.md", ze(await K("./README.md"), e, t, n));
752
+ async function ke(e, t, n) {
753
+ await Y("README.md", Be(await K("./README.md"), e, t, n));
737
754
  }
738
755
  async function Y(t, n) {
739
756
  await e.writeFile(t, n, "utf-8");
740
757
  }
741
- function ke(e) {
758
+ function Ae(e) {
742
759
  console.info("\x1B[36m────────────────────────────────────────────────────────────────────────────────"), console.info(`▶️ ${e}`);
743
760
  }
744
- function Ae(e) {
761
+ function je(e) {
745
762
  console.info(`✅ ${e}`);
746
763
  }
747
764
  function X(e) {
748
765
  console.info(e);
749
766
  }
750
- function je(e) {
767
+ function Me(e) {
751
768
  let t = be.find((t) => e.startsWith(t.idPrefix));
752
769
  if (!t) throw Error(`Failed to locate module type configuration for identifier '${e}'.`);
753
770
  return t;
754
771
  }
755
- function Me(e, t) {
772
+ function Ne(e, t) {
756
773
  let n = e.repository, r = typeof n == "string" ? n : n?.url;
757
774
  if (r == null || r === "") throw Error(`package.json 'repository' field is required to ${t}.`);
758
775
  let i = r.replace(/^git\+/, "").replace(/\.git$/, ""), a = /github\.com[/:]([^/]+)\/([^/]+)$/.exec(i);
@@ -762,17 +779,17 @@ function Me(e, t) {
762
779
  repo: a[2]
763
780
  };
764
781
  }
765
- async function Ne(t) {
782
+ async function Pe(t) {
766
783
  return await e.stat(t);
767
784
  }
768
- async function Pe(e, t, n) {
785
+ async function Fe(e, t, n) {
769
786
  switch (n.typeId) {
770
- case "connector": return await Ie(e, t);
771
- case "presenter": return await Le(e, t);
772
- default: return await Re(e, t);
787
+ case "connector": return await Le(e, t);
788
+ case "presenter": return await Re(e, t);
789
+ default: return await ze(e, t);
773
790
  }
774
791
  }
775
- async function Fe(e, t, n = "./") {
792
+ async function Ie(e, t, n = "./") {
776
793
  if (X(`${e} Bump project version`), t.version == null) t.version = "0.0.001", console.warn(`⚠️ Project version initialised to '${t.version}'.`);
777
794
  else {
778
795
  let e = t.version, n = t.version.split(".");
@@ -786,20 +803,20 @@ async function Z(e) {
786
803
  };
787
804
  return i(n), r;
788
805
  }
789
- async function Ie(e, t) {
806
+ async function Le(e, t) {
790
807
  X(`${e} Build connector project configuration`);
791
808
  let [n, r] = await Promise.all([G("config.json"), K("src/index.ts")]), i = /* @__PURE__ */ s(he, n);
792
809
  if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
793
810
  let a = await Z(r);
794
811
  return await Q(t, n, a, F(a));
795
812
  }
796
- async function Le(e, t) {
813
+ async function Re(e, t) {
797
814
  X(`${e} Build presenter project configuration`);
798
815
  let [n, r] = await Promise.all([G("config.json"), K("src/index.ts")]), i = /* @__PURE__ */ s(R, n);
799
816
  if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
800
817
  return await Q(t, n, await Z(r));
801
818
  }
802
- async function Re(e, t) {
819
+ async function ze(e, t) {
803
820
  X(`${e} Build project configuration`);
804
821
  let n = await G("config.json");
805
822
  return t.name != null && (n.id = t.name.replace("@dpuse/", "")), t.version != null && (n.version = t.version), n.icon ??= await q("logo.svg"), n.iconDark ??= await q("logoDark.svg"), await J("config.json", $(n)), n;
@@ -815,11 +832,11 @@ function $(e) {
815
832
  ], n = Object.entries(e), r = t.flatMap((e) => n.filter(([t]) => t === e)), i = n.filter(([e]) => !t.includes(e)).toSorted(([e], [t]) => e.localeCompare(t, "en", { sensitivity: "base" }));
816
833
  return Object.fromEntries([...r, ...i]);
817
834
  }
818
- function ze(e, t, n, r) {
835
+ function Be(e, t, n, r) {
819
836
  let i = e.indexOf(n), a = e.indexOf(r);
820
837
  if (i === -1 || a === -1) throw Error(`Markers ${n}-${r} not found in content.`);
821
838
  let o = t.trim();
822
839
  return `${e.slice(0, Math.max(0, i + n.length))}\n\n${o}\n\n${e.slice(Math.max(0, a))}`;
823
840
  }
824
841
  //#endregion
825
- export { I as A, Me as C, Oe as D, J as E, Y as O, q as S, Ee as T, Ae as _, _e as a, G as b, ye as c, Se as d, we as f, ke as g, Ne as h, z as i, F as k, Pe as l, je as m, V as n, U as o, Ce as p, ge as r, W as s, B as t, Fe as u, X as v, Te as w, K as x, De as y };
842
+ export { F as A, Ne as C, J as D, De as E, ke as O, q as S, Ee as T, je as _, _e as a, G as b, ye as c, Se as d, we as f, Ae as g, Pe as h, z as i, I as j, Y as k, Fe as l, Me as m, V as n, U as o, Ce as p, ge as r, W as s, B as t, Ie as u, X as v, Te as w, K as x, Oe as y };