@platforma-sdk/block-tools 2.12.3 → 2.12.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/cli.js +6 -6
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +411 -339
- package/dist/cli.mjs.map +1 -1
- package/dist/structure/rules/root-turbo-json.d.ts +2 -0
- package/package.json +9 -9
- package/src/cmd/software/env.test.ts +3 -7
- package/src/structure/__tests__/root-turbo-json.test.ts +41 -0
- package/src/structure/rules/root-turbo-json.ts +71 -0
- package/src/structure/rules/root.ts +8 -1
- package/src/structure/templates/static/test/.oxfmtrc.json +1 -1
- package/src/structure/templates/static/root/turbo.json +0 -49
package/dist/cli.mjs
CHANGED
|
@@ -675,21 +675,26 @@ function Tt(e, t) {
|
|
|
675
675
|
let n = F("requireField").obj;
|
|
676
676
|
if (!st(n, e)) throw Error(t ?? `requireField: missing field '${e}'`);
|
|
677
677
|
}
|
|
678
|
+
function Et(e, t) {
|
|
679
|
+
let n = F("ensureFieldEntries").obj, r = st(n, e) ? ot(n, e) : void 0, i = L(r) ? r : {};
|
|
680
|
+
for (let [e, n] of Object.entries(t)) i[e] = n;
|
|
681
|
+
L(r) || ct(n, e, i);
|
|
682
|
+
}
|
|
678
683
|
function B(e, t) {
|
|
679
684
|
R(`scripts.${e}`, t);
|
|
680
685
|
}
|
|
681
686
|
function V(e) {
|
|
682
687
|
z(`scripts.${e}`);
|
|
683
688
|
}
|
|
684
|
-
var
|
|
689
|
+
var Dt = [
|
|
685
690
|
"dependencies",
|
|
686
691
|
"devDependencies",
|
|
687
692
|
"peerDependencies",
|
|
688
693
|
"optionalDependencies"
|
|
689
694
|
];
|
|
690
|
-
function
|
|
695
|
+
function Ot(e, t, n, r) {
|
|
691
696
|
let i = F(e), a = i.obj, o = n === "sdk:" ? gt(n, xt(i, e).isSdkInternal) : n;
|
|
692
|
-
for (let e of
|
|
697
|
+
for (let e of Dt) {
|
|
693
698
|
if (e === r) continue;
|
|
694
699
|
let n = a[e];
|
|
695
700
|
L(n) && t in n && delete n[t];
|
|
@@ -697,136 +702,136 @@ function Dt(e, t, n, r) {
|
|
|
697
702
|
let s = a[r], c = L(s) ? s : {};
|
|
698
703
|
c[t] = o, L(s) || (a[r] = c);
|
|
699
704
|
}
|
|
700
|
-
function
|
|
701
|
-
|
|
705
|
+
function kt(e, t) {
|
|
706
|
+
Ot("ensureDep", e, t, "dependencies");
|
|
702
707
|
}
|
|
703
|
-
function
|
|
704
|
-
|
|
708
|
+
function H(e, t) {
|
|
709
|
+
Ot("ensureDevDep", e, t, "devDependencies");
|
|
705
710
|
}
|
|
706
|
-
function
|
|
707
|
-
|
|
711
|
+
function At(e, t) {
|
|
712
|
+
Ot("ensurePeerDep", e, t, "peerDependencies");
|
|
708
713
|
}
|
|
709
|
-
function
|
|
714
|
+
function U(e) {
|
|
710
715
|
let t = F("removeDep").obj;
|
|
711
|
-
for (let n of
|
|
716
|
+
for (let n of Dt) {
|
|
712
717
|
let r = t[n];
|
|
713
718
|
L(r) && e in r && delete r[e];
|
|
714
719
|
}
|
|
715
720
|
}
|
|
716
|
-
function
|
|
717
|
-
for (let [t, n] of Object.entries(e))
|
|
721
|
+
function W(e) {
|
|
722
|
+
for (let [t, n] of Object.entries(e)) H(t, n);
|
|
718
723
|
}
|
|
719
|
-
function
|
|
720
|
-
for (let [t, n] of Object.entries(e))
|
|
724
|
+
function G(e) {
|
|
725
|
+
for (let [t, n] of Object.entries(e)) At(t, n);
|
|
721
726
|
}
|
|
722
|
-
function
|
|
727
|
+
function jt(e, t, n) {
|
|
723
728
|
let r = xt(F(e), e);
|
|
724
|
-
for (let i of r.modules) i.scope === t &&
|
|
725
|
-
}
|
|
726
|
-
function jt(e) {
|
|
727
|
-
At("ensureWorkspaceScopeDeps", e, "dependencies");
|
|
729
|
+
for (let i of r.modules) i.scope === t && Ot(e, i.name, "workspace:*", n);
|
|
728
730
|
}
|
|
729
731
|
function Mt(e) {
|
|
730
|
-
|
|
732
|
+
jt("ensureWorkspaceScopeDeps", e, "dependencies");
|
|
731
733
|
}
|
|
732
734
|
function Nt(e) {
|
|
735
|
+
jt("ensureWorkspaceScopeDevDeps", e, "devDependencies");
|
|
736
|
+
}
|
|
737
|
+
function Pt(e) {
|
|
733
738
|
let t = F("pruneKeysMatching").obj;
|
|
734
739
|
for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
|
|
735
740
|
}
|
|
736
|
-
function
|
|
741
|
+
function Ft(e, t) {
|
|
737
742
|
let n = ut(e, t);
|
|
738
743
|
for (let t of Object.keys(e)) delete e[t];
|
|
739
744
|
for (let t of Object.keys(n)) e[t] = n[t];
|
|
740
745
|
}
|
|
741
746
|
function K(e) {
|
|
742
|
-
|
|
747
|
+
Ft(F("enforceFieldOrder").obj, e);
|
|
743
748
|
}
|
|
744
|
-
function
|
|
749
|
+
function It(e, t) {
|
|
745
750
|
let n = Object.keys(e).sort(), r = {};
|
|
746
751
|
for (let t of n) r[t] = e[t];
|
|
747
752
|
for (let t of Object.keys(e)) delete e[t];
|
|
748
|
-
for (let i of n) e[i] = r[i], t && L(e[i]) &&
|
|
753
|
+
for (let i of n) e[i] = r[i], t && L(e[i]) && It(e[i], !0);
|
|
749
754
|
}
|
|
750
755
|
function q(e = "", t = {}) {
|
|
751
756
|
let n = t.recursive ?? !1;
|
|
752
757
|
if (e === "" && !n) return;
|
|
753
758
|
let r = F("enforceAlphabeticalOrder").obj;
|
|
754
759
|
if (e === "") {
|
|
755
|
-
|
|
760
|
+
It(r, !0);
|
|
756
761
|
return;
|
|
757
762
|
}
|
|
758
763
|
let i = ot(r, e);
|
|
759
|
-
L(i) &&
|
|
764
|
+
L(i) && It(i, n);
|
|
760
765
|
}
|
|
761
|
-
function
|
|
766
|
+
function Lt() {
|
|
762
767
|
let e = I("ensureWorkspaceModulePaths"), t = xt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
|
|
763
768
|
Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
|
|
764
769
|
}
|
|
765
|
-
function
|
|
770
|
+
function Rt(e, t) {
|
|
766
771
|
let n = e.doc.getIn(["catalog", t]);
|
|
767
772
|
return typeof n == "string" ? n : void 0;
|
|
768
773
|
}
|
|
769
|
-
function
|
|
774
|
+
function zt(e, t) {
|
|
770
775
|
let n = I("ensureCatalogVersion");
|
|
771
|
-
|
|
776
|
+
Rt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
|
|
772
777
|
}
|
|
773
|
-
function
|
|
778
|
+
function Bt(e) {
|
|
774
779
|
let t = I("ensureCatalogLatest");
|
|
775
780
|
if (!t.getLatestVersion) return;
|
|
776
781
|
let n = t.getLatestVersion(e);
|
|
777
|
-
n !== void 0 &&
|
|
782
|
+
n !== void 0 && Rt(t, e) !== n && t.doc.setIn(["catalog", e], n);
|
|
778
783
|
}
|
|
779
|
-
function
|
|
784
|
+
function Vt(e, t) {
|
|
780
785
|
let n = I("pinCatalogToDependencyOf");
|
|
781
786
|
if (!n.getDerivedDependencyPin) return;
|
|
782
787
|
let r = n.getDerivedDependencyPin(e);
|
|
783
|
-
r !== void 0 &&
|
|
788
|
+
r !== void 0 && Rt(n, e) !== r && n.doc.setIn(["catalog", e], r);
|
|
784
789
|
}
|
|
785
|
-
function
|
|
790
|
+
function Ht(e) {
|
|
786
791
|
let t = I("ensureCatalogAbsent");
|
|
787
792
|
t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
|
|
788
793
|
}
|
|
789
|
-
function
|
|
794
|
+
function Ut(e) {
|
|
790
795
|
let t = bt("ensureGitignoreEntries");
|
|
791
796
|
for (let n of e) ht(t.lines, n) || t.lines.push(n);
|
|
792
797
|
}
|
|
793
798
|
//#endregion
|
|
794
799
|
//#region src/structure/engine/parsers/yaml.ts
|
|
795
|
-
function
|
|
800
|
+
function Wt(e) {
|
|
796
801
|
return oe(e);
|
|
797
802
|
}
|
|
798
|
-
function
|
|
803
|
+
function Gt(e) {
|
|
799
804
|
return e.toString();
|
|
800
805
|
}
|
|
801
|
-
var
|
|
802
|
-
function
|
|
806
|
+
var Kt = ".structure";
|
|
807
|
+
function qt(e) {
|
|
803
808
|
if (!e.exists(".structure")) return { version: 0 };
|
|
804
809
|
try {
|
|
805
|
-
let t = JSON.parse(e.read(
|
|
810
|
+
let t = JSON.parse(e.read(Kt));
|
|
806
811
|
return { version: typeof t?.version == "number" ? t.version : 0 };
|
|
807
812
|
} catch {
|
|
808
813
|
return { version: 0 };
|
|
809
814
|
}
|
|
810
815
|
}
|
|
811
|
-
function
|
|
812
|
-
if (e < t) throw new
|
|
816
|
+
function Jt(e, t = 0) {
|
|
817
|
+
if (e < t) throw new Yt(e, t);
|
|
813
818
|
}
|
|
814
|
-
var
|
|
819
|
+
var Yt = class extends Error {
|
|
815
820
|
constructor(e, t) {
|
|
816
821
|
super(`Block .structure version is ${e}, below floor ${t}. Bootstrap via the legacy-migration skill, then re-run.`), this.version = e, this.floor = t, this.name = "StructureVersionFloorError";
|
|
817
822
|
}
|
|
818
823
|
};
|
|
819
|
-
function
|
|
820
|
-
e.write(
|
|
824
|
+
function Xt(e, t) {
|
|
825
|
+
e.write(Kt, JSON.stringify(t));
|
|
821
826
|
}
|
|
822
827
|
//#endregion
|
|
823
828
|
//#region src/structure/engine/runner.ts
|
|
824
|
-
var
|
|
829
|
+
var Zt = class extends Error {
|
|
825
830
|
constructor(e) {
|
|
826
831
|
super(`Post-run recheck: rule set not idempotent. Failing item: ${e.primitive} '${e.path}' (scope=${e.scope}, action=${e.action}). Engine bug.`), this.failing = e, this.name = "RecheckError";
|
|
827
832
|
}
|
|
828
833
|
};
|
|
829
|
-
function
|
|
834
|
+
function Qt(e, t, n, r) {
|
|
830
835
|
switch (e.kind) {
|
|
831
836
|
case "text": return e.value;
|
|
832
837
|
case "file":
|
|
@@ -845,15 +850,15 @@ function Zt(e, t, n, r) {
|
|
|
845
850
|
case "binary": throw Error(`binary('${e.path}') cannot be resolved to a string; it is only valid inside seed()/scaffold(), which copy it verbatim via fs.writeBinary.`);
|
|
846
851
|
}
|
|
847
852
|
}
|
|
848
|
-
function
|
|
853
|
+
function $t(e, t, n, r, i) {
|
|
849
854
|
if (n.kind === "binary") {
|
|
850
855
|
if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
851
856
|
e.writeBinary(t, r.staticReadBinary(n.path));
|
|
852
857
|
return;
|
|
853
858
|
}
|
|
854
|
-
e.write(t,
|
|
859
|
+
e.write(t, Qt(n, t, r, i));
|
|
855
860
|
}
|
|
856
|
-
function
|
|
861
|
+
function en(e, t, n, r, i, a) {
|
|
857
862
|
let o = e.split("/").pop() ?? e;
|
|
858
863
|
if (e.endsWith(".json")) {
|
|
859
864
|
let i = Qe(t);
|
|
@@ -861,12 +866,12 @@ function $t(e, t, n, r, i, a) {
|
|
|
861
866
|
return St(i, n, { triggerContext: r }), it(i, { collapse: o !== "package.json" });
|
|
862
867
|
}
|
|
863
868
|
if (e.endsWith(".yaml") || e.endsWith(".yml")) {
|
|
864
|
-
let e =
|
|
869
|
+
let e = Wt(t);
|
|
865
870
|
return Ct(e, n, {
|
|
866
871
|
triggerContext: r,
|
|
867
872
|
getLatestVersion: i,
|
|
868
873
|
getDerivedDependencyPin: a
|
|
869
|
-
}),
|
|
874
|
+
}), Gt(e);
|
|
870
875
|
}
|
|
871
876
|
if (o === ".gitignore" || o.endsWith(".gitignore")) {
|
|
872
877
|
let e = dt(t);
|
|
@@ -874,7 +879,7 @@ function $t(e, t, n, r, i, a) {
|
|
|
874
879
|
}
|
|
875
880
|
throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
|
|
876
881
|
}
|
|
877
|
-
function
|
|
882
|
+
function tn(e) {
|
|
878
883
|
let t = e.list(""), n = /* @__PURE__ */ new Set();
|
|
879
884
|
for (let e of t) {
|
|
880
885
|
n.add(e);
|
|
@@ -883,16 +888,16 @@ function en(e) {
|
|
|
883
888
|
}
|
|
884
889
|
return n;
|
|
885
890
|
}
|
|
886
|
-
function
|
|
891
|
+
function nn(e, t) {
|
|
887
892
|
let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
|
|
888
893
|
return e.has(n);
|
|
889
894
|
}
|
|
890
|
-
function
|
|
895
|
+
function rn(e, t, n) {
|
|
891
896
|
return {
|
|
892
897
|
ctx: t,
|
|
893
898
|
version: t.version,
|
|
894
|
-
pathExists: (t) =>
|
|
895
|
-
pathMissing: (t) => !
|
|
899
|
+
pathExists: (t) => nn(e, t),
|
|
900
|
+
pathMissing: (t) => !nn(e, t),
|
|
896
901
|
filesMatch: (t) => {
|
|
897
902
|
let r = n ? `${n}/${t}` : t;
|
|
898
903
|
for (let t of e) if (Le(r, t)) return !0;
|
|
@@ -900,20 +905,20 @@ function nn(e, t, n) {
|
|
|
900
905
|
}
|
|
901
906
|
};
|
|
902
907
|
}
|
|
903
|
-
function
|
|
908
|
+
function an(e, t) {
|
|
904
909
|
for (let n of e.triggers) if (!n(t)) return !1;
|
|
905
910
|
return !0;
|
|
906
911
|
}
|
|
907
|
-
function
|
|
912
|
+
function on(e, t) {
|
|
908
913
|
return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
|
|
909
914
|
}
|
|
910
|
-
function
|
|
915
|
+
function sn(e, t) {
|
|
911
916
|
return e.filter((e) => e.modes.includes(t));
|
|
912
917
|
}
|
|
913
|
-
function
|
|
918
|
+
function cn(e, t, n, r, i, a) {
|
|
914
919
|
let o = e.leaf;
|
|
915
920
|
if (o.kind === "fixed") {
|
|
916
|
-
let i =
|
|
921
|
+
let i = Qt(o.content, e.resolvedPath, r, a);
|
|
917
922
|
return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
|
|
918
923
|
scope: e.scope,
|
|
919
924
|
path: e.resolvedPath,
|
|
@@ -926,13 +931,13 @@ function sn(e, t, n, r, i, a) {
|
|
|
926
931
|
action: "create"
|
|
927
932
|
});
|
|
928
933
|
}
|
|
929
|
-
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
934
|
+
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || $t(t, e.resolvedPath, o.initial, r, a), {
|
|
930
935
|
scope: e.scope,
|
|
931
936
|
path: e.resolvedPath,
|
|
932
937
|
primitive: "scaffold",
|
|
933
938
|
action: "create"
|
|
934
939
|
});
|
|
935
|
-
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
940
|
+
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || $t(t, e.resolvedPath, o.initial, r, a), {
|
|
936
941
|
scope: e.scope,
|
|
937
942
|
path: e.resolvedPath,
|
|
938
943
|
primitive: "seed",
|
|
@@ -955,11 +960,11 @@ function sn(e, t, n, r, i, a) {
|
|
|
955
960
|
});
|
|
956
961
|
}
|
|
957
962
|
}
|
|
958
|
-
function
|
|
963
|
+
function ln(e, t, n, r, i, a, o, s) {
|
|
959
964
|
if (e.leaf.kind !== "managed") return;
|
|
960
965
|
let c = e.leaf, l = e.resolvedPath, u = t.exists(l), d, f = !1;
|
|
961
|
-
u ? d = t.read(l) : (d =
|
|
962
|
-
let p =
|
|
966
|
+
u ? d = t.read(l) : (d = Qt(c.initial, l, i, s), f = !0);
|
|
967
|
+
let p = en(l, d, c.body, r, a, o);
|
|
963
968
|
if (f) return n || t.write(l, p), {
|
|
964
969
|
scope: e.scope,
|
|
965
970
|
path: l,
|
|
@@ -973,40 +978,40 @@ function cn(e, t, n, r, i, a, o, s) {
|
|
|
973
978
|
action: "update"
|
|
974
979
|
};
|
|
975
980
|
}
|
|
976
|
-
function
|
|
977
|
-
let c =
|
|
981
|
+
function un(e, t, n, r, i, a, o, s) {
|
|
982
|
+
let c = sn(e, on(n, a)), l = [], u = tn(t);
|
|
978
983
|
for (let e of c) {
|
|
979
|
-
if (e.leaf.kind === "managed" || !
|
|
980
|
-
let o =
|
|
984
|
+
if (e.leaf.kind === "managed" || !an(e, rn(u, n, e.modulePath))) continue;
|
|
985
|
+
let o = cn(e, t, r, i, a, n);
|
|
981
986
|
o && l.push(o);
|
|
982
987
|
}
|
|
983
|
-
let d =
|
|
988
|
+
let d = tn(t);
|
|
984
989
|
for (let e of c) {
|
|
985
990
|
if (e.leaf.kind !== "managed") continue;
|
|
986
|
-
let a =
|
|
987
|
-
if (!
|
|
988
|
-
let c =
|
|
991
|
+
let a = rn(d, n, e.modulePath);
|
|
992
|
+
if (!an(e, a)) continue;
|
|
993
|
+
let c = ln(e, t, r, a, i, o, s, n);
|
|
989
994
|
c && l.push(c);
|
|
990
995
|
}
|
|
991
996
|
return l;
|
|
992
997
|
}
|
|
993
|
-
function
|
|
998
|
+
function dn(e, t, n, r = {}) {
|
|
994
999
|
return Be(n, () => {
|
|
995
|
-
let i = Me(e, n), a = !!r.initMode, o =
|
|
1000
|
+
let i = Me(e, n), a = !!r.initMode, o = un(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
|
|
996
1001
|
if (!n.dryRun && !n.updateDepsOnly && !a) {
|
|
997
|
-
|
|
1002
|
+
Xt(t, { version: 2 });
|
|
998
1003
|
let i = {
|
|
999
1004
|
...r.rediscover ? r.rediscover(t) : n,
|
|
1000
1005
|
dryRun: !0
|
|
1001
|
-
}, a =
|
|
1002
|
-
if (a.length > 0) throw new
|
|
1006
|
+
}, a = un(Me(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Kt);
|
|
1007
|
+
if (a.length > 0) throw new Zt(a[0]);
|
|
1003
1008
|
}
|
|
1004
|
-
return a && !n.dryRun &&
|
|
1009
|
+
return a && !n.dryRun && Xt(t, { version: 2 }), { changes: o };
|
|
1005
1010
|
});
|
|
1006
1011
|
}
|
|
1007
1012
|
//#endregion
|
|
1008
1013
|
//#region src/structure/engine/discovery.ts
|
|
1009
|
-
var
|
|
1014
|
+
var fn = [
|
|
1010
1015
|
"root",
|
|
1011
1016
|
"block",
|
|
1012
1017
|
"model",
|
|
@@ -1014,12 +1019,12 @@ var dn = [
|
|
|
1014
1019
|
"workflow",
|
|
1015
1020
|
"test",
|
|
1016
1021
|
"software"
|
|
1017
|
-
],
|
|
1022
|
+
], pn = class extends Error {
|
|
1018
1023
|
constructor(e, t) {
|
|
1019
1024
|
super(e), this.path = t, this.name = "DiscoveryError";
|
|
1020
1025
|
}
|
|
1021
1026
|
};
|
|
1022
|
-
function
|
|
1027
|
+
function mn(e) {
|
|
1023
1028
|
let t = /* @__PURE__ */ new Set();
|
|
1024
1029
|
for (let n of [
|
|
1025
1030
|
e.dependencies,
|
|
@@ -1029,18 +1034,18 @@ function pn(e) {
|
|
|
1029
1034
|
]) if (n) for (let e of Object.keys(n)) t.add(e);
|
|
1030
1035
|
return t;
|
|
1031
1036
|
}
|
|
1032
|
-
function
|
|
1037
|
+
function hn(e) {
|
|
1033
1038
|
return e === "" || e === ".";
|
|
1034
1039
|
}
|
|
1035
|
-
function
|
|
1040
|
+
function gn(e) {
|
|
1036
1041
|
let t = e.pkg["block-scope"];
|
|
1037
1042
|
if (typeof t == "string") {
|
|
1038
|
-
if (!
|
|
1043
|
+
if (!fn.includes(t)) throw new pn(`package.json "block-scope" must be one of ${fn.join(", ")}, got '${t}'`, e.path);
|
|
1039
1044
|
return t;
|
|
1040
1045
|
}
|
|
1041
|
-
if (
|
|
1046
|
+
if (hn(e.path)) return "root";
|
|
1042
1047
|
if (e.pkg.block !== void 0) return "block";
|
|
1043
|
-
let n =
|
|
1048
|
+
let n = mn(e.pkg);
|
|
1044
1049
|
if (e.pkg["block-software"] !== void 0) return "software";
|
|
1045
1050
|
if (n.has("@platforma-sdk/package-builder")) {
|
|
1046
1051
|
for (let e of n) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
|
|
@@ -1050,15 +1055,15 @@ function hn(e) {
|
|
|
1050
1055
|
if (n.has("@platforma-sdk/model") && e.pkg.main) return "model";
|
|
1051
1056
|
if (n.has("@platforma-sdk/test")) return "test";
|
|
1052
1057
|
}
|
|
1053
|
-
function
|
|
1058
|
+
function _n(e) {
|
|
1054
1059
|
let t = [];
|
|
1055
1060
|
for (let n of e) {
|
|
1056
|
-
let e =
|
|
1057
|
-
if (!e) throw new
|
|
1061
|
+
let e = gn(n);
|
|
1062
|
+
if (!e) throw new pn(`Unclassified workspace package at '${n.path}'. Add a top-level "block-scope" string to its package.json.`, n.path);
|
|
1058
1063
|
t.push({
|
|
1059
1064
|
scope: e,
|
|
1060
1065
|
name: n.pkg.name ?? n.path,
|
|
1061
|
-
path:
|
|
1066
|
+
path: hn(n.path) ? "" : n.path
|
|
1062
1067
|
});
|
|
1063
1068
|
}
|
|
1064
1069
|
return t;
|
|
@@ -1068,21 +1073,21 @@ function gn(e) {
|
|
|
1068
1073
|
function J(e, t) {
|
|
1069
1074
|
return e.modules.filter((e) => e.scope === t);
|
|
1070
1075
|
}
|
|
1071
|
-
function
|
|
1076
|
+
function vn(e, t) {
|
|
1072
1077
|
let n = J(e, t);
|
|
1073
1078
|
if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
|
|
1074
1079
|
if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
|
|
1075
1080
|
return n[0];
|
|
1076
1081
|
}
|
|
1077
|
-
function vn(e, t) {
|
|
1078
|
-
return { [_n(e, t).name]: "workspace:*" };
|
|
1079
|
-
}
|
|
1080
1082
|
function yn(e, t) {
|
|
1083
|
+
return { [vn(e, t).name]: "workspace:*" };
|
|
1084
|
+
}
|
|
1085
|
+
function bn(e, t) {
|
|
1081
1086
|
let n = {};
|
|
1082
1087
|
for (let r of J(e, t)) n[r.name] = "workspace:*";
|
|
1083
1088
|
return n;
|
|
1084
1089
|
}
|
|
1085
|
-
function
|
|
1090
|
+
function xn(e) {
|
|
1086
1091
|
let t = e.facadeName, n = [
|
|
1087
1092
|
{
|
|
1088
1093
|
scope: "root",
|
|
@@ -1121,7 +1126,7 @@ function bn(e) {
|
|
|
1121
1126
|
path: "software"
|
|
1122
1127
|
}), n;
|
|
1123
1128
|
}
|
|
1124
|
-
function
|
|
1129
|
+
function Sn(e) {
|
|
1125
1130
|
return {
|
|
1126
1131
|
isSdkInternal: e.isSdkInternal ?? !1,
|
|
1127
1132
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
@@ -1138,22 +1143,22 @@ var Y = class extends Error {
|
|
|
1138
1143
|
super(e), this.name = "StructureCliError";
|
|
1139
1144
|
}
|
|
1140
1145
|
};
|
|
1141
|
-
function
|
|
1146
|
+
function Cn(e, t) {
|
|
1142
1147
|
return e === "" ? t : `${e}/${t}`;
|
|
1143
1148
|
}
|
|
1144
|
-
function
|
|
1149
|
+
function wn(e, t) {
|
|
1145
1150
|
try {
|
|
1146
1151
|
return JSON.parse(e.read(t));
|
|
1147
1152
|
} catch {
|
|
1148
1153
|
return;
|
|
1149
1154
|
}
|
|
1150
1155
|
}
|
|
1151
|
-
function
|
|
1156
|
+
function Tn(e) {
|
|
1152
1157
|
if (e.includes("*")) throw new Y(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
|
|
1153
1158
|
let t = e.replace(/^\.\//, "").replace(/\/$/, "");
|
|
1154
1159
|
return t === "." ? "" : t;
|
|
1155
1160
|
}
|
|
1156
|
-
function
|
|
1161
|
+
function En(e) {
|
|
1157
1162
|
let t;
|
|
1158
1163
|
try {
|
|
1159
1164
|
t = e.read("pnpm-workspace.yaml");
|
|
@@ -1162,12 +1167,12 @@ function Tn(e) {
|
|
|
1162
1167
|
}
|
|
1163
1168
|
let n = ae(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
|
|
1164
1169
|
for (let t of r) {
|
|
1165
|
-
let n =
|
|
1170
|
+
let n = Tn(t);
|
|
1166
1171
|
(n === "" || e.exists(n)) && i.add(n);
|
|
1167
1172
|
}
|
|
1168
1173
|
let a = [];
|
|
1169
1174
|
for (let t of i) {
|
|
1170
|
-
let n =
|
|
1175
|
+
let n = wn(e, Cn(t, "package.json"));
|
|
1171
1176
|
n && a.push({
|
|
1172
1177
|
path: t,
|
|
1173
1178
|
pkg: n
|
|
@@ -1175,7 +1180,7 @@ function Tn(e) {
|
|
|
1175
1180
|
}
|
|
1176
1181
|
return a;
|
|
1177
1182
|
}
|
|
1178
|
-
function
|
|
1183
|
+
function Dn(e) {
|
|
1179
1184
|
let t = [], n = new Set([
|
|
1180
1185
|
"node_modules",
|
|
1181
1186
|
".turbo",
|
|
@@ -1187,7 +1192,7 @@ function En(e) {
|
|
|
1187
1192
|
let o = e.listDir(i);
|
|
1188
1193
|
for (let s of o) {
|
|
1189
1194
|
if (!s.isDirectory || n.has(s.name)) continue;
|
|
1190
|
-
let o =
|
|
1195
|
+
let o = Cn(i, s.name), c = wn(e, Cn(o, "package.json"));
|
|
1191
1196
|
c && t.push({
|
|
1192
1197
|
path: o,
|
|
1193
1198
|
pkg: c
|
|
@@ -1196,7 +1201,7 @@ function En(e) {
|
|
|
1196
1201
|
}
|
|
1197
1202
|
return r("", 1), t;
|
|
1198
1203
|
}
|
|
1199
|
-
function
|
|
1204
|
+
function On(e) {
|
|
1200
1205
|
let t = e.indexOf("/");
|
|
1201
1206
|
if (!e.startsWith("@") || t < 0) throw new Y(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
|
|
1202
1207
|
let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
|
|
@@ -1209,15 +1214,15 @@ function Dn(e) {
|
|
|
1209
1214
|
shortName: r.slice(i + 1)
|
|
1210
1215
|
};
|
|
1211
1216
|
}
|
|
1212
|
-
function
|
|
1213
|
-
let { fs: t, isSdkInternal: n } = e, r = n ?
|
|
1217
|
+
function kn(e) {
|
|
1218
|
+
let { fs: t, isSdkInternal: n } = e, r = n ? Dn(t) : En(t);
|
|
1214
1219
|
if (r.length === 0) throw new Y("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
|
|
1215
|
-
let i =
|
|
1216
|
-
|
|
1220
|
+
let i = _n(r), a = qt(t);
|
|
1221
|
+
Jt(a.version, 0);
|
|
1217
1222
|
let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
|
|
1218
1223
|
if (!o) throw new Y("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
|
|
1219
|
-
let s =
|
|
1220
|
-
return
|
|
1224
|
+
let s = On(o.name.replace(/\.block$/, ""));
|
|
1225
|
+
return Sn({
|
|
1221
1226
|
isSdkInternal: n,
|
|
1222
1227
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
1223
1228
|
modules: i,
|
|
@@ -1249,25 +1254,25 @@ var X = [
|
|
|
1249
1254
|
"pnpm",
|
|
1250
1255
|
"block",
|
|
1251
1256
|
"block-software"
|
|
1252
|
-
],
|
|
1257
|
+
], An = {
|
|
1253
1258
|
"build:dev-local": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=local turbo run build",
|
|
1254
1259
|
"build:dev-remote": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build",
|
|
1255
1260
|
"build:dev-no-software": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=none turbo run build",
|
|
1256
1261
|
"build:dev-binary-existing": "env PL_BUILD_CHANNEL=dev PL_BUILD_USE_PUBLISHED=true turbo run build",
|
|
1257
1262
|
"build:release": "env PL_BUILD_CHANNEL=release PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build"
|
|
1258
|
-
},
|
|
1263
|
+
}, jn = {
|
|
1259
1264
|
test: "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --concurrency 1",
|
|
1260
1265
|
"test:dry-run": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --dry-run=json"
|
|
1261
1266
|
};
|
|
1262
|
-
function
|
|
1267
|
+
function Mn() {
|
|
1263
1268
|
return {
|
|
1264
1269
|
version: "1.0.0",
|
|
1265
1270
|
private: !0,
|
|
1266
1271
|
scripts: {
|
|
1267
1272
|
fmt: "turbo run fmt",
|
|
1268
1273
|
check: "turbo run check",
|
|
1269
|
-
...kn,
|
|
1270
1274
|
...An,
|
|
1275
|
+
...jn,
|
|
1271
1276
|
"mark-stable": "turbo run mark-stable",
|
|
1272
1277
|
"do-pack": "turbo run do-pack",
|
|
1273
1278
|
watch: "turbo watch build",
|
|
@@ -1290,91 +1295,156 @@ function jn() {
|
|
|
1290
1295
|
packageManager: "pnpm@9.12.0"
|
|
1291
1296
|
};
|
|
1292
1297
|
}
|
|
1293
|
-
function
|
|
1298
|
+
function Nn() {
|
|
1294
1299
|
R("packageManager", "pnpm@9.12.0"), z("name"), B("fmt", "turbo run fmt"), B("check", "turbo run check");
|
|
1295
|
-
for (let [e, t] of Object.entries(kn)) B(e, t);
|
|
1296
1300
|
for (let [e, t] of Object.entries(An)) B(e, t);
|
|
1297
|
-
|
|
1301
|
+
for (let [e, t] of Object.entries(jn)) B(e, t);
|
|
1302
|
+
V("build"), V("build:dev"), B("mark-stable", "turbo run mark-stable"), B("do-pack", "turbo run do-pack"), B("watch", "turbo watch build"), B("changeset", "changeset"), B("version-packages", "changeset version"), B("update-sdk", "block-tools structure refresh --update-deps-only"), V("update"), B("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), W({
|
|
1298
1303
|
"@changesets/cli": "catalog:",
|
|
1299
1304
|
"@milaboratories/ts-builder": "sdk:",
|
|
1300
1305
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1301
1306
|
shx: "catalog:",
|
|
1302
1307
|
turbo: "catalog:"
|
|
1303
|
-
}),
|
|
1308
|
+
}), G({
|
|
1304
1309
|
oxlint: "*",
|
|
1305
1310
|
oxfmt: "*"
|
|
1306
|
-
}),
|
|
1311
|
+
}), Pt((e, t) => {
|
|
1307
1312
|
if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
|
|
1308
1313
|
let n = t;
|
|
1309
1314
|
return n.pnpm !== void 0 || n.overrides !== void 0;
|
|
1310
1315
|
}), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
|
|
1311
1316
|
}
|
|
1312
1317
|
//#endregion
|
|
1318
|
+
//#region src/structure/rules/root-turbo-json.ts
|
|
1319
|
+
var Pn = "https://turbo.build/schema.json", Fn = ["tsconfig.json"], In = {
|
|
1320
|
+
fmt: { cache: !1 },
|
|
1321
|
+
check: {
|
|
1322
|
+
dependsOn: ["^build"],
|
|
1323
|
+
outputs: []
|
|
1324
|
+
},
|
|
1325
|
+
build: {
|
|
1326
|
+
dependsOn: ["^build", "check"],
|
|
1327
|
+
inputs: ["$TURBO_DEFAULT$"],
|
|
1328
|
+
env: [
|
|
1329
|
+
"PL_DOCKER_REGISTRY_PUSH_TO",
|
|
1330
|
+
"PL_BUILD_CHANNEL",
|
|
1331
|
+
"PL_BUILD_VARIANT",
|
|
1332
|
+
"PL_BUILD_LOCATION",
|
|
1333
|
+
"PL_BUILD_USE_PUBLISHED",
|
|
1334
|
+
"PL_DEV_DOCKER_PUSH_URL",
|
|
1335
|
+
"PL_DEV_DOCKER_PULL_URL",
|
|
1336
|
+
"PL_DEV_BINARY_UPLOAD_URL",
|
|
1337
|
+
"PL_RELEASE_DOCKER_PUSH_URL",
|
|
1338
|
+
"PL_RELEASE_DOCKER_PULL_URL",
|
|
1339
|
+
"PL_RELEASE_BINARY_UPLOAD_URL",
|
|
1340
|
+
"PL_REGISTRY_PLATFORMA_OPEN_UPLOAD_URL"
|
|
1341
|
+
],
|
|
1342
|
+
passThroughEnv: ["AWS_*", "PL_AWS_*"],
|
|
1343
|
+
outputs: [
|
|
1344
|
+
"./dist/**",
|
|
1345
|
+
"./block-pack/**",
|
|
1346
|
+
"./pkg-*.tgz"
|
|
1347
|
+
]
|
|
1348
|
+
},
|
|
1349
|
+
"do-pack": {
|
|
1350
|
+
dependsOn: ["build"],
|
|
1351
|
+
outputs: ["package.tgz"]
|
|
1352
|
+
},
|
|
1353
|
+
test: {
|
|
1354
|
+
dependsOn: ["build", "check"],
|
|
1355
|
+
passThroughEnv: [
|
|
1356
|
+
"PL_ADDRESS",
|
|
1357
|
+
"PL_TEST_PASSWORD",
|
|
1358
|
+
"PL_TEST_USER",
|
|
1359
|
+
"PL_TEST_PROXY",
|
|
1360
|
+
"DEBUG"
|
|
1361
|
+
]
|
|
1362
|
+
},
|
|
1363
|
+
"mark-stable": {
|
|
1364
|
+
passThroughEnv: ["PL_REGISTRY", "AWS_*"],
|
|
1365
|
+
cache: !1
|
|
1366
|
+
}
|
|
1367
|
+
};
|
|
1368
|
+
function Ln() {
|
|
1369
|
+
return {
|
|
1370
|
+
$schema: Pn,
|
|
1371
|
+
globalDependencies: Fn,
|
|
1372
|
+
tasks: { ...In }
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
function Rn() {
|
|
1376
|
+
R("$schema", Pn), R("globalDependencies", Fn), Et("tasks", In), z("tasks.build:dev"), K([
|
|
1377
|
+
"$schema",
|
|
1378
|
+
"globalDependencies",
|
|
1379
|
+
"tasks"
|
|
1380
|
+
]);
|
|
1381
|
+
}
|
|
1382
|
+
//#endregion
|
|
1313
1383
|
//#region src/structure/engine/registry-client.ts
|
|
1314
|
-
var
|
|
1315
|
-
function
|
|
1384
|
+
var zn = 2, Bn = 500, Vn = 3e4;
|
|
1385
|
+
function Hn(e) {
|
|
1316
1386
|
if (!e) return null;
|
|
1317
1387
|
let t = Number(e);
|
|
1318
1388
|
if (Number.isFinite(t) && t > 0) return t * 1e3;
|
|
1319
1389
|
let n = Date.parse(e);
|
|
1320
1390
|
return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
|
|
1321
1391
|
}
|
|
1322
|
-
async function
|
|
1392
|
+
async function Un(e) {
|
|
1323
1393
|
for (let t = 1;; t++) {
|
|
1324
1394
|
let n;
|
|
1325
1395
|
try {
|
|
1326
|
-
n = await fetch(e, { signal: AbortSignal.timeout(
|
|
1396
|
+
n = await fetch(e, { signal: AbortSignal.timeout(Vn) });
|
|
1327
1397
|
} catch (e) {
|
|
1328
|
-
if (t >
|
|
1329
|
-
await ce(
|
|
1398
|
+
if (t > zn) throw e;
|
|
1399
|
+
await ce(Bn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1330
1400
|
continue;
|
|
1331
1401
|
}
|
|
1332
1402
|
if (n.ok) return n;
|
|
1333
|
-
if (!(n.status === 429 || n.status >= 500) || t >
|
|
1334
|
-
let r =
|
|
1403
|
+
if (!(n.status === 429 || n.status >= 500) || t > zn) throw Error(`registry returned HTTP ${n.status}`);
|
|
1404
|
+
let r = Hn(n.headers.get("retry-after"));
|
|
1335
1405
|
if (r != null) {
|
|
1336
1406
|
await ce(r);
|
|
1337
1407
|
continue;
|
|
1338
1408
|
}
|
|
1339
|
-
await ce(
|
|
1409
|
+
await ce(Bn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1340
1410
|
}
|
|
1341
1411
|
}
|
|
1342
|
-
function
|
|
1412
|
+
function Wn() {
|
|
1343
1413
|
return {
|
|
1344
1414
|
async getLatestVersion(e) {
|
|
1345
|
-
let t = (await (await
|
|
1415
|
+
let t = (await (await Un(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
|
|
1346
1416
|
if (!t) throw Error("no 'latest' dist-tag in registry response");
|
|
1347
1417
|
return t;
|
|
1348
1418
|
},
|
|
1349
1419
|
async getDeclaredDependency(e, t, n) {
|
|
1350
|
-
let r = await (await
|
|
1420
|
+
let r = await (await Un(`https://registry.npmjs.org/${e}/${t}`)).json();
|
|
1351
1421
|
return r.dependencies?.[n] ?? r.peerDependencies?.[n];
|
|
1352
1422
|
}
|
|
1353
1423
|
};
|
|
1354
1424
|
}
|
|
1355
|
-
async function
|
|
1425
|
+
async function Gn(e, t) {
|
|
1356
1426
|
let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
|
|
1357
1427
|
return new Map(n);
|
|
1358
1428
|
}
|
|
1359
|
-
function
|
|
1429
|
+
function Kn(e) {
|
|
1360
1430
|
return (t) => e.get(t);
|
|
1361
1431
|
}
|
|
1362
|
-
var
|
|
1363
|
-
function
|
|
1364
|
-
return
|
|
1432
|
+
var qn = [/^@platforma-sdk\//, /^@milaboratories\//];
|
|
1433
|
+
function Jn(e) {
|
|
1434
|
+
return qn.some((t) => t.test(e));
|
|
1365
1435
|
}
|
|
1366
|
-
async function
|
|
1367
|
-
return e.length === 0 ? () => void 0 :
|
|
1436
|
+
async function Yn(e, t = Wn()) {
|
|
1437
|
+
return e.length === 0 ? () => void 0 : Kn(await Gn(t, e));
|
|
1368
1438
|
}
|
|
1369
|
-
function
|
|
1439
|
+
function Xn(e) {
|
|
1370
1440
|
return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
|
|
1371
1441
|
}
|
|
1372
|
-
async function
|
|
1442
|
+
async function Zn(e, t = Wn()) {
|
|
1373
1443
|
if (e.length === 0) return () => void 0;
|
|
1374
1444
|
let n = await Promise.all(e.map(async (e) => {
|
|
1375
1445
|
let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
|
|
1376
1446
|
if (n === void 0) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares no dependency '${e.entry}'. A derived pin requires the source to declare the dep as an exact version.`);
|
|
1377
|
-
if (!
|
|
1447
|
+
if (!Xn(n)) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares '${e.entry}: ${n}', which is not an exact version. A derived pin requires an exact ('x.y.z') source dependency so the catalog can pin to it precisely.`);
|
|
1378
1448
|
return [e.entry, n];
|
|
1379
1449
|
})), r = new Map(n);
|
|
1380
1450
|
return (e) => r.get(e);
|
|
@@ -1382,7 +1452,7 @@ async function Gn(e, t = Rn()) {
|
|
|
1382
1452
|
//#endregion
|
|
1383
1453
|
//#region src/structure/rules/shared/retired-deps.ts
|
|
1384
1454
|
// @vitejs/plugin-vue — bundled by ts-builder's internal vite config.
|
|
1385
|
-
var
|
|
1455
|
+
var Qn = [
|
|
1386
1456
|
"vite",
|
|
1387
1457
|
"tsup",
|
|
1388
1458
|
"vue-tsc",
|
|
@@ -1390,8 +1460,8 @@ var Kn = [
|
|
|
1390
1460
|
"vite-plugin-dts",
|
|
1391
1461
|
"@platforma-sdk/eslint-config"
|
|
1392
1462
|
];
|
|
1393
|
-
function
|
|
1394
|
-
for (let e of
|
|
1463
|
+
function $n() {
|
|
1464
|
+
for (let e of Qn) U(e);
|
|
1395
1465
|
}
|
|
1396
1466
|
//#endregion
|
|
1397
1467
|
//#region src/structure/rules/root-pnpm-workspace.ts
|
|
@@ -1405,35 +1475,35 @@ var Z = [
|
|
|
1405
1475
|
"@platforma-sdk/package-builder",
|
|
1406
1476
|
"@milaboratories/ts-builder",
|
|
1407
1477
|
"@milaboratories/ts-configs"
|
|
1408
|
-
],
|
|
1409
|
-
for (let e of Z) if (!
|
|
1410
|
-
var
|
|
1478
|
+
], er = "0.0.0-init-must-fetch";
|
|
1479
|
+
for (let e of Z) if (!Jn(e)) throw Error(`SDK_CATALOG_PACKAGES entry '${e}' matches no catalog bump pattern; its placeholder would never be resolved to npm latest on init. Add it to CATALOG_BUMP_PATTERNS or move it to the infra floor.`);
|
|
1480
|
+
var tr = {
|
|
1411
1481
|
turbo: "~2.8.11",
|
|
1412
1482
|
shx: "~0.4.0",
|
|
1413
1483
|
"@changesets/cli": "~2.29.8",
|
|
1414
1484
|
vitest: "~4.0.18"
|
|
1415
|
-
},
|
|
1485
|
+
}, nr = [{
|
|
1416
1486
|
entry: "vue",
|
|
1417
1487
|
of: "@platforma-sdk/ui-vue"
|
|
1418
1488
|
}, {
|
|
1419
1489
|
entry: "@milaboratories/helpers",
|
|
1420
1490
|
of: "@platforma-sdk/model"
|
|
1421
|
-
}],
|
|
1422
|
-
function
|
|
1491
|
+
}], rr = "@platforma-open/milaboratories.runenv-python-3", ir = "1.8.2";
|
|
1492
|
+
function ar(e) {
|
|
1423
1493
|
let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
|
|
1424
|
-
for (let e of Z) n[e] =
|
|
1425
|
-
return Object.assign(n,
|
|
1494
|
+
for (let e of Z) n[e] = er;
|
|
1495
|
+
return Object.assign(n, tr), e.modules.some((e) => e.scope === "software") && (n[rr] = ir), {
|
|
1426
1496
|
packages: t,
|
|
1427
1497
|
catalog: n
|
|
1428
1498
|
};
|
|
1429
1499
|
}
|
|
1430
|
-
function
|
|
1431
|
-
|
|
1432
|
-
for (let e of
|
|
1500
|
+
function or() {
|
|
1501
|
+
Lt();
|
|
1502
|
+
for (let e of Qn) Ht(e);
|
|
1433
1503
|
}
|
|
1434
1504
|
//#endregion
|
|
1435
1505
|
//#region src/structure/rules/root-gitignore.ts
|
|
1436
|
-
var
|
|
1506
|
+
var sr = [
|
|
1437
1507
|
".test_auth.json",
|
|
1438
1508
|
"node_modules/",
|
|
1439
1509
|
"dist/",
|
|
@@ -1448,45 +1518,47 @@ var tr = [
|
|
|
1448
1518
|
".vscode/sftp.json",
|
|
1449
1519
|
"test-dry-run.json"
|
|
1450
1520
|
];
|
|
1451
|
-
function
|
|
1452
|
-
|
|
1521
|
+
function cr() {
|
|
1522
|
+
Ut(sr);
|
|
1453
1523
|
}
|
|
1454
1524
|
//#endregion
|
|
1455
1525
|
//#region src/structure/rules/root.ts
|
|
1456
|
-
function
|
|
1526
|
+
function lr() {
|
|
1457
1527
|
S("root", () => {
|
|
1458
1528
|
C(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
}), E("
|
|
1462
|
-
|
|
1529
|
+
E("turbo.json", M(() => Ln()), () => {
|
|
1530
|
+
Rn();
|
|
1531
|
+
}), T(".vscode/settings.json", A("root/.vscode/settings.json")), E("package.json", M(() => Mn()), () => {
|
|
1532
|
+
Nn();
|
|
1533
|
+
}), E("pnpm-workspace.yaml", M((e) => ar(e)), () => {
|
|
1534
|
+
or();
|
|
1463
1535
|
}), E(".gitignore", A("root/.gitignore"), () => {
|
|
1464
|
-
|
|
1536
|
+
cr();
|
|
1465
1537
|
});
|
|
1466
1538
|
});
|
|
1467
1539
|
});
|
|
1468
1540
|
}
|
|
1469
1541
|
//#endregion
|
|
1470
1542
|
//#region src/structure/rules/root-ci.ts
|
|
1471
|
-
function
|
|
1543
|
+
function ur(e) {
|
|
1472
1544
|
return e.split(/[-_]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
1473
1545
|
}
|
|
1474
|
-
function
|
|
1546
|
+
function dr() {
|
|
1475
1547
|
S("root", () => {
|
|
1476
1548
|
C(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1477
1549
|
T(".github/workflows/build.yaml", j("workflows/build.tpl.yaml", (e) => {
|
|
1478
1550
|
let t = e.blockVars.shortName;
|
|
1479
1551
|
return {
|
|
1480
|
-
appName: `Block: ${
|
|
1552
|
+
appName: `Block: ${ur(t)}`,
|
|
1481
1553
|
appNameSlug: `block-${t}`
|
|
1482
1554
|
};
|
|
1483
|
-
})), T(".github/workflows/mark-stable.yaml", j("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${
|
|
1555
|
+
})), T(".github/workflows/mark-stable.yaml", j("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${ur(e.blockVars.shortName)} - Mark Stable` })));
|
|
1484
1556
|
});
|
|
1485
1557
|
});
|
|
1486
1558
|
}
|
|
1487
1559
|
//#endregion
|
|
1488
1560
|
//#region src/structure/rules/block-package-json.ts
|
|
1489
|
-
var
|
|
1561
|
+
var fr = {
|
|
1490
1562
|
"@platforma-open": {
|
|
1491
1563
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1492
1564
|
serveUrl: "https://blocks.pl-open.science"
|
|
@@ -1495,45 +1567,45 @@ var or = {
|
|
|
1495
1567
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1496
1568
|
serveUrl: "https://block.registry.platforma.bio/releases"
|
|
1497
1569
|
}
|
|
1498
|
-
},
|
|
1570
|
+
}, pr = {
|
|
1499
1571
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1500
1572
|
serveUrl: "https://blocks.pl-open.science"
|
|
1501
|
-
},
|
|
1573
|
+
}, mr = {
|
|
1502
1574
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/aux/dev/?region=eu-central-1",
|
|
1503
1575
|
serveUrl: "https://aux-blocks.pl-open.science"
|
|
1504
1576
|
};
|
|
1505
|
-
function
|
|
1506
|
-
let n = t ?
|
|
1577
|
+
function hr(e, t) {
|
|
1578
|
+
let n = t ? mr : fr[e] ?? pr;
|
|
1507
1579
|
return `block-tools publish -r ${n.s3} --registry-serve-url ${n.serveUrl}`;
|
|
1508
1580
|
}
|
|
1509
|
-
function
|
|
1581
|
+
function gr(e) {
|
|
1510
1582
|
let t = {};
|
|
1511
1583
|
for (let n of J(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
|
|
1512
1584
|
for (let n of J(e, "model")) t.model = `${n.name}/dist/model.json`;
|
|
1513
1585
|
for (let n of J(e, "ui")) t.ui = `${n.name}/dist`;
|
|
1514
1586
|
return t;
|
|
1515
1587
|
}
|
|
1516
|
-
function
|
|
1588
|
+
function _r(e, t) {
|
|
1517
1589
|
return {
|
|
1518
1590
|
build: "ts-builder build --target block-facade && block-tools pack",
|
|
1519
1591
|
check: "ts-builder type-check --target block-facade",
|
|
1520
|
-
prepublishOnly:
|
|
1592
|
+
prepublishOnly: hr(e, t),
|
|
1521
1593
|
"do-pack": "shx rm -f package.tgz && pnpm pack && shx mv *.tgz package.tgz"
|
|
1522
1594
|
};
|
|
1523
1595
|
}
|
|
1524
|
-
var
|
|
1596
|
+
var vr = {
|
|
1525
1597
|
"@milaboratories/ts-builder": "sdk:",
|
|
1526
1598
|
"@milaboratories/ts-configs": "sdk:",
|
|
1527
1599
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1528
1600
|
"@platforma-sdk/model": "sdk:",
|
|
1529
1601
|
shx: "catalog:",
|
|
1530
1602
|
typescript: "catalog:"
|
|
1531
|
-
},
|
|
1603
|
+
}, yr = { ".": {
|
|
1532
1604
|
sources: "./src/index.ts",
|
|
1533
1605
|
types: "./dist/index.d.ts",
|
|
1534
1606
|
default: "./dist/index.js"
|
|
1535
1607
|
} };
|
|
1536
|
-
function
|
|
1608
|
+
function br(e) {
|
|
1537
1609
|
if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
|
|
1538
1610
|
let t = e.meta, n = [
|
|
1539
1611
|
["block.meta.title", t.title],
|
|
@@ -1545,14 +1617,14 @@ function mr(e) {
|
|
|
1545
1617
|
];
|
|
1546
1618
|
for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
|
|
1547
1619
|
}
|
|
1548
|
-
function
|
|
1620
|
+
function xr(e) {
|
|
1549
1621
|
let t = e.blockVars, n = {
|
|
1550
|
-
...
|
|
1551
|
-
...
|
|
1552
|
-
...
|
|
1553
|
-
...
|
|
1622
|
+
...vr,
|
|
1623
|
+
...bn(e, "model"),
|
|
1624
|
+
...bn(e, "ui"),
|
|
1625
|
+
...bn(e, "workflow")
|
|
1554
1626
|
}, r = {
|
|
1555
|
-
components:
|
|
1627
|
+
components: gr(e),
|
|
1556
1628
|
meta: {
|
|
1557
1629
|
title: t.shortName,
|
|
1558
1630
|
description: `${t.shortName} block`,
|
|
@@ -1564,7 +1636,7 @@ function hr(e) {
|
|
|
1564
1636
|
}
|
|
1565
1637
|
}
|
|
1566
1638
|
};
|
|
1567
|
-
return
|
|
1639
|
+
return br(r), {
|
|
1568
1640
|
name: `${t.facadeName}.block`,
|
|
1569
1641
|
version: "1.0.0",
|
|
1570
1642
|
type: "module",
|
|
@@ -1572,35 +1644,35 @@ function hr(e) {
|
|
|
1572
1644
|
main: "./dist/index.js",
|
|
1573
1645
|
module: "./dist/index.js",
|
|
1574
1646
|
types: "./dist/index.d.ts",
|
|
1575
|
-
exports:
|
|
1576
|
-
scripts:
|
|
1647
|
+
exports: yr,
|
|
1648
|
+
scripts: _r(t.npmOrg, e.isSdkInternal),
|
|
1577
1649
|
dependencies: {},
|
|
1578
1650
|
devDependencies: n,
|
|
1579
1651
|
block: r
|
|
1580
1652
|
};
|
|
1581
1653
|
}
|
|
1582
|
-
function
|
|
1654
|
+
function Sr(e) {
|
|
1583
1655
|
let t = e.blockVars;
|
|
1584
|
-
R("type", "module"), R("files", ["dist", "block-pack"]), R("main", "./dist/index.js"), R("module", "./dist/index.js"), R("types", "./dist/index.d.ts"), R("exports",
|
|
1585
|
-
let n =
|
|
1656
|
+
R("type", "module"), R("files", ["dist", "block-pack"]), R("main", "./dist/index.js"), R("module", "./dist/index.js"), R("types", "./dist/index.d.ts"), R("exports", yr);
|
|
1657
|
+
let n = _r(t.npmOrg, e.isSdkInternal);
|
|
1586
1658
|
for (let [e, t] of Object.entries(n)) B(e, t);
|
|
1587
|
-
V("mark-stable"),
|
|
1659
|
+
V("mark-stable"), Nt("model"), Nt("ui"), Nt("workflow"), H("@milaboratories/ts-builder", "sdk:"), H("@milaboratories/ts-configs", "sdk:"), H("@platforma-sdk/block-tools", "sdk:"), H("@platforma-sdk/model", "sdk:"), H("shx", "catalog:"), H("typescript", "catalog:"), R("block.components", gr(e)), Tt("version", "facade package.json must carry a 'version' (the facade publishes)"), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
|
|
1588
1660
|
}
|
|
1589
1661
|
//#endregion
|
|
1590
1662
|
//#region src/structure/rules/shared/pascal-case.ts
|
|
1591
|
-
function
|
|
1663
|
+
function Cr(e) {
|
|
1592
1664
|
let t = e.split(/[^A-Za-z0-9]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
|
|
1593
1665
|
return /^[0-9]/.test(t) ? `_${t}` : t;
|
|
1594
1666
|
}
|
|
1595
1667
|
//#endregion
|
|
1596
1668
|
//#region src/structure/rules/block.ts
|
|
1597
|
-
function
|
|
1669
|
+
function wr() {
|
|
1598
1670
|
S("block", () => {
|
|
1599
1671
|
k("index.js"), k("index.d.ts"), T("src/index.ts", j("block/src/index.tpl.ts", (e) => ({
|
|
1600
1672
|
facadeName: e.blockVars.facadeName,
|
|
1601
|
-
pascalName:
|
|
1602
|
-
}))), T("src/AGENTS.ts", A("block/src/AGENTS.ts")), D("src/block-extra.ts", A("block/src/block-extra.ts")), D("src/agents-extra.ts", A("block/src/agents-extra.ts")), T("tsconfig.json", A("block/tsconfig.json")), O("logos/block-logo.png", Xe("block/logos/block-logo.png")), O("logos/organization-logo.png", Xe("block/logos/organization-logo.png")), E("package.json", M((e) =>
|
|
1603
|
-
|
|
1673
|
+
pascalName: Cr(e.blockVars.shortName)
|
|
1674
|
+
}))), T("src/AGENTS.ts", A("block/src/AGENTS.ts")), D("src/block-extra.ts", A("block/src/block-extra.ts")), D("src/agents-extra.ts", A("block/src/agents-extra.ts")), T("tsconfig.json", A("block/tsconfig.json")), O("logos/block-logo.png", Xe("block/logos/block-logo.png")), O("logos/organization-logo.png", Xe("block/logos/organization-logo.png")), E("package.json", M((e) => xr(e)), (e) => {
|
|
1675
|
+
Sr(e);
|
|
1604
1676
|
});
|
|
1605
1677
|
});
|
|
1606
1678
|
}
|
|
@@ -1609,7 +1681,7 @@ function vr() {
|
|
|
1609
1681
|
var Q = "src/**/*.test.ts";
|
|
1610
1682
|
//#endregion
|
|
1611
1683
|
//#region src/structure/rules/model-package-json.ts
|
|
1612
|
-
function
|
|
1684
|
+
function Tr(e) {
|
|
1613
1685
|
return {
|
|
1614
1686
|
name: `${e.blockVars.facadeName}.model`,
|
|
1615
1687
|
private: !0,
|
|
@@ -1643,7 +1715,7 @@ function yr(e) {
|
|
|
1643
1715
|
}
|
|
1644
1716
|
};
|
|
1645
1717
|
}
|
|
1646
|
-
function
|
|
1718
|
+
function Er() {
|
|
1647
1719
|
R("private", !0), R("type", "module"), R("main", "dist/index.cjs"), R("module", "dist/index.js"), R("types", "dist/index.d.ts"), R("exports", {
|
|
1648
1720
|
".": {
|
|
1649
1721
|
types: "./dist/index.d.ts",
|
|
@@ -1651,29 +1723,29 @@ function br() {
|
|
|
1651
1723
|
import: "./dist/index.js"
|
|
1652
1724
|
},
|
|
1653
1725
|
"./dist/*": "./dist/*"
|
|
1654
|
-
}), B("fmt", "ts-builder format"), B("watch", "ts-builder build --target block-model --watch"), B("build", "ts-builder build --target block-model && block-tools build-model"), B("check", "ts-builder check --target block-model"),
|
|
1726
|
+
}), B("fmt", "ts-builder format"), B("watch", "ts-builder build --target block-model --watch"), B("build", "ts-builder build --target block-model && block-tools build-model"), B("check", "ts-builder check --target block-model"), kt("@platforma-sdk/model", "sdk:"), W({
|
|
1655
1727
|
"@milaboratories/ts-builder": "sdk:",
|
|
1656
1728
|
"@milaboratories/ts-configs": "sdk:",
|
|
1657
1729
|
"@platforma-sdk/block-tools": "sdk:"
|
|
1658
|
-
}),
|
|
1730
|
+
}), G({
|
|
1659
1731
|
"@types/node": "*",
|
|
1660
1732
|
typescript: "*"
|
|
1661
1733
|
}), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
|
|
1662
|
-
B("test", "vitest run --passWithNoTests"),
|
|
1663
|
-
}, () =>
|
|
1734
|
+
B("test", "vitest run --passWithNoTests"), H("vitest", "catalog:"), H("@types/node", "*");
|
|
1735
|
+
}, () => U("vitest"))), $n(), z("tsup"), V("lint"), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
|
|
1664
1736
|
}
|
|
1665
1737
|
//#endregion
|
|
1666
1738
|
//#region src/structure/rules/model.ts
|
|
1667
|
-
function
|
|
1739
|
+
function Dr() {
|
|
1668
1740
|
S("model", () => {
|
|
1669
|
-
C(w(Q), () => T("tsconfig.json", A("model/tsconfig.node.json")), () => T("tsconfig.json", A("model/tsconfig.json"))), T(".oxlintrc.json", A("model/.oxlintrc.json")), T(".oxfmtrc.json", A("model/.oxfmtrc.json")), O("src/index.ts", A("model/src/index.ts")), E("package.json", M((e) =>
|
|
1670
|
-
|
|
1741
|
+
C(w(Q), () => T("tsconfig.json", A("model/tsconfig.node.json")), () => T("tsconfig.json", A("model/tsconfig.json"))), T(".oxlintrc.json", A("model/.oxlintrc.json")), T(".oxfmtrc.json", A("model/.oxfmtrc.json")), O("src/index.ts", A("model/src/index.ts")), E("package.json", M((e) => Tr(e)), () => {
|
|
1742
|
+
Er();
|
|
1671
1743
|
});
|
|
1672
1744
|
});
|
|
1673
1745
|
}
|
|
1674
1746
|
//#endregion
|
|
1675
1747
|
//#region src/structure/rules/ui-package-json.ts
|
|
1676
|
-
function
|
|
1748
|
+
function Or(e) {
|
|
1677
1749
|
return {
|
|
1678
1750
|
name: `${e.blockVars.facadeName}.ui`,
|
|
1679
1751
|
private: !0,
|
|
@@ -1688,7 +1760,7 @@ function Sr(e) {
|
|
|
1688
1760
|
dependencies: {
|
|
1689
1761
|
"@platforma-sdk/ui-vue": "sdk:",
|
|
1690
1762
|
vue: "catalog:",
|
|
1691
|
-
...
|
|
1763
|
+
...yn(e, "model")
|
|
1692
1764
|
},
|
|
1693
1765
|
devDependencies: {
|
|
1694
1766
|
"@milaboratories/ts-builder": "sdk:",
|
|
@@ -1700,29 +1772,29 @@ function Sr(e) {
|
|
|
1700
1772
|
}
|
|
1701
1773
|
};
|
|
1702
1774
|
}
|
|
1703
|
-
function
|
|
1704
|
-
R("private", !0), R("type", "module"), B("fmt", "ts-builder format"), B("dev", "ts-builder serve --target block-ui"), B("watch", "ts-builder build --target block-ui --watch"), B("build", "ts-builder build --target block-ui"), B("check", "ts-builder check --target block-ui"),
|
|
1775
|
+
function kr() {
|
|
1776
|
+
R("private", !0), R("type", "module"), B("fmt", "ts-builder format"), B("dev", "ts-builder serve --target block-ui"), B("watch", "ts-builder build --target block-ui --watch"), B("build", "ts-builder build --target block-ui"), B("check", "ts-builder check --target block-ui"), kt("@platforma-sdk/ui-vue", "sdk:"), kt("vue", "catalog:"), Mt("model"), W({
|
|
1705
1777
|
"@milaboratories/ts-builder": "sdk:",
|
|
1706
1778
|
"@milaboratories/ts-configs": "sdk:"
|
|
1707
|
-
}),
|
|
1779
|
+
}), $n(), V("preview"), V("lint"), G({
|
|
1708
1780
|
"@types/node": "*",
|
|
1709
1781
|
typescript: "*"
|
|
1710
1782
|
}), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
|
|
1711
|
-
B("test", "vitest run --passWithNoTests"),
|
|
1712
|
-
}, () =>
|
|
1783
|
+
B("test", "vitest run --passWithNoTests"), H("vitest", "catalog:"), H("@types/node", "*");
|
|
1784
|
+
}, () => U("vitest"))), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
|
|
1713
1785
|
}
|
|
1714
1786
|
//#endregion
|
|
1715
1787
|
//#region src/structure/rules/ui.ts
|
|
1716
|
-
function
|
|
1788
|
+
function Ar() {
|
|
1717
1789
|
S("ui", () => {
|
|
1718
|
-
C(w(Q), () => T("tsconfig.json", A("ui/tsconfig.node.json")), () => T("tsconfig.json", A("ui/tsconfig.json"))), T(".oxlintrc.json", A("ui/.oxlintrc.json")), T(".oxfmtrc.json", A("ui/.oxfmtrc.json")), D("index.html", A("ui/index.html")), O("src/main.ts", A("ui/src/main.ts")), O("src/app.ts", j("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), O("src/MainPage.vue", j("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), E("package.json", M((e) =>
|
|
1719
|
-
|
|
1790
|
+
C(w(Q), () => T("tsconfig.json", A("ui/tsconfig.node.json")), () => T("tsconfig.json", A("ui/tsconfig.json"))), T(".oxlintrc.json", A("ui/.oxlintrc.json")), T(".oxfmtrc.json", A("ui/.oxfmtrc.json")), D("index.html", A("ui/index.html")), O("src/main.ts", A("ui/src/main.ts")), O("src/app.ts", j("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), O("src/MainPage.vue", j("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), E("package.json", M((e) => Or(e)), () => {
|
|
1791
|
+
kr();
|
|
1720
1792
|
});
|
|
1721
1793
|
});
|
|
1722
1794
|
}
|
|
1723
1795
|
//#endregion
|
|
1724
1796
|
//#region src/structure/rules/workflow-package-json.ts
|
|
1725
|
-
function
|
|
1797
|
+
function jr(e) {
|
|
1726
1798
|
return {
|
|
1727
1799
|
name: `${e.blockVars.facadeName}.workflow`,
|
|
1728
1800
|
private: !0,
|
|
@@ -1734,7 +1806,7 @@ function Tr(e) {
|
|
|
1734
1806
|
},
|
|
1735
1807
|
dependencies: {
|
|
1736
1808
|
"@platforma-sdk/workflow-tengo": "sdk:",
|
|
1737
|
-
...
|
|
1809
|
+
...bn(e, "software")
|
|
1738
1810
|
},
|
|
1739
1811
|
devDependencies: {
|
|
1740
1812
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
@@ -1743,31 +1815,31 @@ function Tr(e) {
|
|
|
1743
1815
|
}
|
|
1744
1816
|
};
|
|
1745
1817
|
}
|
|
1746
|
-
function
|
|
1818
|
+
function Mr() {
|
|
1747
1819
|
R("private", !0), R("type", "module"), B("build", "shx rm -rf dist && pl-tengo build"), B("check", "pl-tengo check"), B("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
|
|
1748
|
-
B("test", "vitest run --passWithNoTests"),
|
|
1749
|
-
}, () =>
|
|
1820
|
+
B("test", "vitest run --passWithNoTests"), W({ vitest: "catalog:" });
|
|
1821
|
+
}, () => U("vitest"))), kt("@platforma-sdk/workflow-tengo", "sdk:"), Mt("software"), W({
|
|
1750
1822
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1751
1823
|
"@platforma-sdk/test": "sdk:",
|
|
1752
1824
|
shx: "catalog:"
|
|
1753
|
-
}),
|
|
1825
|
+
}), $n(), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
|
|
1754
1826
|
}
|
|
1755
1827
|
//#endregion
|
|
1756
1828
|
//#region src/structure/rules/workflow.ts
|
|
1757
|
-
function
|
|
1829
|
+
function Nr() {
|
|
1758
1830
|
S("workflow", () => {
|
|
1759
1831
|
T("format.el", A("workflow/format.el")), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
|
|
1760
1832
|
T("tsconfig.json", A("workflow/tsconfig.json")), D("vitest.config.mts", A("workflow/vitest.config.mts"));
|
|
1761
1833
|
}, () => {
|
|
1762
1834
|
k("tsconfig.json"), k("vitest.config.mts");
|
|
1763
|
-
})), k("index.js"), k("index.d.ts"), O("src/main.tpl.tengo", j("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), E("package.json", M((e) =>
|
|
1764
|
-
|
|
1835
|
+
})), k("index.js"), k("index.d.ts"), O("src/main.tpl.tengo", j("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), E("package.json", M((e) => jr(e)), () => {
|
|
1836
|
+
Mr();
|
|
1765
1837
|
});
|
|
1766
1838
|
});
|
|
1767
1839
|
}
|
|
1768
1840
|
//#endregion
|
|
1769
1841
|
//#region src/structure/rules/test-package-json.ts
|
|
1770
|
-
function
|
|
1842
|
+
function Pr(e) {
|
|
1771
1843
|
return {
|
|
1772
1844
|
name: `${e.blockVars.facadeName}.test`,
|
|
1773
1845
|
private: !0,
|
|
@@ -1786,27 +1858,27 @@ function Or(e) {
|
|
|
1786
1858
|
}
|
|
1787
1859
|
};
|
|
1788
1860
|
}
|
|
1789
|
-
function
|
|
1790
|
-
R("private", !0), R("type", "module"), B("fmt", "ts-builder format"), B("check", "ts-builder check --target block-test"), B("test", "vitest run --passWithNoTests"), V("lint"),
|
|
1861
|
+
function Fr() {
|
|
1862
|
+
R("private", !0), R("type", "module"), B("fmt", "ts-builder format"), B("check", "ts-builder check --target block-test"), B("test", "vitest run --passWithNoTests"), V("lint"), W({
|
|
1791
1863
|
"@platforma-sdk/test": "sdk:",
|
|
1792
1864
|
"@milaboratories/ts-builder": "sdk:",
|
|
1793
1865
|
"@milaboratories/ts-configs": "sdk:",
|
|
1794
1866
|
vitest: "catalog:"
|
|
1795
|
-
}),
|
|
1867
|
+
}), G({ typescript: "*" }), U("@types/node"), $n(), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
|
|
1796
1868
|
}
|
|
1797
1869
|
//#endregion
|
|
1798
1870
|
//#region src/structure/rules/test.ts
|
|
1799
|
-
function
|
|
1871
|
+
function Ir() {
|
|
1800
1872
|
S("test", () => {
|
|
1801
|
-
T("tsconfig.json", A("test/tsconfig.json")), T(".oxlintrc.json", A("test/.oxlintrc.json")), T(".oxfmtrc.json", A("test/.oxfmtrc.json")), D("vitest.config.mts", A("test/vitest.config.mts")), O("src/demo.test.ts", Ze("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), E("package.json", M((e) =>
|
|
1802
|
-
|
|
1873
|
+
T("tsconfig.json", A("test/tsconfig.json")), T(".oxlintrc.json", A("test/.oxlintrc.json")), T(".oxfmtrc.json", A("test/.oxfmtrc.json")), D("vitest.config.mts", A("test/vitest.config.mts")), O("src/demo.test.ts", Ze("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), E("package.json", M((e) => Pr(e)), () => {
|
|
1874
|
+
Fr();
|
|
1803
1875
|
});
|
|
1804
1876
|
});
|
|
1805
1877
|
}
|
|
1806
1878
|
//#endregion
|
|
1807
1879
|
//#region src/structure/rules/software-package-json.ts
|
|
1808
|
-
var
|
|
1809
|
-
function
|
|
1880
|
+
var Lr = "block-tools software build", Rr = "shx rm -f *.tgz && block-tools software build && pnpm pack && shx mv platforma-open*.tgz package.tgz";
|
|
1881
|
+
function zr() {
|
|
1810
1882
|
return { entrypoints: { main: { binary: {
|
|
1811
1883
|
artifact: {
|
|
1812
1884
|
type: "python",
|
|
@@ -1821,39 +1893,39 @@ function Nr() {
|
|
|
1821
1893
|
cmd: ["python", "{pkg}/main.py"]
|
|
1822
1894
|
} } } };
|
|
1823
1895
|
}
|
|
1824
|
-
function
|
|
1896
|
+
function Br(e) {
|
|
1825
1897
|
return {
|
|
1826
1898
|
name: `${e.blockVars.facadeName}.software`,
|
|
1827
1899
|
type: "module",
|
|
1828
1900
|
description: "Block Software",
|
|
1829
1901
|
files: ["./dist/**/*"],
|
|
1830
1902
|
scripts: {
|
|
1831
|
-
build:
|
|
1832
|
-
"do-pack":
|
|
1903
|
+
build: Lr,
|
|
1904
|
+
"do-pack": Rr,
|
|
1833
1905
|
changeset: "changeset",
|
|
1834
1906
|
"version-packages": "changeset version"
|
|
1835
1907
|
},
|
|
1836
|
-
"block-software":
|
|
1908
|
+
"block-software": zr(),
|
|
1837
1909
|
devDependencies: {
|
|
1838
1910
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
1839
1911
|
"@platforma-sdk/block-tools": "sdk:"
|
|
1840
1912
|
}
|
|
1841
1913
|
};
|
|
1842
1914
|
}
|
|
1843
|
-
function
|
|
1844
|
-
z("private"), R("type", "module"), R("files", ["./dist/**/*"]), B("build",
|
|
1915
|
+
function Vr() {
|
|
1916
|
+
z("private"), R("type", "module"), R("files", ["./dist/**/*"]), B("build", Lr), B("do-pack", Rr), V("prepublishOnly"), B("changeset", "changeset"), B("version-packages", "changeset version"), H("@platforma-open/milaboratories.runenv-python-3", "catalog:"), H("@platforma-sdk/block-tools", "sdk:"), U("@platforma-sdk/package-builder"), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
|
|
1845
1917
|
}
|
|
1846
1918
|
//#endregion
|
|
1847
1919
|
//#region src/structure/rules/software.ts
|
|
1848
|
-
var
|
|
1849
|
-
function
|
|
1920
|
+
var Hr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", Ur = "# No dependencies specified for this script\n";
|
|
1921
|
+
function Wr() {
|
|
1850
1922
|
S("software", () => {
|
|
1851
|
-
O("src/main.py", Ze(
|
|
1852
|
-
|
|
1923
|
+
O("src/main.py", Ze(Hr)), O("src/requirements.txt", Ze(Ur)), E("package.json", M((e) => Br(e)), () => {
|
|
1924
|
+
Vr();
|
|
1853
1925
|
});
|
|
1854
1926
|
});
|
|
1855
1927
|
}
|
|
1856
|
-
function
|
|
1928
|
+
function Gr() {
|
|
1857
1929
|
S("model", () => {
|
|
1858
1930
|
k("eslint.config.mjs"), k("vite.config.mts");
|
|
1859
1931
|
}), S("ui", () => {
|
|
@@ -1861,25 +1933,25 @@ function zr() {
|
|
|
1861
1933
|
}), S("test", () => {
|
|
1862
1934
|
k("eslint.config.mjs");
|
|
1863
1935
|
}), S("root", () => {
|
|
1864
|
-
k(".prettierrc"), E("package.json", M(() =>
|
|
1865
|
-
V("pretty"),
|
|
1936
|
+
k(".prettierrc"), E("package.json", M(() => Mn()), () => {
|
|
1937
|
+
V("pretty"), U("@platforma-sdk/blocks-deps-updater");
|
|
1866
1938
|
});
|
|
1867
1939
|
});
|
|
1868
1940
|
}
|
|
1869
1941
|
//#endregion
|
|
1870
1942
|
//#region src/structure/rules/root-catalog-bump.ts
|
|
1871
|
-
function
|
|
1943
|
+
function Kr() {
|
|
1872
1944
|
Ye(() => {
|
|
1873
1945
|
S("root", () => {
|
|
1874
1946
|
C(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1875
|
-
E("pnpm-workspace.yaml", M((e) =>
|
|
1876
|
-
for (let e of Z)
|
|
1877
|
-
for (let e of
|
|
1947
|
+
E("pnpm-workspace.yaml", M((e) => ar(e)), (e) => {
|
|
1948
|
+
for (let e of Z) Bt(e);
|
|
1949
|
+
for (let e of nr) Vt(e.entry, {
|
|
1878
1950
|
of: e.of,
|
|
1879
1951
|
ofVersion: e.ofVersion
|
|
1880
1952
|
});
|
|
1881
|
-
for (let [e, t] of Object.entries(
|
|
1882
|
-
e.modules.some((e) => e.scope === "software") &&
|
|
1953
|
+
for (let [e, t] of Object.entries(tr)) zt(e, t);
|
|
1954
|
+
e.modules.some((e) => e.scope === "software") && zt(rr, ir);
|
|
1883
1955
|
});
|
|
1884
1956
|
});
|
|
1885
1957
|
});
|
|
@@ -1887,25 +1959,25 @@ function Br() {
|
|
|
1887
1959
|
}
|
|
1888
1960
|
//#endregion
|
|
1889
1961
|
//#region src/structure/structure-definition.ts
|
|
1890
|
-
var
|
|
1891
|
-
|
|
1962
|
+
var qr = He(() => {
|
|
1963
|
+
lr(), dr(), wr(), Dr(), Ar(), Nr(), Ir(), Wr(), Gr(), Kr();
|
|
1892
1964
|
});
|
|
1893
1965
|
//#endregion
|
|
1894
1966
|
//#region src/structure/cli/run-structure.ts
|
|
1895
|
-
async function
|
|
1896
|
-
return
|
|
1967
|
+
async function Jr() {
|
|
1968
|
+
return Yn(Z.filter(Jn));
|
|
1897
1969
|
}
|
|
1898
|
-
async function
|
|
1899
|
-
let t = h.resolve(e.blockPath), n = e.mode === "check", r = new Ee(t), i = new De(e.templatesRoot), a =
|
|
1970
|
+
async function Yr(e) {
|
|
1971
|
+
let t = h.resolve(e.blockPath), n = e.mode === "check", r = new Ee(t), i = new De(e.templatesRoot), a = dn(qr, r, kn({
|
|
1900
1972
|
fs: r,
|
|
1901
1973
|
isSdkInternal: e.isSdkInternal,
|
|
1902
1974
|
updateDepsOnly: e.updateDepsOnly,
|
|
1903
1975
|
dryRun: n
|
|
1904
1976
|
}), {
|
|
1905
1977
|
templates: i,
|
|
1906
|
-
registryLookup: e.updateDepsOnly ? await
|
|
1907
|
-
derivedPinLookup: e.updateDepsOnly ? await
|
|
1908
|
-
rediscover: () =>
|
|
1978
|
+
registryLookup: e.updateDepsOnly ? await Jr() : void 0,
|
|
1979
|
+
derivedPinLookup: e.updateDepsOnly ? await Zn(nr) : void 0,
|
|
1980
|
+
rediscover: () => kn({
|
|
1909
1981
|
fs: r,
|
|
1910
1982
|
isSdkInternal: e.isSdkInternal,
|
|
1911
1983
|
updateDepsOnly: !1,
|
|
@@ -1917,16 +1989,16 @@ async function Ur(e) {
|
|
|
1917
1989
|
changes: a.changes
|
|
1918
1990
|
};
|
|
1919
1991
|
}
|
|
1920
|
-
function
|
|
1992
|
+
function Xr(e, t) {
|
|
1921
1993
|
if (t.length === 0) return ` ${e}: up to date (0 changes)`;
|
|
1922
1994
|
let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
|
|
1923
1995
|
return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
|
|
1924
1996
|
}
|
|
1925
1997
|
//#endregion
|
|
1926
1998
|
//#region src/cmd/structure/refresh.ts
|
|
1927
|
-
async function
|
|
1999
|
+
async function Zr(e) {
|
|
1928
2000
|
for (let t of e.paths) {
|
|
1929
|
-
let n = await
|
|
2001
|
+
let n = await Yr({
|
|
1930
2002
|
blockPath: t,
|
|
1931
2003
|
isSdkInternal: e.isSdkInternal,
|
|
1932
2004
|
updateDepsOnly: e.updateDepsOnly,
|
|
@@ -1934,14 +2006,14 @@ async function Gr(e) {
|
|
|
1934
2006
|
templatesRoot: e.templatesRoot,
|
|
1935
2007
|
log: (t) => e.logger.info(t)
|
|
1936
2008
|
});
|
|
1937
|
-
e.logger.info(
|
|
2009
|
+
e.logger.info(Xr(t, n.changes));
|
|
1938
2010
|
}
|
|
1939
2011
|
}
|
|
1940
|
-
function
|
|
2012
|
+
function Qr(e) {
|
|
1941
2013
|
let t = new p("refresh").description("Bring block(s) up to date with the canonical structure. Applies rules, writes files, bumps .structure version. Default mode is offline; --update-deps-only fires only catalog-bump rules (network).");
|
|
1942
2014
|
return t.argument("[paths...]", "block path(s); defaults to the current directory"), t.option("--sdk-internal", "block(s) live inside the SDK monorepo; skip root-scope rules"), t.option("--update-deps-only", "fire ONLY catalog-bump rules (npm network). Follow with `pnpm install` then a plain refresh."), t.action(async (t, n) => {
|
|
1943
2015
|
let r = t.length > 0 ? t : ["."], i = h.join(e, "src", "structure", "templates");
|
|
1944
|
-
await
|
|
2016
|
+
await Zr({
|
|
1945
2017
|
paths: r,
|
|
1946
2018
|
isSdkInternal: !!n.sdkInternal,
|
|
1947
2019
|
updateDepsOnly: !!n.updateDepsOnly,
|
|
@@ -1952,11 +2024,11 @@ function Kr(e) {
|
|
|
1952
2024
|
}
|
|
1953
2025
|
//#endregion
|
|
1954
2026
|
//#region src/cmd/update-deps.ts
|
|
1955
|
-
function
|
|
2027
|
+
function $r(e) {
|
|
1956
2028
|
let t = new p("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
|
|
1957
2029
|
return t.action(async () => {
|
|
1958
2030
|
let t = new _();
|
|
1959
|
-
t.warn("`block-tools update-deps` is deprecated and will be removed in a future release. Use `block-tools structure refresh --update-deps-only` instead. Delegating now."), await
|
|
2031
|
+
t.warn("`block-tools update-deps` is deprecated and will be removed in a future release. Use `block-tools structure refresh --update-deps-only` instead. Delegating now."), await Zr({
|
|
1960
2032
|
paths: ["."],
|
|
1961
2033
|
isSdkInternal: !1,
|
|
1962
2034
|
updateDepsOnly: !0,
|
|
@@ -1967,7 +2039,7 @@ function qr(e) {
|
|
|
1967
2039
|
}
|
|
1968
2040
|
//#endregion
|
|
1969
2041
|
//#region src/cmd/list-overview-snapshots.ts
|
|
1970
|
-
function
|
|
2042
|
+
function ei() {
|
|
1971
2043
|
let e = new p("list-overview-snapshots").description("List all available global overview snapshots in the registry");
|
|
1972
2044
|
return e.addOption(new m("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.option("--json", "output in JSON format", !1), e.action(async (e) => {
|
|
1973
2045
|
let t = new _(), n = await new s(o(e.registry), t).listGlobalOverviewSnapshots();
|
|
@@ -1981,7 +2053,7 @@ function Jr() {
|
|
|
1981
2053
|
}
|
|
1982
2054
|
//#endregion
|
|
1983
2055
|
//#region src/cmd/restore-overview-from-snapshot.ts
|
|
1984
|
-
function
|
|
2056
|
+
function ti() {
|
|
1985
2057
|
let e = new p("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
|
|
1986
2058
|
return e.addOption(new m("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.requiredOption("-s, --snapshot <timestamp>", "snapshot timestamp ID to restore from"), e.option("--skip-confirmation", "skip confirmation prompt (use with caution)", !1), e.action(async (e) => {
|
|
1987
2059
|
let t = new _(), n = new s(o(e.registry), t), r = await n.listGlobalOverviewSnapshots();
|
|
@@ -2007,7 +2079,7 @@ function Yr() {
|
|
|
2007
2079
|
}
|
|
2008
2080
|
//#endregion
|
|
2009
2081
|
//#region src/registry_v1/flags.ts
|
|
2010
|
-
function
|
|
2082
|
+
function ni(e) {
|
|
2011
2083
|
let t = e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);
|
|
2012
2084
|
if (t) {
|
|
2013
2085
|
let { src: e, destName: n } = t.groups;
|
|
@@ -2020,22 +2092,22 @@ function Xr(e) {
|
|
|
2020
2092
|
destName: h.basename(e)
|
|
2021
2093
|
};
|
|
2022
2094
|
}
|
|
2023
|
-
function
|
|
2024
|
-
return new m(e, t).argParser((e, t) => [...t ?? [],
|
|
2095
|
+
function ri(e, t) {
|
|
2096
|
+
return new m(e, t).argParser((e, t) => [...t ?? [], ni(e)]).default([]);
|
|
2025
2097
|
}
|
|
2026
2098
|
//#endregion
|
|
2027
2099
|
//#region src/cmd/upload-package-v1.ts
|
|
2028
|
-
var
|
|
2100
|
+
var ii = [
|
|
2029
2101
|
"registry",
|
|
2030
2102
|
"organization",
|
|
2031
2103
|
"package",
|
|
2032
2104
|
"version"
|
|
2033
2105
|
];
|
|
2034
|
-
function
|
|
2106
|
+
function ai() {
|
|
2035
2107
|
let e = new p("upload-package-v1").description("Uploads V1 package and refreshes the registry");
|
|
2036
|
-
return e.addOption(new m("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new m("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new m("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new m("-v, --version <version>", "target version").env("PL_PACKAGE_VERSION")), e.option("-m, --meta <path>", "json file containing meta information to associate with tha package"), e.addOption(
|
|
2108
|
+
return e.addOption(new m("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new m("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new m("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new m("-v, --version <version>", "target version").env("PL_PACKAGE_VERSION")), e.option("-m, --meta <path>", "json file containing meta information to associate with tha package"), e.addOption(ri("-f, --file <file>", "package files")), e.addOption(new m("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), e.option("--no-refresh", "do not refresh repository after adding the package"), e.action(async (e) => {
|
|
2037
2109
|
let t = new _(), n = l.parse({});
|
|
2038
|
-
for (let t of
|
|
2110
|
+
for (let t of ii) e[t] && (n[t] = e[t]);
|
|
2039
2111
|
e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await g.promises.readFile(e.meta, { encoding: "utf-8" })) : e.meta.endsWith(".yaml") && (n.meta = ie.parse(await g.promises.readFile(e.meta, { encoding: "utf-8" }))));
|
|
2040
2112
|
for (let t of e.file) n.files[t.destName] = t.src;
|
|
2041
2113
|
let r = await c(n);
|
|
@@ -2051,12 +2123,12 @@ function $r() {
|
|
|
2051
2123
|
}
|
|
2052
2124
|
//#endregion
|
|
2053
2125
|
//#region src/cmd/structure/check.ts
|
|
2054
|
-
function
|
|
2126
|
+
function oi(e) {
|
|
2055
2127
|
let t = new p("check").description("Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.");
|
|
2056
2128
|
return t.argument("[paths...]", "block path(s); defaults to the current directory"), t.option("--sdk-internal", "block(s) live inside the SDK monorepo; skip root-scope rules"), t.action(async (t, n) => {
|
|
2057
2129
|
let r = new _(), i = t.length > 0 ? t : ["."], a = h.join(e, "src", "structure", "templates"), o = !1;
|
|
2058
2130
|
for (let e of i) {
|
|
2059
|
-
let t = await
|
|
2131
|
+
let t = await Yr({
|
|
2060
2132
|
blockPath: e,
|
|
2061
2133
|
isSdkInternal: !!n.sdkInternal,
|
|
2062
2134
|
updateDepsOnly: !1,
|
|
@@ -2064,35 +2136,35 @@ function ei(e) {
|
|
|
2064
2136
|
templatesRoot: a,
|
|
2065
2137
|
log: (e) => r.info(e)
|
|
2066
2138
|
});
|
|
2067
|
-
r.info(
|
|
2139
|
+
r.info(Xr(e, t.changes)), t.changes.length > 0 && (o = !0);
|
|
2068
2140
|
}
|
|
2069
2141
|
if (o) throw Error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.");
|
|
2070
2142
|
}), t;
|
|
2071
2143
|
}
|
|
2072
2144
|
//#endregion
|
|
2073
2145
|
//#region src/structure/init-block-constructor.ts
|
|
2074
|
-
var $ = ["python"],
|
|
2146
|
+
var $ = ["python"], si = class extends Error {
|
|
2075
2147
|
constructor(e) {
|
|
2076
2148
|
super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
|
|
2077
2149
|
}
|
|
2078
2150
|
};
|
|
2079
|
-
async function
|
|
2151
|
+
async function ci(e, t, n, r) {
|
|
2080
2152
|
if (e !== void 0 && e !== "") return e;
|
|
2081
|
-
if (n) throw new
|
|
2153
|
+
if (n) throw new si(t);
|
|
2082
2154
|
return r();
|
|
2083
2155
|
}
|
|
2084
|
-
async function
|
|
2085
|
-
let t = await
|
|
2156
|
+
async function li(e) {
|
|
2157
|
+
let t = await ci(e.npmOrg, "npm-org", e.nonInteractive, () => de({
|
|
2086
2158
|
message: "npm org (e.g. @platforma-open):",
|
|
2087
2159
|
default: "@platforma-open"
|
|
2088
|
-
})), n = await
|
|
2160
|
+
})), n = await ci(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await ci(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
|
|
2089
2161
|
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await ue({
|
|
2090
2162
|
message: "Include a software module?",
|
|
2091
2163
|
default: !1
|
|
2092
2164
|
}) : e.withSoftware;
|
|
2093
2165
|
let a;
|
|
2094
2166
|
if (i) {
|
|
2095
|
-
if (a = await
|
|
2167
|
+
if (a = await ci(e.platform, "platform", e.nonInteractive, () => fe({
|
|
2096
2168
|
message: "Software platform:",
|
|
2097
2169
|
choices: $.map((e) => ({
|
|
2098
2170
|
name: e,
|
|
@@ -2109,20 +2181,20 @@ async function ri(e) {
|
|
|
2109
2181
|
softwarePlatform: a
|
|
2110
2182
|
};
|
|
2111
2183
|
}
|
|
2112
|
-
async function
|
|
2113
|
-
let t = e.vars, n =
|
|
2184
|
+
async function ui(e) {
|
|
2185
|
+
let t = e.vars, n = xn(t), r = new Ee(e.blockPath), i = new De(e.templatesRoot), a = Sn({
|
|
2114
2186
|
blockVars: t,
|
|
2115
2187
|
modules: n,
|
|
2116
2188
|
isSdkInternal: !1,
|
|
2117
2189
|
version: 2,
|
|
2118
2190
|
dryRun: !1
|
|
2119
|
-
}), o = Z.filter(
|
|
2191
|
+
}), o = Z.filter(Jn), s, c;
|
|
2120
2192
|
try {
|
|
2121
|
-
s = await
|
|
2193
|
+
s = await Yn(o), c = await Zn(nr);
|
|
2122
2194
|
} catch (e) {
|
|
2123
2195
|
throw Error(`init requires network access to resolve SDK catalog versions from npm, but the registry lookup failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
2124
2196
|
}
|
|
2125
|
-
return
|
|
2197
|
+
return dn(qr, r, a, {
|
|
2126
2198
|
templates: i,
|
|
2127
2199
|
initMode: !0,
|
|
2128
2200
|
registryLookup: s,
|
|
@@ -2131,12 +2203,12 @@ async function ii(e) {
|
|
|
2131
2203
|
}
|
|
2132
2204
|
//#endregion
|
|
2133
2205
|
//#region src/cmd/structure/init.ts
|
|
2134
|
-
function
|
|
2206
|
+
function di(e) {
|
|
2135
2207
|
let t = new p("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
|
|
2136
2208
|
return t.argument("[path]", "target directory (default: <short-name> under the current directory)"), t.option("--npm-org <org>", "npm org, e.g. @platforma-open"), t.option("--org-scope <scope>", "org scope, e.g. my-org"), t.option("--short-name <name>", "block short name, e.g. mixcr-clonotyping"), t.option("--with-software", "include a software module"), t.option("--no-software", "omit the software module"), t.addOption(new m("--platform <platform>", "software platform (single-valued)").choices([...$])), t.option("--non-interactive", "error on any missing flag instead of prompting"), t.action(async (t, n) => {
|
|
2137
2209
|
let r = new _(), i = n.withSoftware === !0, a = n.software === !1;
|
|
2138
2210
|
if (i && a) throw Error("--with-software and --no-software are mutually exclusive.");
|
|
2139
|
-
let o = i ? !0 : a ? !1 : void 0, s = await
|
|
2211
|
+
let o = i ? !0 : a ? !1 : void 0, s = await li({
|
|
2140
2212
|
npmOrg: n.npmOrg,
|
|
2141
2213
|
orgScope: n.orgScope,
|
|
2142
2214
|
shortName: n.shortName,
|
|
@@ -2144,7 +2216,7 @@ function ai(e) {
|
|
|
2144
2216
|
platform: n.platform,
|
|
2145
2217
|
nonInteractive: n.nonInteractive
|
|
2146
2218
|
});
|
|
2147
|
-
await
|
|
2219
|
+
await ui({
|
|
2148
2220
|
vars: s,
|
|
2149
2221
|
blockPath: t ? h.resolve(t) : h.resolve(process.cwd(), s.shortName),
|
|
2150
2222
|
templatesRoot: h.join(e, "src", "structure", "templates"),
|
|
@@ -2154,13 +2226,13 @@ function ai(e) {
|
|
|
2154
2226
|
}
|
|
2155
2227
|
//#endregion
|
|
2156
2228
|
//#region src/cmd/software/knobs.ts
|
|
2157
|
-
var
|
|
2229
|
+
var fi = ["dev", "release"], pi = [
|
|
2158
2230
|
"docker",
|
|
2159
2231
|
"binary",
|
|
2160
2232
|
"all",
|
|
2161
2233
|
"none"
|
|
2162
|
-
],
|
|
2163
|
-
function
|
|
2234
|
+
], mi = ["local", "remote"];
|
|
2235
|
+
function hi(e) {
|
|
2164
2236
|
if (e.usePublished) {
|
|
2165
2237
|
if (e.variant === "docker" || e.variant === "all") throw y.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);
|
|
2166
2238
|
return { kind: "binary-existing" };
|
|
@@ -2174,31 +2246,31 @@ function li(e) {
|
|
|
2174
2246
|
}
|
|
2175
2247
|
//#endregion
|
|
2176
2248
|
//#region src/cmd/software/ecr-login.ts
|
|
2177
|
-
var
|
|
2178
|
-
function
|
|
2249
|
+
var gi = "public.ecr.aws", _i = "us-east-1";
|
|
2250
|
+
function vi(e) {
|
|
2179
2251
|
if (process.env.AWS_ACCESS_KEY_ID || process.env.AWS_PROFILE) return;
|
|
2180
2252
|
let t = process.env.PL_AWS_PROFILE ?? me.AWS_DEV_PROFILE;
|
|
2181
2253
|
process.env.AWS_PROFILE = t, e?.debug(`Using AWS profile '${t}' for dev push credentials`);
|
|
2182
2254
|
}
|
|
2183
|
-
function
|
|
2255
|
+
function yi(e) {
|
|
2184
2256
|
return new URL(`https://${e}`).hostname;
|
|
2185
2257
|
}
|
|
2186
|
-
function
|
|
2258
|
+
function bi() {
|
|
2187
2259
|
return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ?? me.AWS_DEV_PROFILE}`;
|
|
2188
2260
|
}
|
|
2189
|
-
async function
|
|
2190
|
-
let n =
|
|
2191
|
-
if (n !==
|
|
2261
|
+
async function xi(e, t) {
|
|
2262
|
+
let n = yi(e);
|
|
2263
|
+
if (n !== gi) throw y.CLIError(`automatic docker login is only supported for '${gi}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);
|
|
2192
2264
|
t?.info(`Logging in to ECR registry '${n}'...`);
|
|
2193
2265
|
let r, i;
|
|
2194
2266
|
try {
|
|
2195
|
-
let e = (await new ge({ region:
|
|
2267
|
+
let e = (await new ge({ region: _i }).send(new _e({}))).authorizationData?.authorizationToken;
|
|
2196
2268
|
if (!e) throw Error("empty authorization token");
|
|
2197
2269
|
let t = Buffer.from(e, "base64").toString("utf8"), n = t.indexOf(":");
|
|
2198
2270
|
if (n < 0) throw Error("malformed authorization token (no ':' separator)");
|
|
2199
2271
|
r = t.slice(0, n), i = t.slice(n + 1);
|
|
2200
2272
|
} catch (e) {
|
|
2201
|
-
throw y.CLIError(`failed to obtain an ECR login token for '${n}': ${e instanceof Error ? e.message : String(e)}\nYour AWS/SSO session is likely expired or absent — log in and retry:\n` +
|
|
2273
|
+
throw y.CLIError(`failed to obtain an ECR login token for '${n}': ${e instanceof Error ? e.message : String(e)}\nYour AWS/SSO session is likely expired or absent — log in and retry:\n` + bi());
|
|
2202
2274
|
}
|
|
2203
2275
|
let a = he("docker", [
|
|
2204
2276
|
"login",
|
|
@@ -2222,9 +2294,9 @@ async function hi(e, t) {
|
|
|
2222
2294
|
}
|
|
2223
2295
|
//#endregion
|
|
2224
2296
|
//#region src/cmd/software/run-build.ts
|
|
2225
|
-
async function
|
|
2297
|
+
async function Si(e) {
|
|
2226
2298
|
let { core: t, scenario: n, options: r = {}, logger: i } = e, a = r.ids;
|
|
2227
|
-
t.buildMode =
|
|
2299
|
+
t.buildMode = Ci(n);
|
|
2228
2300
|
let o = () => t.buildSoftwareArchives({
|
|
2229
2301
|
ids: a,
|
|
2230
2302
|
forceBuild: !!r.force,
|
|
@@ -2249,12 +2321,12 @@ async function gi(e) {
|
|
|
2249
2321
|
});
|
|
2250
2322
|
break;
|
|
2251
2323
|
case "target": {
|
|
2252
|
-
let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f =
|
|
2324
|
+
let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f = Ei(e, r);
|
|
2253
2325
|
l && t.buildDockerImages({
|
|
2254
2326
|
ids: a,
|
|
2255
2327
|
registry: f.pull,
|
|
2256
2328
|
strictPlatformMatching: v.isCI()
|
|
2257
|
-
}), u && await o(), d && e === "dev" && (l || u) &&
|
|
2329
|
+
}), u && await o(), d && e === "dev" && (l || u) && vi(i), l && d && (f.autoLogin && f.push && await xi(f.push, i), t.publishDockerImages({
|
|
2258
2330
|
ids: a,
|
|
2259
2331
|
pushTo: f.push,
|
|
2260
2332
|
strictPlatformMatching: v.isCI()
|
|
@@ -2271,40 +2343,40 @@ async function gi(e) {
|
|
|
2271
2343
|
noSoftware: n.kind === "no-software"
|
|
2272
2344
|
});
|
|
2273
2345
|
}
|
|
2274
|
-
function
|
|
2346
|
+
function Ci(e) {
|
|
2275
2347
|
return e.kind !== "target" || e.channel === "release" ? "release" : e.variant !== "docker" && e.location === "remote" ? "dev-remote" : "dev-local";
|
|
2276
2348
|
}
|
|
2277
|
-
function
|
|
2349
|
+
function wi(e) {
|
|
2278
2350
|
if (!e.includes("://")) return e;
|
|
2279
2351
|
let t = new URL(e);
|
|
2280
2352
|
return t.host + t.pathname;
|
|
2281
2353
|
}
|
|
2282
|
-
function
|
|
2354
|
+
function Ti(e) {
|
|
2283
2355
|
return {
|
|
2284
|
-
registry:
|
|
2356
|
+
registry: wi(e),
|
|
2285
2357
|
autoLogin: e.startsWith("ecr://")
|
|
2286
2358
|
};
|
|
2287
2359
|
}
|
|
2288
|
-
function
|
|
2289
|
-
let n = e === "dev", r = process.env[n ? v.PL_DEV_DOCKER_PUSH_URL : v.PL_RELEASE_DOCKER_PUSH_URL], i = process.env[n ? v.PL_DEV_DOCKER_PULL_URL : v.PL_RELEASE_DOCKER_PULL_URL], a = t.dockerPushTo ?? r ?? (n ? me.DEV_DOCKER_PUSH_TARGET : void 0), o = a ?
|
|
2360
|
+
function Ei(e, t) {
|
|
2361
|
+
let n = e === "dev", r = process.env[n ? v.PL_DEV_DOCKER_PUSH_URL : v.PL_RELEASE_DOCKER_PUSH_URL], i = process.env[n ? v.PL_DEV_DOCKER_PULL_URL : v.PL_RELEASE_DOCKER_PULL_URL], a = t.dockerPushTo ?? r ?? (n ? me.DEV_DOCKER_PUSH_TARGET : void 0), o = a ? Ti(a) : {
|
|
2290
2362
|
registry: void 0,
|
|
2291
2363
|
autoLogin: !1
|
|
2292
2364
|
}, s = t.dockerRegistry ?? i ?? a;
|
|
2293
2365
|
return {
|
|
2294
|
-
pull: s ?
|
|
2366
|
+
pull: s ? wi(s) : void 0,
|
|
2295
2367
|
push: o.registry,
|
|
2296
2368
|
autoLogin: o.autoLogin
|
|
2297
2369
|
};
|
|
2298
2370
|
}
|
|
2299
2371
|
//#endregion
|
|
2300
2372
|
//#region src/cmd/software/env.ts
|
|
2301
|
-
var
|
|
2373
|
+
var Di = "PL_BUILD_CHANNEL", Oi = "PL_BUILD_VARIANT", ki = "PL_BUILD_LOCATION", Ai = "PL_BUILD_USE_PUBLISHED";
|
|
2302
2374
|
v.PL_DOCKER_REGISTRY_PUSH_TO, v.PL_DEV_DOCKER_PUSH_URL, v.PL_DEV_DOCKER_PULL_URL, v.PL_DEV_BINARY_UPLOAD_URL, v.PL_RELEASE_DOCKER_PUSH_URL, v.PL_RELEASE_DOCKER_PULL_URL, v.PL_RELEASE_BINARY_UPLOAD_URL;
|
|
2303
2375
|
//#endregion
|
|
2304
2376
|
//#region src/cmd/software/build.ts
|
|
2305
|
-
function
|
|
2377
|
+
function ji() {
|
|
2306
2378
|
let e = new p("build").description("Build a software module for a target and write its .sw.json descriptor (build + push in one pass)");
|
|
2307
|
-
return e.addOption(new m("--channel <channel>", "registry channel to build for").choices([...
|
|
2379
|
+
return e.addOption(new m("--channel <channel>", "registry channel to build for").choices([...fi]).env(Di)), e.addOption(new m("--variant <variant>", "artifact kind to build (default: all declared)").choices([...pi]).env(Oi)), e.addOption(new m("--location <location>", "where the artifact lands (local = no push)").choices([...mi]).env(ki)), e.addOption(new m("--use-published", "do not build or push; emit a descriptor pointing at the already-published release artifact").env(Ai)), e.addOption(new m("--log-level <level>", "logging level").choices([
|
|
2308
2380
|
"error",
|
|
2309
2381
|
"warn",
|
|
2310
2382
|
"info",
|
|
@@ -2312,7 +2384,7 @@ function Ti() {
|
|
|
2312
2384
|
]).default("info")), e.addOption(new m("--package-root <path>", "path to directory with package.json file")), e.addOption(new m("--force", "force action, ignoring automatic safety checks").default(!1)), e.addOption(new m("--version <value>", "override package version (ignore package.json)")), e.addOption(new m("--platform <os-arch>", "{os}-{arch} pair; no effect on cross-platform packages").choices([...y.AllPlatforms]).env(v.PL_PKG_OS)), e.addOption(new m("--all-platforms", "build for all supported platforms").default(!1)), e.addOption(new m("--full-dir-hash", "hash file contents (not metadata) for the dev content hash").env(v.PL_PKG_FULL_HASH).default(!1)), e.addOption(new m("--package-id <id...>", "act only on selected packages")), e.addOption(new m("--content-root <path>", "override software content root").env(v.PL_PKG_CONTENT_ROOT)), e.addOption(new m("--storage-url <url>", "override binary upload registry URL").env(v.PL_PKG_STORAGE_URL)), e.addOption(new m("--docker-registry <registry>", "docker pull registry embedded in the descriptor").env(v.PL_DOCKER_REGISTRY)), e.addOption(new m("--docker-push-to <registry>", "alternative registry for docker push").env(v.PL_DOCKER_REGISTRY_PUSH_TO)), e.addOption(new m("--docker-build", "build docker images").env(v.PL_DOCKER_BUILD).default(!1)), e.addOption(new m("--docker-no-build", "do not build docker images").env(v.PL_DOCKER_NO_BUILD).default(!1)), e.addOption(new m("--docker-autopush", "push docker images after build").env(v.PL_DOCKER_AUTOPUSH).default(!1)), e.addOption(new m("--docker-no-autopush", "do not push docker images").env(v.PL_DOCKER_NO_AUTOPUSH).default(!1)), e.addOption(new m("--conda-build", "build conda environment before packing").env(v.PL_CONDA_BUILD).default(!1)), e.addOption(new m("--conda-no-build", "do not build conda environment").env(v.PL_CONDA_NO_BUILD).default(!1)), e.action(async (e) => {
|
|
2313
2385
|
let t = y.createLogger(e.logLevel);
|
|
2314
2386
|
try {
|
|
2315
|
-
let n =
|
|
2387
|
+
let n = hi({
|
|
2316
2388
|
channel: e.channel,
|
|
2317
2389
|
variant: e.variant,
|
|
2318
2390
|
location: e.location,
|
|
@@ -2328,7 +2400,7 @@ function Ti() {
|
|
|
2328
2400
|
enable: e.dockerAutopush,
|
|
2329
2401
|
disable: e.dockerNoAutopush
|
|
2330
2402
|
});
|
|
2331
|
-
await
|
|
2403
|
+
await Si({
|
|
2332
2404
|
core: r,
|
|
2333
2405
|
scenario: n,
|
|
2334
2406
|
logger: t,
|
|
@@ -2355,22 +2427,22 @@ function Ti() {
|
|
|
2355
2427
|
}
|
|
2356
2428
|
//#endregion
|
|
2357
2429
|
//#region src/cmd/software/index.ts
|
|
2358
|
-
function
|
|
2430
|
+
function Mi() {
|
|
2359
2431
|
let e = new p("software").description("Build and publish a block's software modules");
|
|
2360
|
-
return e.addCommand(
|
|
2432
|
+
return e.addCommand(ji()), e;
|
|
2361
2433
|
}
|
|
2362
2434
|
//#endregion
|
|
2363
2435
|
//#region src/cli.ts
|
|
2364
|
-
function
|
|
2436
|
+
function Ni(e = process.cwd()) {
|
|
2365
2437
|
let t = new p();
|
|
2366
|
-
t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(ve()), t.addCommand(be()), t.addCommand(xe()), t.addCommand(Ce()), t.addCommand(we()), t.addCommand(Te()), t.addCommand(
|
|
2438
|
+
t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(ve()), t.addCommand(be()), t.addCommand(xe()), t.addCommand(Ce()), t.addCommand(we()), t.addCommand(Te()), t.addCommand($r(e)), t.addCommand(ei()), t.addCommand(ti()), t.addCommand(ai()), t.addCommand(Mi());
|
|
2367
2439
|
let n = new p("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
|
|
2368
|
-
return n.addCommand(
|
|
2440
|
+
return n.addCommand(oi(e)), n.addCommand(di(e)), n.addCommand(Qr(e)), t.addCommand(n), t;
|
|
2369
2441
|
}
|
|
2370
|
-
async function
|
|
2371
|
-
await
|
|
2442
|
+
async function Pi(e, t) {
|
|
2443
|
+
await Ni(t).parseAsync(e);
|
|
2372
2444
|
}
|
|
2373
2445
|
//#endregion
|
|
2374
|
-
export {
|
|
2446
|
+
export { Ni as buildProgram, Pi as run };
|
|
2375
2447
|
|
|
2376
2448
|
//# sourceMappingURL=cli.mjs.map
|