@platforma-sdk/block-tools 2.16.12 → 2.16.14
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 +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +190 -169
- package/dist/cli.mjs.map +1 -1
- package/dist/structure/rules/root-changeset-config.d.ts +3 -2
- package/package.json +7 -7
- package/src/structure/__tests__/root-changeset-config.test.ts +47 -0
- package/src/structure/rules/root-changeset-config.ts +66 -21
- package/src/structure/rules/root.ts +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1559,7 +1559,26 @@ function hr() {
|
|
|
1559
1559
|
}
|
|
1560
1560
|
//#endregion
|
|
1561
1561
|
//#region src/structure/rules/root-changeset-config.ts
|
|
1562
|
-
var gr = "---\n---\n\nInitial release.\n"
|
|
1562
|
+
var gr = "---\n---\n\nInitial release.\n";
|
|
1563
|
+
function _r(e) {
|
|
1564
|
+
return {
|
|
1565
|
+
$schema: "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
1566
|
+
changelog: yr,
|
|
1567
|
+
commit: !1,
|
|
1568
|
+
fixed: [Tr(e)],
|
|
1569
|
+
linked: [],
|
|
1570
|
+
access: br,
|
|
1571
|
+
baseBranch: xr,
|
|
1572
|
+
updateInternalDependencies: Sr,
|
|
1573
|
+
ignore: []
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
function vr(e) {
|
|
1577
|
+
R("changelog", yr), R("commit", !1), R("access", br), R("baseBranch", xr), R("updateInternalDependencies", Sr);
|
|
1578
|
+
let t = Tr(e);
|
|
1579
|
+
Ut("fixed", (e) => Er(e, t)), W(Cr);
|
|
1580
|
+
}
|
|
1581
|
+
var yr = "@changesets/cli/changelog", br = "restricted", xr = "main", Sr = "patch", Cr = [
|
|
1563
1582
|
"$schema",
|
|
1564
1583
|
"changelog",
|
|
1565
1584
|
"commit",
|
|
@@ -1569,26 +1588,28 @@ var gr = "---\n---\n\nInitial release.\n", _r = "@changesets/cli/changelog", vr
|
|
|
1569
1588
|
"baseBranch",
|
|
1570
1589
|
"updateInternalDependencies",
|
|
1571
1590
|
"ignore"
|
|
1591
|
+
], wr = [
|
|
1592
|
+
"block",
|
|
1593
|
+
"model",
|
|
1594
|
+
"ui",
|
|
1595
|
+
"workflow"
|
|
1572
1596
|
];
|
|
1573
|
-
function
|
|
1574
|
-
return
|
|
1575
|
-
$schema: "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
1576
|
-
changelog: _r,
|
|
1577
|
-
commit: !1,
|
|
1578
|
-
fixed: [],
|
|
1579
|
-
linked: [],
|
|
1580
|
-
access: vr,
|
|
1581
|
-
baseBranch: yr,
|
|
1582
|
-
updateInternalDependencies: br,
|
|
1583
|
-
ignore: []
|
|
1584
|
-
};
|
|
1597
|
+
function Tr(e) {
|
|
1598
|
+
return wr.flatMap((t) => K(e, t).map((e) => e.name));
|
|
1585
1599
|
}
|
|
1586
|
-
function
|
|
1587
|
-
|
|
1600
|
+
function Er(e, t) {
|
|
1601
|
+
let n = new Set(t), r = Array.isArray(e) ? e.filter(Dr) : [], i = r.findIndex((e) => e.some((e) => n.has(e))), a = [];
|
|
1602
|
+
return r.forEach((e, r) => {
|
|
1603
|
+
let o = e.filter((e) => !n.has(e));
|
|
1604
|
+
r === i ? a.push([...t, ...o]) : o.length > 0 && a.push(o);
|
|
1605
|
+
}), i === -1 && a.push(t), a;
|
|
1606
|
+
}
|
|
1607
|
+
function Dr(e) {
|
|
1608
|
+
return Array.isArray(e) && e.every((e) => typeof e == "string");
|
|
1588
1609
|
}
|
|
1589
1610
|
//#endregion
|
|
1590
1611
|
//#region src/structure/rules/root.ts
|
|
1591
|
-
function
|
|
1612
|
+
function Or() {
|
|
1592
1613
|
C("root", () => {
|
|
1593
1614
|
w(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1594
1615
|
D("turbo.json", N(() => Un()), () => {
|
|
@@ -1599,33 +1620,33 @@ function wr() {
|
|
|
1599
1620
|
pr();
|
|
1600
1621
|
}), D(".gitignore", j("root/.gitignore"), () => {
|
|
1601
1622
|
hr();
|
|
1602
|
-
}), D(".changeset/config.json", N(() =>
|
|
1603
|
-
|
|
1623
|
+
}), D(".changeset/config.json", N((e) => _r(e)), (e) => {
|
|
1624
|
+
vr(e);
|
|
1604
1625
|
}), k(".changeset/scaffold.md", et(gr));
|
|
1605
1626
|
});
|
|
1606
1627
|
});
|
|
1607
1628
|
}
|
|
1608
1629
|
//#endregion
|
|
1609
1630
|
//#region src/structure/rules/root-ci.ts
|
|
1610
|
-
function
|
|
1631
|
+
function kr(e) {
|
|
1611
1632
|
return e.split(/[-_]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
1612
1633
|
}
|
|
1613
|
-
function
|
|
1634
|
+
function Ar() {
|
|
1614
1635
|
C("root", () => {
|
|
1615
1636
|
w(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1616
1637
|
E(".github/workflows/build.yaml", M("workflows/build.tpl.yaml", (e) => {
|
|
1617
1638
|
let t = e.blockVars.shortName;
|
|
1618
1639
|
return {
|
|
1619
|
-
appName: `Block: ${
|
|
1640
|
+
appName: `Block: ${kr(t)}`,
|
|
1620
1641
|
appNameSlug: `block-${t}`
|
|
1621
1642
|
};
|
|
1622
|
-
})), E(".github/workflows/mark-stable.yaml", M("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${
|
|
1643
|
+
})), E(".github/workflows/mark-stable.yaml", M("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${kr(e.blockVars.shortName)} - Mark Stable` })));
|
|
1623
1644
|
});
|
|
1624
1645
|
});
|
|
1625
1646
|
}
|
|
1626
1647
|
//#endregion
|
|
1627
1648
|
//#region src/structure/rules/block-package-json.ts
|
|
1628
|
-
var
|
|
1649
|
+
var jr = {
|
|
1629
1650
|
"@platforma-open": {
|
|
1630
1651
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1631
1652
|
serveUrl: "https://blocks.pl-open.science"
|
|
@@ -1634,45 +1655,45 @@ var Dr = {
|
|
|
1634
1655
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1635
1656
|
serveUrl: "https://block.registry.platforma.bio/releases"
|
|
1636
1657
|
}
|
|
1637
|
-
},
|
|
1658
|
+
}, Mr = {
|
|
1638
1659
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1639
1660
|
serveUrl: "https://blocks.pl-open.science"
|
|
1640
|
-
},
|
|
1661
|
+
}, Nr = {
|
|
1641
1662
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/aux/dev/?region=eu-central-1",
|
|
1642
1663
|
serveUrl: "https://aux-blocks.pl-open.science"
|
|
1643
1664
|
};
|
|
1644
|
-
function
|
|
1645
|
-
let n = t ?
|
|
1665
|
+
function Pr(e, t) {
|
|
1666
|
+
let n = t ? Nr : jr[e] ?? Mr;
|
|
1646
1667
|
return `block-tools publish -r ${n.s3} --registry-serve-url ${n.serveUrl}`;
|
|
1647
1668
|
}
|
|
1648
|
-
function
|
|
1669
|
+
function Fr(e) {
|
|
1649
1670
|
let t = {};
|
|
1650
1671
|
for (let n of K(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
|
|
1651
1672
|
for (let n of K(e, "model")) t.model = `${n.name}/dist/model.json`;
|
|
1652
1673
|
for (let n of K(e, "ui")) t.ui = `${n.name}/dist`;
|
|
1653
1674
|
return t;
|
|
1654
1675
|
}
|
|
1655
|
-
function
|
|
1676
|
+
function Ir(e, t) {
|
|
1656
1677
|
return {
|
|
1657
1678
|
build: "ts-builder build --target block-facade && block-tools pack",
|
|
1658
1679
|
check: "ts-builder type-check --target block-facade",
|
|
1659
|
-
prepublishOnly:
|
|
1680
|
+
prepublishOnly: Pr(e, t),
|
|
1660
1681
|
"do-pack": "shx rm -f package.tgz && pnpm pack && shx mv *.tgz package.tgz"
|
|
1661
1682
|
};
|
|
1662
1683
|
}
|
|
1663
|
-
var
|
|
1684
|
+
var Lr = {
|
|
1664
1685
|
"@milaboratories/ts-builder": "sdk:",
|
|
1665
1686
|
"@milaboratories/ts-configs": "sdk:",
|
|
1666
1687
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1667
1688
|
"@platforma-sdk/model": "sdk:",
|
|
1668
1689
|
shx: "catalog:",
|
|
1669
1690
|
typescript: "catalog:"
|
|
1670
|
-
},
|
|
1691
|
+
}, Rr = { ".": {
|
|
1671
1692
|
sources: "./src/index.ts",
|
|
1672
1693
|
types: "./dist/index.d.ts",
|
|
1673
1694
|
default: "./dist/index.js"
|
|
1674
1695
|
} };
|
|
1675
|
-
function
|
|
1696
|
+
function zr(e) {
|
|
1676
1697
|
if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
|
|
1677
1698
|
let t = e.meta, n = [
|
|
1678
1699
|
["block.meta.title", t.title],
|
|
@@ -1684,15 +1705,15 @@ function Fr(e) {
|
|
|
1684
1705
|
];
|
|
1685
1706
|
for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
|
|
1686
1707
|
}
|
|
1687
|
-
function
|
|
1708
|
+
function Br(e) {
|
|
1688
1709
|
let t = e.blockVars, n = {
|
|
1689
|
-
...
|
|
1710
|
+
...Lr,
|
|
1690
1711
|
...q(e, "model"),
|
|
1691
1712
|
...q(e, "ui"),
|
|
1692
1713
|
...q(e, "workflow"),
|
|
1693
1714
|
...q(e, "kind")
|
|
1694
1715
|
}, r = {
|
|
1695
|
-
components:
|
|
1716
|
+
components: Fr(e),
|
|
1696
1717
|
meta: {
|
|
1697
1718
|
title: t.shortName,
|
|
1698
1719
|
description: `${t.shortName} block`,
|
|
@@ -1704,7 +1725,7 @@ function Ir(e) {
|
|
|
1704
1725
|
}
|
|
1705
1726
|
}
|
|
1706
1727
|
};
|
|
1707
|
-
return
|
|
1728
|
+
return zr(r), {
|
|
1708
1729
|
name: `${t.facadeName}.block`,
|
|
1709
1730
|
version: X,
|
|
1710
1731
|
type: "module",
|
|
@@ -1712,45 +1733,45 @@ function Ir(e) {
|
|
|
1712
1733
|
main: "./dist/index.js",
|
|
1713
1734
|
module: "./dist/index.js",
|
|
1714
1735
|
types: "./dist/index.d.ts",
|
|
1715
|
-
exports:
|
|
1716
|
-
scripts:
|
|
1736
|
+
exports: Rr,
|
|
1737
|
+
scripts: Ir(t.npmOrg, e.isSdkInternal),
|
|
1717
1738
|
dependencies: {},
|
|
1718
1739
|
devDependencies: n,
|
|
1719
1740
|
block: r
|
|
1720
1741
|
};
|
|
1721
1742
|
}
|
|
1722
|
-
function
|
|
1743
|
+
function Vr(e) {
|
|
1723
1744
|
let t = e.blockVars, n = K(e, "kind");
|
|
1724
1745
|
if (n.length !== 1) throw Error(n.length === 0 ? `block '${t.facadeName}' declares no kind — every block must have a sibling kind/ package` : `block '${t.facadeName}' declares ${n.length} kinds; exactly one is required`);
|
|
1725
|
-
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",
|
|
1726
|
-
let r =
|
|
1746
|
+
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", Rr);
|
|
1747
|
+
let r = Ir(t.npmOrg, e.isSdkInternal);
|
|
1727
1748
|
for (let [e, t] of Object.entries(r)) z(e, t);
|
|
1728
|
-
zt("model"), zt("ui"), zt("workflow"), zt("kind"), V("@milaboratories/ts-builder", "sdk:"), V("@milaboratories/ts-configs", "sdk:"), V("@platforma-sdk/block-tools", "sdk:"), V("@platforma-sdk/model", "sdk:"), V("shx", "catalog:"), V("typescript", "catalog:"), R("block.components",
|
|
1749
|
+
zt("model"), zt("ui"), zt("workflow"), zt("kind"), V("@milaboratories/ts-builder", "sdk:"), V("@milaboratories/ts-configs", "sdk:"), V("@platforma-sdk/block-tools", "sdk:"), V("@platforma-sdk/model", "sdk:"), V("shx", "catalog:"), V("typescript", "catalog:"), R("block.components", Fr(e)), At("version", "facade package.json must carry a 'version' (the facade publishes)"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1729
1750
|
}
|
|
1730
1751
|
//#endregion
|
|
1731
1752
|
//#region src/structure/rules/shared/pascal-case.ts
|
|
1732
|
-
function
|
|
1753
|
+
function Hr(e) {
|
|
1733
1754
|
let t = e.split(/[^A-Za-z0-9]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
|
|
1734
1755
|
return /^[0-9]/.test(t) ? `_${t}` : t;
|
|
1735
1756
|
}
|
|
1736
1757
|
//#endregion
|
|
1737
1758
|
//#region src/structure/rules/block.ts
|
|
1738
|
-
function
|
|
1759
|
+
function Ur() {
|
|
1739
1760
|
C("block", () => {
|
|
1740
1761
|
A("index.js"), A("index.d.ts"), E("src/index.ts", M("block/src/index.tpl.ts", (e) => ({
|
|
1741
1762
|
facadeName: e.blockVars.facadeName,
|
|
1742
|
-
pascalName:
|
|
1743
|
-
}))), E("src/AGENTS.ts", j("block/src/AGENTS.ts")), O("src/block-extra.ts", j("block/src/block-extra.ts")), O("src/agents-extra.ts", j("block/src/agents-extra.ts")), E("tsconfig.json", j("block/tsconfig.json")), k("logos/block-logo.png", $e("block/logos/block-logo.png")), k("logos/organization-logo.png", $e("block/logos/organization-logo.png")), D("package.json", N((e) =>
|
|
1744
|
-
|
|
1763
|
+
pascalName: Hr(e.blockVars.shortName)
|
|
1764
|
+
}))), E("src/AGENTS.ts", j("block/src/AGENTS.ts")), O("src/block-extra.ts", j("block/src/block-extra.ts")), O("src/agents-extra.ts", j("block/src/agents-extra.ts")), E("tsconfig.json", j("block/tsconfig.json")), k("logos/block-logo.png", $e("block/logos/block-logo.png")), k("logos/organization-logo.png", $e("block/logos/organization-logo.png")), D("package.json", N((e) => Br(e)), (e) => {
|
|
1765
|
+
Vr(e);
|
|
1745
1766
|
});
|
|
1746
1767
|
});
|
|
1747
1768
|
}
|
|
1748
1769
|
//#endregion
|
|
1749
1770
|
//#region src/structure/rules/shared/colocated-tests.ts
|
|
1750
|
-
var Q = "src/**/*.test.ts",
|
|
1771
|
+
var Q = "src/**/*.test.ts", Wr = "src/**/*.test.tengo";
|
|
1751
1772
|
//#endregion
|
|
1752
1773
|
//#region src/structure/rules/model-package-json.ts
|
|
1753
|
-
function
|
|
1774
|
+
function Gr(e) {
|
|
1754
1775
|
return {
|
|
1755
1776
|
name: `${e.blockVars.facadeName}.model`,
|
|
1756
1777
|
version: X,
|
|
@@ -1788,7 +1809,7 @@ function Vr(e) {
|
|
|
1788
1809
|
}
|
|
1789
1810
|
};
|
|
1790
1811
|
}
|
|
1791
|
-
function
|
|
1812
|
+
function Kr() {
|
|
1792
1813
|
Z(), R("private", !0), R("type", "module"), R("main", "dist/index.cjs"), R("module", "dist/index.js"), R("types", "dist/index.d.ts"), R("exports", {
|
|
1793
1814
|
".": {
|
|
1794
1815
|
types: "./dist/index.d.ts",
|
|
@@ -1809,23 +1830,23 @@ function Hr() {
|
|
|
1809
1830
|
}
|
|
1810
1831
|
//#endregion
|
|
1811
1832
|
//#region src/structure/rules/model.ts
|
|
1812
|
-
function
|
|
1833
|
+
function qr() {
|
|
1813
1834
|
C("model", () => {
|
|
1814
|
-
w(T(Q), () => E("tsconfig.json", j("model/tsconfig.node.json")), () => E("tsconfig.json", j("model/tsconfig.json"))), E(".oxlintrc.json", j("model/.oxlintrc.json")), E(".oxfmtrc.json", j("model/.oxfmtrc.json")), k("src/index.ts", M("model/src/index.tpl.ts", (e) => ({ kindPkg: `${e.blockVars.facadeName}.kind` }))), D("package.json", N((e) =>
|
|
1815
|
-
|
|
1835
|
+
w(T(Q), () => E("tsconfig.json", j("model/tsconfig.node.json")), () => E("tsconfig.json", j("model/tsconfig.json"))), E(".oxlintrc.json", j("model/.oxlintrc.json")), E(".oxfmtrc.json", j("model/.oxfmtrc.json")), k("src/index.ts", M("model/src/index.tpl.ts", (e) => ({ kindPkg: `${e.blockVars.facadeName}.kind` }))), D("package.json", N((e) => Gr(e)), () => {
|
|
1836
|
+
Kr();
|
|
1816
1837
|
});
|
|
1817
1838
|
});
|
|
1818
1839
|
}
|
|
1819
1840
|
//#endregion
|
|
1820
1841
|
//#region src/structure/rules/kind-package-json.ts
|
|
1821
|
-
var
|
|
1842
|
+
var Jr = { ".": {
|
|
1822
1843
|
types: "./dist/index.d.ts",
|
|
1823
1844
|
sources: "./src/index.ts",
|
|
1824
1845
|
import: "./dist/index.js",
|
|
1825
1846
|
require: "./dist/index.cjs",
|
|
1826
1847
|
default: "./dist/index.js"
|
|
1827
1848
|
} };
|
|
1828
|
-
function
|
|
1849
|
+
function Yr(e) {
|
|
1829
1850
|
return {
|
|
1830
1851
|
name: `${e.blockVars.facadeName}.kind`,
|
|
1831
1852
|
version: X,
|
|
@@ -1834,7 +1855,7 @@ function Gr(e) {
|
|
|
1834
1855
|
main: "./dist/index.cjs",
|
|
1835
1856
|
module: "./dist/index.js",
|
|
1836
1857
|
types: "./dist/index.d.ts",
|
|
1837
|
-
exports:
|
|
1858
|
+
exports: Jr,
|
|
1838
1859
|
scripts: {
|
|
1839
1860
|
fmt: "ts-builder format",
|
|
1840
1861
|
watch: "ts-builder build --target block-kind --watch",
|
|
@@ -1853,8 +1874,8 @@ function Gr(e) {
|
|
|
1853
1874
|
}
|
|
1854
1875
|
};
|
|
1855
1876
|
}
|
|
1856
|
-
function
|
|
1857
|
-
Z(), R("private", !0), R("type", "module"), R("main", "./dist/index.cjs"), R("module", "./dist/index.js"), R("types", "./dist/index.d.ts"), R("exports",
|
|
1877
|
+
function Xr() {
|
|
1878
|
+
Z(), R("private", !0), R("type", "module"), R("main", "./dist/index.cjs"), R("module", "./dist/index.js"), R("types", "./dist/index.d.ts"), R("exports", Jr), z("fmt", "ts-builder format"), z("watch", "ts-builder build --target block-kind --watch"), z("build", "ts-builder build --target block-kind && block-tools build-kind-manifest"), z("check", "ts-builder check --target block-kind"), B("lint"), Pt("@platforma-sdk/block-kind", "sdk:"), U({
|
|
1858
1879
|
"@milaboratories/ts-builder": "sdk:",
|
|
1859
1880
|
"@milaboratories/ts-configs": "sdk:",
|
|
1860
1881
|
"@platforma-sdk/block-tools": "sdk:"
|
|
@@ -1865,16 +1886,16 @@ function Kr() {
|
|
|
1865
1886
|
}
|
|
1866
1887
|
//#endregion
|
|
1867
1888
|
//#region src/structure/rules/kind.ts
|
|
1868
|
-
function
|
|
1889
|
+
function Zr() {
|
|
1869
1890
|
C("kind", () => {
|
|
1870
|
-
E("tsconfig.json", j("kind/tsconfig.json")), E(".oxlintrc.json", j("kind/.oxlintrc.json")), E(".oxfmtrc.json", j("kind/.oxfmtrc.json")), O("src/index.ts", j("kind/src/index.ts")), D("package.json", N((e) =>
|
|
1871
|
-
|
|
1891
|
+
E("tsconfig.json", j("kind/tsconfig.json")), E(".oxlintrc.json", j("kind/.oxlintrc.json")), E(".oxfmtrc.json", j("kind/.oxfmtrc.json")), O("src/index.ts", j("kind/src/index.ts")), D("package.json", N((e) => Yr(e)), () => {
|
|
1892
|
+
Xr();
|
|
1872
1893
|
});
|
|
1873
1894
|
});
|
|
1874
1895
|
}
|
|
1875
1896
|
//#endregion
|
|
1876
1897
|
//#region src/structure/rules/ui-package-json.ts
|
|
1877
|
-
function
|
|
1898
|
+
function Qr(e) {
|
|
1878
1899
|
return {
|
|
1879
1900
|
name: `${e.blockVars.facadeName}.ui`,
|
|
1880
1901
|
version: X,
|
|
@@ -1902,7 +1923,7 @@ function Jr(e) {
|
|
|
1902
1923
|
}
|
|
1903
1924
|
};
|
|
1904
1925
|
}
|
|
1905
|
-
function
|
|
1926
|
+
function $r() {
|
|
1906
1927
|
Z(), R("private", !0), R("type", "module"), z("fmt", "ts-builder format"), z("dev", "ts-builder serve --target block-ui"), z("watch", "ts-builder build --target block-ui --watch"), z("build", "ts-builder build --target block-ui"), z("check", "ts-builder check --target block-ui"), Pt("@platforma-sdk/ui-vue", "sdk:"), Pt("vue", "catalog:"), Rt("model"), U({
|
|
1907
1928
|
"@milaboratories/ts-builder": "sdk:",
|
|
1908
1929
|
"@milaboratories/ts-configs": "sdk:"
|
|
@@ -1915,16 +1936,16 @@ function Yr() {
|
|
|
1915
1936
|
}
|
|
1916
1937
|
//#endregion
|
|
1917
1938
|
//#region src/structure/rules/ui.ts
|
|
1918
|
-
function
|
|
1939
|
+
function ei() {
|
|
1919
1940
|
C("ui", () => {
|
|
1920
|
-
w(T(Q), () => E("tsconfig.json", j("ui/tsconfig.node.json")), () => E("tsconfig.json", j("ui/tsconfig.json"))), E(".oxlintrc.json", j("ui/.oxlintrc.json")), E(".oxfmtrc.json", j("ui/.oxfmtrc.json")), O("index.html", j("ui/index.html")), k("src/main.ts", j("ui/src/main.ts")), k("src/app.ts", M("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), k("src/MainPage.vue", M("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), D("package.json", N((e) =>
|
|
1921
|
-
|
|
1941
|
+
w(T(Q), () => E("tsconfig.json", j("ui/tsconfig.node.json")), () => E("tsconfig.json", j("ui/tsconfig.json"))), E(".oxlintrc.json", j("ui/.oxlintrc.json")), E(".oxfmtrc.json", j("ui/.oxfmtrc.json")), O("index.html", j("ui/index.html")), k("src/main.ts", j("ui/src/main.ts")), k("src/app.ts", M("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), k("src/MainPage.vue", M("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), D("package.json", N((e) => Qr(e)), () => {
|
|
1942
|
+
$r();
|
|
1922
1943
|
});
|
|
1923
1944
|
});
|
|
1924
1945
|
}
|
|
1925
1946
|
//#endregion
|
|
1926
1947
|
//#region src/structure/rules/workflow-package-json.ts
|
|
1927
|
-
function
|
|
1948
|
+
function ti(e) {
|
|
1928
1949
|
return {
|
|
1929
1950
|
name: `${e.blockVars.facadeName}.workflow`,
|
|
1930
1951
|
version: X,
|
|
@@ -1946,11 +1967,11 @@ function Zr(e) {
|
|
|
1946
1967
|
}
|
|
1947
1968
|
};
|
|
1948
1969
|
}
|
|
1949
|
-
function
|
|
1970
|
+
function ni() {
|
|
1950
1971
|
Z(), R("private", !0), R("type", "module"), z("build", "shx rm -rf dist && pl-tengo build"), z("check", "pl-tengo imports && pl-tengo check"), z("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
|
|
1951
|
-
w(T(
|
|
1972
|
+
w(T(Wr), () => z("test", "pl-tengo test && vitest run --passWithNoTests"), () => z("test", "vitest run --passWithNoTests")), U({ vitest: "catalog:" });
|
|
1952
1973
|
}, () => {
|
|
1953
|
-
w(T(
|
|
1974
|
+
w(T(Wr), () => z("test", "pl-tengo test")), H("vitest");
|
|
1954
1975
|
})), Pt("@platforma-sdk/workflow-tengo", "sdk:"), Rt("software"), U({
|
|
1955
1976
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1956
1977
|
"@platforma-sdk/test": "sdk:",
|
|
@@ -1959,20 +1980,20 @@ function Qr() {
|
|
|
1959
1980
|
}
|
|
1960
1981
|
//#endregion
|
|
1961
1982
|
//#region src/structure/rules/workflow.ts
|
|
1962
|
-
function
|
|
1983
|
+
function ri() {
|
|
1963
1984
|
C("workflow", () => {
|
|
1964
1985
|
E("format.el", j("workflow/format.el")), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
|
|
1965
1986
|
E("tsconfig.json", j("workflow/tsconfig.json")), O("vitest.config.mts", j("workflow/vitest.config.mts"));
|
|
1966
1987
|
}, () => {
|
|
1967
1988
|
A("tsconfig.json"), A("vitest.config.mts");
|
|
1968
|
-
})), A("index.js"), A("index.d.ts"), k("src/main.tpl.tengo", M("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), D("package.json", N((e) =>
|
|
1969
|
-
|
|
1989
|
+
})), A("index.js"), A("index.d.ts"), k("src/main.tpl.tengo", M("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), D("package.json", N((e) => ti(e)), () => {
|
|
1990
|
+
ni();
|
|
1970
1991
|
});
|
|
1971
1992
|
});
|
|
1972
1993
|
}
|
|
1973
1994
|
//#endregion
|
|
1974
1995
|
//#region src/structure/rules/test-package-json.ts
|
|
1975
|
-
function
|
|
1996
|
+
function ii(e) {
|
|
1976
1997
|
return {
|
|
1977
1998
|
name: `${e.blockVars.facadeName}.test`,
|
|
1978
1999
|
version: X,
|
|
@@ -1992,7 +2013,7 @@ function ei(e) {
|
|
|
1992
2013
|
}
|
|
1993
2014
|
};
|
|
1994
2015
|
}
|
|
1995
|
-
function
|
|
2016
|
+
function ai() {
|
|
1996
2017
|
Z(), R("private", !0), R("type", "module"), z("fmt", "ts-builder format"), z("check", "ts-builder check --target block-test"), z("test", "vitest run --passWithNoTests"), B("lint"), U({
|
|
1997
2018
|
"@platforma-sdk/test": "sdk:",
|
|
1998
2019
|
"@milaboratories/ts-builder": "sdk:",
|
|
@@ -2002,17 +2023,17 @@ function ti() {
|
|
|
2002
2023
|
}
|
|
2003
2024
|
//#endregion
|
|
2004
2025
|
//#region src/structure/rules/test.ts
|
|
2005
|
-
function
|
|
2026
|
+
function oi() {
|
|
2006
2027
|
C("test", () => {
|
|
2007
|
-
E("tsconfig.json", j("test/tsconfig.json")), E(".oxlintrc.json", j("test/.oxlintrc.json")), E(".oxfmtrc.json", j("test/.oxfmtrc.json")), O("vitest.config.mts", j("test/vitest.config.mts")), k("src/demo.test.ts", et("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), D("package.json", N((e) =>
|
|
2008
|
-
|
|
2028
|
+
E("tsconfig.json", j("test/tsconfig.json")), E(".oxlintrc.json", j("test/.oxlintrc.json")), E(".oxfmtrc.json", j("test/.oxfmtrc.json")), O("vitest.config.mts", j("test/vitest.config.mts")), k("src/demo.test.ts", et("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), D("package.json", N((e) => ii(e)), () => {
|
|
2029
|
+
ai();
|
|
2009
2030
|
});
|
|
2010
2031
|
});
|
|
2011
2032
|
}
|
|
2012
2033
|
//#endregion
|
|
2013
2034
|
//#region src/structure/rules/software-package-json.ts
|
|
2014
|
-
var
|
|
2015
|
-
function
|
|
2035
|
+
var si = "block-tools software build", ci = "shx rm -f *.tgz && block-tools software build && pnpm pack && shx mv platforma-open*.tgz package.tgz";
|
|
2036
|
+
function li() {
|
|
2016
2037
|
return { entrypoints: { main: { binary: {
|
|
2017
2038
|
artifact: {
|
|
2018
2039
|
type: "python",
|
|
@@ -2027,7 +2048,7 @@ function ai() {
|
|
|
2027
2048
|
cmd: ["python", "{pkg}/main.py"]
|
|
2028
2049
|
} } } };
|
|
2029
2050
|
}
|
|
2030
|
-
function
|
|
2051
|
+
function ui(e) {
|
|
2031
2052
|
return {
|
|
2032
2053
|
name: `${e.blockVars.facadeName}.software`,
|
|
2033
2054
|
version: X,
|
|
@@ -2035,32 +2056,32 @@ function oi(e) {
|
|
|
2035
2056
|
description: "Block Software",
|
|
2036
2057
|
files: ["./dist/**/*"],
|
|
2037
2058
|
scripts: {
|
|
2038
|
-
build:
|
|
2039
|
-
"do-pack":
|
|
2059
|
+
build: si,
|
|
2060
|
+
"do-pack": ci,
|
|
2040
2061
|
changeset: "changeset",
|
|
2041
2062
|
"version-packages": "changeset version"
|
|
2042
2063
|
},
|
|
2043
|
-
"block-software":
|
|
2064
|
+
"block-software": li(),
|
|
2044
2065
|
devDependencies: {
|
|
2045
2066
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
2046
2067
|
"@platforma-sdk/block-tools": "sdk:"
|
|
2047
2068
|
}
|
|
2048
2069
|
};
|
|
2049
2070
|
}
|
|
2050
|
-
function
|
|
2051
|
-
kt("private"), Z(), R("type", "module"), R("files", ["./dist/**/*"]), z("build",
|
|
2071
|
+
function di() {
|
|
2072
|
+
kt("private"), Z(), R("type", "module"), R("files", ["./dist/**/*"]), z("build", si), z("do-pack", ci), B("prepublishOnly"), z("changeset", "changeset"), z("version-packages", "changeset version"), V("@platforma-open/milaboratories.runenv-python-3", "catalog:"), V("@platforma-sdk/block-tools", "sdk:"), H("@platforma-sdk/package-builder"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
2052
2073
|
}
|
|
2053
2074
|
//#endregion
|
|
2054
2075
|
//#region src/structure/rules/software.ts
|
|
2055
|
-
var
|
|
2056
|
-
function
|
|
2076
|
+
var fi = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", pi = "# No dependencies specified for this script\n";
|
|
2077
|
+
function mi() {
|
|
2057
2078
|
C("software", () => {
|
|
2058
|
-
k("src/main.py", et(
|
|
2059
|
-
|
|
2079
|
+
k("src/main.py", et(fi)), k("src/requirements.txt", et(pi)), D("package.json", N((e) => ui(e)), () => {
|
|
2080
|
+
di();
|
|
2060
2081
|
});
|
|
2061
2082
|
});
|
|
2062
2083
|
}
|
|
2063
|
-
function
|
|
2084
|
+
function hi() {
|
|
2064
2085
|
C("model", () => {
|
|
2065
2086
|
A("eslint.config.mjs"), A("vite.config.mts");
|
|
2066
2087
|
}), C("ui", () => {
|
|
@@ -2075,7 +2096,7 @@ function di() {
|
|
|
2075
2096
|
}
|
|
2076
2097
|
//#endregion
|
|
2077
2098
|
//#region src/structure/rules/root-catalog-bump.ts
|
|
2078
|
-
function
|
|
2099
|
+
function gi() {
|
|
2079
2100
|
Qe(() => {
|
|
2080
2101
|
C("root", () => {
|
|
2081
2102
|
w(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
@@ -2094,23 +2115,23 @@ function fi() {
|
|
|
2094
2115
|
}
|
|
2095
2116
|
//#endregion
|
|
2096
2117
|
//#region src/structure/structure-definition.ts
|
|
2097
|
-
var
|
|
2098
|
-
|
|
2118
|
+
var _i = Ge(() => {
|
|
2119
|
+
Or(), Ar(), Ur(), qr(), Zr(), ei(), ri(), oi(), mi(), hi(), gi();
|
|
2099
2120
|
});
|
|
2100
2121
|
//#endregion
|
|
2101
2122
|
//#region src/structure/cli/run-structure.ts
|
|
2102
|
-
async function
|
|
2123
|
+
async function vi() {
|
|
2103
2124
|
return tr(or.filter(er));
|
|
2104
2125
|
}
|
|
2105
|
-
async function
|
|
2106
|
-
let t = g.resolve(e.blockPath), n = e.mode === "check", r = new ke(t), i = new Ae(e.templatesRoot), a = vn(
|
|
2126
|
+
async function yi(e) {
|
|
2127
|
+
let t = g.resolve(e.blockPath), n = e.mode === "check", r = new ke(t), i = new Ae(e.templatesRoot), a = vn(_i, r, Fn({
|
|
2107
2128
|
fs: r,
|
|
2108
2129
|
isSdkInternal: e.isSdkInternal,
|
|
2109
2130
|
updateDepsOnly: e.updateDepsOnly,
|
|
2110
2131
|
dryRun: n
|
|
2111
2132
|
}), {
|
|
2112
2133
|
templates: i,
|
|
2113
|
-
registryLookup: e.updateDepsOnly ? await
|
|
2134
|
+
registryLookup: e.updateDepsOnly ? await vi() : void 0,
|
|
2114
2135
|
derivedPinLookup: e.updateDepsOnly ? await rr(lr) : void 0,
|
|
2115
2136
|
rediscover: () => Fn({
|
|
2116
2137
|
fs: r,
|
|
@@ -2124,16 +2145,16 @@ async function hi(e) {
|
|
|
2124
2145
|
changes: a.changes
|
|
2125
2146
|
};
|
|
2126
2147
|
}
|
|
2127
|
-
function
|
|
2148
|
+
function bi(e, t) {
|
|
2128
2149
|
if (t.length === 0) return ` ${e}: up to date (0 changes)`;
|
|
2129
2150
|
let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
|
|
2130
2151
|
return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
|
|
2131
2152
|
}
|
|
2132
2153
|
//#endregion
|
|
2133
2154
|
//#region src/cmd/structure/refresh.ts
|
|
2134
|
-
async function
|
|
2155
|
+
async function xi(e) {
|
|
2135
2156
|
for (let t of e.paths) {
|
|
2136
|
-
let n = await
|
|
2157
|
+
let n = await yi({
|
|
2137
2158
|
blockPath: t,
|
|
2138
2159
|
isSdkInternal: e.isSdkInternal,
|
|
2139
2160
|
updateDepsOnly: e.updateDepsOnly,
|
|
@@ -2141,14 +2162,14 @@ async function _i(e) {
|
|
|
2141
2162
|
templatesRoot: e.templatesRoot,
|
|
2142
2163
|
log: (t) => e.logger.info(t)
|
|
2143
2164
|
});
|
|
2144
|
-
e.logger.info(
|
|
2165
|
+
e.logger.info(bi(t, n.changes));
|
|
2145
2166
|
}
|
|
2146
2167
|
}
|
|
2147
|
-
function
|
|
2168
|
+
function Si(e) {
|
|
2148
2169
|
let t = new m("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).");
|
|
2149
2170
|
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) => {
|
|
2150
2171
|
let r = t.length > 0 ? t : ["."], i = g.join(e, "src", "structure", "templates");
|
|
2151
|
-
await
|
|
2172
|
+
await xi({
|
|
2152
2173
|
paths: r,
|
|
2153
2174
|
isSdkInternal: !!n.sdkInternal,
|
|
2154
2175
|
updateDepsOnly: !!n.updateDepsOnly,
|
|
@@ -2159,11 +2180,11 @@ function vi(e) {
|
|
|
2159
2180
|
}
|
|
2160
2181
|
//#endregion
|
|
2161
2182
|
//#region src/cmd/update-deps.ts
|
|
2162
|
-
function
|
|
2183
|
+
function Ci(e) {
|
|
2163
2184
|
let t = new m("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
|
|
2164
2185
|
return t.action(async () => {
|
|
2165
2186
|
let t = new b();
|
|
2166
|
-
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
|
|
2187
|
+
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 xi({
|
|
2167
2188
|
paths: ["."],
|
|
2168
2189
|
isSdkInternal: !1,
|
|
2169
2190
|
updateDepsOnly: !0,
|
|
@@ -2174,7 +2195,7 @@ function yi(e) {
|
|
|
2174
2195
|
}
|
|
2175
2196
|
//#endregion
|
|
2176
2197
|
//#region src/cmd/list-overview-snapshots.ts
|
|
2177
|
-
function
|
|
2198
|
+
function wi() {
|
|
2178
2199
|
let e = new m("list-overview-snapshots").description("List all available global overview snapshots in the registry");
|
|
2179
2200
|
return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.option("--json", "output in JSON format", !1), e.action(async (e) => {
|
|
2180
2201
|
let t = new b(), n = await new ee(l(e.registry), t).listGlobalOverviewSnapshots();
|
|
@@ -2188,7 +2209,7 @@ function bi() {
|
|
|
2188
2209
|
}
|
|
2189
2210
|
//#endregion
|
|
2190
2211
|
//#region src/cmd/restore-overview-from-snapshot.ts
|
|
2191
|
-
function
|
|
2212
|
+
function Ti() {
|
|
2192
2213
|
let e = new m("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
|
|
2193
2214
|
return e.addOption(new h("-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) => {
|
|
2194
2215
|
let t = new b(), n = new ee(l(e.registry), t), r = await n.listGlobalOverviewSnapshots();
|
|
@@ -2214,7 +2235,7 @@ function xi() {
|
|
|
2214
2235
|
}
|
|
2215
2236
|
//#endregion
|
|
2216
2237
|
//#region src/registry_v1/flags.ts
|
|
2217
|
-
function
|
|
2238
|
+
function Ei(e) {
|
|
2218
2239
|
let t = e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);
|
|
2219
2240
|
if (t) {
|
|
2220
2241
|
let { src: e, destName: n } = t.groups;
|
|
@@ -2227,22 +2248,22 @@ function Si(e) {
|
|
|
2227
2248
|
destName: g.basename(e)
|
|
2228
2249
|
};
|
|
2229
2250
|
}
|
|
2230
|
-
function
|
|
2231
|
-
return new h(e, t).argParser((e, t) => [...t ?? [],
|
|
2251
|
+
function Di(e, t) {
|
|
2252
|
+
return new h(e, t).argParser((e, t) => [...t ?? [], Ei(e)]).default([]);
|
|
2232
2253
|
}
|
|
2233
2254
|
//#endregion
|
|
2234
2255
|
//#region src/cmd/upload-package-v1.ts
|
|
2235
|
-
var
|
|
2256
|
+
var Oi = [
|
|
2236
2257
|
"registry",
|
|
2237
2258
|
"organization",
|
|
2238
2259
|
"package",
|
|
2239
2260
|
"version"
|
|
2240
2261
|
];
|
|
2241
|
-
function
|
|
2262
|
+
function ki() {
|
|
2242
2263
|
let e = new m("upload-package-v1").description("Uploads V1 package and refreshes the registry");
|
|
2243
|
-
return e.addOption(new h("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new h("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new h("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new h("-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(
|
|
2264
|
+
return e.addOption(new h("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new h("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new h("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new h("-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(Di("-f, --file <file>", "package files")), e.addOption(new h("--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) => {
|
|
2244
2265
|
let t = new b(), n = f.parse({});
|
|
2245
|
-
for (let t of
|
|
2266
|
+
for (let t of Oi) e[t] && (n[t] = e[t]);
|
|
2246
2267
|
e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await _.promises.readFile(e.meta, { encoding: "utf-8" })) : e.meta.endsWith(".yaml") && (n.meta = ce.parse(await _.promises.readFile(e.meta, { encoding: "utf-8" }))));
|
|
2247
2268
|
for (let t of e.file) n.files[t.destName] = t.src;
|
|
2248
2269
|
let r = await d(n);
|
|
@@ -2258,12 +2279,12 @@ function Ti() {
|
|
|
2258
2279
|
}
|
|
2259
2280
|
//#endregion
|
|
2260
2281
|
//#region src/cmd/structure/check.ts
|
|
2261
|
-
function
|
|
2282
|
+
function Ai(e) {
|
|
2262
2283
|
let t = new m("check").description("Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.");
|
|
2263
2284
|
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) => {
|
|
2264
2285
|
let r = new b(), i = t.length > 0 ? t : ["."], a = g.join(e, "src", "structure", "templates"), o = !1;
|
|
2265
2286
|
for (let e of i) {
|
|
2266
|
-
let t = await
|
|
2287
|
+
let t = await yi({
|
|
2267
2288
|
blockPath: e,
|
|
2268
2289
|
isSdkInternal: !!n.sdkInternal,
|
|
2269
2290
|
updateDepsOnly: !1,
|
|
@@ -2271,35 +2292,35 @@ function Ei(e) {
|
|
|
2271
2292
|
templatesRoot: a,
|
|
2272
2293
|
log: (e) => r.info(e)
|
|
2273
2294
|
});
|
|
2274
|
-
r.info(
|
|
2295
|
+
r.info(bi(e, t.changes)), t.changes.length > 0 && (o = !0);
|
|
2275
2296
|
}
|
|
2276
2297
|
if (o) throw Error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.");
|
|
2277
2298
|
}), t;
|
|
2278
2299
|
}
|
|
2279
2300
|
//#endregion
|
|
2280
2301
|
//#region src/structure/init-block-constructor.ts
|
|
2281
|
-
var $ = ["python"],
|
|
2302
|
+
var $ = ["python"], ji = class extends Error {
|
|
2282
2303
|
constructor(e) {
|
|
2283
2304
|
super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
|
|
2284
2305
|
}
|
|
2285
2306
|
};
|
|
2286
|
-
async function
|
|
2307
|
+
async function Mi(e, t, n, r) {
|
|
2287
2308
|
if (e !== void 0 && e !== "") return e;
|
|
2288
|
-
if (n) throw new
|
|
2309
|
+
if (n) throw new ji(t);
|
|
2289
2310
|
return r();
|
|
2290
2311
|
}
|
|
2291
|
-
async function
|
|
2292
|
-
let t = await
|
|
2312
|
+
async function Ni(e) {
|
|
2313
|
+
let t = await Mi(e.npmOrg, "npm-org", e.nonInteractive, () => he({
|
|
2293
2314
|
message: "npm org (e.g. @platforma-open):",
|
|
2294
2315
|
default: "@platforma-open"
|
|
2295
|
-
})), n = await
|
|
2316
|
+
})), n = await Mi(e.orgScope, "org-scope", e.nonInteractive, () => he({ message: "org scope (e.g. my-org):" })), r = await Mi(e.shortName, "short-name", e.nonInteractive, () => he({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
|
|
2296
2317
|
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await me({
|
|
2297
2318
|
message: "Include a software module?",
|
|
2298
2319
|
default: !1
|
|
2299
2320
|
}) : e.withSoftware;
|
|
2300
2321
|
let a;
|
|
2301
2322
|
if (i) {
|
|
2302
|
-
if (a = await
|
|
2323
|
+
if (a = await Mi(e.platform, "platform", e.nonInteractive, () => ge({
|
|
2303
2324
|
message: "Software platform:",
|
|
2304
2325
|
choices: $.map((e) => ({
|
|
2305
2326
|
name: e,
|
|
@@ -2316,7 +2337,7 @@ async function ki(e) {
|
|
|
2316
2337
|
softwarePlatform: a
|
|
2317
2338
|
};
|
|
2318
2339
|
}
|
|
2319
|
-
async function
|
|
2340
|
+
async function Pi(e) {
|
|
2320
2341
|
let t = e.vars, n = Dn(t), r = new ke(e.blockPath), i = new Ae(e.templatesRoot), a = On({
|
|
2321
2342
|
blockVars: t,
|
|
2322
2343
|
modules: n,
|
|
@@ -2329,7 +2350,7 @@ async function Ai(e) {
|
|
|
2329
2350
|
} catch (e) {
|
|
2330
2351
|
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)}`);
|
|
2331
2352
|
}
|
|
2332
|
-
return vn(
|
|
2353
|
+
return vn(_i, r, a, {
|
|
2333
2354
|
templates: i,
|
|
2334
2355
|
initMode: !0,
|
|
2335
2356
|
registryLookup: s,
|
|
@@ -2338,12 +2359,12 @@ async function Ai(e) {
|
|
|
2338
2359
|
}
|
|
2339
2360
|
//#endregion
|
|
2340
2361
|
//#region src/cmd/structure/init.ts
|
|
2341
|
-
function
|
|
2362
|
+
function Fi(e) {
|
|
2342
2363
|
let t = new m("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
|
|
2343
2364
|
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 h("--platform <platform>", "software platform (single-valued)").choices([...$])), t.option("--non-interactive", "error on any missing flag instead of prompting"), t.action(async (t, n) => {
|
|
2344
2365
|
let r = new b(), i = n.withSoftware === !0, a = n.software === !1;
|
|
2345
2366
|
if (i && a) throw Error("--with-software and --no-software are mutually exclusive.");
|
|
2346
|
-
let o = i ? !0 : a ? !1 : void 0, s = await
|
|
2367
|
+
let o = i ? !0 : a ? !1 : void 0, s = await Ni({
|
|
2347
2368
|
npmOrg: n.npmOrg,
|
|
2348
2369
|
orgScope: n.orgScope,
|
|
2349
2370
|
shortName: n.shortName,
|
|
@@ -2351,7 +2372,7 @@ function ji(e) {
|
|
|
2351
2372
|
platform: n.platform,
|
|
2352
2373
|
nonInteractive: n.nonInteractive
|
|
2353
2374
|
});
|
|
2354
|
-
await
|
|
2375
|
+
await Pi({
|
|
2355
2376
|
vars: s,
|
|
2356
2377
|
blockPath: t ? g.resolve(t) : g.resolve(process.cwd(), s.shortName),
|
|
2357
2378
|
templatesRoot: g.join(e, "src", "structure", "templates"),
|
|
@@ -2361,13 +2382,13 @@ function ji(e) {
|
|
|
2361
2382
|
}
|
|
2362
2383
|
//#endregion
|
|
2363
2384
|
//#region src/cmd/software/knobs.ts
|
|
2364
|
-
var
|
|
2385
|
+
var Ii = ["dev", "release"], Li = [
|
|
2365
2386
|
"docker",
|
|
2366
2387
|
"binary",
|
|
2367
2388
|
"all",
|
|
2368
2389
|
"none"
|
|
2369
|
-
],
|
|
2370
|
-
function
|
|
2390
|
+
], Ri = ["local", "remote"];
|
|
2391
|
+
function zi(e) {
|
|
2371
2392
|
if (e.usePublished) {
|
|
2372
2393
|
if (e.variant === "docker" || e.variant === "all") throw y.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);
|
|
2373
2394
|
return { kind: "binary-existing" };
|
|
@@ -2381,31 +2402,31 @@ function Fi(e) {
|
|
|
2381
2402
|
}
|
|
2382
2403
|
//#endregion
|
|
2383
2404
|
//#region src/cmd/software/ecr-login.ts
|
|
2384
|
-
var
|
|
2385
|
-
function
|
|
2405
|
+
var Bi = "public.ecr.aws", Vi = "us-east-1";
|
|
2406
|
+
function Hi(e) {
|
|
2386
2407
|
if (process.env.AWS_ACCESS_KEY_ID || process.env.AWS_PROFILE) return;
|
|
2387
2408
|
let t = process.env.PL_AWS_PROFILE ?? se.AWS_DEV_PROFILE;
|
|
2388
2409
|
process.env.AWS_PROFILE = t, e?.debug(`Using AWS profile '${t}' for dev push credentials`);
|
|
2389
2410
|
}
|
|
2390
|
-
function
|
|
2411
|
+
function Ui(e) {
|
|
2391
2412
|
return new URL(`https://${e}`).hostname;
|
|
2392
2413
|
}
|
|
2393
|
-
function
|
|
2414
|
+
function Wi() {
|
|
2394
2415
|
return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ?? se.AWS_DEV_PROFILE}`;
|
|
2395
2416
|
}
|
|
2396
|
-
async function
|
|
2397
|
-
let n =
|
|
2398
|
-
if (n !==
|
|
2417
|
+
async function Gi(e, t) {
|
|
2418
|
+
let n = Ui(e);
|
|
2419
|
+
if (n !== Bi) throw y.CLIError(`automatic docker login is only supported for '${Bi}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);
|
|
2399
2420
|
t?.info(`Logging in to ECR registry '${n}'...`);
|
|
2400
2421
|
let r, i;
|
|
2401
2422
|
try {
|
|
2402
|
-
let e = (await new ve({ region:
|
|
2423
|
+
let e = (await new ve({ region: Vi }).send(new ye({}))).authorizationData?.authorizationToken;
|
|
2403
2424
|
if (!e) throw Error("empty authorization token");
|
|
2404
2425
|
let t = Buffer.from(e, "base64").toString("utf8"), n = t.indexOf(":");
|
|
2405
2426
|
if (n < 0) throw Error("malformed authorization token (no ':' separator)");
|
|
2406
2427
|
r = t.slice(0, n), i = t.slice(n + 1);
|
|
2407
2428
|
} catch (e) {
|
|
2408
|
-
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` +
|
|
2429
|
+
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` + Wi());
|
|
2409
2430
|
}
|
|
2410
2431
|
let a = _e("docker", [
|
|
2411
2432
|
"login",
|
|
@@ -2429,9 +2450,9 @@ async function Vi(e, t) {
|
|
|
2429
2450
|
}
|
|
2430
2451
|
//#endregion
|
|
2431
2452
|
//#region src/cmd/software/run-build.ts
|
|
2432
|
-
async function
|
|
2453
|
+
async function Ki(e) {
|
|
2433
2454
|
let { core: t, scenario: n, options: r = {}, logger: i } = e, a = r.ids;
|
|
2434
|
-
t.buildMode =
|
|
2455
|
+
t.buildMode = Ji(n), qi(n) || t.assertDockerCoverage();
|
|
2435
2456
|
let o = () => t.buildSoftwareArchives({
|
|
2436
2457
|
ids: a,
|
|
2437
2458
|
forceBuild: !!r.force,
|
|
@@ -2456,12 +2477,12 @@ async function Hi(e) {
|
|
|
2456
2477
|
});
|
|
2457
2478
|
break;
|
|
2458
2479
|
case "target": {
|
|
2459
|
-
let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f =
|
|
2480
|
+
let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f = Zi(e, r);
|
|
2460
2481
|
l && t.buildDockerImages({
|
|
2461
2482
|
ids: a,
|
|
2462
2483
|
registry: f.pull,
|
|
2463
2484
|
strictPlatformMatching: v.isCI()
|
|
2464
|
-
}), u && await o(), d && e === "dev" && (l || u) &&
|
|
2485
|
+
}), u && await o(), d && e === "dev" && (l || u) && Hi(i), l && d && (f.autoLogin && f.push && await Gi(f.push, i), t.publishDockerImages({
|
|
2465
2486
|
ids: a,
|
|
2466
2487
|
pushTo: f.push,
|
|
2467
2488
|
strictPlatformMatching: v.isCI()
|
|
@@ -2476,46 +2497,46 @@ async function Hi(e) {
|
|
|
2476
2497
|
t.buildSwJsonFiles({
|
|
2477
2498
|
packageIds: a,
|
|
2478
2499
|
noSoftware: n.kind === "no-software",
|
|
2479
|
-
skipDockerCoverage:
|
|
2500
|
+
skipDockerCoverage: qi(n)
|
|
2480
2501
|
});
|
|
2481
2502
|
}
|
|
2482
|
-
function
|
|
2503
|
+
function qi(e) {
|
|
2483
2504
|
return e.kind === "no-software" || e.kind === "binary-existing";
|
|
2484
2505
|
}
|
|
2485
|
-
function
|
|
2506
|
+
function Ji(e) {
|
|
2486
2507
|
return e.kind !== "target" || e.channel === "release" ? "release" : e.variant !== "docker" && e.location === "remote" ? "dev-remote" : "dev-local";
|
|
2487
2508
|
}
|
|
2488
|
-
function
|
|
2509
|
+
function Yi(e) {
|
|
2489
2510
|
if (!e.includes("://")) return e;
|
|
2490
2511
|
let t = new URL(e);
|
|
2491
2512
|
return t.host + t.pathname;
|
|
2492
2513
|
}
|
|
2493
|
-
function
|
|
2514
|
+
function Xi(e) {
|
|
2494
2515
|
return {
|
|
2495
|
-
registry:
|
|
2516
|
+
registry: Yi(e),
|
|
2496
2517
|
autoLogin: e.startsWith("ecr://")
|
|
2497
2518
|
};
|
|
2498
2519
|
}
|
|
2499
|
-
function
|
|
2500
|
-
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 ? se.DEV_DOCKER_PUSH_TARGET : void 0), o = a ?
|
|
2520
|
+
function Zi(e, t) {
|
|
2521
|
+
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 ? se.DEV_DOCKER_PUSH_TARGET : void 0), o = a ? Xi(a) : {
|
|
2501
2522
|
registry: void 0,
|
|
2502
2523
|
autoLogin: !1
|
|
2503
2524
|
}, s = t.dockerRegistry ?? i ?? (n ? a : se.DOCKER_REGISTRY);
|
|
2504
2525
|
return {
|
|
2505
|
-
pull: s ?
|
|
2526
|
+
pull: s ? Yi(s) : void 0,
|
|
2506
2527
|
push: o.registry,
|
|
2507
2528
|
autoLogin: o.autoLogin
|
|
2508
2529
|
};
|
|
2509
2530
|
}
|
|
2510
2531
|
//#endregion
|
|
2511
2532
|
//#region src/cmd/software/env.ts
|
|
2512
|
-
var
|
|
2533
|
+
var Qi = "PL_BUILD_CHANNEL", $i = "PL_BUILD_VARIANT", ea = "PL_BUILD_LOCATION", ta = "PL_BUILD_USE_PUBLISHED";
|
|
2513
2534
|
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;
|
|
2514
2535
|
//#endregion
|
|
2515
2536
|
//#region src/cmd/software/build.ts
|
|
2516
|
-
function
|
|
2537
|
+
function na() {
|
|
2517
2538
|
let e = new m("build").description("Build a software module for a target and write its .sw.json descriptor (build + push in one pass)");
|
|
2518
|
-
return e.addOption(new h("--channel <channel>", "registry channel to build for").choices([...
|
|
2539
|
+
return e.addOption(new h("--channel <channel>", "registry channel to build for").choices([...Ii]).env(Qi)), e.addOption(new h("--variant <variant>", "artifact kind to build (default: all declared)").choices([...Li]).env($i)), e.addOption(new h("--location <location>", "where the artifact lands (local = no push)").choices([...Ri]).env(ea)), e.addOption(new h("--use-published", "do not build or push; emit a descriptor pointing at the already-published release artifact").env(ta)), e.addOption(new h("--log-level <level>", "logging level").choices([
|
|
2519
2540
|
"error",
|
|
2520
2541
|
"warn",
|
|
2521
2542
|
"info",
|
|
@@ -2523,7 +2544,7 @@ function Qi() {
|
|
|
2523
2544
|
]).default("info")), e.addOption(new h("--package-root <path>", "path to directory with package.json file")), e.addOption(new h("--force", "force action, ignoring automatic safety checks").default(!1)), e.addOption(new h("--version <value>", "override package version (ignore package.json)")), e.addOption(new h("--platform <os-arch>", "{os}-{arch} pair; no effect on cross-platform packages").choices([...y.AllPlatforms]).env(v.PL_PKG_OS)), e.addOption(new h("--all-platforms", "build for all supported platforms").default(!1)), e.addOption(new h("--full-dir-hash", "hash file contents (not metadata) for the dev content hash").env(v.PL_PKG_FULL_HASH).default(!1)), e.addOption(new h("--package-id <id...>", "act only on selected packages")), e.addOption(new h("--content-root <path>", "override software content root").env(v.PL_PKG_CONTENT_ROOT)), e.addOption(new h("--storage-url <url>", "override binary upload registry URL").env(v.PL_PKG_STORAGE_URL)), e.addOption(new h("--docker-registry <registry>", "docker pull registry embedded in the descriptor").env(v.PL_DOCKER_REGISTRY)), e.addOption(new h("--docker-push-to <registry>", "alternative registry for docker push").env(v.PL_DOCKER_REGISTRY_PUSH_TO)), e.addOption(new h("--docker-build", "build docker images").env(v.PL_DOCKER_BUILD).default(!1)), e.addOption(new h("--docker-no-build", "do not build docker images").env(v.PL_DOCKER_NO_BUILD).default(!1)), e.addOption(new h("--docker-autopush", "push docker images after build").env(v.PL_DOCKER_AUTOPUSH).default(!1)), e.addOption(new h("--docker-no-autopush", "do not push docker images").env(v.PL_DOCKER_NO_AUTOPUSH).default(!1)), e.addOption(new h("--conda-build", "build conda environment before packing").env(v.PL_CONDA_BUILD).default(!1)), e.addOption(new h("--conda-no-build", "do not build conda environment").env(v.PL_CONDA_NO_BUILD).default(!1)), e.action(async (e) => {
|
|
2524
2545
|
let t = y.createLogger(e.logLevel);
|
|
2525
2546
|
try {
|
|
2526
|
-
let n =
|
|
2547
|
+
let n = zi({
|
|
2527
2548
|
channel: e.channel,
|
|
2528
2549
|
variant: e.variant,
|
|
2529
2550
|
location: e.location,
|
|
@@ -2544,7 +2565,7 @@ function Qi() {
|
|
|
2544
2565
|
pushDocker: a,
|
|
2545
2566
|
pushDisabledExplicitly: !!e.dockerNoAutopush,
|
|
2546
2567
|
dockerPackageCount: r.selectedDockerPackages(e.packageId).length
|
|
2547
|
-
}), await
|
|
2568
|
+
}), await Ki({
|
|
2548
2569
|
core: r,
|
|
2549
2570
|
scenario: n,
|
|
2550
2571
|
logger: t,
|
|
@@ -2571,22 +2592,22 @@ function Qi() {
|
|
|
2571
2592
|
}
|
|
2572
2593
|
//#endregion
|
|
2573
2594
|
//#region src/cmd/software/index.ts
|
|
2574
|
-
function
|
|
2595
|
+
function ra() {
|
|
2575
2596
|
let e = new m("software").description("Build and publish a block's software modules");
|
|
2576
|
-
return e.addCommand(
|
|
2597
|
+
return e.addCommand(na()), e;
|
|
2577
2598
|
}
|
|
2578
2599
|
//#endregion
|
|
2579
2600
|
//#region src/cli.ts
|
|
2580
|
-
function
|
|
2601
|
+
function ia(e = process.cwd()) {
|
|
2581
2602
|
let t = new m();
|
|
2582
|
-
t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(be()), t.addCommand(Se()), t.addCommand(Ce()), t.addCommand(we()), t.addCommand(Ee()), t.addCommand(De()), t.addCommand(Oe()), t.addCommand(
|
|
2603
|
+
t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(be()), t.addCommand(Se()), t.addCommand(Ce()), t.addCommand(we()), t.addCommand(Ee()), t.addCommand(De()), t.addCommand(Oe()), t.addCommand(Ci(e)), t.addCommand(wi()), t.addCommand(Ti()), t.addCommand(ki()), t.addCommand(ra());
|
|
2583
2604
|
let n = new m("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
|
|
2584
|
-
return n.addCommand(
|
|
2605
|
+
return n.addCommand(Ai(e)), n.addCommand(Fi(e)), n.addCommand(Si(e)), t.addCommand(n), t;
|
|
2585
2606
|
}
|
|
2586
|
-
async function
|
|
2587
|
-
await
|
|
2607
|
+
async function aa(e, t) {
|
|
2608
|
+
await ia(t).parseAsync(e);
|
|
2588
2609
|
}
|
|
2589
2610
|
//#endregion
|
|
2590
|
-
export {
|
|
2611
|
+
export { ia as buildProgram, aa as run };
|
|
2591
2612
|
|
|
2592
2613
|
//# sourceMappingURL=cli.mjs.map
|