@platforma-sdk/block-tools 2.10.19 → 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +11 -11
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +362 -352
- package/dist/cli.mjs.map +1 -1
- package/dist/structure/engine/builders.d.ts +7 -6
- package/dist/structure/engine/content-rules.d.ts +4 -4
- package/dist/structure/engine/ir.d.ts +11 -6
- package/dist/structure/rules/block-package-json.d.ts +1 -1
- package/dist/structure/rules/root-ci.d.ts +1 -0
- package/dist/v2/registry/schema_public.d.ts +150 -150
- package/package.json +6 -6
- package/src/structure/CLAUDE.md +2 -0
- package/src/structure/__tests__/discovery-shortname.test.ts +50 -0
- package/src/structure/__tests__/root-ci-workflows.test.ts +68 -0
- package/src/structure/engine/builders.ts +7 -6
- package/src/structure/engine/content-rules.ts +7 -7
- package/src/structure/engine/discovery-fs.ts +9 -1
- package/src/structure/engine/ir.ts +11 -6
- package/src/structure/engine/runner.ts +14 -14
- package/src/structure/rules/block-package-json.ts +2 -3
- package/src/structure/rules/block.ts +3 -4
- package/src/structure/rules/migrations.ts +1 -2
- package/src/structure/rules/model.ts +1 -2
- package/src/structure/rules/root-catalog-bump.ts +3 -4
- package/src/structure/rules/root-ci.ts +55 -0
- package/src/structure/rules/root.ts +2 -3
- package/src/structure/rules/software.ts +1 -2
- package/src/structure/rules/test.ts +1 -2
- package/src/structure/rules/ui.ts +3 -5
- package/src/structure/rules/workflow.ts +3 -5
- package/src/structure/structure-definition.ts +2 -0
- package/src/structure/templates/text/workflows/build.tpl.yaml +67 -0
- package/src/structure/templates/text/workflows/mark-stable.tpl.yaml +34 -0
package/dist/cli.mjs
CHANGED
|
@@ -550,10 +550,6 @@ function Ve(e, t) {
|
|
|
550
550
|
function He() {
|
|
551
551
|
return _;
|
|
552
552
|
}
|
|
553
|
-
function y() {
|
|
554
|
-
if (!_) throw Error("getActiveRunContext() called outside engine.run(). Generators only see the run context during a run.");
|
|
555
|
-
return _;
|
|
556
|
-
}
|
|
557
553
|
function Ue(e) {
|
|
558
554
|
if (g) throw Error("defineStructure() cannot be called from inside another defineStructure().");
|
|
559
555
|
let t = [], n = {
|
|
@@ -593,7 +589,7 @@ function We(e) {
|
|
|
593
589
|
throw Error(`defineStructure validation: path '${t}' under scope '${e}' is declared as both seed and ${n}. Seeds are block-author territory (written once at init, untouched thereafter); engine-managed primitives (fixed/managed/scaffold) rewrite on every refresh. The two contracts cannot coexist on the same path.`);
|
|
594
590
|
}
|
|
595
591
|
}
|
|
596
|
-
function
|
|
592
|
+
function y(e, t) {
|
|
597
593
|
let n = Be("scope");
|
|
598
594
|
if (n.inScope) throw Error("scope() cannot nest. Already inside a scope.");
|
|
599
595
|
let r = {
|
|
@@ -612,7 +608,7 @@ var Ge;
|
|
|
612
608
|
function Ke(e) {
|
|
613
609
|
Ge = e;
|
|
614
610
|
}
|
|
615
|
-
function
|
|
611
|
+
function b(e, t, n) {
|
|
616
612
|
qe(e, t), n && qe((t) => !e(t), n);
|
|
617
613
|
}
|
|
618
614
|
function qe(e, t) {
|
|
@@ -635,7 +631,7 @@ function Je(e, t) {
|
|
|
635
631
|
n.stack.pop();
|
|
636
632
|
}
|
|
637
633
|
}
|
|
638
|
-
function
|
|
634
|
+
function x(e) {
|
|
639
635
|
return (t) => t.filesMatch(e);
|
|
640
636
|
}
|
|
641
637
|
function Ye(e, t, n) {
|
|
@@ -654,14 +650,14 @@ function Ye(e, t, n) {
|
|
|
654
650
|
function Xe(e) {
|
|
655
651
|
Ye("onInitOrUpdate", ["init", "updateDeps"], e);
|
|
656
652
|
}
|
|
657
|
-
function
|
|
653
|
+
function S(e, t) {
|
|
658
654
|
v("fixed", {
|
|
659
655
|
kind: "fixed",
|
|
660
656
|
path: e,
|
|
661
657
|
content: t
|
|
662
658
|
});
|
|
663
659
|
}
|
|
664
|
-
function
|
|
660
|
+
function C(e, t, n) {
|
|
665
661
|
v("managed", {
|
|
666
662
|
kind: "managed",
|
|
667
663
|
path: e,
|
|
@@ -676,20 +672,20 @@ function Ze(e, t) {
|
|
|
676
672
|
initial: t
|
|
677
673
|
});
|
|
678
674
|
}
|
|
679
|
-
function
|
|
675
|
+
function w(e, t) {
|
|
680
676
|
v("seed", {
|
|
681
677
|
kind: "seed",
|
|
682
678
|
path: e,
|
|
683
679
|
initial: t
|
|
684
680
|
});
|
|
685
681
|
}
|
|
686
|
-
function
|
|
682
|
+
function T(e) {
|
|
687
683
|
v("remove", {
|
|
688
684
|
kind: "remove",
|
|
689
685
|
path: e
|
|
690
686
|
});
|
|
691
687
|
}
|
|
692
|
-
function
|
|
688
|
+
function E(e) {
|
|
693
689
|
return {
|
|
694
690
|
kind: "file",
|
|
695
691
|
path: e
|
|
@@ -707,7 +703,7 @@ function $e(e) {
|
|
|
707
703
|
value: e
|
|
708
704
|
};
|
|
709
705
|
}
|
|
710
|
-
function
|
|
706
|
+
function D(e, t) {
|
|
711
707
|
return {
|
|
712
708
|
kind: "tpl",
|
|
713
709
|
path: e,
|
|
@@ -720,34 +716,30 @@ function O(e) {
|
|
|
720
716
|
fn: e
|
|
721
717
|
};
|
|
722
718
|
}
|
|
723
|
-
function tt() {
|
|
724
|
-
if (!_) throw Error("blockVars() called outside engine.run(). Generators and managed bodies only see BlockVars during a run.");
|
|
725
|
-
return _.blockVars;
|
|
726
|
-
}
|
|
727
719
|
//#endregion
|
|
728
720
|
//#region src/structure/engine/parsers/json.ts
|
|
729
|
-
function
|
|
721
|
+
function et(e) {
|
|
730
722
|
return JSON.parse(e);
|
|
731
723
|
}
|
|
732
|
-
var
|
|
733
|
-
function
|
|
734
|
-
return e.length === 0 ? "[]" : "[" + e.map(
|
|
724
|
+
var tt = 100, nt = 2;
|
|
725
|
+
function rt(e) {
|
|
726
|
+
return e.length === 0 ? "[]" : "[" + e.map(it).join(", ") + "]";
|
|
735
727
|
}
|
|
736
|
-
function
|
|
737
|
-
if (Array.isArray(e)) return
|
|
728
|
+
function it(e) {
|
|
729
|
+
if (Array.isArray(e)) return rt(e);
|
|
738
730
|
if (A(e)) {
|
|
739
731
|
let t = Object.entries(e);
|
|
740
|
-
return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${
|
|
732
|
+
return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${it(t)}`).join(", ") + " }";
|
|
741
733
|
}
|
|
742
734
|
return JSON.stringify(e);
|
|
743
735
|
}
|
|
744
|
-
function
|
|
745
|
-
let i = t +
|
|
736
|
+
function at(e, t, n, r) {
|
|
737
|
+
let i = t + nt, a = " ".repeat(i);
|
|
746
738
|
if (Array.isArray(e)) {
|
|
747
|
-
let o =
|
|
748
|
-
if (n + o.length + r <=
|
|
739
|
+
let o = rt(e);
|
|
740
|
+
if (n + o.length + r <= tt) return o;
|
|
749
741
|
let s = e.length - 1;
|
|
750
|
-
return "[\n" + e.map((e, t) => a +
|
|
742
|
+
return "[\n" + e.map((e, t) => a + at(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
|
|
751
743
|
}
|
|
752
744
|
if (A(e)) {
|
|
753
745
|
let n = Object.entries(e);
|
|
@@ -755,13 +747,13 @@ function st(e, t, n, r) {
|
|
|
755
747
|
let r = n.length - 1;
|
|
756
748
|
return "{\n" + n.map(([e, t], n) => {
|
|
757
749
|
let o = `${a}${JSON.stringify(e)}: `;
|
|
758
|
-
return o +
|
|
750
|
+
return o + at(t, i, o.length, n === r ? 0 : 1);
|
|
759
751
|
}).join(",\n") + "\n" + " ".repeat(t) + "}";
|
|
760
752
|
}
|
|
761
753
|
return JSON.stringify(e);
|
|
762
754
|
}
|
|
763
|
-
function
|
|
764
|
-
return t?.collapse ?
|
|
755
|
+
function ot(e, t) {
|
|
756
|
+
return t?.collapse ? at(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
|
|
765
757
|
}
|
|
766
758
|
function k(e) {
|
|
767
759
|
return e === "" || e === void 0 ? [] : e.split(".");
|
|
@@ -769,7 +761,7 @@ function k(e) {
|
|
|
769
761
|
function A(e) {
|
|
770
762
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
771
763
|
}
|
|
772
|
-
function
|
|
764
|
+
function st(e, t) {
|
|
773
765
|
let n = k(t), r = e;
|
|
774
766
|
for (let e of n) {
|
|
775
767
|
if (!A(r)) return;
|
|
@@ -777,7 +769,7 @@ function lt(e, t) {
|
|
|
777
769
|
}
|
|
778
770
|
return r;
|
|
779
771
|
}
|
|
780
|
-
function
|
|
772
|
+
function ct(e, t) {
|
|
781
773
|
let n = k(t);
|
|
782
774
|
if (n.length === 0) return !0;
|
|
783
775
|
let r = e;
|
|
@@ -787,7 +779,7 @@ function ut(e, t) {
|
|
|
787
779
|
}
|
|
788
780
|
return A(r) ? n[n.length - 1] in r : !1;
|
|
789
781
|
}
|
|
790
|
-
function
|
|
782
|
+
function lt(e, t, n) {
|
|
791
783
|
let r = k(t);
|
|
792
784
|
if (r.length === 0) throw Error("setAtPath: jsonPath must be non-empty");
|
|
793
785
|
let i = e;
|
|
@@ -801,7 +793,7 @@ function dt(e, t, n) {
|
|
|
801
793
|
}
|
|
802
794
|
i[r[r.length - 1]] = n;
|
|
803
795
|
}
|
|
804
|
-
function
|
|
796
|
+
function ut(e, t) {
|
|
805
797
|
let n = k(t);
|
|
806
798
|
if (n.length === 0) throw Error("deleteAtPath: jsonPath must be non-empty");
|
|
807
799
|
let r = e;
|
|
@@ -811,7 +803,7 @@ function ft(e, t) {
|
|
|
811
803
|
}
|
|
812
804
|
A(r) && delete r[n[n.length - 1]];
|
|
813
805
|
}
|
|
814
|
-
function
|
|
806
|
+
function dt(e, t) {
|
|
815
807
|
let n = new Set(t), r = Object.keys(e), i = /* @__PURE__ */ new Map();
|
|
816
808
|
i.set("", []);
|
|
817
809
|
let a = "";
|
|
@@ -826,62 +818,62 @@ function pt(e, t) {
|
|
|
826
818
|
}
|
|
827
819
|
//#endregion
|
|
828
820
|
//#region src/structure/engine/parsers/lines.ts
|
|
829
|
-
function
|
|
821
|
+
function ft(e) {
|
|
830
822
|
let t = e.split("\n");
|
|
831
823
|
return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
|
|
832
824
|
}
|
|
833
|
-
function
|
|
825
|
+
function pt(e) {
|
|
834
826
|
return e.join("\n") + "\n";
|
|
835
827
|
}
|
|
836
|
-
function
|
|
828
|
+
function mt(e) {
|
|
837
829
|
return e.replace(/(^|\s)#.*$/, "$1").trim();
|
|
838
830
|
}
|
|
839
|
-
function
|
|
840
|
-
let n =
|
|
831
|
+
function ht(e, t) {
|
|
832
|
+
let n = mt(e);
|
|
841
833
|
return n === "" ? !1 : n === t.trim();
|
|
842
834
|
}
|
|
843
|
-
function
|
|
844
|
-
for (let n of e) if (
|
|
835
|
+
function gt(e, t) {
|
|
836
|
+
for (let n of e) if (ht(n, t)) return !0;
|
|
845
837
|
return !1;
|
|
846
838
|
}
|
|
847
839
|
//#endregion
|
|
848
840
|
//#region src/structure/engine/content-rules.ts
|
|
849
|
-
function
|
|
841
|
+
function _t(e, t) {
|
|
850
842
|
return e === "sdk:" ? t ? "workspace:*" : "catalog:" : e;
|
|
851
843
|
}
|
|
852
|
-
var
|
|
844
|
+
var vt = [
|
|
853
845
|
"dependencies",
|
|
854
846
|
"devDependencies",
|
|
855
847
|
"peerDependencies",
|
|
856
848
|
"optionalDependencies"
|
|
857
849
|
];
|
|
858
|
-
function
|
|
859
|
-
if (P(e)) for (let n of
|
|
850
|
+
function yt(e, t) {
|
|
851
|
+
if (P(e)) for (let n of vt) {
|
|
860
852
|
let r = e[n];
|
|
861
853
|
if (P(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
|
|
862
854
|
}
|
|
863
855
|
}
|
|
864
856
|
var j;
|
|
865
|
-
function
|
|
857
|
+
function bt(e) {
|
|
866
858
|
if (!j) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
|
|
867
859
|
return j;
|
|
868
860
|
}
|
|
869
861
|
function M(e) {
|
|
870
|
-
let t =
|
|
862
|
+
let t = bt(e);
|
|
871
863
|
if (t.kind !== "json") throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);
|
|
872
864
|
return t;
|
|
873
865
|
}
|
|
874
866
|
function N(e) {
|
|
875
|
-
let t =
|
|
867
|
+
let t = bt(e);
|
|
876
868
|
if (t.kind !== "yaml") throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);
|
|
877
869
|
return t;
|
|
878
870
|
}
|
|
879
|
-
function
|
|
880
|
-
let t =
|
|
871
|
+
function xt(e) {
|
|
872
|
+
let t = bt(e);
|
|
881
873
|
if (t.kind !== "lines") throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);
|
|
882
874
|
return t;
|
|
883
875
|
}
|
|
884
|
-
function
|
|
876
|
+
function St(e, t) {
|
|
885
877
|
let n = e.ctx ?? He();
|
|
886
878
|
if (!n) throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);
|
|
887
879
|
return n;
|
|
@@ -889,7 +881,7 @@ function wt(e, t) {
|
|
|
889
881
|
function P(e) {
|
|
890
882
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
891
883
|
}
|
|
892
|
-
function
|
|
884
|
+
function Ct(e, t, n = {}) {
|
|
893
885
|
if (j) throw Error("Nested managed(...) body — engine bug.");
|
|
894
886
|
j = {
|
|
895
887
|
kind: "json",
|
|
@@ -898,12 +890,12 @@ function Tt(e, t, n = {}) {
|
|
|
898
890
|
triggerContext: n.triggerContext
|
|
899
891
|
};
|
|
900
892
|
try {
|
|
901
|
-
return t(), e;
|
|
893
|
+
return t(n.ctx ?? n.triggerContext?.ctx), e;
|
|
902
894
|
} finally {
|
|
903
895
|
j = void 0;
|
|
904
896
|
}
|
|
905
897
|
}
|
|
906
|
-
function
|
|
898
|
+
function wt(e, t, n = {}) {
|
|
907
899
|
if (j) throw Error("Nested managed(...) body — engine bug.");
|
|
908
900
|
j = {
|
|
909
901
|
kind: "yaml",
|
|
@@ -914,12 +906,12 @@ function Et(e, t, n = {}) {
|
|
|
914
906
|
getDerivedDependencyPin: n.getDerivedDependencyPin
|
|
915
907
|
};
|
|
916
908
|
try {
|
|
917
|
-
return t(), e;
|
|
909
|
+
return t(n.ctx ?? n.triggerContext?.ctx), e;
|
|
918
910
|
} finally {
|
|
919
911
|
j = void 0;
|
|
920
912
|
}
|
|
921
913
|
}
|
|
922
|
-
function
|
|
914
|
+
function Tt(e, t, n = {}) {
|
|
923
915
|
if (j) throw Error("Nested managed(...) body — engine bug.");
|
|
924
916
|
j = {
|
|
925
917
|
kind: "lines",
|
|
@@ -928,7 +920,7 @@ function Dt(e, t, n = {}) {
|
|
|
928
920
|
triggerContext: n.triggerContext
|
|
929
921
|
};
|
|
930
922
|
try {
|
|
931
|
-
return t(), e;
|
|
923
|
+
return t(n.ctx ?? n.triggerContext?.ctx), e;
|
|
932
924
|
} finally {
|
|
933
925
|
j = void 0;
|
|
934
926
|
}
|
|
@@ -940,27 +932,27 @@ Ke((e, t) => {
|
|
|
940
932
|
return e(n) && t(), !0;
|
|
941
933
|
});
|
|
942
934
|
function F(e, t) {
|
|
943
|
-
|
|
935
|
+
lt(M("ensureField").obj, e, t);
|
|
944
936
|
}
|
|
945
|
-
function
|
|
937
|
+
function Et(e, t) {
|
|
946
938
|
let n = M("removeField").obj;
|
|
947
|
-
|
|
939
|
+
ct(n, e) && (t && !t(st(n, e)) || ut(n, e));
|
|
948
940
|
}
|
|
949
941
|
function I(e, t) {
|
|
950
942
|
F(`scripts.${e}`, t);
|
|
951
943
|
}
|
|
952
944
|
function L(e) {
|
|
953
|
-
|
|
945
|
+
Et(`scripts.${e}`);
|
|
954
946
|
}
|
|
955
|
-
var
|
|
947
|
+
var Dt = [
|
|
956
948
|
"dependencies",
|
|
957
949
|
"devDependencies",
|
|
958
950
|
"peerDependencies",
|
|
959
951
|
"optionalDependencies"
|
|
960
952
|
];
|
|
961
953
|
function R(e, t, n, r) {
|
|
962
|
-
let i = M(e), a = i.obj, o = n === "sdk:" ?
|
|
963
|
-
for (let e of
|
|
954
|
+
let i = M(e), a = i.obj, o = n === "sdk:" ? _t(n, St(i, e).isSdkInternal) : n;
|
|
955
|
+
for (let e of Dt) {
|
|
964
956
|
if (e === r) continue;
|
|
965
957
|
let n = a[e];
|
|
966
958
|
P(n) && t in n && delete n[t];
|
|
@@ -974,12 +966,12 @@ function z(e, t) {
|
|
|
974
966
|
function B(e, t) {
|
|
975
967
|
R("ensureDevDep", e, t, "devDependencies");
|
|
976
968
|
}
|
|
977
|
-
function
|
|
969
|
+
function Ot(e, t) {
|
|
978
970
|
R("ensurePeerDep", e, t, "peerDependencies");
|
|
979
971
|
}
|
|
980
972
|
function V(e) {
|
|
981
973
|
let t = M("removeDep").obj;
|
|
982
|
-
for (let n of
|
|
974
|
+
for (let n of Dt) {
|
|
983
975
|
let r = t[n];
|
|
984
976
|
P(r) && e in r && delete r[e];
|
|
985
977
|
}
|
|
@@ -988,105 +980,105 @@ function H(e) {
|
|
|
988
980
|
for (let [t, n] of Object.entries(e)) B(t, n);
|
|
989
981
|
}
|
|
990
982
|
function U(e) {
|
|
991
|
-
for (let [t, n] of Object.entries(e))
|
|
983
|
+
for (let [t, n] of Object.entries(e)) Ot(t, n);
|
|
992
984
|
}
|
|
993
|
-
function
|
|
994
|
-
let r =
|
|
985
|
+
function kt(e, t, n) {
|
|
986
|
+
let r = St(M(e), e);
|
|
995
987
|
for (let i of r.modules) i.scope === t && R(e, i.name, "workspace:*", n);
|
|
996
988
|
}
|
|
997
989
|
function W(e) {
|
|
998
|
-
|
|
990
|
+
kt("ensureWorkspaceScopeDeps", e, "dependencies");
|
|
999
991
|
}
|
|
1000
|
-
function
|
|
992
|
+
function At(e) {
|
|
1001
993
|
let t = M("pruneKeysMatching").obj;
|
|
1002
994
|
for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
|
|
1003
995
|
}
|
|
1004
|
-
function
|
|
1005
|
-
let n =
|
|
996
|
+
function jt(e, t) {
|
|
997
|
+
let n = dt(e, t);
|
|
1006
998
|
for (let t of Object.keys(e)) delete e[t];
|
|
1007
999
|
for (let t of Object.keys(n)) e[t] = n[t];
|
|
1008
1000
|
}
|
|
1009
1001
|
function G(e) {
|
|
1010
|
-
|
|
1002
|
+
jt(M("enforceFieldOrder").obj, e);
|
|
1011
1003
|
}
|
|
1012
|
-
function
|
|
1004
|
+
function Mt(e, t) {
|
|
1013
1005
|
let n = Object.keys(e).sort(), r = {};
|
|
1014
1006
|
for (let t of n) r[t] = e[t];
|
|
1015
1007
|
for (let t of Object.keys(e)) delete e[t];
|
|
1016
|
-
for (let i of n) e[i] = r[i], t && P(e[i]) &&
|
|
1008
|
+
for (let i of n) e[i] = r[i], t && P(e[i]) && Mt(e[i], !0);
|
|
1017
1009
|
}
|
|
1018
1010
|
function K(e = "", t = {}) {
|
|
1019
1011
|
let n = t.recursive ?? !1;
|
|
1020
1012
|
if (e === "" && !n) return;
|
|
1021
1013
|
let r = M("enforceAlphabeticalOrder").obj;
|
|
1022
1014
|
if (e === "") {
|
|
1023
|
-
|
|
1015
|
+
Mt(r, !0);
|
|
1024
1016
|
return;
|
|
1025
1017
|
}
|
|
1026
|
-
let i =
|
|
1027
|
-
P(i) &&
|
|
1018
|
+
let i = st(r, e);
|
|
1019
|
+
P(i) && Mt(i, n);
|
|
1028
1020
|
}
|
|
1029
|
-
function
|
|
1030
|
-
let e = N("ensureWorkspaceModulePaths"), t =
|
|
1021
|
+
function Nt() {
|
|
1022
|
+
let e = N("ensureWorkspaceModulePaths"), t = St(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
|
|
1031
1023
|
Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
|
|
1032
1024
|
}
|
|
1033
|
-
function
|
|
1025
|
+
function Pt(e, t) {
|
|
1034
1026
|
let n = e.doc.getIn(["catalog", t]);
|
|
1035
1027
|
return typeof n == "string" ? n : void 0;
|
|
1036
1028
|
}
|
|
1037
|
-
function
|
|
1029
|
+
function Ft(e, t) {
|
|
1038
1030
|
let n = N("ensureCatalogVersion");
|
|
1039
|
-
|
|
1031
|
+
Pt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
|
|
1040
1032
|
}
|
|
1041
|
-
function
|
|
1033
|
+
function It(e) {
|
|
1042
1034
|
let t = N("ensureCatalogLatest");
|
|
1043
1035
|
if (!t.getLatestVersion) return;
|
|
1044
1036
|
let n = t.getLatestVersion(e);
|
|
1045
|
-
n !== void 0 &&
|
|
1037
|
+
n !== void 0 && Pt(t, e) !== n && t.doc.setIn(["catalog", e], n);
|
|
1046
1038
|
}
|
|
1047
|
-
function
|
|
1039
|
+
function Lt(e, t) {
|
|
1048
1040
|
let n = N("pinCatalogToDependencyOf");
|
|
1049
1041
|
if (!n.getDerivedDependencyPin) return;
|
|
1050
1042
|
let r = n.getDerivedDependencyPin(e);
|
|
1051
|
-
r !== void 0 &&
|
|
1043
|
+
r !== void 0 && Pt(n, e) !== r && n.doc.setIn(["catalog", e], r);
|
|
1052
1044
|
}
|
|
1053
|
-
function
|
|
1045
|
+
function Rt(e) {
|
|
1054
1046
|
let t = N("ensureCatalogAbsent");
|
|
1055
1047
|
t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
|
|
1056
1048
|
}
|
|
1057
|
-
function
|
|
1058
|
-
let t =
|
|
1059
|
-
for (let n of e)
|
|
1049
|
+
function zt(e) {
|
|
1050
|
+
let t = xt("ensureGitignoreEntries");
|
|
1051
|
+
for (let n of e) gt(t.lines, n) || t.lines.push(n);
|
|
1060
1052
|
}
|
|
1061
1053
|
//#endregion
|
|
1062
1054
|
//#region src/structure/engine/parsers/yaml.ts
|
|
1063
|
-
function
|
|
1055
|
+
function Bt(e) {
|
|
1064
1056
|
return se(e);
|
|
1065
1057
|
}
|
|
1066
|
-
function
|
|
1058
|
+
function Vt(e) {
|
|
1067
1059
|
return e.toString();
|
|
1068
1060
|
}
|
|
1069
|
-
var
|
|
1070
|
-
function
|
|
1071
|
-
if (e < t) throw new
|
|
1061
|
+
var Ht = ".structure";
|
|
1062
|
+
function Ut(e, t = 0) {
|
|
1063
|
+
if (e < t) throw new Wt(e, t);
|
|
1072
1064
|
}
|
|
1073
|
-
var
|
|
1065
|
+
var Wt = class extends Error {
|
|
1074
1066
|
constructor(e, t) {
|
|
1075
1067
|
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";
|
|
1076
1068
|
}
|
|
1077
1069
|
};
|
|
1078
|
-
function
|
|
1070
|
+
function Gt(e, t = 1) {
|
|
1079
1071
|
let n = { version: t };
|
|
1080
|
-
e.write(
|
|
1072
|
+
e.write(Ht, JSON.stringify(n));
|
|
1081
1073
|
}
|
|
1082
1074
|
//#endregion
|
|
1083
1075
|
//#region src/structure/engine/runner.ts
|
|
1084
|
-
var
|
|
1076
|
+
var Kt = class extends Error {
|
|
1085
1077
|
constructor(e) {
|
|
1086
1078
|
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";
|
|
1087
1079
|
}
|
|
1088
1080
|
};
|
|
1089
|
-
function
|
|
1081
|
+
function qt(e, t, n, r) {
|
|
1090
1082
|
switch (e.kind) {
|
|
1091
1083
|
case "text": return e.value;
|
|
1092
1084
|
case "file":
|
|
@@ -1094,10 +1086,10 @@ function Yt(e, t, n, r) {
|
|
|
1094
1086
|
return n.staticRead(e.path);
|
|
1095
1087
|
case "tpl":
|
|
1096
1088
|
if (!n) throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
1097
|
-
return Ae(n.textRead(e.path), typeof e.vars == "function" ? e.vars() : e.vars);
|
|
1089
|
+
return Ae(n.textRead(e.path), typeof e.vars == "function" ? e.vars(r) : e.vars);
|
|
1098
1090
|
case "generate": {
|
|
1099
|
-
let n = e.fn();
|
|
1100
|
-
if (t.endsWith(".json")) return
|
|
1091
|
+
let n = e.fn(r);
|
|
1092
|
+
if (t.endsWith(".json")) return yt(n, r.isSdkInternal), ot(n, { collapse: !t.endsWith("package.json") });
|
|
1101
1093
|
if (t.endsWith(".yaml") || t.endsWith(".yml")) return ce(n);
|
|
1102
1094
|
if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
|
|
1103
1095
|
return n;
|
|
@@ -1105,36 +1097,36 @@ function Yt(e, t, n, r) {
|
|
|
1105
1097
|
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.`);
|
|
1106
1098
|
}
|
|
1107
1099
|
}
|
|
1108
|
-
function
|
|
1100
|
+
function Jt(e, t, n, r, i) {
|
|
1109
1101
|
if (n.kind === "binary") {
|
|
1110
1102
|
if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
1111
1103
|
e.writeBinary(t, r.staticReadBinary(n.path));
|
|
1112
1104
|
return;
|
|
1113
1105
|
}
|
|
1114
|
-
e.write(t,
|
|
1106
|
+
e.write(t, qt(n, t, r, i));
|
|
1115
1107
|
}
|
|
1116
|
-
function
|
|
1108
|
+
function Yt(e, t, n, r, i, a) {
|
|
1117
1109
|
let o = e.split("/").pop() ?? e;
|
|
1118
1110
|
if (e.endsWith(".json")) {
|
|
1119
|
-
let i =
|
|
1111
|
+
let i = et(t);
|
|
1120
1112
|
if (typeof i != "object" || !i || Array.isArray(i)) throw Error(`managed: parsed value at '${e}' is not a JSON object`);
|
|
1121
|
-
return
|
|
1113
|
+
return Ct(i, n, { triggerContext: r }), ot(i, { collapse: o !== "package.json" });
|
|
1122
1114
|
}
|
|
1123
1115
|
if (e.endsWith(".yaml") || e.endsWith(".yml")) {
|
|
1124
|
-
let e =
|
|
1125
|
-
return
|
|
1116
|
+
let e = Bt(t);
|
|
1117
|
+
return wt(e, n, {
|
|
1126
1118
|
triggerContext: r,
|
|
1127
1119
|
getLatestVersion: i,
|
|
1128
1120
|
getDerivedDependencyPin: a
|
|
1129
|
-
}),
|
|
1121
|
+
}), Vt(e);
|
|
1130
1122
|
}
|
|
1131
1123
|
if (o === ".gitignore" || o.endsWith(".gitignore")) {
|
|
1132
|
-
let e =
|
|
1133
|
-
return
|
|
1124
|
+
let e = ft(t);
|
|
1125
|
+
return Tt(e, n, { triggerContext: r }), pt(e);
|
|
1134
1126
|
}
|
|
1135
1127
|
throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
|
|
1136
1128
|
}
|
|
1137
|
-
function
|
|
1129
|
+
function Xt(e) {
|
|
1138
1130
|
let t = e.list(""), n = /* @__PURE__ */ new Set();
|
|
1139
1131
|
for (let e of t) {
|
|
1140
1132
|
n.add(e);
|
|
@@ -1143,16 +1135,16 @@ function Qt(e) {
|
|
|
1143
1135
|
}
|
|
1144
1136
|
return n;
|
|
1145
1137
|
}
|
|
1146
|
-
function
|
|
1138
|
+
function Zt(e, t) {
|
|
1147
1139
|
let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
|
|
1148
1140
|
return e.has(n);
|
|
1149
1141
|
}
|
|
1150
|
-
function
|
|
1142
|
+
function Qt(e, t, n) {
|
|
1151
1143
|
return {
|
|
1152
1144
|
ctx: t,
|
|
1153
1145
|
version: t.version,
|
|
1154
|
-
pathExists: (t) =>
|
|
1155
|
-
pathMissing: (t) =>
|
|
1146
|
+
pathExists: (t) => Zt(e, t),
|
|
1147
|
+
pathMissing: (t) => !Zt(e, t),
|
|
1156
1148
|
filesMatch: (t) => {
|
|
1157
1149
|
let r = n ? `${n}/${t}` : t;
|
|
1158
1150
|
for (let t of e) if (ze(r, t)) return !0;
|
|
@@ -1160,20 +1152,20 @@ function en(e, t, n) {
|
|
|
1160
1152
|
}
|
|
1161
1153
|
};
|
|
1162
1154
|
}
|
|
1163
|
-
function
|
|
1155
|
+
function $t(e, t) {
|
|
1164
1156
|
for (let n of e.triggers) if (!n(t)) return !1;
|
|
1165
1157
|
return !0;
|
|
1166
1158
|
}
|
|
1167
|
-
function
|
|
1159
|
+
function en(e, t) {
|
|
1168
1160
|
return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
|
|
1169
1161
|
}
|
|
1170
|
-
function
|
|
1162
|
+
function tn(e, t) {
|
|
1171
1163
|
return e.filter((e) => e.modes.includes(t));
|
|
1172
1164
|
}
|
|
1173
|
-
function
|
|
1165
|
+
function nn(e, t, n, r, i, a) {
|
|
1174
1166
|
let o = e.leaf;
|
|
1175
1167
|
if (o.kind === "fixed") {
|
|
1176
|
-
let i =
|
|
1168
|
+
let i = qt(o.content, e.resolvedPath, r, a);
|
|
1177
1169
|
return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
|
|
1178
1170
|
scope: e.scope,
|
|
1179
1171
|
path: e.resolvedPath,
|
|
@@ -1186,13 +1178,13 @@ function an(e, t, n, r, i, a) {
|
|
|
1186
1178
|
action: "create"
|
|
1187
1179
|
});
|
|
1188
1180
|
}
|
|
1189
|
-
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
1181
|
+
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || Jt(t, e.resolvedPath, o.initial, r, a), {
|
|
1190
1182
|
scope: e.scope,
|
|
1191
1183
|
path: e.resolvedPath,
|
|
1192
1184
|
primitive: "scaffold",
|
|
1193
1185
|
action: "create"
|
|
1194
1186
|
});
|
|
1195
|
-
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
1187
|
+
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || Jt(t, e.resolvedPath, o.initial, r, a), {
|
|
1196
1188
|
scope: e.scope,
|
|
1197
1189
|
path: e.resolvedPath,
|
|
1198
1190
|
primitive: "seed",
|
|
@@ -1215,11 +1207,11 @@ function an(e, t, n, r, i, a) {
|
|
|
1215
1207
|
});
|
|
1216
1208
|
}
|
|
1217
1209
|
}
|
|
1218
|
-
function
|
|
1210
|
+
function rn(e, t, n, r, i, a, o, s) {
|
|
1219
1211
|
if (e.leaf.kind !== "managed") return;
|
|
1220
1212
|
let c = e.leaf, l = e.resolvedPath, ee = t.exists(l), u, d = !1;
|
|
1221
|
-
ee ? u = t.read(l) : (u =
|
|
1222
|
-
let f =
|
|
1213
|
+
ee ? u = t.read(l) : (u = qt(c.initial, l, i, s), d = !0);
|
|
1214
|
+
let f = Yt(l, u, c.body, r, a, o);
|
|
1223
1215
|
if (d) return n || t.write(l, f), {
|
|
1224
1216
|
scope: e.scope,
|
|
1225
1217
|
path: l,
|
|
@@ -1233,40 +1225,40 @@ function on(e, t, n, r, i, a, o, s) {
|
|
|
1233
1225
|
action: "update"
|
|
1234
1226
|
};
|
|
1235
1227
|
}
|
|
1236
|
-
function
|
|
1237
|
-
let c =
|
|
1228
|
+
function an(e, t, n, r, i, a, o, s) {
|
|
1229
|
+
let c = tn(e, en(n, a)), l = [], ee = Xt(t);
|
|
1238
1230
|
for (let e of c) {
|
|
1239
|
-
if (e.leaf.kind === "managed" ||
|
|
1240
|
-
let o =
|
|
1231
|
+
if (e.leaf.kind === "managed" || !$t(e, Qt(ee, n, e.modulePath))) continue;
|
|
1232
|
+
let o = nn(e, t, r, i, a, n);
|
|
1241
1233
|
o && l.push(o);
|
|
1242
1234
|
}
|
|
1243
|
-
let u =
|
|
1235
|
+
let u = Xt(t);
|
|
1244
1236
|
for (let e of c) {
|
|
1245
1237
|
if (e.leaf.kind !== "managed") continue;
|
|
1246
|
-
let a =
|
|
1247
|
-
if (
|
|
1248
|
-
let c =
|
|
1238
|
+
let a = Qt(u, n, e.modulePath);
|
|
1239
|
+
if (!$t(e, a)) continue;
|
|
1240
|
+
let c = rn(e, t, r, a, i, o, s, n);
|
|
1249
1241
|
c && l.push(c);
|
|
1250
1242
|
}
|
|
1251
1243
|
return l;
|
|
1252
1244
|
}
|
|
1253
|
-
function
|
|
1245
|
+
function on(e, t, n, r = {}) {
|
|
1254
1246
|
return Ve(n, () => {
|
|
1255
|
-
let i = Pe(e, n), a = !!r.initMode, o =
|
|
1247
|
+
let i = Pe(e, n), a = !!r.initMode, o = an(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
|
|
1256
1248
|
if (!n.dryRun && !n.updateDepsOnly && !a) {
|
|
1257
|
-
|
|
1249
|
+
Gt(t);
|
|
1258
1250
|
let i = {
|
|
1259
1251
|
...r.rediscover ? r.rediscover(t) : n,
|
|
1260
1252
|
dryRun: !0
|
|
1261
|
-
}, a =
|
|
1262
|
-
if (a.length > 0) throw new
|
|
1253
|
+
}, a = an(Pe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Ht);
|
|
1254
|
+
if (a.length > 0) throw new Kt(a[0]);
|
|
1263
1255
|
}
|
|
1264
|
-
return a && !n.dryRun &&
|
|
1256
|
+
return a && !n.dryRun && Gt(t), { changes: o };
|
|
1265
1257
|
});
|
|
1266
1258
|
}
|
|
1267
1259
|
//#endregion
|
|
1268
1260
|
//#region src/structure/engine/discovery.ts
|
|
1269
|
-
var
|
|
1261
|
+
var sn = [
|
|
1270
1262
|
"root",
|
|
1271
1263
|
"block",
|
|
1272
1264
|
"model",
|
|
@@ -1274,12 +1266,12 @@ var ln = [
|
|
|
1274
1266
|
"workflow",
|
|
1275
1267
|
"test",
|
|
1276
1268
|
"software"
|
|
1277
|
-
],
|
|
1269
|
+
], cn = class extends Error {
|
|
1278
1270
|
constructor(e, t) {
|
|
1279
1271
|
super(e), this.path = t, this.name = "DiscoveryError";
|
|
1280
1272
|
}
|
|
1281
1273
|
};
|
|
1282
|
-
function
|
|
1274
|
+
function ln(e) {
|
|
1283
1275
|
let t = /* @__PURE__ */ new Set();
|
|
1284
1276
|
for (let n of [
|
|
1285
1277
|
e.dependencies,
|
|
@@ -1289,17 +1281,17 @@ function dn(e) {
|
|
|
1289
1281
|
]) if (n) for (let e of Object.keys(n)) t.add(e);
|
|
1290
1282
|
return t;
|
|
1291
1283
|
}
|
|
1292
|
-
function
|
|
1284
|
+
function un(e) {
|
|
1293
1285
|
return e === "" || e === ".";
|
|
1294
1286
|
}
|
|
1295
|
-
function
|
|
1287
|
+
function dn(e, t) {
|
|
1296
1288
|
let n = e.pkg["block-scope"];
|
|
1297
1289
|
if (typeof n == "string") {
|
|
1298
|
-
if (!
|
|
1290
|
+
if (!sn.includes(n)) throw new cn(`package.json "block-scope" must be one of ${sn.join(", ")}, got '${n}'`, e.path);
|
|
1299
1291
|
return n;
|
|
1300
1292
|
}
|
|
1301
|
-
if (
|
|
1302
|
-
let r =
|
|
1293
|
+
if (un(e.path)) return "root";
|
|
1294
|
+
let r = ln(e.pkg);
|
|
1303
1295
|
if (e.pkg["block-software"] !== void 0) return "software";
|
|
1304
1296
|
if (r.has("@platforma-sdk/package-builder")) {
|
|
1305
1297
|
for (let e of r) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
|
|
@@ -1314,17 +1306,17 @@ function pn(e, t) {
|
|
|
1314
1306
|
if (r.has("@platforma-sdk/model") && e.pkg.main) return "model";
|
|
1315
1307
|
if (r.has("@platforma-sdk/test")) return "test";
|
|
1316
1308
|
}
|
|
1317
|
-
function
|
|
1309
|
+
function fn(e) {
|
|
1318
1310
|
let t = /* @__PURE__ */ new Set();
|
|
1319
1311
|
for (let n of e) typeof n.pkg.name == "string" && t.add(n.pkg.name);
|
|
1320
1312
|
let n = [];
|
|
1321
1313
|
for (let r of e) {
|
|
1322
|
-
let e =
|
|
1323
|
-
if (!e) throw new
|
|
1314
|
+
let e = dn(r, t);
|
|
1315
|
+
if (!e) throw new cn(`Unclassified workspace package at '${r.path}'. Add a top-level "block-scope" string to its package.json.`, r.path);
|
|
1324
1316
|
n.push({
|
|
1325
1317
|
scope: e,
|
|
1326
1318
|
name: r.pkg.name ?? r.path,
|
|
1327
|
-
path:
|
|
1319
|
+
path: un(r.path) ? "" : r.path
|
|
1328
1320
|
});
|
|
1329
1321
|
}
|
|
1330
1322
|
return n;
|
|
@@ -1334,21 +1326,21 @@ function mn(e) {
|
|
|
1334
1326
|
function q(e, t) {
|
|
1335
1327
|
return e.modules.filter((e) => e.scope === t);
|
|
1336
1328
|
}
|
|
1337
|
-
function
|
|
1329
|
+
function pn(e, t) {
|
|
1338
1330
|
let n = q(e, t);
|
|
1339
1331
|
if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
|
|
1340
1332
|
if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
|
|
1341
1333
|
return n[0];
|
|
1342
1334
|
}
|
|
1343
|
-
function
|
|
1344
|
-
return { [
|
|
1335
|
+
function mn(e, t) {
|
|
1336
|
+
return { [pn(e, t).name]: "workspace:*" };
|
|
1345
1337
|
}
|
|
1346
|
-
function
|
|
1338
|
+
function hn(e, t) {
|
|
1347
1339
|
let n = {};
|
|
1348
1340
|
for (let r of q(e, t)) n[r.name] = "workspace:*";
|
|
1349
1341
|
return n;
|
|
1350
1342
|
}
|
|
1351
|
-
function
|
|
1343
|
+
function gn(e) {
|
|
1352
1344
|
let t = e.facadeName, n = [
|
|
1353
1345
|
{
|
|
1354
1346
|
scope: "root",
|
|
@@ -1387,7 +1379,7 @@ function _n(e) {
|
|
|
1387
1379
|
path: "software"
|
|
1388
1380
|
}), n;
|
|
1389
1381
|
}
|
|
1390
|
-
function
|
|
1382
|
+
function _n(e) {
|
|
1391
1383
|
return {
|
|
1392
1384
|
isSdkInternal: e.isSdkInternal ?? !1,
|
|
1393
1385
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
@@ -1399,41 +1391,41 @@ function vn(e) {
|
|
|
1399
1391
|
}
|
|
1400
1392
|
//#endregion
|
|
1401
1393
|
//#region src/structure/engine/discovery-fs.ts
|
|
1402
|
-
var
|
|
1394
|
+
var J = class extends Error {
|
|
1403
1395
|
constructor(e) {
|
|
1404
1396
|
super(e), this.name = "StructureCliError";
|
|
1405
1397
|
}
|
|
1406
1398
|
};
|
|
1407
|
-
function
|
|
1399
|
+
function vn(e, t) {
|
|
1408
1400
|
return e === "" ? t : `${e}/${t}`;
|
|
1409
1401
|
}
|
|
1410
|
-
function
|
|
1402
|
+
function yn(e, t) {
|
|
1411
1403
|
try {
|
|
1412
1404
|
return JSON.parse(e.read(t));
|
|
1413
1405
|
} catch {
|
|
1414
1406
|
return;
|
|
1415
1407
|
}
|
|
1416
1408
|
}
|
|
1417
|
-
function
|
|
1418
|
-
if (e.includes("*")) throw new
|
|
1409
|
+
function bn(e) {
|
|
1410
|
+
if (e.includes("*")) throw new J(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
|
|
1419
1411
|
let t = e.replace(/^\.\//, "").replace(/\/$/, "");
|
|
1420
1412
|
return t === "." ? "" : t;
|
|
1421
1413
|
}
|
|
1422
|
-
function
|
|
1414
|
+
function xn(e) {
|
|
1423
1415
|
let t;
|
|
1424
1416
|
try {
|
|
1425
1417
|
t = e.read("pnpm-workspace.yaml");
|
|
1426
1418
|
} catch {
|
|
1427
|
-
throw new
|
|
1419
|
+
throw new J("No pnpm-workspace.yaml found. This directory is empty or unrecognisable as a block — run 'block-tools structure init' instead, or pass --sdk-internal for an in-monorepo block.");
|
|
1428
1420
|
}
|
|
1429
1421
|
let n = oe(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
|
|
1430
1422
|
for (let t of r) {
|
|
1431
|
-
let n =
|
|
1423
|
+
let n = bn(t);
|
|
1432
1424
|
(n === "" || e.exists(n)) && i.add(n);
|
|
1433
1425
|
}
|
|
1434
1426
|
let a = [];
|
|
1435
1427
|
for (let t of i) {
|
|
1436
|
-
let n =
|
|
1428
|
+
let n = yn(e, vn(t, "package.json"));
|
|
1437
1429
|
n && a.push({
|
|
1438
1430
|
path: t,
|
|
1439
1431
|
pkg: n
|
|
@@ -1441,7 +1433,7 @@ function Sn(e) {
|
|
|
1441
1433
|
}
|
|
1442
1434
|
return a;
|
|
1443
1435
|
}
|
|
1444
|
-
function
|
|
1436
|
+
function Sn(e) {
|
|
1445
1437
|
let t = [], n = new Set([
|
|
1446
1438
|
"node_modules",
|
|
1447
1439
|
".turbo",
|
|
@@ -1453,7 +1445,7 @@ function Cn(e) {
|
|
|
1453
1445
|
let o = e.listDir(i);
|
|
1454
1446
|
for (let s of o) {
|
|
1455
1447
|
if (!s.isDirectory || n.has(s.name)) continue;
|
|
1456
|
-
let o =
|
|
1448
|
+
let o = vn(i, s.name), c = yn(e, vn(o, "package.json"));
|
|
1457
1449
|
c && t.push({
|
|
1458
1450
|
path: o,
|
|
1459
1451
|
pkg: c
|
|
@@ -1462,11 +1454,11 @@ function Cn(e) {
|
|
|
1462
1454
|
}
|
|
1463
1455
|
return r("", 1), t;
|
|
1464
1456
|
}
|
|
1465
|
-
function
|
|
1457
|
+
function Cn(e) {
|
|
1466
1458
|
let t = e.indexOf("/");
|
|
1467
|
-
if (!e.startsWith("@") || t < 0) throw new
|
|
1459
|
+
if (!e.startsWith("@") || t < 0) throw new J(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
|
|
1468
1460
|
let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
|
|
1469
|
-
if (i < 0) throw new
|
|
1461
|
+
if (i < 0) throw new J(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
|
|
1470
1462
|
return {
|
|
1471
1463
|
facadeName: e,
|
|
1472
1464
|
baseName: r,
|
|
@@ -1475,23 +1467,23 @@ function wn(e) {
|
|
|
1475
1467
|
shortName: r.slice(i + 1)
|
|
1476
1468
|
};
|
|
1477
1469
|
}
|
|
1478
|
-
function
|
|
1470
|
+
function wn(e) {
|
|
1479
1471
|
try {
|
|
1480
|
-
let t = JSON.parse(e.read(
|
|
1472
|
+
let t = JSON.parse(e.read(Ht));
|
|
1481
1473
|
return typeof t.version == "number" ? t.version : 0;
|
|
1482
1474
|
} catch {
|
|
1483
1475
|
return 0;
|
|
1484
1476
|
}
|
|
1485
1477
|
}
|
|
1486
|
-
function
|
|
1487
|
-
let { fs: t, isSdkInternal: n } = e, r = n ?
|
|
1488
|
-
if (r.length === 0) throw new
|
|
1489
|
-
let i =
|
|
1490
|
-
|
|
1478
|
+
function Tn(e) {
|
|
1479
|
+
let { fs: t, isSdkInternal: n } = e, r = n ? Sn(t) : xn(t);
|
|
1480
|
+
if (r.length === 0) throw new J("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
|
|
1481
|
+
let i = fn(r), a = wn(t);
|
|
1482
|
+
Ut(a, 0);
|
|
1491
1483
|
let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
|
|
1492
|
-
if (!o) throw new
|
|
1493
|
-
let s =
|
|
1494
|
-
return
|
|
1484
|
+
if (!o) throw new J("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
|
|
1485
|
+
let s = Cn(o.name.replace(/\.block$/, ""));
|
|
1486
|
+
return _n({
|
|
1495
1487
|
isSdkInternal: n,
|
|
1496
1488
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
1497
1489
|
modules: i,
|
|
@@ -1502,7 +1494,7 @@ function En(e) {
|
|
|
1502
1494
|
}
|
|
1503
1495
|
//#endregion
|
|
1504
1496
|
//#region src/structure/rules/shared/key-order.ts
|
|
1505
|
-
var
|
|
1497
|
+
var Y = [
|
|
1506
1498
|
"name",
|
|
1507
1499
|
"version",
|
|
1508
1500
|
"private",
|
|
@@ -1526,7 +1518,7 @@ var X = [
|
|
|
1526
1518
|
];
|
|
1527
1519
|
//#endregion
|
|
1528
1520
|
//#region src/structure/rules/root-package-json.ts
|
|
1529
|
-
function
|
|
1521
|
+
function En(e) {
|
|
1530
1522
|
return {
|
|
1531
1523
|
version: "1.0.0",
|
|
1532
1524
|
private: !0,
|
|
@@ -1559,8 +1551,8 @@ function Dn(e) {
|
|
|
1559
1551
|
packageManager: "pnpm@9.12.0"
|
|
1560
1552
|
};
|
|
1561
1553
|
}
|
|
1562
|
-
function
|
|
1563
|
-
F("packageManager", "pnpm@9.12.0"),
|
|
1554
|
+
function Dn() {
|
|
1555
|
+
F("packageManager", "pnpm@9.12.0"), Et("name"), I("fmt", "turbo run fmt"), I("check", "turbo run check"), I("build", "turbo run build"), I("build:dev", "env PL_PKG_DEV=local turbo run build"), I("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), I("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), I("mark-stable", "turbo run mark-stable"), I("do-pack", "turbo run do-pack"), I("watch", "turbo watch build"), I("changeset", "changeset"), I("version-packages", "changeset version"), I("update-sdk", "block-tools structure refresh --update-deps-only"), L("update"), I("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), H({
|
|
1564
1556
|
"@changesets/cli": "catalog:",
|
|
1565
1557
|
"@milaboratories/ts-builder": "sdk:",
|
|
1566
1558
|
"@platforma-sdk/block-tools": "sdk:",
|
|
@@ -1569,78 +1561,78 @@ function On() {
|
|
|
1569
1561
|
}), U({
|
|
1570
1562
|
oxlint: "*",
|
|
1571
1563
|
oxfmt: "*"
|
|
1572
|
-
}),
|
|
1564
|
+
}), At((e, t) => {
|
|
1573
1565
|
if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
|
|
1574
1566
|
let n = t;
|
|
1575
1567
|
return n.pnpm !== void 0 || n.overrides !== void 0;
|
|
1576
|
-
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...
|
|
1568
|
+
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
|
|
1577
1569
|
}
|
|
1578
1570
|
//#endregion
|
|
1579
1571
|
//#region src/structure/engine/registry-client.ts
|
|
1580
|
-
var
|
|
1581
|
-
function
|
|
1572
|
+
var On = 2, kn = 500, An = 3e4;
|
|
1573
|
+
function jn(e) {
|
|
1582
1574
|
if (!e) return null;
|
|
1583
1575
|
let t = Number(e);
|
|
1584
1576
|
if (Number.isFinite(t) && t > 0) return t * 1e3;
|
|
1585
1577
|
let n = Date.parse(e);
|
|
1586
1578
|
return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
|
|
1587
1579
|
}
|
|
1588
|
-
async function
|
|
1580
|
+
async function Mn(e) {
|
|
1589
1581
|
for (let t = 1;; t++) {
|
|
1590
1582
|
let n;
|
|
1591
1583
|
try {
|
|
1592
|
-
n = await fetch(e, { signal: AbortSignal.timeout(
|
|
1584
|
+
n = await fetch(e, { signal: AbortSignal.timeout(An) });
|
|
1593
1585
|
} catch (e) {
|
|
1594
|
-
if (t >
|
|
1595
|
-
await le(
|
|
1586
|
+
if (t > On) throw e;
|
|
1587
|
+
await le(kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1596
1588
|
continue;
|
|
1597
1589
|
}
|
|
1598
1590
|
if (n.ok) return n;
|
|
1599
|
-
if (!(n.status === 429 || n.status >= 500) || t >
|
|
1600
|
-
let r =
|
|
1591
|
+
if (!(n.status === 429 || n.status >= 500) || t > On) throw Error(`registry returned HTTP ${n.status}`);
|
|
1592
|
+
let r = jn(n.headers.get("retry-after"));
|
|
1601
1593
|
if (r != null) {
|
|
1602
1594
|
await le(r);
|
|
1603
1595
|
continue;
|
|
1604
1596
|
}
|
|
1605
|
-
await le(
|
|
1597
|
+
await le(kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1606
1598
|
}
|
|
1607
1599
|
}
|
|
1608
|
-
function
|
|
1600
|
+
function Nn() {
|
|
1609
1601
|
return {
|
|
1610
1602
|
async getLatestVersion(e) {
|
|
1611
|
-
let t = (await (await
|
|
1603
|
+
let t = (await (await Mn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
|
|
1612
1604
|
if (!t) throw Error("no 'latest' dist-tag in registry response");
|
|
1613
1605
|
return t;
|
|
1614
1606
|
},
|
|
1615
1607
|
async getDeclaredDependency(e, t, n) {
|
|
1616
|
-
let r = await (await
|
|
1608
|
+
let r = await (await Mn(`https://registry.npmjs.org/${e}/${t}`)).json();
|
|
1617
1609
|
return r.dependencies?.[n] ?? r.peerDependencies?.[n];
|
|
1618
1610
|
}
|
|
1619
1611
|
};
|
|
1620
1612
|
}
|
|
1621
|
-
async function
|
|
1613
|
+
async function Pn(e, t) {
|
|
1622
1614
|
let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
|
|
1623
1615
|
return new Map(n);
|
|
1624
1616
|
}
|
|
1625
|
-
function
|
|
1617
|
+
function Fn(e) {
|
|
1626
1618
|
return (t) => e.get(t);
|
|
1627
1619
|
}
|
|
1628
|
-
var
|
|
1629
|
-
function
|
|
1630
|
-
return
|
|
1620
|
+
var In = [/^@platforma-sdk\//, /^@milaboratories\//];
|
|
1621
|
+
function Ln(e) {
|
|
1622
|
+
return In.some((t) => t.test(e));
|
|
1631
1623
|
}
|
|
1632
|
-
async function
|
|
1633
|
-
return e.length === 0 ? () => void 0 :
|
|
1624
|
+
async function Rn(e, t = Nn()) {
|
|
1625
|
+
return e.length === 0 ? () => void 0 : Fn(await Pn(t, e));
|
|
1634
1626
|
}
|
|
1635
|
-
function
|
|
1627
|
+
function zn(e) {
|
|
1636
1628
|
return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
|
|
1637
1629
|
}
|
|
1638
|
-
async function
|
|
1630
|
+
async function Bn(e, t = Nn()) {
|
|
1639
1631
|
if (e.length === 0) return () => void 0;
|
|
1640
1632
|
let n = await Promise.all(e.map(async (e) => {
|
|
1641
1633
|
let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
|
|
1642
1634
|
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.`);
|
|
1643
|
-
if (!
|
|
1635
|
+
if (!zn(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.`);
|
|
1644
1636
|
return [e.entry, n];
|
|
1645
1637
|
})), r = new Map(n);
|
|
1646
1638
|
return (e) => r.get(e);
|
|
@@ -1648,7 +1640,7 @@ async function Vn(e, t = Pn()) {
|
|
|
1648
1640
|
//#endregion
|
|
1649
1641
|
//#region src/structure/rules/shared/retired-deps.ts
|
|
1650
1642
|
// @vitejs/plugin-vue — bundled by ts-builder's internal vite config.
|
|
1651
|
-
var
|
|
1643
|
+
var Vn = [
|
|
1652
1644
|
"vite",
|
|
1653
1645
|
"tsup",
|
|
1654
1646
|
"vue-tsc",
|
|
@@ -1656,12 +1648,12 @@ var Hn = [
|
|
|
1656
1648
|
"vite-plugin-dts",
|
|
1657
1649
|
"@platforma-sdk/eslint-config"
|
|
1658
1650
|
];
|
|
1659
|
-
function
|
|
1660
|
-
for (let e of
|
|
1651
|
+
function Hn() {
|
|
1652
|
+
for (let e of Vn) V(e);
|
|
1661
1653
|
}
|
|
1662
1654
|
//#endregion
|
|
1663
1655
|
//#region src/structure/rules/root-pnpm-workspace.ts
|
|
1664
|
-
var
|
|
1656
|
+
var X = [
|
|
1665
1657
|
"@platforma-sdk/model",
|
|
1666
1658
|
"@platforma-sdk/ui-vue",
|
|
1667
1659
|
"@platforma-sdk/workflow-tengo",
|
|
@@ -1671,32 +1663,32 @@ var Z = [
|
|
|
1671
1663
|
"@platforma-sdk/package-builder",
|
|
1672
1664
|
"@milaboratories/ts-builder",
|
|
1673
1665
|
"@milaboratories/ts-configs"
|
|
1674
|
-
],
|
|
1675
|
-
for (let e of
|
|
1676
|
-
var
|
|
1666
|
+
], Un = "0.0.0-init-must-fetch";
|
|
1667
|
+
for (let e of X) if (!Ln(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.`);
|
|
1668
|
+
var Wn = {
|
|
1677
1669
|
turbo: "~2.8.11",
|
|
1678
1670
|
shx: "~0.4.0",
|
|
1679
1671
|
"@changesets/cli": "~2.29.8",
|
|
1680
1672
|
vitest: "~4.0.18"
|
|
1681
|
-
},
|
|
1673
|
+
}, Gn = [{
|
|
1682
1674
|
entry: "vue",
|
|
1683
1675
|
of: "@platforma-sdk/ui-vue"
|
|
1684
|
-
}],
|
|
1685
|
-
function
|
|
1676
|
+
}], Kn = "@platforma-open/milaboratories.runenv-python-3", qn = "1.8.2";
|
|
1677
|
+
function Jn(e) {
|
|
1686
1678
|
let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
|
|
1687
|
-
for (let e of
|
|
1688
|
-
return Object.assign(n,
|
|
1679
|
+
for (let e of X) n[e] = Un;
|
|
1680
|
+
return Object.assign(n, Wn), e.modules.some((e) => e.scope === "software") && (n[Kn] = qn), {
|
|
1689
1681
|
packages: t,
|
|
1690
1682
|
catalog: n
|
|
1691
1683
|
};
|
|
1692
1684
|
}
|
|
1693
|
-
function
|
|
1694
|
-
|
|
1695
|
-
for (let e of
|
|
1685
|
+
function Yn() {
|
|
1686
|
+
Nt();
|
|
1687
|
+
for (let e of Vn) Rt(e);
|
|
1696
1688
|
}
|
|
1697
1689
|
//#endregion
|
|
1698
1690
|
//#region src/structure/rules/root-gitignore.ts
|
|
1699
|
-
var
|
|
1691
|
+
var Xn = [
|
|
1700
1692
|
".test_auth.json",
|
|
1701
1693
|
"node_modules/",
|
|
1702
1694
|
"dist/",
|
|
@@ -1711,34 +1703,52 @@ var Zn = [
|
|
|
1711
1703
|
".vscode/sftp.json",
|
|
1712
1704
|
"test-dry-run.json"
|
|
1713
1705
|
];
|
|
1714
|
-
function
|
|
1715
|
-
|
|
1706
|
+
function Zn() {
|
|
1707
|
+
zt(Xn);
|
|
1716
1708
|
}
|
|
1717
1709
|
//#endregion
|
|
1718
1710
|
//#region src/structure/rules/root.ts
|
|
1719
|
-
function
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
}),
|
|
1725
|
-
|
|
1726
|
-
}),
|
|
1727
|
-
|
|
1711
|
+
function Qn() {
|
|
1712
|
+
y("root", () => {
|
|
1713
|
+
b(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1714
|
+
S("turbo.json", E("root/turbo.json")), S(".vscode/settings.json", E("root/.vscode/settings.json")), C("package.json", O((e) => En(e)), () => {
|
|
1715
|
+
Dn();
|
|
1716
|
+
}), C("pnpm-workspace.yaml", O((e) => Jn(e)), () => {
|
|
1717
|
+
Yn();
|
|
1718
|
+
}), C(".gitignore", E("root/.gitignore"), () => {
|
|
1719
|
+
Zn();
|
|
1728
1720
|
});
|
|
1729
1721
|
});
|
|
1730
1722
|
});
|
|
1731
1723
|
}
|
|
1732
1724
|
//#endregion
|
|
1725
|
+
//#region src/structure/rules/root-ci.ts
|
|
1726
|
+
function $n(e) {
|
|
1727
|
+
return e.split(/[-_]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
1728
|
+
}
|
|
1729
|
+
function er() {
|
|
1730
|
+
y("root", () => {
|
|
1731
|
+
b(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1732
|
+
S(".github/workflows/build.yaml", D("workflows/build.tpl.yaml", (e) => {
|
|
1733
|
+
let t = e.blockVars.shortName;
|
|
1734
|
+
return {
|
|
1735
|
+
appName: `Block: ${$n(t)}`,
|
|
1736
|
+
appNameSlug: `block-${t}`
|
|
1737
|
+
};
|
|
1738
|
+
})), S(".github/workflows/mark-stable.yaml", D("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${$n(e.blockVars.shortName)} - Mark Stable` })));
|
|
1739
|
+
});
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
//#endregion
|
|
1733
1743
|
//#region src/structure/rules/block-package-json.ts
|
|
1734
|
-
function
|
|
1744
|
+
function tr(e) {
|
|
1735
1745
|
let t = {};
|
|
1736
1746
|
for (let n of q(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
|
|
1737
1747
|
for (let n of q(e, "model")) t.model = `${n.name}/dist/model.json`;
|
|
1738
1748
|
for (let n of q(e, "ui")) t.ui = `${n.name}/dist`;
|
|
1739
1749
|
return t;
|
|
1740
1750
|
}
|
|
1741
|
-
function
|
|
1751
|
+
function nr(e) {
|
|
1742
1752
|
if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
|
|
1743
1753
|
let t = e.meta, n = [
|
|
1744
1754
|
["block.meta.title", t.title],
|
|
@@ -1750,13 +1760,13 @@ function tr(e) {
|
|
|
1750
1760
|
];
|
|
1751
1761
|
for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
|
|
1752
1762
|
}
|
|
1753
|
-
function
|
|
1763
|
+
function rr(e) {
|
|
1754
1764
|
let t = e.blockVars, n = {
|
|
1755
|
-
...
|
|
1756
|
-
...
|
|
1757
|
-
...
|
|
1765
|
+
...mn(e, "model"),
|
|
1766
|
+
...mn(e, "ui"),
|
|
1767
|
+
...mn(e, "workflow")
|
|
1758
1768
|
}, r = {
|
|
1759
|
-
components:
|
|
1769
|
+
components: tr(e),
|
|
1760
1770
|
meta: {
|
|
1761
1771
|
title: t.shortName,
|
|
1762
1772
|
description: `${t.shortName} block`,
|
|
@@ -1768,7 +1778,7 @@ function nr(e) {
|
|
|
1768
1778
|
}
|
|
1769
1779
|
}
|
|
1770
1780
|
};
|
|
1771
|
-
return
|
|
1781
|
+
return nr(r), {
|
|
1772
1782
|
name: `${t.facadeName}.block`,
|
|
1773
1783
|
version: "1.0.0",
|
|
1774
1784
|
files: ["index.d.ts", "index.js"],
|
|
@@ -1786,24 +1796,24 @@ function nr(e) {
|
|
|
1786
1796
|
block: r
|
|
1787
1797
|
};
|
|
1788
1798
|
}
|
|
1789
|
-
function
|
|
1790
|
-
F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), W("model"), W("ui"), W("workflow"), B("@platforma-sdk/block-tools", "sdk:"), B("shx", "catalog:"), F("block.components",
|
|
1799
|
+
function ir(e) {
|
|
1800
|
+
F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), W("model"), W("ui"), W("workflow"), B("@platforma-sdk/block-tools", "sdk:"), B("shx", "catalog:"), F("block.components", tr(e)), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
|
|
1791
1801
|
}
|
|
1792
1802
|
//#endregion
|
|
1793
1803
|
//#region src/structure/rules/block.ts
|
|
1794
|
-
function
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1804
|
+
function ar() {
|
|
1805
|
+
y("block", () => {
|
|
1806
|
+
S("index.js", E("block/index.js")), S("index.d.ts", E("block/index.d.ts")), w("logos/block-logo.png", Qe("block/logos/block-logo.png")), w("logos/organization-logo.png", Qe("block/logos/organization-logo.png")), C("package.json", O((e) => rr(e)), (e) => {
|
|
1807
|
+
ir(e);
|
|
1798
1808
|
});
|
|
1799
1809
|
});
|
|
1800
1810
|
}
|
|
1801
1811
|
//#endregion
|
|
1802
1812
|
//#region src/structure/rules/shared/colocated-tests.ts
|
|
1803
|
-
var
|
|
1813
|
+
var Z = "src/**/*.test.ts";
|
|
1804
1814
|
//#endregion
|
|
1805
1815
|
//#region src/structure/rules/model-package-json.ts
|
|
1806
|
-
function
|
|
1816
|
+
function or(e) {
|
|
1807
1817
|
return {
|
|
1808
1818
|
name: `${e.blockVars.facadeName}.model`,
|
|
1809
1819
|
version: "1.0.0",
|
|
@@ -1837,7 +1847,7 @@ function ar(e) {
|
|
|
1837
1847
|
}
|
|
1838
1848
|
};
|
|
1839
1849
|
}
|
|
1840
|
-
function
|
|
1850
|
+
function sr() {
|
|
1841
1851
|
F("type", "module"), F("main", "dist/index.cjs"), F("module", "dist/index.js"), F("types", "dist/index.d.ts"), F("exports", {
|
|
1842
1852
|
".": {
|
|
1843
1853
|
types: "./dist/index.d.ts",
|
|
@@ -1852,22 +1862,22 @@ function or() {
|
|
|
1852
1862
|
}), U({
|
|
1853
1863
|
"@types/node": "*",
|
|
1854
1864
|
typescript: "*"
|
|
1855
|
-
}),
|
|
1865
|
+
}), b(({ ctx: e }) => !e.isSdkInternal, () => b(x(Z), () => {
|
|
1856
1866
|
I("test", "vitest run --passWithNoTests"), B("vitest", "catalog:"), B("@types/node", "*");
|
|
1857
|
-
}, () => V("vitest"))),
|
|
1867
|
+
}, () => V("vitest"))), Hn(), Et("tsup"), L("lint"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
|
|
1858
1868
|
}
|
|
1859
1869
|
//#endregion
|
|
1860
1870
|
//#region src/structure/rules/model.ts
|
|
1861
|
-
function
|
|
1862
|
-
|
|
1863
|
-
x(
|
|
1864
|
-
|
|
1871
|
+
function cr() {
|
|
1872
|
+
y("model", () => {
|
|
1873
|
+
b(x(Z), () => S("tsconfig.json", E("model/tsconfig.node.json")), () => S("tsconfig.json", E("model/tsconfig.json"))), S(".oxlintrc.json", E("model/.oxlintrc.json")), S(".oxfmtrc.json", E("model/.oxfmtrc.json")), w("src/index.ts", E("model/src/index.ts")), C("package.json", O((e) => or(e)), () => {
|
|
1874
|
+
sr();
|
|
1865
1875
|
});
|
|
1866
1876
|
});
|
|
1867
1877
|
}
|
|
1868
1878
|
//#endregion
|
|
1869
1879
|
//#region src/structure/rules/ui-package-json.ts
|
|
1870
|
-
function
|
|
1880
|
+
function lr(e) {
|
|
1871
1881
|
return {
|
|
1872
1882
|
name: `${e.blockVars.facadeName}.ui`,
|
|
1873
1883
|
version: "1.0.0",
|
|
@@ -1882,7 +1892,7 @@ function cr(e) {
|
|
|
1882
1892
|
dependencies: {
|
|
1883
1893
|
"@platforma-sdk/ui-vue": "sdk:",
|
|
1884
1894
|
vue: "catalog:",
|
|
1885
|
-
...
|
|
1895
|
+
...mn(e, "model")
|
|
1886
1896
|
},
|
|
1887
1897
|
devDependencies: {
|
|
1888
1898
|
"@milaboratories/ts-builder": "sdk:",
|
|
@@ -1894,29 +1904,29 @@ function cr(e) {
|
|
|
1894
1904
|
}
|
|
1895
1905
|
};
|
|
1896
1906
|
}
|
|
1897
|
-
function
|
|
1907
|
+
function ur() {
|
|
1898
1908
|
F("type", "module"), I("fmt", "ts-builder format"), I("dev", "ts-builder serve --target block-ui"), I("watch", "ts-builder build --target block-ui --watch"), I("build", "ts-builder build --target block-ui"), I("check", "ts-builder check --target block-ui"), z("@platforma-sdk/ui-vue", "sdk:"), z("vue", "catalog:"), W("model"), H({
|
|
1899
1909
|
"@milaboratories/ts-builder": "sdk:",
|
|
1900
1910
|
"@milaboratories/ts-configs": "sdk:"
|
|
1901
|
-
}),
|
|
1911
|
+
}), Hn(), L("preview"), L("lint"), U({
|
|
1902
1912
|
"@types/node": "*",
|
|
1903
1913
|
typescript: "*"
|
|
1904
|
-
}),
|
|
1914
|
+
}), b(({ ctx: e }) => !e.isSdkInternal, () => b(x(Z), () => {
|
|
1905
1915
|
I("test", "vitest run --passWithNoTests"), B("vitest", "catalog:"), B("@types/node", "*");
|
|
1906
|
-
}, () => V("vitest"))), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...
|
|
1916
|
+
}, () => V("vitest"))), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
|
|
1907
1917
|
}
|
|
1908
1918
|
//#endregion
|
|
1909
1919
|
//#region src/structure/rules/ui.ts
|
|
1910
|
-
function
|
|
1911
|
-
|
|
1912
|
-
x(
|
|
1913
|
-
|
|
1920
|
+
function dr() {
|
|
1921
|
+
y("ui", () => {
|
|
1922
|
+
b(x(Z), () => S("tsconfig.json", E("ui/tsconfig.node.json")), () => S("tsconfig.json", E("ui/tsconfig.json"))), S(".oxlintrc.json", E("ui/.oxlintrc.json")), S(".oxfmtrc.json", E("ui/.oxfmtrc.json")), Ze("index.html", E("ui/index.html")), w("src/main.ts", E("ui/src/main.ts")), w("src/app.ts", D("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), w("src/MainPage.vue", D("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), C("package.json", O((e) => lr(e)), () => {
|
|
1923
|
+
ur();
|
|
1914
1924
|
});
|
|
1915
1925
|
});
|
|
1916
1926
|
}
|
|
1917
1927
|
//#endregion
|
|
1918
1928
|
//#region src/structure/rules/workflow-package-json.ts
|
|
1919
|
-
function
|
|
1929
|
+
function fr(e) {
|
|
1920
1930
|
return {
|
|
1921
1931
|
name: `${e.blockVars.facadeName}.workflow`,
|
|
1922
1932
|
version: "1.0.0",
|
|
@@ -1928,7 +1938,7 @@ function dr(e) {
|
|
|
1928
1938
|
},
|
|
1929
1939
|
dependencies: {
|
|
1930
1940
|
"@platforma-sdk/workflow-tengo": "sdk:",
|
|
1931
|
-
...
|
|
1941
|
+
...hn(e, "software")
|
|
1932
1942
|
},
|
|
1933
1943
|
devDependencies: {
|
|
1934
1944
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
@@ -1937,31 +1947,31 @@ function dr(e) {
|
|
|
1937
1947
|
}
|
|
1938
1948
|
};
|
|
1939
1949
|
}
|
|
1940
|
-
function
|
|
1941
|
-
F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"),
|
|
1950
|
+
function pr() {
|
|
1951
|
+
F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), b(({ ctx: e }) => !e.isSdkInternal, () => b(x(Z), () => {
|
|
1942
1952
|
I("test", "vitest run --passWithNoTests"), H({ vitest: "catalog:" });
|
|
1943
1953
|
}, () => V("vitest"))), z("@platforma-sdk/workflow-tengo", "sdk:"), W("software"), H({
|
|
1944
1954
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1945
1955
|
"@platforma-sdk/test": "sdk:",
|
|
1946
1956
|
shx: "catalog:"
|
|
1947
|
-
}),
|
|
1957
|
+
}), Hn(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
|
|
1948
1958
|
}
|
|
1949
1959
|
//#endregion
|
|
1950
1960
|
//#region src/structure/rules/workflow.ts
|
|
1951
|
-
function
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1961
|
+
function mr() {
|
|
1962
|
+
y("workflow", () => {
|
|
1963
|
+
S("format.el", E("workflow/format.el")), b(({ ctx: e }) => !e.isSdkInternal, () => b(x(Z), () => {
|
|
1964
|
+
S("tsconfig.json", E("workflow/tsconfig.json")), Ze("vitest.config.mts", E("workflow/vitest.config.mts"));
|
|
1955
1965
|
}, () => {
|
|
1956
|
-
|
|
1957
|
-
})),
|
|
1958
|
-
|
|
1966
|
+
T("tsconfig.json"), T("vitest.config.mts");
|
|
1967
|
+
})), T("index.js"), T("index.d.ts"), w("src/main.tpl.tengo", D("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), C("package.json", O((e) => fr(e)), () => {
|
|
1968
|
+
pr();
|
|
1959
1969
|
});
|
|
1960
1970
|
});
|
|
1961
1971
|
}
|
|
1962
1972
|
//#endregion
|
|
1963
1973
|
//#region src/structure/rules/test-package-json.ts
|
|
1964
|
-
function
|
|
1974
|
+
function hr(e) {
|
|
1965
1975
|
return {
|
|
1966
1976
|
name: `${e.blockVars.facadeName}.test`,
|
|
1967
1977
|
version: "1.0.0",
|
|
@@ -1981,26 +1991,26 @@ function mr(e) {
|
|
|
1981
1991
|
}
|
|
1982
1992
|
};
|
|
1983
1993
|
}
|
|
1984
|
-
function
|
|
1994
|
+
function gr() {
|
|
1985
1995
|
F("type", "module"), I("fmt", "ts-builder format"), I("check", "ts-builder check --target block-test"), I("test", "vitest run --passWithNoTests"), L("lint"), H({
|
|
1986
1996
|
"@platforma-sdk/test": "sdk:",
|
|
1987
1997
|
"@milaboratories/ts-builder": "sdk:",
|
|
1988
1998
|
"@milaboratories/ts-configs": "sdk:",
|
|
1989
1999
|
vitest: "catalog:"
|
|
1990
|
-
}), U({ typescript: "*" }), V("@types/node"),
|
|
2000
|
+
}), U({ typescript: "*" }), V("@types/node"), Hn(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
|
|
1991
2001
|
}
|
|
1992
2002
|
//#endregion
|
|
1993
2003
|
//#region src/structure/rules/test.ts
|
|
1994
|
-
function
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2004
|
+
function _r() {
|
|
2005
|
+
y("test", () => {
|
|
2006
|
+
S("tsconfig.json", E("test/tsconfig.json")), S(".oxlintrc.json", E("test/.oxlintrc.json")), S(".oxfmtrc.json", E("test/.oxfmtrc.json")), Ze("vitest.config.mts", E("test/vitest.config.mts")), w("src/demo.test.ts", $e("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), C("package.json", O((e) => hr(e)), () => {
|
|
2007
|
+
gr();
|
|
1998
2008
|
});
|
|
1999
2009
|
});
|
|
2000
2010
|
}
|
|
2001
2011
|
//#endregion
|
|
2002
2012
|
//#region src/structure/rules/software-package-json.ts
|
|
2003
|
-
function
|
|
2013
|
+
function vr() {
|
|
2004
2014
|
return { entrypoints: { main: { binary: {
|
|
2005
2015
|
artifact: {
|
|
2006
2016
|
type: "python",
|
|
@@ -2015,7 +2025,7 @@ function _r() {
|
|
|
2015
2025
|
cmd: ["python", "{pkg}/main.py"]
|
|
2016
2026
|
} } } };
|
|
2017
2027
|
}
|
|
2018
|
-
function
|
|
2028
|
+
function yr(e) {
|
|
2019
2029
|
return {
|
|
2020
2030
|
name: `${e.blockVars.facadeName}.software`,
|
|
2021
2031
|
version: "1.0.0",
|
|
@@ -2028,56 +2038,56 @@ function vr(e) {
|
|
|
2028
2038
|
changeset: "changeset",
|
|
2029
2039
|
"version-packages": "changeset version"
|
|
2030
2040
|
},
|
|
2031
|
-
"block-software":
|
|
2041
|
+
"block-software": vr(),
|
|
2032
2042
|
devDependencies: {
|
|
2033
2043
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
2034
2044
|
"@platforma-sdk/package-builder": "sdk:"
|
|
2035
2045
|
}
|
|
2036
2046
|
};
|
|
2037
2047
|
}
|
|
2038
|
-
function
|
|
2048
|
+
function br() {
|
|
2039
2049
|
F("type", "module"), F("files", ["./dist/**/*"]), I("build", "pl-pkg build"), I("prepublishOnly", "pl-pkg prepublish"), I("changeset", "changeset"), I("version-packages", "changeset version"), H({
|
|
2040
2050
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
2041
2051
|
"@platforma-sdk/package-builder": "sdk:"
|
|
2042
|
-
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...
|
|
2052
|
+
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
|
|
2043
2053
|
}
|
|
2044
2054
|
//#endregion
|
|
2045
2055
|
//#region src/structure/rules/software.ts
|
|
2046
|
-
var
|
|
2047
|
-
function
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2056
|
+
var xr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", Sr = "# No dependencies specified for this script\n";
|
|
2057
|
+
function Cr() {
|
|
2058
|
+
y("software", () => {
|
|
2059
|
+
w("src/main.py", $e(xr)), w("src/requirements.txt", $e(Sr)), C("package.json", O((e) => yr(e)), () => {
|
|
2060
|
+
br();
|
|
2051
2061
|
});
|
|
2052
2062
|
});
|
|
2053
2063
|
}
|
|
2054
|
-
function
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
}),
|
|
2058
|
-
|
|
2059
|
-
}),
|
|
2060
|
-
|
|
2061
|
-
}),
|
|
2062
|
-
|
|
2064
|
+
function wr() {
|
|
2065
|
+
y("model", () => {
|
|
2066
|
+
T("eslint.config.mjs"), T("vite.config.mts");
|
|
2067
|
+
}), y("ui", () => {
|
|
2068
|
+
T("eslint.config.mjs"), T("vite.config.ts"), T("tsconfig.app.json"), T("tsconfig.node.json");
|
|
2069
|
+
}), y("test", () => {
|
|
2070
|
+
T("eslint.config.mjs");
|
|
2071
|
+
}), y("root", () => {
|
|
2072
|
+
T(".prettierrc"), C("package.json", O((e) => En(e)), () => {
|
|
2063
2073
|
L("pretty"), V("@platforma-sdk/blocks-deps-updater");
|
|
2064
2074
|
});
|
|
2065
2075
|
});
|
|
2066
2076
|
}
|
|
2067
2077
|
//#endregion
|
|
2068
2078
|
//#region src/structure/rules/root-catalog-bump.ts
|
|
2069
|
-
function
|
|
2079
|
+
function Tr() {
|
|
2070
2080
|
Xe(() => {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
for (let e of
|
|
2075
|
-
for (let e of
|
|
2081
|
+
y("root", () => {
|
|
2082
|
+
b(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
2083
|
+
C("pnpm-workspace.yaml", O((e) => Jn(e)), (e) => {
|
|
2084
|
+
for (let e of X) It(e);
|
|
2085
|
+
for (let e of Gn) Lt(e.entry, {
|
|
2076
2086
|
of: e.of,
|
|
2077
2087
|
ofVersion: e.ofVersion
|
|
2078
2088
|
});
|
|
2079
|
-
for (let [e, t] of Object.entries(
|
|
2080
|
-
|
|
2089
|
+
for (let [e, t] of Object.entries(Wn)) Ft(e, t);
|
|
2090
|
+
e.modules.some((e) => e.scope === "software") && Ft(Kn, qn);
|
|
2081
2091
|
});
|
|
2082
2092
|
});
|
|
2083
2093
|
});
|
|
@@ -2085,25 +2095,25 @@ function wr() {
|
|
|
2085
2095
|
}
|
|
2086
2096
|
//#endregion
|
|
2087
2097
|
//#region src/structure/structure-definition.ts
|
|
2088
|
-
var
|
|
2089
|
-
|
|
2098
|
+
var Er = Ue(() => {
|
|
2099
|
+
Qn(), er(), ar(), cr(), dr(), mr(), _r(), Cr(), wr(), Tr();
|
|
2090
2100
|
});
|
|
2091
2101
|
//#endregion
|
|
2092
2102
|
//#region src/structure/cli/run-structure.ts
|
|
2093
|
-
async function
|
|
2094
|
-
return
|
|
2103
|
+
async function Dr() {
|
|
2104
|
+
return Rn(X.filter(Ln));
|
|
2095
2105
|
}
|
|
2096
|
-
async function
|
|
2097
|
-
let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a =
|
|
2106
|
+
async function Or(e) {
|
|
2107
|
+
let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a = on(Er, r, Tn({
|
|
2098
2108
|
fs: r,
|
|
2099
2109
|
isSdkInternal: e.isSdkInternal,
|
|
2100
2110
|
updateDepsOnly: e.updateDepsOnly,
|
|
2101
2111
|
dryRun: n
|
|
2102
2112
|
}), {
|
|
2103
2113
|
templates: i,
|
|
2104
|
-
registryLookup: e.updateDepsOnly ? await
|
|
2105
|
-
derivedPinLookup: e.updateDepsOnly ? await
|
|
2106
|
-
rediscover: () =>
|
|
2114
|
+
registryLookup: e.updateDepsOnly ? await Dr() : void 0,
|
|
2115
|
+
derivedPinLookup: e.updateDepsOnly ? await Bn(Gn) : void 0,
|
|
2116
|
+
rediscover: () => Tn({
|
|
2107
2117
|
fs: r,
|
|
2108
2118
|
isSdkInternal: e.isSdkInternal,
|
|
2109
2119
|
updateDepsOnly: !1,
|
|
@@ -2115,14 +2125,14 @@ async function Dr(e) {
|
|
|
2115
2125
|
changes: a.changes
|
|
2116
2126
|
};
|
|
2117
2127
|
}
|
|
2118
|
-
function
|
|
2128
|
+
function kr(e, t) {
|
|
2119
2129
|
if (t.length === 0) return ` ${e}: up to date (0 changes)`;
|
|
2120
2130
|
let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
|
|
2121
2131
|
return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
|
|
2122
2132
|
}
|
|
2123
2133
|
//#endregion
|
|
2124
2134
|
//#region src/cmd/structure/check.ts
|
|
2125
|
-
var
|
|
2135
|
+
var Ar = class e extends d {
|
|
2126
2136
|
static description = "Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.";
|
|
2127
2137
|
static examples = ["<%= config.bin %> <%= command.id %> ./my-block", "<%= config.bin %> <%= command.id %> --sdk-internal etc/blocks/*"];
|
|
2128
2138
|
static strict = !1;
|
|
@@ -2130,7 +2140,7 @@ var kr = class e extends d {
|
|
|
2130
2140
|
async run() {
|
|
2131
2141
|
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates"), a = !1;
|
|
2132
2142
|
for (let e of r) {
|
|
2133
|
-
let t = await
|
|
2143
|
+
let t = await Or({
|
|
2134
2144
|
blockPath: e,
|
|
2135
2145
|
isSdkInternal: n["sdk-internal"],
|
|
2136
2146
|
updateDepsOnly: !1,
|
|
@@ -2138,38 +2148,38 @@ var kr = class e extends d {
|
|
|
2138
2148
|
templatesRoot: i,
|
|
2139
2149
|
log: (e) => this.log(e)
|
|
2140
2150
|
});
|
|
2141
|
-
this.log(
|
|
2151
|
+
this.log(kr(e, t.changes)), t.changes.length > 0 && (a = !0);
|
|
2142
2152
|
}
|
|
2143
2153
|
a && this.error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.", { exit: 1 });
|
|
2144
2154
|
}
|
|
2145
|
-
},
|
|
2155
|
+
}, Q = ["python"], jr = class extends Error {
|
|
2146
2156
|
constructor(e) {
|
|
2147
2157
|
super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
|
|
2148
2158
|
}
|
|
2149
2159
|
};
|
|
2150
|
-
async function
|
|
2160
|
+
async function $(e, t, n, r) {
|
|
2151
2161
|
if (e !== void 0 && e !== "") return e;
|
|
2152
|
-
if (n) throw new
|
|
2162
|
+
if (n) throw new jr(t);
|
|
2153
2163
|
return r();
|
|
2154
2164
|
}
|
|
2155
2165
|
async function Mr(e) {
|
|
2156
|
-
let t = await
|
|
2166
|
+
let t = await $(e.npmOrg, "npm-org", e.nonInteractive, () => de({
|
|
2157
2167
|
message: "npm org (e.g. @platforma-open):",
|
|
2158
2168
|
default: "@platforma-open"
|
|
2159
|
-
})), n = await
|
|
2169
|
+
})), n = await $(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await $(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
|
|
2160
2170
|
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await ue({
|
|
2161
2171
|
message: "Include a software module?",
|
|
2162
2172
|
default: !1
|
|
2163
2173
|
}) : e.withSoftware;
|
|
2164
2174
|
let a;
|
|
2165
2175
|
if (i) {
|
|
2166
|
-
if (a = await
|
|
2176
|
+
if (a = await $(e.platform, "platform", e.nonInteractive, () => fe({
|
|
2167
2177
|
message: "Software platform:",
|
|
2168
|
-
choices:
|
|
2178
|
+
choices: Q.map((e) => ({
|
|
2169
2179
|
name: e,
|
|
2170
2180
|
value: e
|
|
2171
2181
|
}))
|
|
2172
|
-
})),
|
|
2182
|
+
})), !Q.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${Q.join(", ")} ${Q.length === 1 ? "is" : "are"} supported at v1.`);
|
|
2173
2183
|
} else if (e.platform) throw Error("--platform was given but software is disabled (--no-software).");
|
|
2174
2184
|
return {
|
|
2175
2185
|
facadeName: `${t}/${n}.${r}`,
|
|
@@ -2181,19 +2191,19 @@ async function Mr(e) {
|
|
|
2181
2191
|
};
|
|
2182
2192
|
}
|
|
2183
2193
|
async function Nr(e) {
|
|
2184
|
-
let t = e.vars, n =
|
|
2194
|
+
let t = e.vars, n = gn(t), r = new Oe(e.blockPath), i = new ke(e.templatesRoot), a = _n({
|
|
2185
2195
|
blockVars: t,
|
|
2186
2196
|
modules: n,
|
|
2187
2197
|
isSdkInternal: !1,
|
|
2188
2198
|
version: 1,
|
|
2189
2199
|
dryRun: !1
|
|
2190
|
-
}), o =
|
|
2200
|
+
}), o = X.filter(Ln), s, c;
|
|
2191
2201
|
try {
|
|
2192
|
-
s = await
|
|
2202
|
+
s = await Rn(o), c = await Bn(Gn);
|
|
2193
2203
|
} catch (e) {
|
|
2194
2204
|
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)}`);
|
|
2195
2205
|
}
|
|
2196
|
-
return
|
|
2206
|
+
return on(Er, r, a, {
|
|
2197
2207
|
templates: i,
|
|
2198
2208
|
initMode: !0,
|
|
2199
2209
|
registryLookup: s,
|
|
@@ -2213,7 +2223,7 @@ var Pr = {
|
|
|
2213
2223
|
"restore-overview-from-snapshot": Se,
|
|
2214
2224
|
"update-deps": Ce,
|
|
2215
2225
|
"upload-package-v1": De,
|
|
2216
|
-
"structure:check":
|
|
2226
|
+
"structure:check": Ar,
|
|
2217
2227
|
"structure:init": class e extends d {
|
|
2218
2228
|
static description = "Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.";
|
|
2219
2229
|
static examples = ["<%= config.bin %> <%= command.id %> --npm-org @platforma-open --org-scope my-org --short-name demo --no-software --non-interactive", "<%= config.bin %> <%= command.id %> ./demo --npm-org @platforma-open --org-scope my-org --short-name demo --with-software --platform python --non-interactive"];
|
|
@@ -2226,7 +2236,7 @@ var Pr = {
|
|
|
2226
2236
|
"no-software": f.boolean({ description: "omit the software module" }),
|
|
2227
2237
|
platform: f.string({
|
|
2228
2238
|
description: "software platform (single-valued)",
|
|
2229
|
-
options: [
|
|
2239
|
+
options: [...Q]
|
|
2230
2240
|
}),
|
|
2231
2241
|
"non-interactive": f.boolean({ description: "error on any missing flag instead of prompting" })
|
|
2232
2242
|
};
|
|
@@ -2264,7 +2274,7 @@ var Pr = {
|
|
|
2264
2274
|
async run() {
|
|
2265
2275
|
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates");
|
|
2266
2276
|
for (let e of r) {
|
|
2267
|
-
let t = await
|
|
2277
|
+
let t = await Or({
|
|
2268
2278
|
blockPath: e,
|
|
2269
2279
|
isSdkInternal: n["sdk-internal"],
|
|
2270
2280
|
updateDepsOnly: n["update-deps-only"],
|
|
@@ -2272,7 +2282,7 @@ var Pr = {
|
|
|
2272
2282
|
templatesRoot: i,
|
|
2273
2283
|
log: (e) => this.log(e)
|
|
2274
2284
|
});
|
|
2275
|
-
this.log(
|
|
2285
|
+
this.log(kr(e, t.changes));
|
|
2276
2286
|
}
|
|
2277
2287
|
}
|
|
2278
2288
|
}
|