@platforma-sdk/block-tools 2.14.0 → 2.14.2
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 +17 -13
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +780 -730
- package/dist/cli.mjs.map +1 -1
- package/dist/structure/engine/testing.d.ts +3 -0
- package/dist/structure/rules/root-changeset-config.d.ts +8 -0
- package/dist/structure/rules/shared/initial-version.d.ts +10 -0
- package/package.json +4 -4
- package/src/structure/__tests__/facade-end-state.test.ts +68 -3
- package/src/structure/__tests__/init-catalog-completeness.test.ts +86 -0
- package/src/structure/__tests__/init-lint-clean.test.ts +84 -0
- package/src/structure/__tests__/model-package-json.snapshot.test.ts +1 -0
- package/src/structure/__tests__/root-changeset-config.test.ts +94 -0
- package/src/structure/__tests__/root-ci-workflows.test.ts +3 -0
- package/src/structure/engine/testing.ts +4 -0
- package/src/structure/rules/block-package-json.ts +2 -1
- package/src/structure/rules/kind-package-json.ts +5 -1
- package/src/structure/rules/model-package-json.ts +5 -1
- package/src/structure/rules/root-changeset-config.ts +61 -0
- package/src/structure/rules/root-package-json.ts +2 -1
- package/src/structure/rules/root-pnpm-workspace.ts +3 -0
- package/src/structure/rules/root.ts +15 -1
- package/src/structure/rules/shared/initial-version.ts +17 -0
- package/src/structure/rules/software-package-json.ts +6 -0
- package/src/structure/rules/test-package-json.ts +5 -1
- package/src/structure/rules/ui-package-json.ts +5 -1
- package/src/structure/rules/workflow-package-json.ts +5 -1
- package/src/structure/templates/text/model/src/index.tpl.ts +1 -1
- package/src/structure/templates/text/workflows/build.tpl.yaml +1 -1
- package/src/structure/templates/text/workflows/mark-stable.tpl.yaml +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { Ct as e, Ft as t, J as n, K as r, M as i, Mt as a, St as o, Xt as s, Y as c, _ as l, gt as u, n as d, p as f, vt as p, w as
|
|
2
|
-
import { Command as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { BlockPackManifest as
|
|
6
|
-
import { assertDockerPushIntent as
|
|
7
|
-
import { ConsoleLoggerAdapter as
|
|
8
|
-
import
|
|
9
|
-
import { setTimeout as
|
|
10
|
-
import * as
|
|
11
|
-
import { confirm as
|
|
12
|
-
import { spawnSync as
|
|
13
|
-
import { ECRPUBLICClient as
|
|
1
|
+
import { Ct as e, Ft as t, J as n, K as r, M as i, Mt as a, St as o, Xt as s, Y as c, _ as l, gt as u, n as d, p as f, vt as p, w as ee } from "./config-Dx45aFJ_.mjs";
|
|
2
|
+
import { Command as m, Option as h } from "commander";
|
|
3
|
+
import g from "node:path";
|
|
4
|
+
import _ from "node:fs";
|
|
5
|
+
import { BlockPackManifest as te, StableChannel as ne, overrideDescriptionVersion as re, overrideManifestVersion as ie } from "@milaboratories/pl-model-middle-layer";
|
|
6
|
+
import { assertDockerPushIntent as ae, createBuilder as oe, defaults as se, envs as v, util as y } from "@platforma-sdk/package-builder-lib";
|
|
7
|
+
import { ConsoleLoggerAdapter as b } from "@milaboratories/ts-helpers";
|
|
8
|
+
import ce, { parse as le, parseDocument as ue, stringify as de } from "yaml";
|
|
9
|
+
import { setTimeout as fe } from "node:timers/promises";
|
|
10
|
+
import * as pe from "node:os";
|
|
11
|
+
import { confirm as me, input as he, select as ge } from "@inquirer/prompts";
|
|
12
|
+
import { spawnSync as _e } from "node:child_process";
|
|
13
|
+
import { ECRPUBLICClient as ve, GetAuthorizationTokenCommand as ye } from "@aws-sdk/client-ecr-public";
|
|
14
14
|
//#region src/cmd/build-meta.ts
|
|
15
|
-
function
|
|
16
|
-
let e = new
|
|
15
|
+
function be() {
|
|
16
|
+
let e = new m("build-meta").description("Extracts meta information from blocks package.json and outputs meta.json with embedded binary and textual information linked from the meta section.");
|
|
17
17
|
return e.option("-i, --modulePath <path>", "input module path", "."), e.requiredOption("-o, --destination <path>", "output meta.json file"), e.action(async (e) => {
|
|
18
|
-
let n =
|
|
19
|
-
await
|
|
18
|
+
let n = g.resolve(e.modulePath), r = await a(await t((await p(n)).meta, n));
|
|
19
|
+
await _.promises.writeFile(g.resolve(e.destination), JSON.stringify(r));
|
|
20
20
|
}), e;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/cmd/build-model.ts
|
|
24
|
-
async function
|
|
24
|
+
async function xe(e) {
|
|
25
25
|
try {
|
|
26
|
-
return await
|
|
26
|
+
return await _.promises.readFile(e, "utf8");
|
|
27
27
|
} catch (e) {
|
|
28
28
|
if (e instanceof Error && "code" in e && e.code === "ENOENT") return;
|
|
29
29
|
throw e;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
let e = new
|
|
32
|
+
function Se() {
|
|
33
|
+
let e = new m("build-model").description("Extracts and outputs block model JSON from pre-built block model module");
|
|
34
34
|
return e.option("-i, --modulePath <path>", "input module path", "."), e.option("-b, --sourceBundle <path>", "bundled model code to embed into the model for callback-based rendering to work", "./dist/bundle.js"), e.option("-o, --destination <path>", "output model file", "./dist/model.json"), e.action(async (e) => {
|
|
35
|
-
let { model: t, platforma: n } = s(
|
|
35
|
+
let { model: t, platforma: n } = s(g.resolve(e.modulePath));
|
|
36
36
|
if (t ||= n, !t) throw Error("\"model\" export not found");
|
|
37
37
|
let { config: r } = t;
|
|
38
38
|
if (!r) throw Error("Malformed \"model\" object, check it is created with \"BlockModel\" and \".done()\" is executed as the call in the chain.");
|
|
39
39
|
if (!("outputs" in r) || !("sections" in r)) throw Error("\"config\" has unexpected structure");
|
|
40
|
-
let i = await
|
|
40
|
+
let i = await xe(e.sourceBundle);
|
|
41
41
|
i !== void 0 && (r.code = {
|
|
42
42
|
type: "plain",
|
|
43
43
|
content: i
|
|
44
|
-
}), await
|
|
44
|
+
}), await _.promises.writeFile(g.resolve(e.destination), JSON.stringify(r));
|
|
45
45
|
}), e;
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/cmd/build-kind-manifest.ts
|
|
49
|
-
function
|
|
50
|
-
let e = new
|
|
49
|
+
function Ce() {
|
|
50
|
+
let e = new m("build-kind-manifest").description("Writes the block-kind dist manifest (identity + src source-hash) from a pre-built kind bundle");
|
|
51
51
|
return e.option("-i, --modulePath <path>", "kind package dir (contains package.json, src/, dist/)", "."), e.option("-s, --srcDir <path>", "source dir hashed into sourceHash, relative to modulePath", "src"), e.option("-o, --dst <path>", "output dir with the compiled bundle, relative to modulePath", "dist"), e.action(async (e) => {
|
|
52
52
|
await o({
|
|
53
53
|
modulePath: e.modulePath,
|
|
@@ -58,79 +58,79 @@ function Se() {
|
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region src/cmd/pack.ts
|
|
61
|
-
function
|
|
62
|
-
let t = new
|
|
61
|
+
function we() {
|
|
62
|
+
let t = new m("pack").description("Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder");
|
|
63
63
|
return t.option("-i, --modulePath <path>", "input module path", "."), t.option("-o, --destinationPath <path>", "output folder", "./block-pack"), t.action(async (t) => {
|
|
64
|
-
await e(await u(
|
|
64
|
+
await e(await u(g.resolve(t.modulePath)), g.resolve(t.destinationPath));
|
|
65
65
|
}), t;
|
|
66
66
|
}
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region src/cmd/publish.ts
|
|
69
|
-
function
|
|
69
|
+
function Te(e, t) {
|
|
70
70
|
let n = { ...e };
|
|
71
|
-
for (let e in t) t[e] && typeof t[e] == "object" && !Array.isArray(t[e]) && n[e] && typeof n[e] == "object" && !Array.isArray(n[e]) ? n[e] =
|
|
71
|
+
for (let e in t) t[e] && typeof t[e] == "object" && !Array.isArray(t[e]) && n[e] && typeof n[e] == "object" && !Array.isArray(n[e]) ? n[e] = Te(n[e], t[e]) : n[e] = t[e];
|
|
72
72
|
return n;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
let e = new
|
|
76
|
-
return e.addOption(new
|
|
77
|
-
let t = new
|
|
78
|
-
o =
|
|
79
|
-
let s =
|
|
80
|
-
t.info(`Manifest root = ${s}`), t.info(`Facade root = ${u}`), e.versionOverride && (o =
|
|
81
|
-
let d = new
|
|
82
|
-
await c(d, o, u, async (e) => Buffer.from(await
|
|
74
|
+
function Ee() {
|
|
75
|
+
let e = new m("publish").description("Publishes the block package and refreshes the registry (for v2 block-pack schema)");
|
|
76
|
+
return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new h("--registry-serve-url <url>", "CDN serve URL written into block-pack/published.json (npm-consumed blocks)").env("PL_REGISTRY_SERVE_URL").makeOptionMandatory()), e.option("-m, --manifest <path>", "manifest file path", `./block-pack/${i}`), e.option("-v, --version-override <path>", "override package version"), 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.addOption(new h("--unstable", "do not add the published package to stable channel").default(!1).env("PL_PUBLISH_UNSTABLE")), e.action(async (e) => {
|
|
77
|
+
let t = new b(), i = g.resolve(e.manifest), a = JSON.parse(await _.promises.readFile(i, { encoding: "utf-8" })), o = te.parse(a);
|
|
78
|
+
o = Te(a, o);
|
|
79
|
+
let s = g.dirname(i), u = g.dirname(s);
|
|
80
|
+
t.info(`Manifest root = ${s}`), t.info(`Facade root = ${u}`), e.versionOverride && (o = ie(o, e.versionOverride));
|
|
81
|
+
let d = new ee(l(e.registry), t);
|
|
82
|
+
await c(d, o, u, async (e) => Buffer.from(await _.promises.readFile(g.resolve(s, e)))), e.unstable || (t.info(`Adding package to ${ne} channel...`), await d.addPackageToChannel(o.description.id, ne)), await n(s, r({
|
|
83
83
|
registryUrl: e.registryServeUrl,
|
|
84
84
|
id: o.description.id
|
|
85
|
-
})), t.info(`Wrote published coordinates to ${
|
|
85
|
+
})), t.info(`Wrote published coordinates to ${g.resolve(s, "published.json")}`), e.refresh && await d.updateIfNeeded();
|
|
86
86
|
}), e;
|
|
87
87
|
}
|
|
88
88
|
//#endregion
|
|
89
89
|
//#region src/cmd/refresh-registry.ts
|
|
90
|
-
function
|
|
91
|
-
let e = new
|
|
92
|
-
return e.addOption(new
|
|
90
|
+
function De() {
|
|
91
|
+
let e = new m("refresh-registry").description("Refresh overview files based on published but not proecessed artefacts");
|
|
92
|
+
return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new h("-m, --mode <mode>", "refresh mode (allowed valiues: \"force\", \"normal\", \"dry-run\")").choices([
|
|
93
93
|
"force",
|
|
94
94
|
"normal",
|
|
95
95
|
"dry-run"
|
|
96
96
|
]).env("PL_REGISTRY_REFRESH_DRY_RUN").default("normal")), e.action(async (e) => {
|
|
97
|
-
await new
|
|
97
|
+
await new ee(l(e.registry), new b()).updateIfNeeded(e.mode);
|
|
98
98
|
}), e;
|
|
99
99
|
}
|
|
100
100
|
//#endregion
|
|
101
101
|
//#region src/cmd/mark-stable.ts
|
|
102
|
-
function
|
|
103
|
-
let e = new
|
|
104
|
-
return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new
|
|
105
|
-
let t = await p(
|
|
106
|
-
e.versionOverride && (t =
|
|
107
|
-
let n = new
|
|
102
|
+
function Oe() {
|
|
103
|
+
let e = new m("mark-stable").description("Mark target block stable");
|
|
104
|
+
return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new h("-c, --channel <channel name>", "custom channel").default(ne).hideHelp()), e.option("-v, --version-override <path>", "override package version"), e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), 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.option("--unmark", "reverses meaning of this command, flag can be used to remove \"stable\" flag from the package", !1), e.action(async (e) => {
|
|
105
|
+
let t = await p(g.resolve(e.modulePath));
|
|
106
|
+
e.versionOverride && (t = re(t, e.versionOverride));
|
|
107
|
+
let n = new ee(l(e.registry), new b());
|
|
108
108
|
e.unmark ? await n.removePackageFromChannel(t.id, e.channel) : await n.addPackageToChannel(t.id, e.channel), e.refresh && await n.updateIfNeeded();
|
|
109
109
|
}), e;
|
|
110
110
|
}
|
|
111
111
|
//#endregion
|
|
112
112
|
//#region src/structure/engine/fs/node.ts
|
|
113
|
-
var
|
|
113
|
+
var ke = class {
|
|
114
114
|
constructor(e) {
|
|
115
115
|
this.root = e;
|
|
116
116
|
}
|
|
117
117
|
abs(e) {
|
|
118
|
-
return
|
|
118
|
+
return g.resolve(this.root, e);
|
|
119
119
|
}
|
|
120
120
|
read(e) {
|
|
121
|
-
return
|
|
121
|
+
return _.readFileSync(this.abs(e), "utf-8");
|
|
122
122
|
}
|
|
123
123
|
write(e, t) {
|
|
124
124
|
let n = this.abs(e);
|
|
125
|
-
|
|
125
|
+
_.mkdirSync(g.dirname(n), { recursive: !0 }), _.writeFileSync(n, t, "utf-8");
|
|
126
126
|
}
|
|
127
127
|
writeBinary(e, t) {
|
|
128
128
|
let n = this.abs(e);
|
|
129
|
-
|
|
129
|
+
_.mkdirSync(g.dirname(n), { recursive: !0 }), _.writeFileSync(n, t);
|
|
130
130
|
}
|
|
131
131
|
exists(e) {
|
|
132
132
|
try {
|
|
133
|
-
return
|
|
133
|
+
return _.statSync(this.abs(e)), !0;
|
|
134
134
|
} catch {
|
|
135
135
|
return !1;
|
|
136
136
|
}
|
|
@@ -138,15 +138,15 @@ var Oe = class {
|
|
|
138
138
|
list(e) {
|
|
139
139
|
let t = this.abs(e);
|
|
140
140
|
try {
|
|
141
|
-
if (!
|
|
141
|
+
if (!_.statSync(t).isDirectory()) return [];
|
|
142
142
|
} catch {
|
|
143
143
|
return [];
|
|
144
144
|
}
|
|
145
145
|
let n = [];
|
|
146
146
|
function r(e, t) {
|
|
147
|
-
let i =
|
|
147
|
+
let i = _.readdirSync(t, { withFileTypes: !0 });
|
|
148
148
|
for (let a of i) {
|
|
149
|
-
let i = e ? `${e}/${a.name}` : a.name, o =
|
|
149
|
+
let i = e ? `${e}/${a.name}` : a.name, o = g.join(t, a.name);
|
|
150
150
|
a.isDirectory() ? r(i, o) : a.isFile() && n.push(i);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -155,7 +155,7 @@ var Oe = class {
|
|
|
155
155
|
listDir(e) {
|
|
156
156
|
let t = this.abs(e), n;
|
|
157
157
|
try {
|
|
158
|
-
n =
|
|
158
|
+
n = _.readdirSync(t, { withFileTypes: !0 });
|
|
159
159
|
} catch {
|
|
160
160
|
return [];
|
|
161
161
|
}
|
|
@@ -166,48 +166,48 @@ var Oe = class {
|
|
|
166
166
|
}
|
|
167
167
|
move(e, t) {
|
|
168
168
|
let n = this.abs(e), r = this.abs(t);
|
|
169
|
-
|
|
169
|
+
_.mkdirSync(g.dirname(r), { recursive: !0 }), _.renameSync(n, r);
|
|
170
170
|
}
|
|
171
171
|
delete(e) {
|
|
172
|
-
|
|
172
|
+
_.rmSync(this.abs(e), {
|
|
173
173
|
recursive: !0,
|
|
174
174
|
force: !0
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
-
},
|
|
177
|
+
}, Ae = class {
|
|
178
178
|
constructor(e) {
|
|
179
179
|
this.root = e;
|
|
180
180
|
}
|
|
181
181
|
staticRead(e) {
|
|
182
|
-
return
|
|
182
|
+
return _.readFileSync(g.resolve(this.root, "static", e), "utf-8");
|
|
183
183
|
}
|
|
184
184
|
staticReadBinary(e) {
|
|
185
|
-
return
|
|
185
|
+
return _.readFileSync(g.resolve(this.root, "static", e));
|
|
186
186
|
}
|
|
187
187
|
textRead(e) {
|
|
188
|
-
return
|
|
188
|
+
return _.readFileSync(g.resolve(this.root, "text", e), "utf-8");
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
-
function
|
|
191
|
+
function je(e, t) {
|
|
192
192
|
return e.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (e, n) => t[n] ?? `\${${n}}`);
|
|
193
193
|
}
|
|
194
194
|
//#endregion
|
|
195
195
|
//#region src/structure/engine/flatten.ts
|
|
196
|
-
var
|
|
197
|
-
function
|
|
196
|
+
var Me = ["default", "init"];
|
|
197
|
+
function Ne(e, t) {
|
|
198
198
|
if (!e) return t;
|
|
199
199
|
if (!t) return e;
|
|
200
200
|
let n = e.endsWith("/") ? e.slice(0, -1) : e, r = t.startsWith("/") ? t.slice(1) : t;
|
|
201
201
|
return r ? `${n}/${r}` : n;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function Pe(e, t) {
|
|
204
204
|
return e.filter((e) => e.scope === t).slice().sort((e, t) => e.path.localeCompare(t.path));
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Fe(e, t) {
|
|
207
207
|
let n = [];
|
|
208
208
|
function r(e, i, a, o, s) {
|
|
209
209
|
if (e.kind === "scope") {
|
|
210
|
-
let n =
|
|
210
|
+
let n = Pe(t.modules, e.scope);
|
|
211
211
|
for (let t of n) for (let n of e.children) r(n, e.scope, t.path, o, s);
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
@@ -220,14 +220,14 @@ function Pe(e, t) {
|
|
|
220
220
|
for (let t of e.children) r(t, i, a, o, e.modes);
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
|
-
if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${
|
|
223
|
+
if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Le(e)}' is not inside a scope() frame`);
|
|
224
224
|
if (e.kind === "rename") {
|
|
225
225
|
n.push({
|
|
226
226
|
leaf: e,
|
|
227
227
|
scope: i,
|
|
228
228
|
modulePath: a,
|
|
229
|
-
resolvedPath:
|
|
230
|
-
resolvedTo:
|
|
229
|
+
resolvedPath: Ne(a, e.from),
|
|
230
|
+
resolvedTo: Ne(a, e.to),
|
|
231
231
|
triggers: o,
|
|
232
232
|
modes: s
|
|
233
233
|
});
|
|
@@ -237,15 +237,15 @@ function Pe(e, t) {
|
|
|
237
237
|
leaf: e,
|
|
238
238
|
scope: i,
|
|
239
239
|
modulePath: a,
|
|
240
|
-
resolvedPath:
|
|
240
|
+
resolvedPath: Ne(a, Ie(e)),
|
|
241
241
|
triggers: o,
|
|
242
242
|
modes: s
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
for (let t of e.children) r(t, void 0, void 0, [],
|
|
245
|
+
for (let t of e.children) r(t, void 0, void 0, [], Me);
|
|
246
246
|
return n;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function Ie(e) {
|
|
249
249
|
switch (e.kind) {
|
|
250
250
|
case "fixed":
|
|
251
251
|
case "managed":
|
|
@@ -255,63 +255,63 @@ function Fe(e) {
|
|
|
255
255
|
case "rename": return e.from;
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function Le(e) {
|
|
259
259
|
return e.kind === "rename" ? `rename ${e.from} -> ${e.to}` : `${e.kind} ${e.path}`;
|
|
260
260
|
}
|
|
261
261
|
//#endregion
|
|
262
262
|
//#region src/structure/engine/glob.ts
|
|
263
|
-
var
|
|
264
|
-
function
|
|
263
|
+
var Re = /[.+^${}()|[\]\\]/g;
|
|
264
|
+
function ze(e) {
|
|
265
265
|
let t = "";
|
|
266
266
|
for (let n = 0; n < e.length; n++) {
|
|
267
267
|
let r = e[n];
|
|
268
|
-
r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(
|
|
268
|
+
r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(Re, "\\$&");
|
|
269
269
|
}
|
|
270
270
|
return RegExp(`^${t}$`);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
return
|
|
272
|
+
function Be(e, t) {
|
|
273
|
+
return ze(e).test(t);
|
|
274
274
|
}
|
|
275
275
|
//#endregion
|
|
276
276
|
//#region src/structure/engine/builders.ts
|
|
277
|
-
var
|
|
278
|
-
function
|
|
279
|
-
if (!
|
|
280
|
-
return
|
|
277
|
+
var x, Ve;
|
|
278
|
+
function He(e) {
|
|
279
|
+
if (!x) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
|
|
280
|
+
return x;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
let n =
|
|
282
|
+
function S(e, t) {
|
|
283
|
+
let n = He(e);
|
|
284
284
|
n.stack[n.stack.length - 1].push(t);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
let n =
|
|
288
|
-
|
|
286
|
+
function Ue(e, t) {
|
|
287
|
+
let n = Ve;
|
|
288
|
+
Ve = e;
|
|
289
289
|
try {
|
|
290
290
|
return t();
|
|
291
291
|
} finally {
|
|
292
|
-
|
|
292
|
+
Ve = n;
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
function
|
|
296
|
-
return
|
|
295
|
+
function We() {
|
|
296
|
+
return Ve;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
299
|
-
if (
|
|
298
|
+
function Ge(e) {
|
|
299
|
+
if (x) throw Error("defineStructure() cannot be called from inside another defineStructure().");
|
|
300
300
|
let t = [], n = {
|
|
301
301
|
root: t,
|
|
302
302
|
stack: [t],
|
|
303
303
|
inScope: !1
|
|
304
304
|
};
|
|
305
|
-
|
|
305
|
+
x = n;
|
|
306
306
|
try {
|
|
307
307
|
if (e(), n.stack.length !== 1) throw Error(`defineStructure: builder body left ${n.stack.length - 1} unclosed group frame(s)`);
|
|
308
308
|
let r = { children: t };
|
|
309
|
-
return
|
|
309
|
+
return Ke(r), r;
|
|
310
310
|
} finally {
|
|
311
|
-
|
|
311
|
+
x = void 0;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Ke(e) {
|
|
315
315
|
let t = /* @__PURE__ */ new Map();
|
|
316
316
|
function n(e, r) {
|
|
317
317
|
if (e.kind === "scope") {
|
|
@@ -334,8 +334,8 @@ function Ge(e) {
|
|
|
334
334
|
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.`);
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
|
-
function
|
|
338
|
-
let n =
|
|
337
|
+
function C(e, t) {
|
|
338
|
+
let n = He("scope");
|
|
339
339
|
if (n.inScope) throw Error("scope() cannot nest. Already inside a scope.");
|
|
340
340
|
let r = {
|
|
341
341
|
kind: "scope",
|
|
@@ -349,22 +349,22 @@ function w(e, t) {
|
|
|
349
349
|
n.stack.pop(), n.inScope = !1;
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
var
|
|
353
|
-
function
|
|
354
|
-
|
|
352
|
+
var qe;
|
|
353
|
+
function Je(e) {
|
|
354
|
+
qe = e;
|
|
355
355
|
}
|
|
356
|
-
function
|
|
357
|
-
|
|
356
|
+
function w(e, t, n) {
|
|
357
|
+
Ye(e, t), n && Ye((t) => !e(t), n);
|
|
358
358
|
}
|
|
359
|
-
function
|
|
360
|
-
if (
|
|
361
|
-
|
|
359
|
+
function Ye(e, t) {
|
|
360
|
+
if (x) {
|
|
361
|
+
Xe(e, t);
|
|
362
362
|
return;
|
|
363
363
|
}
|
|
364
|
-
if (!(
|
|
364
|
+
if (!(qe?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
let n =
|
|
366
|
+
function Xe(e, t) {
|
|
367
|
+
let n = x, r = {
|
|
368
368
|
kind: "when",
|
|
369
369
|
trigger: e,
|
|
370
370
|
children: []
|
|
@@ -376,11 +376,11 @@ function Ye(e, t) {
|
|
|
376
376
|
n.stack.pop();
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function T(e) {
|
|
380
380
|
return (t) => t.filesMatch(e);
|
|
381
381
|
}
|
|
382
|
-
function
|
|
383
|
-
let r =
|
|
382
|
+
function Ze(e, t, n) {
|
|
383
|
+
let r = He(e), i = {
|
|
384
384
|
kind: "mode",
|
|
385
385
|
modes: t,
|
|
386
386
|
children: []
|
|
@@ -392,70 +392,70 @@ function Xe(e, t, n) {
|
|
|
392
392
|
r.stack.pop();
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
|
|
395
|
+
function Qe(e) {
|
|
396
|
+
Ze("onInitOrUpdate", ["init", "updateDeps"], e);
|
|
397
397
|
}
|
|
398
|
-
function
|
|
399
|
-
|
|
398
|
+
function E(e, t) {
|
|
399
|
+
S("fixed", {
|
|
400
400
|
kind: "fixed",
|
|
401
401
|
path: e,
|
|
402
402
|
content: t
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
|
-
function
|
|
406
|
-
|
|
405
|
+
function D(e, t, n) {
|
|
406
|
+
S("managed", {
|
|
407
407
|
kind: "managed",
|
|
408
408
|
path: e,
|
|
409
409
|
initial: t,
|
|
410
410
|
body: n
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
413
|
+
function $e(e, t) {
|
|
414
|
+
S("scaffold", {
|
|
415
415
|
kind: "scaffold",
|
|
416
416
|
path: e,
|
|
417
417
|
initial: t
|
|
418
418
|
});
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
|
|
420
|
+
function O(e, t) {
|
|
421
|
+
S("seed", {
|
|
422
422
|
kind: "seed",
|
|
423
423
|
path: e,
|
|
424
424
|
initial: t
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
|
-
function
|
|
428
|
-
|
|
427
|
+
function k(e) {
|
|
428
|
+
S("remove", {
|
|
429
429
|
kind: "remove",
|
|
430
430
|
path: e
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function A(e) {
|
|
434
434
|
return {
|
|
435
435
|
kind: "file",
|
|
436
436
|
path: e
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function et(e) {
|
|
440
440
|
return {
|
|
441
441
|
kind: "binary",
|
|
442
442
|
path: e
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function tt(e) {
|
|
446
446
|
return {
|
|
447
447
|
kind: "text",
|
|
448
448
|
value: e
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function j(e, t) {
|
|
452
452
|
return {
|
|
453
453
|
kind: "tpl",
|
|
454
454
|
path: e,
|
|
455
455
|
vars: t
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function M(e) {
|
|
459
459
|
return {
|
|
460
460
|
kind: "generate",
|
|
461
461
|
fn: e
|
|
@@ -463,69 +463,69 @@ function N(e) {
|
|
|
463
463
|
}
|
|
464
464
|
//#endregion
|
|
465
465
|
//#region src/structure/engine/parsers/json.ts
|
|
466
|
-
function
|
|
466
|
+
function nt(e) {
|
|
467
467
|
return JSON.parse(e);
|
|
468
468
|
}
|
|
469
|
-
var
|
|
470
|
-
function it(e) {
|
|
471
|
-
return e.length === 0 ? "[]" : "[" + e.map(at).join(", ") + "]";
|
|
472
|
-
}
|
|
469
|
+
var rt = 100, it = 2;
|
|
473
470
|
function at(e) {
|
|
474
|
-
|
|
475
|
-
|
|
471
|
+
return e.length === 0 ? "[]" : "[" + e.map(ot).join(", ") + "]";
|
|
472
|
+
}
|
|
473
|
+
function ot(e) {
|
|
474
|
+
if (Array.isArray(e)) return at(e);
|
|
475
|
+
if (N(e)) {
|
|
476
476
|
let t = Object.entries(e);
|
|
477
|
-
return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${
|
|
477
|
+
return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${ot(t)}`).join(", ") + " }";
|
|
478
478
|
}
|
|
479
479
|
return JSON.stringify(e);
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
let i = t +
|
|
481
|
+
function st(e, t, n, r) {
|
|
482
|
+
let i = t + it, a = " ".repeat(i);
|
|
483
483
|
if (Array.isArray(e)) {
|
|
484
|
-
let o =
|
|
485
|
-
if (n + o.length + r <=
|
|
484
|
+
let o = at(e);
|
|
485
|
+
if (n + o.length + r <= rt) return o;
|
|
486
486
|
let s = e.length - 1;
|
|
487
|
-
return "[\n" + e.map((e, t) => a +
|
|
487
|
+
return "[\n" + e.map((e, t) => a + st(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
|
|
488
488
|
}
|
|
489
|
-
if (
|
|
489
|
+
if (N(e)) {
|
|
490
490
|
let n = Object.entries(e);
|
|
491
491
|
if (n.length === 0) return "{}";
|
|
492
492
|
let r = n.length - 1;
|
|
493
493
|
return "{\n" + n.map(([e, t], n) => {
|
|
494
494
|
let o = `${a}${JSON.stringify(e)}: `;
|
|
495
|
-
return o +
|
|
495
|
+
return o + st(t, i, o.length, n === r ? 0 : 1);
|
|
496
496
|
}).join(",\n") + "\n" + " ".repeat(t) + "}";
|
|
497
497
|
}
|
|
498
498
|
return JSON.stringify(e);
|
|
499
499
|
}
|
|
500
|
-
function
|
|
501
|
-
return t?.collapse ?
|
|
500
|
+
function ct(e, t) {
|
|
501
|
+
return t?.collapse ? st(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function lt(e) {
|
|
504
504
|
return e === "" || e === void 0 ? [] : e.split(".");
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function N(e) {
|
|
507
507
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
508
508
|
}
|
|
509
|
-
function
|
|
510
|
-
let n =
|
|
509
|
+
function ut(e, t) {
|
|
510
|
+
let n = lt(t), r = e;
|
|
511
511
|
for (let e of n) {
|
|
512
|
-
if (!
|
|
512
|
+
if (!N(r)) return;
|
|
513
513
|
r = r[e];
|
|
514
514
|
}
|
|
515
515
|
return r;
|
|
516
516
|
}
|
|
517
|
-
function
|
|
518
|
-
let n =
|
|
517
|
+
function dt(e, t) {
|
|
518
|
+
let n = lt(t);
|
|
519
519
|
if (n.length === 0) return !0;
|
|
520
520
|
let r = e;
|
|
521
521
|
for (let e = 0; e < n.length - 1; e++) {
|
|
522
|
-
if (!
|
|
522
|
+
if (!N(r)) return !1;
|
|
523
523
|
r = r[n[e]];
|
|
524
524
|
}
|
|
525
|
-
return
|
|
525
|
+
return N(r) ? n[n.length - 1] in r : !1;
|
|
526
526
|
}
|
|
527
|
-
function
|
|
528
|
-
let r =
|
|
527
|
+
function ft(e, t, n) {
|
|
528
|
+
let r = lt(t);
|
|
529
529
|
if (r.length === 0) throw Error("setAtPath: jsonPath must be non-empty");
|
|
530
530
|
let i = e;
|
|
531
531
|
for (let e = 0; e < r.length - 1; e++) {
|
|
@@ -533,22 +533,22 @@ function dt(e, t, n) {
|
|
|
533
533
|
if (n === void 0) {
|
|
534
534
|
let e = {};
|
|
535
535
|
i[t] = e, i = e;
|
|
536
|
-
} else if (
|
|
536
|
+
} else if (N(n)) i = n;
|
|
537
537
|
else throw Error(`setAtPath: cannot descend into non-object at '${r.slice(0, e + 1).join(".")}'`);
|
|
538
538
|
}
|
|
539
539
|
i[r[r.length - 1]] = n;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
542
|
-
let n =
|
|
541
|
+
function pt(e, t) {
|
|
542
|
+
let n = lt(t);
|
|
543
543
|
if (n.length === 0) throw Error("deleteAtPath: jsonPath must be non-empty");
|
|
544
544
|
let r = e;
|
|
545
545
|
for (let e = 0; e < n.length - 1; e++) {
|
|
546
|
-
if (!
|
|
546
|
+
if (!N(r)) return;
|
|
547
547
|
r = r[n[e]];
|
|
548
548
|
}
|
|
549
|
-
|
|
549
|
+
N(r) && delete r[n[n.length - 1]];
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function mt(e, t) {
|
|
552
552
|
let n = new Set(t), r = Object.keys(e), i = /* @__PURE__ */ new Map();
|
|
553
553
|
i.set("", []);
|
|
554
554
|
let a = "";
|
|
@@ -563,72 +563,72 @@ function pt(e, t) {
|
|
|
563
563
|
}
|
|
564
564
|
//#endregion
|
|
565
565
|
//#region src/structure/engine/parsers/lines.ts
|
|
566
|
-
function
|
|
566
|
+
function ht(e) {
|
|
567
567
|
let t = e.split("\n");
|
|
568
568
|
return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function gt(e) {
|
|
571
571
|
return e.join("\n") + "\n";
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function _t(e) {
|
|
574
574
|
return e.replace(/(^|\s)#.*$/, "$1").trim();
|
|
575
575
|
}
|
|
576
|
-
function
|
|
577
|
-
let n =
|
|
576
|
+
function vt(e, t) {
|
|
577
|
+
let n = _t(e);
|
|
578
578
|
return n === "" ? !1 : n === t.trim();
|
|
579
579
|
}
|
|
580
|
-
function
|
|
581
|
-
for (let n of e) if (
|
|
580
|
+
function yt(e, t) {
|
|
581
|
+
for (let n of e) if (vt(n, t)) return !0;
|
|
582
582
|
return !1;
|
|
583
583
|
}
|
|
584
584
|
//#endregion
|
|
585
585
|
//#region src/structure/engine/content-rules.ts
|
|
586
|
-
function
|
|
586
|
+
function bt(e, t) {
|
|
587
587
|
return e === "sdk:" ? t ? "workspace:*" : "catalog:" : e;
|
|
588
588
|
}
|
|
589
|
-
var
|
|
589
|
+
var xt = [
|
|
590
590
|
"dependencies",
|
|
591
591
|
"devDependencies",
|
|
592
592
|
"peerDependencies",
|
|
593
593
|
"optionalDependencies"
|
|
594
594
|
];
|
|
595
|
-
function
|
|
596
|
-
if (
|
|
595
|
+
function St(e, t) {
|
|
596
|
+
if (L(e)) for (let n of xt) {
|
|
597
597
|
let r = e[n];
|
|
598
|
-
if (
|
|
598
|
+
if (L(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
|
-
var
|
|
602
|
-
function
|
|
603
|
-
if (!
|
|
604
|
-
return
|
|
601
|
+
var P;
|
|
602
|
+
function Ct(e) {
|
|
603
|
+
if (!P) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
|
|
604
|
+
return P;
|
|
605
605
|
}
|
|
606
|
-
function
|
|
607
|
-
let t =
|
|
606
|
+
function F(e) {
|
|
607
|
+
let t = Ct(e);
|
|
608
608
|
if (t.kind !== "json") throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);
|
|
609
609
|
return t;
|
|
610
610
|
}
|
|
611
|
-
function
|
|
612
|
-
let t =
|
|
611
|
+
function I(e) {
|
|
612
|
+
let t = Ct(e);
|
|
613
613
|
if (t.kind !== "yaml") throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);
|
|
614
614
|
return t;
|
|
615
615
|
}
|
|
616
|
-
function
|
|
617
|
-
let t =
|
|
616
|
+
function wt(e) {
|
|
617
|
+
let t = Ct(e);
|
|
618
618
|
if (t.kind !== "lines") throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);
|
|
619
619
|
return t;
|
|
620
620
|
}
|
|
621
|
-
function
|
|
622
|
-
let n = e.ctx ??
|
|
621
|
+
function Tt(e, t) {
|
|
622
|
+
let n = e.ctx ?? We();
|
|
623
623
|
if (!n) throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);
|
|
624
624
|
return n;
|
|
625
625
|
}
|
|
626
|
-
function
|
|
626
|
+
function L(e) {
|
|
627
627
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
if (
|
|
631
|
-
|
|
629
|
+
function Et(e, t, n = {}) {
|
|
630
|
+
if (P) throw Error("Nested managed(...) body — engine bug.");
|
|
631
|
+
P = {
|
|
632
632
|
kind: "json",
|
|
633
633
|
obj: e,
|
|
634
634
|
ctx: n.ctx,
|
|
@@ -637,12 +637,12 @@ function Tt(e, t, n = {}) {
|
|
|
637
637
|
try {
|
|
638
638
|
return t(n.ctx ?? n.triggerContext?.ctx), e;
|
|
639
639
|
} finally {
|
|
640
|
-
|
|
640
|
+
P = void 0;
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
function
|
|
644
|
-
if (
|
|
645
|
-
|
|
643
|
+
function Dt(e, t, n = {}) {
|
|
644
|
+
if (P) throw Error("Nested managed(...) body — engine bug.");
|
|
645
|
+
P = {
|
|
646
646
|
kind: "yaml",
|
|
647
647
|
doc: e,
|
|
648
648
|
ctx: n.ctx,
|
|
@@ -653,12 +653,12 @@ function Et(e, t, n = {}) {
|
|
|
653
653
|
try {
|
|
654
654
|
return t(n.ctx ?? n.triggerContext?.ctx), e;
|
|
655
655
|
} finally {
|
|
656
|
-
|
|
656
|
+
P = void 0;
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
-
function
|
|
660
|
-
if (
|
|
661
|
-
|
|
659
|
+
function Ot(e, t, n = {}) {
|
|
660
|
+
if (P) throw Error("Nested managed(...) body — engine bug.");
|
|
661
|
+
P = {
|
|
662
662
|
kind: "lines",
|
|
663
663
|
lines: e,
|
|
664
664
|
ctx: n.ctx,
|
|
@@ -667,183 +667,187 @@ function Dt(e, t, n = {}) {
|
|
|
667
667
|
try {
|
|
668
668
|
return t(n.ctx ?? n.triggerContext?.ctx), e;
|
|
669
669
|
} finally {
|
|
670
|
-
|
|
670
|
+
P = void 0;
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
|
|
674
|
-
if (!
|
|
675
|
-
let n =
|
|
673
|
+
Je((e, t) => {
|
|
674
|
+
if (!P) return !1;
|
|
675
|
+
let n = P.triggerContext;
|
|
676
676
|
if (!n) throw Error("when() inside a managed(...) body requires a triggerContext. The runner supplies it via the `triggerContext` opt to with-managed-*; ensure your test/test helper passes one.");
|
|
677
677
|
return e(n) && t(), !0;
|
|
678
678
|
});
|
|
679
|
-
function
|
|
680
|
-
|
|
679
|
+
function R(e, t) {
|
|
680
|
+
ft(F("ensureField").obj, e, t);
|
|
681
681
|
}
|
|
682
|
-
function
|
|
683
|
-
let n =
|
|
684
|
-
|
|
682
|
+
function kt(e, t) {
|
|
683
|
+
let n = F("removeField").obj;
|
|
684
|
+
dt(n, e) && (t && !t(ut(n, e)) || pt(n, e));
|
|
685
685
|
}
|
|
686
|
-
function
|
|
687
|
-
let n =
|
|
688
|
-
if (!
|
|
686
|
+
function At(e, t) {
|
|
687
|
+
let n = F("requireField").obj;
|
|
688
|
+
if (!dt(n, e)) throw Error(t ?? `requireField: missing field '${e}'`);
|
|
689
689
|
}
|
|
690
|
-
function
|
|
691
|
-
let n =
|
|
690
|
+
function jt(e, t) {
|
|
691
|
+
let n = F("ensureFieldEntries").obj, r = dt(n, e) ? ut(n, e) : void 0, i = L(r) ? r : {};
|
|
692
692
|
for (let [e, n] of Object.entries(t)) i[e] = n;
|
|
693
|
-
|
|
693
|
+
L(r) || ft(n, e, i);
|
|
694
694
|
}
|
|
695
|
-
function
|
|
696
|
-
|
|
695
|
+
function z(e, t) {
|
|
696
|
+
R(`scripts.${e}`, t);
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
|
|
698
|
+
function B(e) {
|
|
699
|
+
kt(`scripts.${e}`);
|
|
700
700
|
}
|
|
701
|
-
var
|
|
701
|
+
var Mt = [
|
|
702
702
|
"dependencies",
|
|
703
703
|
"devDependencies",
|
|
704
704
|
"peerDependencies",
|
|
705
705
|
"optionalDependencies"
|
|
706
706
|
];
|
|
707
|
-
function
|
|
708
|
-
let i =
|
|
709
|
-
for (let e of
|
|
707
|
+
function Nt(e, t, n, r) {
|
|
708
|
+
let i = F(e), a = i.obj, o = n === "sdk:" ? bt(n, Tt(i, e).isSdkInternal) : n;
|
|
709
|
+
for (let e of Mt) {
|
|
710
710
|
if (e === r) continue;
|
|
711
711
|
let n = a[e];
|
|
712
|
-
|
|
712
|
+
L(n) && t in n && delete n[t];
|
|
713
713
|
}
|
|
714
|
-
let s = a[r], c =
|
|
715
|
-
c[t] = o,
|
|
714
|
+
let s = a[r], c = L(s) ? s : {};
|
|
715
|
+
c[t] = o, L(s) || (a[r] = c);
|
|
716
716
|
}
|
|
717
|
-
function
|
|
718
|
-
|
|
717
|
+
function Pt(e, t) {
|
|
718
|
+
Nt("ensureDep", e, t, "dependencies");
|
|
719
719
|
}
|
|
720
|
-
function
|
|
721
|
-
|
|
720
|
+
function V(e, t) {
|
|
721
|
+
Nt("ensureDevDep", e, t, "devDependencies");
|
|
722
722
|
}
|
|
723
|
-
function
|
|
724
|
-
|
|
723
|
+
function Ft(e, t) {
|
|
724
|
+
Nt("ensurePeerDep", e, t, "peerDependencies");
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
let t =
|
|
728
|
-
for (let n of
|
|
726
|
+
function H(e) {
|
|
727
|
+
let t = F("removeDep").obj;
|
|
728
|
+
for (let n of Mt) {
|
|
729
729
|
let r = t[n];
|
|
730
|
-
|
|
730
|
+
L(r) && e in r && delete r[e];
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
-
function
|
|
734
|
-
for (let [t, n] of Object.entries(e))
|
|
733
|
+
function U(e) {
|
|
734
|
+
for (let [t, n] of Object.entries(e)) V(t, n);
|
|
735
735
|
}
|
|
736
|
-
function
|
|
737
|
-
for (let [t, n] of Object.entries(e))
|
|
736
|
+
function It(e) {
|
|
737
|
+
for (let [t, n] of Object.entries(e)) Ft(t, n);
|
|
738
738
|
}
|
|
739
|
-
function
|
|
740
|
-
let r =
|
|
741
|
-
for (let i of r.modules) i.scope === t &&
|
|
739
|
+
function Lt(e, t, n) {
|
|
740
|
+
let r = Tt(F(e), e);
|
|
741
|
+
for (let i of r.modules) i.scope === t && Nt(e, i.name, "workspace:*", n);
|
|
742
742
|
}
|
|
743
|
-
function
|
|
744
|
-
|
|
743
|
+
function Rt(e) {
|
|
744
|
+
Lt("ensureWorkspaceScopeDeps", e, "dependencies");
|
|
745
745
|
}
|
|
746
|
-
function
|
|
747
|
-
|
|
746
|
+
function zt(e) {
|
|
747
|
+
Lt("ensureWorkspaceScopeDevDeps", e, "devDependencies");
|
|
748
748
|
}
|
|
749
|
-
function
|
|
750
|
-
let t =
|
|
749
|
+
function Bt(e) {
|
|
750
|
+
let t = F("pruneKeysMatching").obj;
|
|
751
751
|
for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
|
|
752
752
|
}
|
|
753
|
-
function
|
|
754
|
-
let n =
|
|
753
|
+
function Vt(e, t) {
|
|
754
|
+
let n = mt(e, t);
|
|
755
755
|
for (let t of Object.keys(e)) delete e[t];
|
|
756
756
|
for (let t of Object.keys(n)) e[t] = n[t];
|
|
757
757
|
}
|
|
758
|
-
function
|
|
759
|
-
|
|
758
|
+
function W(e) {
|
|
759
|
+
Vt(F("enforceFieldOrder").obj, e);
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function Ht(e, t) {
|
|
762
762
|
let n = Object.keys(e).sort(), r = {};
|
|
763
763
|
for (let t of n) r[t] = e[t];
|
|
764
764
|
for (let t of Object.keys(e)) delete e[t];
|
|
765
|
-
for (let i of n) e[i] = r[i], t &&
|
|
765
|
+
for (let i of n) e[i] = r[i], t && L(e[i]) && Ht(e[i], !0);
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function G(e = "", t = {}) {
|
|
768
768
|
let n = t.recursive ?? !1;
|
|
769
769
|
if (e === "" && !n) return;
|
|
770
|
-
let r =
|
|
770
|
+
let r = F("enforceAlphabeticalOrder").obj;
|
|
771
771
|
if (e === "") {
|
|
772
|
-
|
|
772
|
+
Ht(r, !0);
|
|
773
773
|
return;
|
|
774
774
|
}
|
|
775
|
-
let i =
|
|
776
|
-
|
|
775
|
+
let i = ut(r, e);
|
|
776
|
+
L(i) && Ht(i, n);
|
|
777
777
|
}
|
|
778
|
-
function
|
|
779
|
-
let
|
|
778
|
+
function Ut(e, t) {
|
|
779
|
+
let n = F("transformAt").obj;
|
|
780
|
+
ft(n, e, t(ut(n, e)));
|
|
781
|
+
}
|
|
782
|
+
function Wt() {
|
|
783
|
+
let e = I("ensureWorkspaceModulePaths"), t = Tt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
|
|
780
784
|
Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
|
|
781
785
|
}
|
|
782
|
-
function
|
|
786
|
+
function Gt(e, t) {
|
|
783
787
|
let n = e.doc.getIn(["catalog", t]);
|
|
784
788
|
return typeof n == "string" ? n : void 0;
|
|
785
789
|
}
|
|
786
|
-
function
|
|
787
|
-
let n =
|
|
788
|
-
|
|
790
|
+
function Kt(e, t) {
|
|
791
|
+
let n = I("ensureCatalogVersion");
|
|
792
|
+
Gt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
|
|
789
793
|
}
|
|
790
|
-
function
|
|
791
|
-
let t =
|
|
794
|
+
function qt(e) {
|
|
795
|
+
let t = I("ensureCatalogLatest");
|
|
792
796
|
if (!t.getLatestVersion) return;
|
|
793
797
|
let n = t.getLatestVersion(e);
|
|
794
|
-
n !== void 0 &&
|
|
798
|
+
n !== void 0 && Gt(t, e) !== n && t.doc.setIn(["catalog", e], n);
|
|
795
799
|
}
|
|
796
|
-
function
|
|
797
|
-
let n =
|
|
800
|
+
function Jt(e, t) {
|
|
801
|
+
let n = I("pinCatalogToDependencyOf");
|
|
798
802
|
if (!n.getDerivedDependencyPin) return;
|
|
799
803
|
let r = n.getDerivedDependencyPin(e);
|
|
800
|
-
r !== void 0 &&
|
|
804
|
+
r !== void 0 && Gt(n, e) !== r && n.doc.setIn(["catalog", e], r);
|
|
801
805
|
}
|
|
802
|
-
function
|
|
803
|
-
let t =
|
|
806
|
+
function Yt(e) {
|
|
807
|
+
let t = I("ensureCatalogAbsent");
|
|
804
808
|
t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
|
|
805
809
|
}
|
|
806
|
-
function
|
|
807
|
-
let t =
|
|
808
|
-
for (let n of e)
|
|
810
|
+
function Xt(e) {
|
|
811
|
+
let t = wt("ensureGitignoreEntries");
|
|
812
|
+
for (let n of e) yt(t.lines, n) || t.lines.push(n);
|
|
809
813
|
}
|
|
810
814
|
//#endregion
|
|
811
815
|
//#region src/structure/engine/parsers/yaml.ts
|
|
812
|
-
function
|
|
813
|
-
return
|
|
816
|
+
function Zt(e) {
|
|
817
|
+
return ue(e);
|
|
814
818
|
}
|
|
815
|
-
function
|
|
819
|
+
function Qt(e) {
|
|
816
820
|
return e.toString();
|
|
817
821
|
}
|
|
818
|
-
var
|
|
819
|
-
function
|
|
822
|
+
var $t = ".structure";
|
|
823
|
+
function en(e) {
|
|
820
824
|
if (!e.exists(".structure")) return { version: 0 };
|
|
821
825
|
try {
|
|
822
|
-
let t = JSON.parse(e.read(
|
|
826
|
+
let t = JSON.parse(e.read($t));
|
|
823
827
|
return { version: typeof t?.version == "number" ? t.version : 0 };
|
|
824
828
|
} catch {
|
|
825
829
|
return { version: 0 };
|
|
826
830
|
}
|
|
827
831
|
}
|
|
828
|
-
function
|
|
829
|
-
if (e < t) throw new
|
|
832
|
+
function tn(e, t = 0) {
|
|
833
|
+
if (e < t) throw new nn(e, t);
|
|
830
834
|
}
|
|
831
|
-
var
|
|
835
|
+
var nn = class extends Error {
|
|
832
836
|
constructor(e, t) {
|
|
833
837
|
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";
|
|
834
838
|
}
|
|
835
839
|
};
|
|
836
|
-
function
|
|
837
|
-
e.write(
|
|
840
|
+
function rn(e, t) {
|
|
841
|
+
e.write($t, JSON.stringify(t));
|
|
838
842
|
}
|
|
839
843
|
//#endregion
|
|
840
844
|
//#region src/structure/engine/runner.ts
|
|
841
|
-
var
|
|
845
|
+
var an = class extends Error {
|
|
842
846
|
constructor(e) {
|
|
843
847
|
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";
|
|
844
848
|
}
|
|
845
849
|
};
|
|
846
|
-
function
|
|
850
|
+
function on(e, t, n, r) {
|
|
847
851
|
switch (e.kind) {
|
|
848
852
|
case "text": return e.value;
|
|
849
853
|
case "file":
|
|
@@ -851,47 +855,47 @@ function tn(e, t, n, r) {
|
|
|
851
855
|
return n.staticRead(e.path);
|
|
852
856
|
case "tpl":
|
|
853
857
|
if (!n) throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
854
|
-
return
|
|
858
|
+
return je(n.textRead(e.path), typeof e.vars == "function" ? e.vars(r) : e.vars);
|
|
855
859
|
case "generate": {
|
|
856
860
|
let n = e.fn(r);
|
|
857
|
-
if (t.endsWith(".json")) return
|
|
858
|
-
if (t.endsWith(".yaml") || t.endsWith(".yml")) return
|
|
861
|
+
if (t.endsWith(".json")) return St(n, r.isSdkInternal), ct(n, { collapse: !t.endsWith("package.json") });
|
|
862
|
+
if (t.endsWith(".yaml") || t.endsWith(".yml")) return de(n);
|
|
859
863
|
if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
|
|
860
864
|
return n;
|
|
861
865
|
}
|
|
862
866
|
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.`);
|
|
863
867
|
}
|
|
864
868
|
}
|
|
865
|
-
function
|
|
869
|
+
function sn(e, t, n, r, i) {
|
|
866
870
|
if (n.kind === "binary") {
|
|
867
871
|
if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
868
872
|
e.writeBinary(t, r.staticReadBinary(n.path));
|
|
869
873
|
return;
|
|
870
874
|
}
|
|
871
|
-
e.write(t,
|
|
875
|
+
e.write(t, on(n, t, r, i));
|
|
872
876
|
}
|
|
873
|
-
function
|
|
877
|
+
function cn(e, t, n, r, i, a) {
|
|
874
878
|
let o = e.split("/").pop() ?? e;
|
|
875
879
|
if (e.endsWith(".json")) {
|
|
876
|
-
let i =
|
|
880
|
+
let i = nt(t);
|
|
877
881
|
if (typeof i != "object" || !i || Array.isArray(i)) throw Error(`managed: parsed value at '${e}' is not a JSON object`);
|
|
878
|
-
return
|
|
882
|
+
return Et(i, n, { triggerContext: r }), ct(i, { collapse: o !== "package.json" });
|
|
879
883
|
}
|
|
880
884
|
if (e.endsWith(".yaml") || e.endsWith(".yml")) {
|
|
881
|
-
let e =
|
|
882
|
-
return
|
|
885
|
+
let e = Zt(t);
|
|
886
|
+
return Dt(e, n, {
|
|
883
887
|
triggerContext: r,
|
|
884
888
|
getLatestVersion: i,
|
|
885
889
|
getDerivedDependencyPin: a
|
|
886
|
-
}),
|
|
890
|
+
}), Qt(e);
|
|
887
891
|
}
|
|
888
892
|
if (o === ".gitignore" || o.endsWith(".gitignore")) {
|
|
889
|
-
let e =
|
|
890
|
-
return
|
|
893
|
+
let e = ht(t);
|
|
894
|
+
return Ot(e, n, { triggerContext: r }), gt(e);
|
|
891
895
|
}
|
|
892
896
|
throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
|
|
893
897
|
}
|
|
894
|
-
function
|
|
898
|
+
function ln(e) {
|
|
895
899
|
let t = e.list(""), n = /* @__PURE__ */ new Set();
|
|
896
900
|
for (let e of t) {
|
|
897
901
|
n.add(e);
|
|
@@ -900,37 +904,37 @@ function an(e) {
|
|
|
900
904
|
}
|
|
901
905
|
return n;
|
|
902
906
|
}
|
|
903
|
-
function
|
|
907
|
+
function un(e, t) {
|
|
904
908
|
let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
|
|
905
909
|
return e.has(n);
|
|
906
910
|
}
|
|
907
|
-
function
|
|
911
|
+
function dn(e, t, n) {
|
|
908
912
|
return {
|
|
909
913
|
ctx: t,
|
|
910
914
|
version: t.version,
|
|
911
|
-
pathExists: (t) =>
|
|
912
|
-
pathMissing: (t) => !
|
|
915
|
+
pathExists: (t) => un(e, t),
|
|
916
|
+
pathMissing: (t) => !un(e, t),
|
|
913
917
|
filesMatch: (t) => {
|
|
914
918
|
let r = n ? `${n}/${t}` : t;
|
|
915
|
-
for (let t of e) if (
|
|
919
|
+
for (let t of e) if (Be(r, t)) return !0;
|
|
916
920
|
return !1;
|
|
917
921
|
}
|
|
918
922
|
};
|
|
919
923
|
}
|
|
920
|
-
function
|
|
924
|
+
function fn(e, t) {
|
|
921
925
|
for (let n of e.triggers) if (!n(t)) return !1;
|
|
922
926
|
return !0;
|
|
923
927
|
}
|
|
924
|
-
function
|
|
928
|
+
function pn(e, t) {
|
|
925
929
|
return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
|
|
926
930
|
}
|
|
927
|
-
function
|
|
931
|
+
function mn(e, t) {
|
|
928
932
|
return e.filter((e) => e.modes.includes(t));
|
|
929
933
|
}
|
|
930
|
-
function
|
|
934
|
+
function hn(e, t, n, r, i, a) {
|
|
931
935
|
let o = e.leaf;
|
|
932
936
|
if (o.kind === "fixed") {
|
|
933
|
-
let i =
|
|
937
|
+
let i = on(o.content, e.resolvedPath, r, a);
|
|
934
938
|
return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
|
|
935
939
|
scope: e.scope,
|
|
936
940
|
path: e.resolvedPath,
|
|
@@ -943,13 +947,13 @@ function dn(e, t, n, r, i, a) {
|
|
|
943
947
|
action: "create"
|
|
944
948
|
});
|
|
945
949
|
}
|
|
946
|
-
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
950
|
+
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || sn(t, e.resolvedPath, o.initial, r, a), {
|
|
947
951
|
scope: e.scope,
|
|
948
952
|
path: e.resolvedPath,
|
|
949
953
|
primitive: "scaffold",
|
|
950
954
|
action: "create"
|
|
951
955
|
});
|
|
952
|
-
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
956
|
+
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || sn(t, e.resolvedPath, o.initial, r, a), {
|
|
953
957
|
scope: e.scope,
|
|
954
958
|
path: e.resolvedPath,
|
|
955
959
|
primitive: "seed",
|
|
@@ -972,11 +976,11 @@ function dn(e, t, n, r, i, a) {
|
|
|
972
976
|
});
|
|
973
977
|
}
|
|
974
978
|
}
|
|
975
|
-
function
|
|
979
|
+
function gn(e, t, n, r, i, a, o, s) {
|
|
976
980
|
if (e.leaf.kind !== "managed") return;
|
|
977
981
|
let c = e.leaf, l = e.resolvedPath, u = t.exists(l), d, f = !1;
|
|
978
|
-
u ? d = t.read(l) : (d =
|
|
979
|
-
let p =
|
|
982
|
+
u ? d = t.read(l) : (d = on(c.initial, l, i, s), f = !0);
|
|
983
|
+
let p = cn(l, d, c.body, r, a, o);
|
|
980
984
|
if (f) return n || t.write(l, p), {
|
|
981
985
|
scope: e.scope,
|
|
982
986
|
path: l,
|
|
@@ -990,40 +994,40 @@ function fn(e, t, n, r, i, a, o, s) {
|
|
|
990
994
|
action: "update"
|
|
991
995
|
};
|
|
992
996
|
}
|
|
993
|
-
function
|
|
994
|
-
let c =
|
|
997
|
+
function _n(e, t, n, r, i, a, o, s) {
|
|
998
|
+
let c = mn(e, pn(n, a)), l = [], u = ln(t);
|
|
995
999
|
for (let e of c) {
|
|
996
|
-
if (e.leaf.kind === "managed" || !
|
|
997
|
-
let o =
|
|
1000
|
+
if (e.leaf.kind === "managed" || !fn(e, dn(u, n, e.modulePath))) continue;
|
|
1001
|
+
let o = hn(e, t, r, i, a, n);
|
|
998
1002
|
o && l.push(o);
|
|
999
1003
|
}
|
|
1000
|
-
let d =
|
|
1004
|
+
let d = ln(t);
|
|
1001
1005
|
for (let e of c) {
|
|
1002
1006
|
if (e.leaf.kind !== "managed") continue;
|
|
1003
|
-
let a =
|
|
1004
|
-
if (!
|
|
1005
|
-
let c =
|
|
1007
|
+
let a = dn(d, n, e.modulePath);
|
|
1008
|
+
if (!fn(e, a)) continue;
|
|
1009
|
+
let c = gn(e, t, r, a, i, o, s, n);
|
|
1006
1010
|
c && l.push(c);
|
|
1007
1011
|
}
|
|
1008
1012
|
return l;
|
|
1009
1013
|
}
|
|
1010
|
-
function
|
|
1011
|
-
return
|
|
1012
|
-
let i =
|
|
1014
|
+
function vn(e, t, n, r = {}) {
|
|
1015
|
+
return Ue(n, () => {
|
|
1016
|
+
let i = Fe(e, n), a = !!r.initMode, o = _n(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
|
|
1013
1017
|
if (!n.dryRun && !n.updateDepsOnly && !a) {
|
|
1014
|
-
|
|
1018
|
+
rn(t, { version: 2 });
|
|
1015
1019
|
let i = {
|
|
1016
1020
|
...r.rediscover ? r.rediscover(t) : n,
|
|
1017
1021
|
dryRun: !0
|
|
1018
|
-
}, a =
|
|
1019
|
-
if (a.length > 0) throw new
|
|
1022
|
+
}, a = _n(Fe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== $t);
|
|
1023
|
+
if (a.length > 0) throw new an(a[0]);
|
|
1020
1024
|
}
|
|
1021
|
-
return a && !n.dryRun &&
|
|
1025
|
+
return a && !n.dryRun && rn(t, { version: 2 }), { changes: o };
|
|
1022
1026
|
});
|
|
1023
1027
|
}
|
|
1024
1028
|
//#endregion
|
|
1025
1029
|
//#region src/structure/engine/discovery.ts
|
|
1026
|
-
var
|
|
1030
|
+
var yn = [
|
|
1027
1031
|
"root",
|
|
1028
1032
|
"block",
|
|
1029
1033
|
"model",
|
|
@@ -1032,12 +1036,12 @@ var hn = [
|
|
|
1032
1036
|
"test",
|
|
1033
1037
|
"software",
|
|
1034
1038
|
"kind"
|
|
1035
|
-
],
|
|
1039
|
+
], bn = class extends Error {
|
|
1036
1040
|
constructor(e, t) {
|
|
1037
1041
|
super(e), this.path = t, this.name = "DiscoveryError";
|
|
1038
1042
|
}
|
|
1039
1043
|
};
|
|
1040
|
-
function
|
|
1044
|
+
function xn(e) {
|
|
1041
1045
|
let t = /* @__PURE__ */ new Set();
|
|
1042
1046
|
for (let n of [
|
|
1043
1047
|
e.dependencies,
|
|
@@ -1047,18 +1051,18 @@ function _n(e) {
|
|
|
1047
1051
|
]) if (n) for (let e of Object.keys(n)) t.add(e);
|
|
1048
1052
|
return t;
|
|
1049
1053
|
}
|
|
1050
|
-
function
|
|
1054
|
+
function Sn(e) {
|
|
1051
1055
|
return e === "" || e === ".";
|
|
1052
1056
|
}
|
|
1053
|
-
function
|
|
1057
|
+
function Cn(e) {
|
|
1054
1058
|
let t = e.pkg["block-scope"];
|
|
1055
1059
|
if (typeof t == "string") {
|
|
1056
|
-
if (!
|
|
1060
|
+
if (!yn.includes(t)) throw new bn(`package.json "block-scope" must be one of ${yn.join(", ")}, got '${t}'`, e.path);
|
|
1057
1061
|
return t;
|
|
1058
1062
|
}
|
|
1059
|
-
if (
|
|
1063
|
+
if (Sn(e.path)) return "root";
|
|
1060
1064
|
if (e.pkg.block !== void 0) return "block";
|
|
1061
|
-
let n =
|
|
1065
|
+
let n = xn(e.pkg);
|
|
1062
1066
|
if (n.has("@platforma-sdk/block-kind")) return "kind";
|
|
1063
1067
|
if (e.pkg["block-software"] !== void 0) return "software";
|
|
1064
1068
|
if (n.has("@platforma-sdk/package-builder")) {
|
|
@@ -1069,39 +1073,39 @@ function yn(e) {
|
|
|
1069
1073
|
if (n.has("@platforma-sdk/model") && e.pkg.main) return "model";
|
|
1070
1074
|
if (n.has("@platforma-sdk/test")) return "test";
|
|
1071
1075
|
}
|
|
1072
|
-
function
|
|
1076
|
+
function wn(e) {
|
|
1073
1077
|
let t = [];
|
|
1074
1078
|
for (let n of e) {
|
|
1075
|
-
let e =
|
|
1076
|
-
if (!e) throw new
|
|
1079
|
+
let e = Cn(n);
|
|
1080
|
+
if (!e) throw new bn(`Unclassified workspace package at '${n.path}'. Add a top-level "block-scope" string to its package.json.`, n.path);
|
|
1077
1081
|
t.push({
|
|
1078
1082
|
scope: e,
|
|
1079
1083
|
name: n.pkg.name ?? n.path,
|
|
1080
|
-
path:
|
|
1084
|
+
path: Sn(n.path) ? "" : n.path
|
|
1081
1085
|
});
|
|
1082
1086
|
}
|
|
1083
1087
|
return t;
|
|
1084
1088
|
}
|
|
1085
1089
|
//#endregion
|
|
1086
1090
|
//#region src/structure/engine/ctx.ts
|
|
1087
|
-
function
|
|
1091
|
+
function K(e, t) {
|
|
1088
1092
|
return e.modules.filter((e) => e.scope === t);
|
|
1089
1093
|
}
|
|
1090
|
-
function
|
|
1091
|
-
let n =
|
|
1094
|
+
function Tn(e, t) {
|
|
1095
|
+
let n = K(e, t);
|
|
1092
1096
|
if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
|
|
1093
1097
|
if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
|
|
1094
1098
|
return n[0];
|
|
1095
1099
|
}
|
|
1096
|
-
function
|
|
1097
|
-
return { [
|
|
1100
|
+
function En(e, t) {
|
|
1101
|
+
return { [Tn(e, t).name]: "workspace:*" };
|
|
1098
1102
|
}
|
|
1099
|
-
function
|
|
1103
|
+
function q(e, t) {
|
|
1100
1104
|
let n = {};
|
|
1101
|
-
for (let r of
|
|
1105
|
+
for (let r of K(e, t)) n[r.name] = "workspace:*";
|
|
1102
1106
|
return n;
|
|
1103
1107
|
}
|
|
1104
|
-
function
|
|
1108
|
+
function Dn(e) {
|
|
1105
1109
|
let t = e.facadeName, n = [
|
|
1106
1110
|
{
|
|
1107
1111
|
scope: "root",
|
|
@@ -1145,7 +1149,7 @@ function Cn(e) {
|
|
|
1145
1149
|
path: "software"
|
|
1146
1150
|
}), n;
|
|
1147
1151
|
}
|
|
1148
|
-
function
|
|
1152
|
+
function On(e) {
|
|
1149
1153
|
return {
|
|
1150
1154
|
isSdkInternal: e.isSdkInternal ?? !1,
|
|
1151
1155
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
@@ -1157,41 +1161,41 @@ function wn(e) {
|
|
|
1157
1161
|
}
|
|
1158
1162
|
//#endregion
|
|
1159
1163
|
//#region src/structure/engine/discovery-fs.ts
|
|
1160
|
-
var
|
|
1164
|
+
var J = class extends Error {
|
|
1161
1165
|
constructor(e) {
|
|
1162
1166
|
super(e), this.name = "StructureCliError";
|
|
1163
1167
|
}
|
|
1164
1168
|
};
|
|
1165
|
-
function
|
|
1169
|
+
function kn(e, t) {
|
|
1166
1170
|
return e === "" ? t : `${e}/${t}`;
|
|
1167
1171
|
}
|
|
1168
|
-
function
|
|
1172
|
+
function An(e, t) {
|
|
1169
1173
|
try {
|
|
1170
1174
|
return JSON.parse(e.read(t));
|
|
1171
1175
|
} catch {
|
|
1172
1176
|
return;
|
|
1173
1177
|
}
|
|
1174
1178
|
}
|
|
1175
|
-
function
|
|
1176
|
-
if (e.includes("*")) throw new
|
|
1179
|
+
function jn(e) {
|
|
1180
|
+
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.`);
|
|
1177
1181
|
let t = e.replace(/^\.\//, "").replace(/\/$/, "");
|
|
1178
1182
|
return t === "." ? "" : t;
|
|
1179
1183
|
}
|
|
1180
|
-
function
|
|
1184
|
+
function Mn(e) {
|
|
1181
1185
|
let t;
|
|
1182
1186
|
try {
|
|
1183
1187
|
t = e.read("pnpm-workspace.yaml");
|
|
1184
1188
|
} catch {
|
|
1185
|
-
throw new
|
|
1189
|
+
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.");
|
|
1186
1190
|
}
|
|
1187
|
-
let n =
|
|
1191
|
+
let n = le(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
|
|
1188
1192
|
for (let t of r) {
|
|
1189
|
-
let n =
|
|
1193
|
+
let n = jn(t);
|
|
1190
1194
|
(n === "" || e.exists(n)) && i.add(n);
|
|
1191
1195
|
}
|
|
1192
1196
|
let a = [];
|
|
1193
1197
|
for (let t of i) {
|
|
1194
|
-
let n =
|
|
1198
|
+
let n = An(e, kn(t, "package.json"));
|
|
1195
1199
|
n && a.push({
|
|
1196
1200
|
path: t,
|
|
1197
1201
|
pkg: n
|
|
@@ -1199,7 +1203,7 @@ function On(e) {
|
|
|
1199
1203
|
}
|
|
1200
1204
|
return a;
|
|
1201
1205
|
}
|
|
1202
|
-
function
|
|
1206
|
+
function Nn(e) {
|
|
1203
1207
|
let t = [], n = new Set([
|
|
1204
1208
|
"node_modules",
|
|
1205
1209
|
".turbo",
|
|
@@ -1211,7 +1215,7 @@ function kn(e) {
|
|
|
1211
1215
|
let o = e.listDir(i);
|
|
1212
1216
|
for (let s of o) {
|
|
1213
1217
|
if (!s.isDirectory || n.has(s.name)) continue;
|
|
1214
|
-
let o =
|
|
1218
|
+
let o = kn(i, s.name), c = An(e, kn(o, "package.json"));
|
|
1215
1219
|
c && t.push({
|
|
1216
1220
|
path: o,
|
|
1217
1221
|
pkg: c
|
|
@@ -1220,11 +1224,11 @@ function kn(e) {
|
|
|
1220
1224
|
}
|
|
1221
1225
|
return r("", 1), t;
|
|
1222
1226
|
}
|
|
1223
|
-
function
|
|
1227
|
+
function Pn(e) {
|
|
1224
1228
|
let t = e.indexOf("/");
|
|
1225
|
-
if (!e.startsWith("@") || t < 0) throw new
|
|
1229
|
+
if (!e.startsWith("@") || t < 0) throw new J(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
|
|
1226
1230
|
let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
|
|
1227
|
-
if (i < 0) throw new
|
|
1231
|
+
if (i < 0) throw new J(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
|
|
1228
1232
|
return {
|
|
1229
1233
|
facadeName: e,
|
|
1230
1234
|
baseName: r,
|
|
@@ -1233,15 +1237,15 @@ function An(e) {
|
|
|
1233
1237
|
shortName: r.slice(i + 1)
|
|
1234
1238
|
};
|
|
1235
1239
|
}
|
|
1236
|
-
function
|
|
1237
|
-
let { fs: t, isSdkInternal: n } = e, r = n ?
|
|
1238
|
-
if (r.length === 0) throw new
|
|
1239
|
-
let i =
|
|
1240
|
-
|
|
1240
|
+
function Fn(e) {
|
|
1241
|
+
let { fs: t, isSdkInternal: n } = e, r = n ? Nn(t) : Mn(t);
|
|
1242
|
+
if (r.length === 0) throw new J("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
|
|
1243
|
+
let i = wn(r), a = en(t);
|
|
1244
|
+
tn(a.version, 0);
|
|
1241
1245
|
let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
|
|
1242
|
-
if (!o) throw new
|
|
1243
|
-
let s =
|
|
1244
|
-
return
|
|
1246
|
+
if (!o) throw new J("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
|
|
1247
|
+
let s = Pn(o.name.replace(/\.block$/, ""));
|
|
1248
|
+
return On({
|
|
1245
1249
|
isSdkInternal: n,
|
|
1246
1250
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
1247
1251
|
modules: i,
|
|
@@ -1252,7 +1256,7 @@ function jn(e) {
|
|
|
1252
1256
|
}
|
|
1253
1257
|
//#endregion
|
|
1254
1258
|
//#region src/structure/rules/shared/key-order.ts
|
|
1255
|
-
var
|
|
1259
|
+
var Y = [
|
|
1256
1260
|
"name",
|
|
1257
1261
|
"version",
|
|
1258
1262
|
"private",
|
|
@@ -1273,25 +1277,31 @@ var Q = [
|
|
|
1273
1277
|
"pnpm",
|
|
1274
1278
|
"block",
|
|
1275
1279
|
"block-software"
|
|
1276
|
-
],
|
|
1280
|
+
], X = "1.0.0";
|
|
1281
|
+
function Z() {
|
|
1282
|
+
Ut("version", (e) => typeof e == "string" && e.length > 0 ? e : X);
|
|
1283
|
+
}
|
|
1284
|
+
//#endregion
|
|
1285
|
+
//#region src/structure/rules/root-package-json.ts
|
|
1286
|
+
var In = {
|
|
1277
1287
|
"build:dev-local": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=local turbo run build",
|
|
1278
1288
|
"build:dev-remote": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build",
|
|
1279
1289
|
"build:dev-no-software": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=none turbo run build",
|
|
1280
1290
|
"build:dev-binary-existing": "env PL_BUILD_CHANNEL=dev PL_BUILD_USE_PUBLISHED=true turbo run build",
|
|
1281
1291
|
"build:release": "env PL_BUILD_CHANNEL=release PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build"
|
|
1282
|
-
},
|
|
1292
|
+
}, Ln = {
|
|
1283
1293
|
test: "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --concurrency 1",
|
|
1284
1294
|
"test:dry-run": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --dry-run=json"
|
|
1285
1295
|
};
|
|
1286
|
-
function
|
|
1296
|
+
function Rn() {
|
|
1287
1297
|
return {
|
|
1288
|
-
version:
|
|
1298
|
+
version: X,
|
|
1289
1299
|
private: !0,
|
|
1290
1300
|
scripts: {
|
|
1291
1301
|
fmt: "turbo run fmt",
|
|
1292
1302
|
check: "turbo run check",
|
|
1293
|
-
...
|
|
1294
|
-
...
|
|
1303
|
+
...In,
|
|
1304
|
+
...Ln,
|
|
1295
1305
|
"mark-stable": "turbo run mark-stable",
|
|
1296
1306
|
"do-pack": "turbo run do-pack",
|
|
1297
1307
|
watch: "turbo watch build",
|
|
@@ -1314,28 +1324,28 @@ function Pn() {
|
|
|
1314
1324
|
packageManager: "pnpm@9.12.0"
|
|
1315
1325
|
};
|
|
1316
1326
|
}
|
|
1317
|
-
function
|
|
1318
|
-
|
|
1319
|
-
for (let [e, t] of Object.entries(
|
|
1320
|
-
for (let [e, t] of Object.entries(
|
|
1321
|
-
|
|
1327
|
+
function zn() {
|
|
1328
|
+
R("packageManager", "pnpm@9.12.0"), kt("name"), z("fmt", "turbo run fmt"), z("check", "turbo run check");
|
|
1329
|
+
for (let [e, t] of Object.entries(In)) z(e, t);
|
|
1330
|
+
for (let [e, t] of Object.entries(Ln)) z(e, t);
|
|
1331
|
+
B("build"), B("build:dev"), z("mark-stable", "turbo run mark-stable"), z("do-pack", "turbo run do-pack"), z("watch", "turbo watch build"), z("changeset", "changeset"), z("version-packages", "changeset version"), z("update-sdk", "block-tools structure refresh --update-deps-only"), B("update"), z("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), U({
|
|
1322
1332
|
"@changesets/cli": "catalog:",
|
|
1323
1333
|
"@milaboratories/ts-builder": "sdk:",
|
|
1324
1334
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1325
1335
|
shx: "catalog:",
|
|
1326
1336
|
turbo: "catalog:"
|
|
1327
|
-
}),
|
|
1337
|
+
}), It({
|
|
1328
1338
|
oxlint: "*",
|
|
1329
1339
|
oxfmt: "*"
|
|
1330
|
-
}),
|
|
1340
|
+
}), Bt((e, t) => {
|
|
1331
1341
|
if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
|
|
1332
1342
|
let n = t;
|
|
1333
1343
|
return n.pnpm !== void 0 || n.overrides !== void 0;
|
|
1334
|
-
}),
|
|
1344
|
+
}), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1335
1345
|
}
|
|
1336
1346
|
//#endregion
|
|
1337
1347
|
//#region src/structure/rules/root-turbo-json.ts
|
|
1338
|
-
var
|
|
1348
|
+
var Bn = "https://turbo.build/schema.json", Vn = ["tsconfig.json"], Hn = {
|
|
1339
1349
|
fmt: { cache: !1 },
|
|
1340
1350
|
check: {
|
|
1341
1351
|
dependsOn: ["^build"],
|
|
@@ -1384,15 +1394,15 @@ var In = "https://turbo.build/schema.json", Ln = ["tsconfig.json"], Rn = {
|
|
|
1384
1394
|
cache: !1
|
|
1385
1395
|
}
|
|
1386
1396
|
};
|
|
1387
|
-
function
|
|
1397
|
+
function Un() {
|
|
1388
1398
|
return {
|
|
1389
|
-
$schema:
|
|
1390
|
-
globalDependencies:
|
|
1391
|
-
tasks: { ...
|
|
1399
|
+
$schema: Bn,
|
|
1400
|
+
globalDependencies: Vn,
|
|
1401
|
+
tasks: { ...Hn }
|
|
1392
1402
|
};
|
|
1393
1403
|
}
|
|
1394
|
-
function
|
|
1395
|
-
|
|
1404
|
+
function Wn() {
|
|
1405
|
+
R("$schema", Bn), R("globalDependencies", Vn), jt("tasks", Hn), kt("tasks.build:dev"), W([
|
|
1396
1406
|
"$schema",
|
|
1397
1407
|
"globalDependencies",
|
|
1398
1408
|
"tasks"
|
|
@@ -1400,70 +1410,70 @@ function Bn() {
|
|
|
1400
1410
|
}
|
|
1401
1411
|
//#endregion
|
|
1402
1412
|
//#region src/structure/engine/registry-client.ts
|
|
1403
|
-
var
|
|
1404
|
-
function
|
|
1413
|
+
var Gn = 2, Kn = 500, qn = 3e4;
|
|
1414
|
+
function Jn(e) {
|
|
1405
1415
|
if (!e) return null;
|
|
1406
1416
|
let t = Number(e);
|
|
1407
1417
|
if (Number.isFinite(t) && t > 0) return t * 1e3;
|
|
1408
1418
|
let n = Date.parse(e);
|
|
1409
1419
|
return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
|
|
1410
1420
|
}
|
|
1411
|
-
async function
|
|
1421
|
+
async function Yn(e) {
|
|
1412
1422
|
for (let t = 1;; t++) {
|
|
1413
1423
|
let n;
|
|
1414
1424
|
try {
|
|
1415
|
-
n = await fetch(e, { signal: AbortSignal.timeout(
|
|
1425
|
+
n = await fetch(e, { signal: AbortSignal.timeout(qn) });
|
|
1416
1426
|
} catch (e) {
|
|
1417
|
-
if (t >
|
|
1418
|
-
await
|
|
1427
|
+
if (t > Gn) throw e;
|
|
1428
|
+
await fe(Kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1419
1429
|
continue;
|
|
1420
1430
|
}
|
|
1421
1431
|
if (n.ok) return n;
|
|
1422
|
-
if (!(n.status === 429 || n.status >= 500) || t >
|
|
1423
|
-
let r =
|
|
1432
|
+
if (!(n.status === 429 || n.status >= 500) || t > Gn) throw Error(`registry returned HTTP ${n.status}`);
|
|
1433
|
+
let r = Jn(n.headers.get("retry-after"));
|
|
1424
1434
|
if (r != null) {
|
|
1425
|
-
await
|
|
1435
|
+
await fe(r);
|
|
1426
1436
|
continue;
|
|
1427
1437
|
}
|
|
1428
|
-
await
|
|
1438
|
+
await fe(Kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1429
1439
|
}
|
|
1430
1440
|
}
|
|
1431
|
-
function
|
|
1441
|
+
function Xn() {
|
|
1432
1442
|
return {
|
|
1433
1443
|
async getLatestVersion(e) {
|
|
1434
|
-
let t = (await (await
|
|
1444
|
+
let t = (await (await Yn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
|
|
1435
1445
|
if (!t) throw Error("no 'latest' dist-tag in registry response");
|
|
1436
1446
|
return t;
|
|
1437
1447
|
},
|
|
1438
1448
|
async getDeclaredDependency(e, t, n) {
|
|
1439
|
-
let r = await (await
|
|
1449
|
+
let r = await (await Yn(`https://registry.npmjs.org/${e}/${t}`)).json();
|
|
1440
1450
|
return r.dependencies?.[n] ?? r.peerDependencies?.[n];
|
|
1441
1451
|
}
|
|
1442
1452
|
};
|
|
1443
1453
|
}
|
|
1444
|
-
async function
|
|
1454
|
+
async function Zn(e, t) {
|
|
1445
1455
|
let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
|
|
1446
1456
|
return new Map(n);
|
|
1447
1457
|
}
|
|
1448
|
-
function
|
|
1458
|
+
function Qn(e) {
|
|
1449
1459
|
return (t) => e.get(t);
|
|
1450
1460
|
}
|
|
1451
|
-
var
|
|
1452
|
-
function
|
|
1453
|
-
return
|
|
1461
|
+
var $n = [/^@platforma-sdk\//, /^@milaboratories\//];
|
|
1462
|
+
function er(e) {
|
|
1463
|
+
return $n.some((t) => t.test(e));
|
|
1454
1464
|
}
|
|
1455
|
-
async function
|
|
1456
|
-
return e.length === 0 ? () => void 0 :
|
|
1465
|
+
async function tr(e, t = Xn()) {
|
|
1466
|
+
return e.length === 0 ? () => void 0 : Qn(await Zn(t, e));
|
|
1457
1467
|
}
|
|
1458
|
-
function
|
|
1468
|
+
function nr(e) {
|
|
1459
1469
|
return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
|
|
1460
1470
|
}
|
|
1461
|
-
async function
|
|
1471
|
+
async function rr(e, t = Xn()) {
|
|
1462
1472
|
if (e.length === 0) return () => void 0;
|
|
1463
1473
|
let n = await Promise.all(e.map(async (e) => {
|
|
1464
1474
|
let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
|
|
1465
1475
|
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.`);
|
|
1466
|
-
if (!
|
|
1476
|
+
if (!nr(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.`);
|
|
1467
1477
|
return [e.entry, n];
|
|
1468
1478
|
})), r = new Map(n);
|
|
1469
1479
|
return (e) => r.get(e);
|
|
@@ -1471,7 +1481,7 @@ async function $n(e, t = Kn()) {
|
|
|
1471
1481
|
//#endregion
|
|
1472
1482
|
//#region src/structure/rules/shared/retired-deps.ts
|
|
1473
1483
|
// @vitejs/plugin-vue — bundled by ts-builder's internal vite config.
|
|
1474
|
-
var
|
|
1484
|
+
var ir = [
|
|
1475
1485
|
"vite",
|
|
1476
1486
|
"tsup",
|
|
1477
1487
|
"vue-tsc",
|
|
@@ -1479,50 +1489,53 @@ var er = [
|
|
|
1479
1489
|
"vite-plugin-dts",
|
|
1480
1490
|
"@platforma-sdk/eslint-config"
|
|
1481
1491
|
];
|
|
1482
|
-
function
|
|
1483
|
-
for (let e of
|
|
1492
|
+
function ar() {
|
|
1493
|
+
for (let e of ir) H(e);
|
|
1484
1494
|
}
|
|
1485
1495
|
//#endregion
|
|
1486
1496
|
//#region src/structure/rules/root-pnpm-workspace.ts
|
|
1487
|
-
var
|
|
1497
|
+
var or = [
|
|
1488
1498
|
"@platforma-sdk/model",
|
|
1489
1499
|
"@platforma-sdk/ui-vue",
|
|
1490
1500
|
"@platforma-sdk/workflow-tengo",
|
|
1491
1501
|
"@platforma-sdk/test",
|
|
1502
|
+
"@platforma-sdk/block-kind",
|
|
1492
1503
|
"@platforma-sdk/block-tools",
|
|
1504
|
+
"@platforma-sdk/block-kind",
|
|
1493
1505
|
"@platforma-sdk/tengo-builder",
|
|
1494
1506
|
"@platforma-sdk/package-builder",
|
|
1495
1507
|
"@milaboratories/ts-builder",
|
|
1496
1508
|
"@milaboratories/ts-configs"
|
|
1497
|
-
],
|
|
1498
|
-
for (let e of
|
|
1499
|
-
var
|
|
1509
|
+
], sr = "0.0.0-init-must-fetch";
|
|
1510
|
+
for (let e of or) if (!er(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.`);
|
|
1511
|
+
var cr = {
|
|
1500
1512
|
turbo: "~2.8.11",
|
|
1501
1513
|
shx: "~0.4.0",
|
|
1502
1514
|
"@changesets/cli": "~2.29.8",
|
|
1503
|
-
vitest: "~4.0.18"
|
|
1504
|
-
|
|
1515
|
+
vitest: "~4.0.18",
|
|
1516
|
+
typescript: "~5.9.3"
|
|
1517
|
+
}, lr = [{
|
|
1505
1518
|
entry: "vue",
|
|
1506
1519
|
of: "@platforma-sdk/ui-vue"
|
|
1507
1520
|
}, {
|
|
1508
1521
|
entry: "@milaboratories/helpers",
|
|
1509
1522
|
of: "@platforma-sdk/model"
|
|
1510
|
-
}],
|
|
1511
|
-
function
|
|
1523
|
+
}], ur = "@platforma-open/milaboratories.runenv-python-3", dr = "1.8.2";
|
|
1524
|
+
function fr(e) {
|
|
1512
1525
|
let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
|
|
1513
|
-
for (let e of
|
|
1514
|
-
return Object.assign(n,
|
|
1526
|
+
for (let e of or) n[e] = sr;
|
|
1527
|
+
return Object.assign(n, cr), e.modules.some((e) => e.scope === "software") && (n[ur] = dr), {
|
|
1515
1528
|
packages: t,
|
|
1516
1529
|
catalog: n
|
|
1517
1530
|
};
|
|
1518
1531
|
}
|
|
1519
|
-
function
|
|
1520
|
-
|
|
1521
|
-
for (let e of
|
|
1532
|
+
function pr() {
|
|
1533
|
+
Wt();
|
|
1534
|
+
for (let e of ir) Yt(e);
|
|
1522
1535
|
}
|
|
1523
1536
|
//#endregion
|
|
1524
1537
|
//#region src/structure/rules/root-gitignore.ts
|
|
1525
|
-
var
|
|
1538
|
+
var mr = [
|
|
1526
1539
|
".test_auth.json",
|
|
1527
1540
|
"node_modules/",
|
|
1528
1541
|
"dist/",
|
|
@@ -1537,47 +1550,78 @@ var ur = [
|
|
|
1537
1550
|
".vscode/sftp.json",
|
|
1538
1551
|
"test-dry-run.json"
|
|
1539
1552
|
];
|
|
1540
|
-
function
|
|
1541
|
-
|
|
1553
|
+
function hr() {
|
|
1554
|
+
Xt(mr);
|
|
1555
|
+
}
|
|
1556
|
+
//#endregion
|
|
1557
|
+
//#region src/structure/rules/root-changeset-config.ts
|
|
1558
|
+
var gr = "---\n---\n\nInitial release.\n", _r = "@changesets/cli/changelog", vr = "restricted", yr = "main", br = "patch", xr = [
|
|
1559
|
+
"$schema",
|
|
1560
|
+
"changelog",
|
|
1561
|
+
"commit",
|
|
1562
|
+
"fixed",
|
|
1563
|
+
"linked",
|
|
1564
|
+
"access",
|
|
1565
|
+
"baseBranch",
|
|
1566
|
+
"updateInternalDependencies",
|
|
1567
|
+
"ignore"
|
|
1568
|
+
];
|
|
1569
|
+
function Sr() {
|
|
1570
|
+
return {
|
|
1571
|
+
$schema: "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
1572
|
+
changelog: _r,
|
|
1573
|
+
commit: !1,
|
|
1574
|
+
fixed: [],
|
|
1575
|
+
linked: [],
|
|
1576
|
+
access: vr,
|
|
1577
|
+
baseBranch: yr,
|
|
1578
|
+
updateInternalDependencies: br,
|
|
1579
|
+
ignore: []
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
function Cr() {
|
|
1583
|
+
R("changelog", _r), R("commit", !1), R("access", vr), R("baseBranch", yr), R("updateInternalDependencies", br), W(xr);
|
|
1542
1584
|
}
|
|
1543
1585
|
//#endregion
|
|
1544
1586
|
//#region src/structure/rules/root.ts
|
|
1545
|
-
function
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
}),
|
|
1551
|
-
|
|
1552
|
-
}),
|
|
1553
|
-
|
|
1554
|
-
}),
|
|
1555
|
-
|
|
1556
|
-
})
|
|
1587
|
+
function wr() {
|
|
1588
|
+
C("root", () => {
|
|
1589
|
+
w(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1590
|
+
D("turbo.json", M(() => Un()), () => {
|
|
1591
|
+
Wn();
|
|
1592
|
+
}), E(".vscode/settings.json", A("root/.vscode/settings.json")), D("package.json", M(() => Rn()), () => {
|
|
1593
|
+
zn();
|
|
1594
|
+
}), D("pnpm-workspace.yaml", M((e) => fr(e)), () => {
|
|
1595
|
+
pr();
|
|
1596
|
+
}), D(".gitignore", A("root/.gitignore"), () => {
|
|
1597
|
+
hr();
|
|
1598
|
+
}), D(".changeset/config.json", M(() => Sr()), () => {
|
|
1599
|
+
Cr();
|
|
1600
|
+
}), O(".changeset/scaffold.md", tt(gr));
|
|
1557
1601
|
});
|
|
1558
1602
|
});
|
|
1559
1603
|
}
|
|
1560
1604
|
//#endregion
|
|
1561
1605
|
//#region src/structure/rules/root-ci.ts
|
|
1562
|
-
function
|
|
1606
|
+
function Tr(e) {
|
|
1563
1607
|
return e.split(/[-_]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
1564
1608
|
}
|
|
1565
|
-
function
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1609
|
+
function Er() {
|
|
1610
|
+
C("root", () => {
|
|
1611
|
+
w(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1612
|
+
E(".github/workflows/build.yaml", j("workflows/build.tpl.yaml", (e) => {
|
|
1569
1613
|
let t = e.blockVars.shortName;
|
|
1570
1614
|
return {
|
|
1571
|
-
appName: `Block: ${
|
|
1615
|
+
appName: `Block: ${Tr(t)}`,
|
|
1572
1616
|
appNameSlug: `block-${t}`
|
|
1573
1617
|
};
|
|
1574
|
-
})),
|
|
1618
|
+
})), E(".github/workflows/mark-stable.yaml", j("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${Tr(e.blockVars.shortName)} - Mark Stable` })));
|
|
1575
1619
|
});
|
|
1576
1620
|
});
|
|
1577
1621
|
}
|
|
1578
1622
|
//#endregion
|
|
1579
1623
|
//#region src/structure/rules/block-package-json.ts
|
|
1580
|
-
var
|
|
1624
|
+
var Dr = {
|
|
1581
1625
|
"@platforma-open": {
|
|
1582
1626
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1583
1627
|
serveUrl: "https://blocks.pl-open.science"
|
|
@@ -1586,45 +1630,45 @@ var hr = {
|
|
|
1586
1630
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1587
1631
|
serveUrl: "https://block.registry.platforma.bio/releases"
|
|
1588
1632
|
}
|
|
1589
|
-
},
|
|
1633
|
+
}, Or = {
|
|
1590
1634
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1591
1635
|
serveUrl: "https://blocks.pl-open.science"
|
|
1592
|
-
},
|
|
1636
|
+
}, kr = {
|
|
1593
1637
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/aux/dev/?region=eu-central-1",
|
|
1594
1638
|
serveUrl: "https://aux-blocks.pl-open.science"
|
|
1595
1639
|
};
|
|
1596
|
-
function
|
|
1597
|
-
let n = t ?
|
|
1640
|
+
function Ar(e, t) {
|
|
1641
|
+
let n = t ? kr : Dr[e] ?? Or;
|
|
1598
1642
|
return `block-tools publish -r ${n.s3} --registry-serve-url ${n.serveUrl}`;
|
|
1599
1643
|
}
|
|
1600
|
-
function
|
|
1644
|
+
function jr(e) {
|
|
1601
1645
|
let t = {};
|
|
1602
|
-
for (let n of
|
|
1603
|
-
for (let n of
|
|
1604
|
-
for (let n of
|
|
1646
|
+
for (let n of K(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
|
|
1647
|
+
for (let n of K(e, "model")) t.model = `${n.name}/dist/model.json`;
|
|
1648
|
+
for (let n of K(e, "ui")) t.ui = `${n.name}/dist`;
|
|
1605
1649
|
return t;
|
|
1606
1650
|
}
|
|
1607
|
-
function
|
|
1651
|
+
function Mr(e, t) {
|
|
1608
1652
|
return {
|
|
1609
1653
|
build: "ts-builder build --target block-facade && block-tools pack",
|
|
1610
1654
|
check: "ts-builder type-check --target block-facade",
|
|
1611
|
-
prepublishOnly:
|
|
1655
|
+
prepublishOnly: Ar(e, t),
|
|
1612
1656
|
"do-pack": "shx rm -f package.tgz && pnpm pack && shx mv *.tgz package.tgz"
|
|
1613
1657
|
};
|
|
1614
1658
|
}
|
|
1615
|
-
var
|
|
1659
|
+
var Nr = {
|
|
1616
1660
|
"@milaboratories/ts-builder": "sdk:",
|
|
1617
1661
|
"@milaboratories/ts-configs": "sdk:",
|
|
1618
1662
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1619
1663
|
"@platforma-sdk/model": "sdk:",
|
|
1620
1664
|
shx: "catalog:",
|
|
1621
1665
|
typescript: "catalog:"
|
|
1622
|
-
},
|
|
1666
|
+
}, Pr = { ".": {
|
|
1623
1667
|
sources: "./src/index.ts",
|
|
1624
1668
|
types: "./dist/index.d.ts",
|
|
1625
1669
|
default: "./dist/index.js"
|
|
1626
1670
|
} };
|
|
1627
|
-
function
|
|
1671
|
+
function Fr(e) {
|
|
1628
1672
|
if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
|
|
1629
1673
|
let t = e.meta, n = [
|
|
1630
1674
|
["block.meta.title", t.title],
|
|
@@ -1636,15 +1680,15 @@ function Cr(e) {
|
|
|
1636
1680
|
];
|
|
1637
1681
|
for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
|
|
1638
1682
|
}
|
|
1639
|
-
function
|
|
1683
|
+
function Ir(e) {
|
|
1640
1684
|
let t = e.blockVars, n = {
|
|
1641
|
-
...
|
|
1642
|
-
...
|
|
1643
|
-
...
|
|
1644
|
-
...
|
|
1645
|
-
...
|
|
1685
|
+
...Nr,
|
|
1686
|
+
...q(e, "model"),
|
|
1687
|
+
...q(e, "ui"),
|
|
1688
|
+
...q(e, "workflow"),
|
|
1689
|
+
...q(e, "kind")
|
|
1646
1690
|
}, r = {
|
|
1647
|
-
components:
|
|
1691
|
+
components: jr(e),
|
|
1648
1692
|
meta: {
|
|
1649
1693
|
title: t.shortName,
|
|
1650
1694
|
description: `${t.shortName} block`,
|
|
@@ -1656,55 +1700,56 @@ function wr(e) {
|
|
|
1656
1700
|
}
|
|
1657
1701
|
}
|
|
1658
1702
|
};
|
|
1659
|
-
return
|
|
1703
|
+
return Fr(r), {
|
|
1660
1704
|
name: `${t.facadeName}.block`,
|
|
1661
|
-
version:
|
|
1705
|
+
version: X,
|
|
1662
1706
|
type: "module",
|
|
1663
1707
|
files: ["dist", "block-pack"],
|
|
1664
1708
|
main: "./dist/index.js",
|
|
1665
1709
|
module: "./dist/index.js",
|
|
1666
1710
|
types: "./dist/index.d.ts",
|
|
1667
|
-
exports:
|
|
1668
|
-
scripts:
|
|
1711
|
+
exports: Pr,
|
|
1712
|
+
scripts: Mr(t.npmOrg, e.isSdkInternal),
|
|
1669
1713
|
dependencies: {},
|
|
1670
1714
|
devDependencies: n,
|
|
1671
1715
|
block: r
|
|
1672
1716
|
};
|
|
1673
1717
|
}
|
|
1674
|
-
function
|
|
1675
|
-
let t = e.blockVars, n =
|
|
1718
|
+
function Lr(e) {
|
|
1719
|
+
let t = e.blockVars, n = K(e, "kind");
|
|
1676
1720
|
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`);
|
|
1677
|
-
|
|
1678
|
-
let r =
|
|
1679
|
-
for (let [e, t] of Object.entries(r))
|
|
1680
|
-
|
|
1721
|
+
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", Pr);
|
|
1722
|
+
let r = Mr(t.npmOrg, e.isSdkInternal);
|
|
1723
|
+
for (let [e, t] of Object.entries(r)) z(e, t);
|
|
1724
|
+
B("mark-stable"), 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", jr(e)), At("version", "facade package.json must carry a 'version' (the facade publishes)"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1681
1725
|
}
|
|
1682
1726
|
//#endregion
|
|
1683
1727
|
//#region src/structure/rules/shared/pascal-case.ts
|
|
1684
|
-
function
|
|
1728
|
+
function Rr(e) {
|
|
1685
1729
|
let t = e.split(/[^A-Za-z0-9]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
|
|
1686
1730
|
return /^[0-9]/.test(t) ? `_${t}` : t;
|
|
1687
1731
|
}
|
|
1688
1732
|
//#endregion
|
|
1689
1733
|
//#region src/structure/rules/block.ts
|
|
1690
|
-
function
|
|
1691
|
-
|
|
1692
|
-
|
|
1734
|
+
function zr() {
|
|
1735
|
+
C("block", () => {
|
|
1736
|
+
k("index.js"), k("index.d.ts"), E("src/index.ts", j("block/src/index.tpl.ts", (e) => ({
|
|
1693
1737
|
facadeName: e.blockVars.facadeName,
|
|
1694
|
-
pascalName:
|
|
1695
|
-
}))),
|
|
1696
|
-
|
|
1738
|
+
pascalName: Rr(e.blockVars.shortName)
|
|
1739
|
+
}))), E("src/AGENTS.ts", A("block/src/AGENTS.ts")), $e("src/block-extra.ts", A("block/src/block-extra.ts")), $e("src/agents-extra.ts", A("block/src/agents-extra.ts")), E("tsconfig.json", A("block/tsconfig.json")), O("logos/block-logo.png", et("block/logos/block-logo.png")), O("logos/organization-logo.png", et("block/logos/organization-logo.png")), D("package.json", M((e) => Ir(e)), (e) => {
|
|
1740
|
+
Lr(e);
|
|
1697
1741
|
});
|
|
1698
1742
|
});
|
|
1699
1743
|
}
|
|
1700
1744
|
//#endregion
|
|
1701
1745
|
//#region src/structure/rules/shared/colocated-tests.ts
|
|
1702
|
-
var
|
|
1746
|
+
var Q = "src/**/*.test.ts";
|
|
1703
1747
|
//#endregion
|
|
1704
1748
|
//#region src/structure/rules/model-package-json.ts
|
|
1705
|
-
function
|
|
1749
|
+
function Br(e) {
|
|
1706
1750
|
return {
|
|
1707
1751
|
name: `${e.blockVars.facadeName}.model`,
|
|
1752
|
+
version: X,
|
|
1708
1753
|
private: !0,
|
|
1709
1754
|
type: "module",
|
|
1710
1755
|
main: "dist/index.cjs",
|
|
@@ -1726,7 +1771,7 @@ function Or(e) {
|
|
|
1726
1771
|
},
|
|
1727
1772
|
dependencies: {
|
|
1728
1773
|
"@platforma-sdk/model": "sdk:",
|
|
1729
|
-
...
|
|
1774
|
+
...q(e, "kind")
|
|
1730
1775
|
},
|
|
1731
1776
|
devDependencies: {
|
|
1732
1777
|
"@milaboratories/ts-builder": "sdk:",
|
|
@@ -1739,52 +1784,53 @@ function Or(e) {
|
|
|
1739
1784
|
}
|
|
1740
1785
|
};
|
|
1741
1786
|
}
|
|
1742
|
-
function
|
|
1743
|
-
|
|
1787
|
+
function Vr() {
|
|
1788
|
+
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", {
|
|
1744
1789
|
".": {
|
|
1745
1790
|
types: "./dist/index.d.ts",
|
|
1746
1791
|
sources: "./src/index.ts",
|
|
1747
1792
|
import: "./dist/index.js"
|
|
1748
1793
|
},
|
|
1749
1794
|
"./dist/*": "./dist/*"
|
|
1750
|
-
}),
|
|
1795
|
+
}), z("fmt", "ts-builder format"), z("watch", "ts-builder build --target block-model --watch"), z("build", "ts-builder build --target block-model && block-tools build-model"), z("check", "ts-builder check --target block-model"), Pt("@platforma-sdk/model", "sdk:"), Rt("kind"), U({
|
|
1751
1796
|
"@milaboratories/ts-builder": "sdk:",
|
|
1752
1797
|
"@milaboratories/ts-configs": "sdk:",
|
|
1753
1798
|
"@platforma-sdk/block-tools": "sdk:"
|
|
1754
|
-
}),
|
|
1799
|
+
}), It({
|
|
1755
1800
|
"@types/node": "*",
|
|
1756
1801
|
typescript: "*"
|
|
1757
|
-
}),
|
|
1758
|
-
|
|
1759
|
-
}, () =>
|
|
1802
|
+
}), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
|
|
1803
|
+
z("test", "vitest run --passWithNoTests"), V("vitest", "catalog:"), V("@types/node", "*");
|
|
1804
|
+
}, () => H("vitest"))), ar(), kt("tsup"), B("lint"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1760
1805
|
}
|
|
1761
1806
|
//#endregion
|
|
1762
1807
|
//#region src/structure/rules/model.ts
|
|
1763
|
-
function
|
|
1764
|
-
|
|
1765
|
-
T(
|
|
1766
|
-
|
|
1808
|
+
function Hr() {
|
|
1809
|
+
C("model", () => {
|
|
1810
|
+
w(T(Q), () => E("tsconfig.json", A("model/tsconfig.node.json")), () => E("tsconfig.json", A("model/tsconfig.json"))), E(".oxlintrc.json", A("model/.oxlintrc.json")), E(".oxfmtrc.json", A("model/.oxfmtrc.json")), O("src/index.ts", j("model/src/index.tpl.ts", (e) => ({ kindPkg: `${e.blockVars.facadeName}.kind` }))), D("package.json", M((e) => Br(e)), () => {
|
|
1811
|
+
Vr();
|
|
1767
1812
|
});
|
|
1768
1813
|
});
|
|
1769
1814
|
}
|
|
1770
1815
|
//#endregion
|
|
1771
1816
|
//#region src/structure/rules/kind-package-json.ts
|
|
1772
|
-
var
|
|
1817
|
+
var Ur = { ".": {
|
|
1773
1818
|
types: "./dist/index.d.ts",
|
|
1774
1819
|
sources: "./src/index.ts",
|
|
1775
1820
|
import: "./dist/index.js",
|
|
1776
1821
|
require: "./dist/index.cjs",
|
|
1777
1822
|
default: "./dist/index.js"
|
|
1778
1823
|
} };
|
|
1779
|
-
function
|
|
1824
|
+
function Wr(e) {
|
|
1780
1825
|
return {
|
|
1781
1826
|
name: `${e.blockVars.facadeName}.kind`,
|
|
1827
|
+
version: X,
|
|
1782
1828
|
private: !0,
|
|
1783
1829
|
type: "module",
|
|
1784
1830
|
main: "./dist/index.cjs",
|
|
1785
1831
|
module: "./dist/index.js",
|
|
1786
1832
|
types: "./dist/index.d.ts",
|
|
1787
|
-
exports:
|
|
1833
|
+
exports: Ur,
|
|
1788
1834
|
scripts: {
|
|
1789
1835
|
fmt: "ts-builder format",
|
|
1790
1836
|
watch: "ts-builder build --target block-kind --watch",
|
|
@@ -1803,30 +1849,31 @@ function Mr(e) {
|
|
|
1803
1849
|
}
|
|
1804
1850
|
};
|
|
1805
1851
|
}
|
|
1806
|
-
function
|
|
1807
|
-
|
|
1852
|
+
function Gr() {
|
|
1853
|
+
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", Ur), 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({
|
|
1808
1854
|
"@milaboratories/ts-builder": "sdk:",
|
|
1809
1855
|
"@milaboratories/ts-configs": "sdk:",
|
|
1810
1856
|
"@platforma-sdk/block-tools": "sdk:"
|
|
1811
|
-
}),
|
|
1857
|
+
}), It({
|
|
1812
1858
|
"@types/node": "*",
|
|
1813
1859
|
typescript: "*"
|
|
1814
|
-
}),
|
|
1860
|
+
}), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1815
1861
|
}
|
|
1816
1862
|
//#endregion
|
|
1817
1863
|
//#region src/structure/rules/kind.ts
|
|
1818
|
-
function
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1864
|
+
function Kr() {
|
|
1865
|
+
C("kind", () => {
|
|
1866
|
+
E("tsconfig.json", A("kind/tsconfig.json")), E(".oxlintrc.json", A("kind/.oxlintrc.json")), E(".oxfmtrc.json", A("kind/.oxfmtrc.json")), O("src/index.ts", A("kind/src/index.ts")), D("package.json", M((e) => Wr(e)), () => {
|
|
1867
|
+
Gr();
|
|
1822
1868
|
});
|
|
1823
1869
|
});
|
|
1824
1870
|
}
|
|
1825
1871
|
//#endregion
|
|
1826
1872
|
//#region src/structure/rules/ui-package-json.ts
|
|
1827
|
-
function
|
|
1873
|
+
function qr(e) {
|
|
1828
1874
|
return {
|
|
1829
1875
|
name: `${e.blockVars.facadeName}.ui`,
|
|
1876
|
+
version: X,
|
|
1830
1877
|
private: !0,
|
|
1831
1878
|
type: "module",
|
|
1832
1879
|
scripts: {
|
|
@@ -1839,7 +1886,7 @@ function Fr(e) {
|
|
|
1839
1886
|
dependencies: {
|
|
1840
1887
|
"@platforma-sdk/ui-vue": "sdk:",
|
|
1841
1888
|
vue: "catalog:",
|
|
1842
|
-
...
|
|
1889
|
+
...En(e, "model")
|
|
1843
1890
|
},
|
|
1844
1891
|
devDependencies: {
|
|
1845
1892
|
"@milaboratories/ts-builder": "sdk:",
|
|
@@ -1851,31 +1898,32 @@ function Fr(e) {
|
|
|
1851
1898
|
}
|
|
1852
1899
|
};
|
|
1853
1900
|
}
|
|
1854
|
-
function
|
|
1855
|
-
|
|
1901
|
+
function Jr() {
|
|
1902
|
+
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({
|
|
1856
1903
|
"@milaboratories/ts-builder": "sdk:",
|
|
1857
1904
|
"@milaboratories/ts-configs": "sdk:"
|
|
1858
|
-
}),
|
|
1905
|
+
}), ar(), B("preview"), B("lint"), It({
|
|
1859
1906
|
"@types/node": "*",
|
|
1860
1907
|
typescript: "*"
|
|
1861
|
-
}),
|
|
1862
|
-
|
|
1863
|
-
}, () =>
|
|
1908
|
+
}), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
|
|
1909
|
+
z("test", "vitest run --passWithNoTests"), V("vitest", "catalog:"), V("@types/node", "*");
|
|
1910
|
+
}, () => H("vitest"))), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1864
1911
|
}
|
|
1865
1912
|
//#endregion
|
|
1866
1913
|
//#region src/structure/rules/ui.ts
|
|
1867
|
-
function
|
|
1868
|
-
|
|
1869
|
-
T(
|
|
1870
|
-
|
|
1914
|
+
function Yr() {
|
|
1915
|
+
C("ui", () => {
|
|
1916
|
+
w(T(Q), () => E("tsconfig.json", A("ui/tsconfig.node.json")), () => E("tsconfig.json", A("ui/tsconfig.json"))), E(".oxlintrc.json", A("ui/.oxlintrc.json")), E(".oxfmtrc.json", A("ui/.oxfmtrc.json")), $e("index.html", A("ui/index.html")), O("src/main.ts", A("ui/src/main.ts")), O("src/app.ts", j("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), O("src/MainPage.vue", j("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), D("package.json", M((e) => qr(e)), () => {
|
|
1917
|
+
Jr();
|
|
1871
1918
|
});
|
|
1872
1919
|
});
|
|
1873
1920
|
}
|
|
1874
1921
|
//#endregion
|
|
1875
1922
|
//#region src/structure/rules/workflow-package-json.ts
|
|
1876
|
-
function
|
|
1923
|
+
function Xr(e) {
|
|
1877
1924
|
return {
|
|
1878
1925
|
name: `${e.blockVars.facadeName}.workflow`,
|
|
1926
|
+
version: X,
|
|
1879
1927
|
private: !0,
|
|
1880
1928
|
type: "module",
|
|
1881
1929
|
scripts: {
|
|
@@ -1885,7 +1933,7 @@ function Rr(e) {
|
|
|
1885
1933
|
},
|
|
1886
1934
|
dependencies: {
|
|
1887
1935
|
"@platforma-sdk/workflow-tengo": "sdk:",
|
|
1888
|
-
...
|
|
1936
|
+
...q(e, "software")
|
|
1889
1937
|
},
|
|
1890
1938
|
devDependencies: {
|
|
1891
1939
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
@@ -1894,33 +1942,34 @@ function Rr(e) {
|
|
|
1894
1942
|
}
|
|
1895
1943
|
};
|
|
1896
1944
|
}
|
|
1897
|
-
function
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
}, () =>
|
|
1945
|
+
function Zr() {
|
|
1946
|
+
Z(), R("private", !0), R("type", "module"), z("build", "shx rm -rf dist && pl-tengo build"), z("check", "pl-tengo check"), z("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
|
|
1947
|
+
z("test", "vitest run --passWithNoTests"), U({ vitest: "catalog:" });
|
|
1948
|
+
}, () => H("vitest"))), Pt("@platforma-sdk/workflow-tengo", "sdk:"), Rt("software"), U({
|
|
1901
1949
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1902
1950
|
"@platforma-sdk/test": "sdk:",
|
|
1903
1951
|
shx: "catalog:"
|
|
1904
|
-
}),
|
|
1952
|
+
}), ar(), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1905
1953
|
}
|
|
1906
1954
|
//#endregion
|
|
1907
1955
|
//#region src/structure/rules/workflow.ts
|
|
1908
|
-
function
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1956
|
+
function Qr() {
|
|
1957
|
+
C("workflow", () => {
|
|
1958
|
+
E("format.el", A("workflow/format.el")), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
|
|
1959
|
+
E("tsconfig.json", A("workflow/tsconfig.json")), $e("vitest.config.mts", A("workflow/vitest.config.mts"));
|
|
1912
1960
|
}, () => {
|
|
1913
|
-
|
|
1914
|
-
})),
|
|
1915
|
-
|
|
1961
|
+
k("tsconfig.json"), k("vitest.config.mts");
|
|
1962
|
+
})), k("index.js"), k("index.d.ts"), O("src/main.tpl.tengo", j("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), D("package.json", M((e) => Xr(e)), () => {
|
|
1963
|
+
Zr();
|
|
1916
1964
|
});
|
|
1917
1965
|
});
|
|
1918
1966
|
}
|
|
1919
1967
|
//#endregion
|
|
1920
1968
|
//#region src/structure/rules/test-package-json.ts
|
|
1921
|
-
function
|
|
1969
|
+
function $r(e) {
|
|
1922
1970
|
return {
|
|
1923
1971
|
name: `${e.blockVars.facadeName}.test`,
|
|
1972
|
+
version: X,
|
|
1924
1973
|
private: !0,
|
|
1925
1974
|
type: "module",
|
|
1926
1975
|
scripts: {
|
|
@@ -1937,27 +1986,27 @@ function Vr(e) {
|
|
|
1937
1986
|
}
|
|
1938
1987
|
};
|
|
1939
1988
|
}
|
|
1940
|
-
function
|
|
1941
|
-
|
|
1989
|
+
function ei() {
|
|
1990
|
+
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({
|
|
1942
1991
|
"@platforma-sdk/test": "sdk:",
|
|
1943
1992
|
"@milaboratories/ts-builder": "sdk:",
|
|
1944
1993
|
"@milaboratories/ts-configs": "sdk:",
|
|
1945
1994
|
vitest: "catalog:"
|
|
1946
|
-
}),
|
|
1995
|
+
}), It({ typescript: "*" }), H("@types/node"), ar(), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1947
1996
|
}
|
|
1948
1997
|
//#endregion
|
|
1949
1998
|
//#region src/structure/rules/test.ts
|
|
1950
|
-
function
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1999
|
+
function ti() {
|
|
2000
|
+
C("test", () => {
|
|
2001
|
+
E("tsconfig.json", A("test/tsconfig.json")), E(".oxlintrc.json", A("test/.oxlintrc.json")), E(".oxfmtrc.json", A("test/.oxfmtrc.json")), $e("vitest.config.mts", A("test/vitest.config.mts")), O("src/demo.test.ts", tt("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), D("package.json", M((e) => $r(e)), () => {
|
|
2002
|
+
ei();
|
|
1954
2003
|
});
|
|
1955
2004
|
});
|
|
1956
2005
|
}
|
|
1957
2006
|
//#endregion
|
|
1958
2007
|
//#region src/structure/rules/software-package-json.ts
|
|
1959
|
-
var
|
|
1960
|
-
function
|
|
2008
|
+
var ni = "block-tools software build", ri = "shx rm -f *.tgz && block-tools software build && pnpm pack && shx mv platforma-open*.tgz package.tgz";
|
|
2009
|
+
function ii() {
|
|
1961
2010
|
return { entrypoints: { main: { binary: {
|
|
1962
2011
|
artifact: {
|
|
1963
2012
|
type: "python",
|
|
@@ -1972,65 +2021,66 @@ function Kr() {
|
|
|
1972
2021
|
cmd: ["python", "{pkg}/main.py"]
|
|
1973
2022
|
} } } };
|
|
1974
2023
|
}
|
|
1975
|
-
function
|
|
2024
|
+
function ai(e) {
|
|
1976
2025
|
return {
|
|
1977
2026
|
name: `${e.blockVars.facadeName}.software`,
|
|
2027
|
+
version: X,
|
|
1978
2028
|
type: "module",
|
|
1979
2029
|
description: "Block Software",
|
|
1980
2030
|
files: ["./dist/**/*"],
|
|
1981
2031
|
scripts: {
|
|
1982
|
-
build:
|
|
1983
|
-
"do-pack":
|
|
2032
|
+
build: ni,
|
|
2033
|
+
"do-pack": ri,
|
|
1984
2034
|
changeset: "changeset",
|
|
1985
2035
|
"version-packages": "changeset version"
|
|
1986
2036
|
},
|
|
1987
|
-
"block-software":
|
|
2037
|
+
"block-software": ii(),
|
|
1988
2038
|
devDependencies: {
|
|
1989
2039
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
1990
2040
|
"@platforma-sdk/block-tools": "sdk:"
|
|
1991
2041
|
}
|
|
1992
2042
|
};
|
|
1993
2043
|
}
|
|
1994
|
-
function
|
|
1995
|
-
|
|
2044
|
+
function oi() {
|
|
2045
|
+
kt("private"), Z(), R("type", "module"), R("files", ["./dist/**/*"]), z("build", ni), z("do-pack", ri), 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]);
|
|
1996
2046
|
}
|
|
1997
2047
|
//#endregion
|
|
1998
2048
|
//#region src/structure/rules/software.ts
|
|
1999
|
-
var
|
|
2000
|
-
function
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2049
|
+
var si = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", ci = "# No dependencies specified for this script\n";
|
|
2050
|
+
function li() {
|
|
2051
|
+
C("software", () => {
|
|
2052
|
+
O("src/main.py", tt(si)), O("src/requirements.txt", tt(ci)), D("package.json", M((e) => ai(e)), () => {
|
|
2053
|
+
oi();
|
|
2004
2054
|
});
|
|
2005
2055
|
});
|
|
2006
2056
|
}
|
|
2007
|
-
function
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
}),
|
|
2011
|
-
|
|
2012
|
-
}),
|
|
2013
|
-
|
|
2014
|
-
}),
|
|
2015
|
-
|
|
2016
|
-
|
|
2057
|
+
function ui() {
|
|
2058
|
+
C("model", () => {
|
|
2059
|
+
k("eslint.config.mjs"), k("vite.config.mts");
|
|
2060
|
+
}), C("ui", () => {
|
|
2061
|
+
k("eslint.config.mjs"), k("vite.config.ts"), k("tsconfig.app.json"), k("tsconfig.node.json");
|
|
2062
|
+
}), C("test", () => {
|
|
2063
|
+
k("eslint.config.mjs");
|
|
2064
|
+
}), C("root", () => {
|
|
2065
|
+
k(".prettierrc"), D("package.json", M(() => Rn()), () => {
|
|
2066
|
+
B("pretty"), H("@platforma-sdk/blocks-deps-updater");
|
|
2017
2067
|
});
|
|
2018
2068
|
});
|
|
2019
2069
|
}
|
|
2020
2070
|
//#endregion
|
|
2021
2071
|
//#region src/structure/rules/root-catalog-bump.ts
|
|
2022
|
-
function
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
for (let e of
|
|
2028
|
-
for (let e of
|
|
2072
|
+
function di() {
|
|
2073
|
+
Qe(() => {
|
|
2074
|
+
C("root", () => {
|
|
2075
|
+
w(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
2076
|
+
D("pnpm-workspace.yaml", M((e) => fr(e)), (e) => {
|
|
2077
|
+
for (let e of or) qt(e);
|
|
2078
|
+
for (let e of lr) Jt(e.entry, {
|
|
2029
2079
|
of: e.of,
|
|
2030
2080
|
ofVersion: e.ofVersion
|
|
2031
2081
|
});
|
|
2032
|
-
for (let [e, t] of Object.entries(
|
|
2033
|
-
e.modules.some((e) => e.scope === "software") &&
|
|
2082
|
+
for (let [e, t] of Object.entries(cr)) Kt(e, t);
|
|
2083
|
+
e.modules.some((e) => e.scope === "software") && Kt(ur, dr);
|
|
2034
2084
|
});
|
|
2035
2085
|
});
|
|
2036
2086
|
});
|
|
@@ -2038,25 +2088,25 @@ function $r() {
|
|
|
2038
2088
|
}
|
|
2039
2089
|
//#endregion
|
|
2040
2090
|
//#region src/structure/structure-definition.ts
|
|
2041
|
-
var
|
|
2042
|
-
|
|
2091
|
+
var fi = Ge(() => {
|
|
2092
|
+
wr(), Er(), zr(), Hr(), Kr(), Yr(), Qr(), ti(), li(), ui(), di();
|
|
2043
2093
|
});
|
|
2044
2094
|
//#endregion
|
|
2045
2095
|
//#region src/structure/cli/run-structure.ts
|
|
2046
|
-
async function
|
|
2047
|
-
return
|
|
2096
|
+
async function pi() {
|
|
2097
|
+
return tr(or.filter(er));
|
|
2048
2098
|
}
|
|
2049
|
-
async function
|
|
2050
|
-
let t =
|
|
2099
|
+
async function mi(e) {
|
|
2100
|
+
let t = g.resolve(e.blockPath), n = e.mode === "check", r = new ke(t), i = new Ae(e.templatesRoot), a = vn(fi, r, Fn({
|
|
2051
2101
|
fs: r,
|
|
2052
2102
|
isSdkInternal: e.isSdkInternal,
|
|
2053
2103
|
updateDepsOnly: e.updateDepsOnly,
|
|
2054
2104
|
dryRun: n
|
|
2055
2105
|
}), {
|
|
2056
2106
|
templates: i,
|
|
2057
|
-
registryLookup: e.updateDepsOnly ? await
|
|
2058
|
-
derivedPinLookup: e.updateDepsOnly ? await
|
|
2059
|
-
rediscover: () =>
|
|
2107
|
+
registryLookup: e.updateDepsOnly ? await pi() : void 0,
|
|
2108
|
+
derivedPinLookup: e.updateDepsOnly ? await rr(lr) : void 0,
|
|
2109
|
+
rediscover: () => Fn({
|
|
2060
2110
|
fs: r,
|
|
2061
2111
|
isSdkInternal: e.isSdkInternal,
|
|
2062
2112
|
updateDepsOnly: !1,
|
|
@@ -2068,16 +2118,16 @@ async function ni(e) {
|
|
|
2068
2118
|
changes: a.changes
|
|
2069
2119
|
};
|
|
2070
2120
|
}
|
|
2071
|
-
function
|
|
2121
|
+
function hi(e, t) {
|
|
2072
2122
|
if (t.length === 0) return ` ${e}: up to date (0 changes)`;
|
|
2073
2123
|
let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
|
|
2074
2124
|
return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
|
|
2075
2125
|
}
|
|
2076
2126
|
//#endregion
|
|
2077
2127
|
//#region src/cmd/structure/refresh.ts
|
|
2078
|
-
async function
|
|
2128
|
+
async function gi(e) {
|
|
2079
2129
|
for (let t of e.paths) {
|
|
2080
|
-
let n = await
|
|
2130
|
+
let n = await mi({
|
|
2081
2131
|
blockPath: t,
|
|
2082
2132
|
isSdkInternal: e.isSdkInternal,
|
|
2083
2133
|
updateDepsOnly: e.updateDepsOnly,
|
|
@@ -2085,43 +2135,43 @@ async function ii(e) {
|
|
|
2085
2135
|
templatesRoot: e.templatesRoot,
|
|
2086
2136
|
log: (t) => e.logger.info(t)
|
|
2087
2137
|
});
|
|
2088
|
-
e.logger.info(
|
|
2138
|
+
e.logger.info(hi(t, n.changes));
|
|
2089
2139
|
}
|
|
2090
2140
|
}
|
|
2091
|
-
function
|
|
2092
|
-
let t = new
|
|
2141
|
+
function _i(e) {
|
|
2142
|
+
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).");
|
|
2093
2143
|
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) => {
|
|
2094
|
-
let r = t.length > 0 ? t : ["."], i =
|
|
2095
|
-
await
|
|
2144
|
+
let r = t.length > 0 ? t : ["."], i = g.join(e, "src", "structure", "templates");
|
|
2145
|
+
await gi({
|
|
2096
2146
|
paths: r,
|
|
2097
2147
|
isSdkInternal: !!n.sdkInternal,
|
|
2098
2148
|
updateDepsOnly: !!n.updateDepsOnly,
|
|
2099
2149
|
templatesRoot: i,
|
|
2100
|
-
logger: new
|
|
2150
|
+
logger: new b()
|
|
2101
2151
|
});
|
|
2102
2152
|
}), t;
|
|
2103
2153
|
}
|
|
2104
2154
|
//#endregion
|
|
2105
2155
|
//#region src/cmd/update-deps.ts
|
|
2106
|
-
function
|
|
2107
|
-
let t = new
|
|
2156
|
+
function vi(e) {
|
|
2157
|
+
let t = new m("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
|
|
2108
2158
|
return t.action(async () => {
|
|
2109
|
-
let t = new
|
|
2110
|
-
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
|
|
2159
|
+
let t = new b();
|
|
2160
|
+
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 gi({
|
|
2111
2161
|
paths: ["."],
|
|
2112
2162
|
isSdkInternal: !1,
|
|
2113
2163
|
updateDepsOnly: !0,
|
|
2114
|
-
templatesRoot:
|
|
2164
|
+
templatesRoot: g.join(e, "src", "structure", "templates"),
|
|
2115
2165
|
logger: t
|
|
2116
2166
|
});
|
|
2117
2167
|
}), t;
|
|
2118
2168
|
}
|
|
2119
2169
|
//#endregion
|
|
2120
2170
|
//#region src/cmd/list-overview-snapshots.ts
|
|
2121
|
-
function
|
|
2122
|
-
let e = new
|
|
2123
|
-
return e.addOption(new
|
|
2124
|
-
let t = new
|
|
2171
|
+
function yi() {
|
|
2172
|
+
let e = new m("list-overview-snapshots").description("List all available global overview snapshots in the registry");
|
|
2173
|
+
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) => {
|
|
2174
|
+
let t = new b(), n = await new ee(l(e.registry), t).listGlobalOverviewSnapshots();
|
|
2125
2175
|
if (e.json) t.info(JSON.stringify(n, null, 2));
|
|
2126
2176
|
else if (n.length === 0) t.info("No snapshots found.");
|
|
2127
2177
|
else {
|
|
@@ -2132,10 +2182,10 @@ function si() {
|
|
|
2132
2182
|
}
|
|
2133
2183
|
//#endregion
|
|
2134
2184
|
//#region src/cmd/restore-overview-from-snapshot.ts
|
|
2135
|
-
function
|
|
2136
|
-
let e = new
|
|
2137
|
-
return e.addOption(new
|
|
2138
|
-
let t = new
|
|
2185
|
+
function bi() {
|
|
2186
|
+
let e = new m("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
|
|
2187
|
+
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) => {
|
|
2188
|
+
let t = new b(), n = new ee(l(e.registry), t), r = await n.listGlobalOverviewSnapshots();
|
|
2139
2189
|
if (!r.find((t) => t.timestamp === e.snapshot)) throw Error(`Snapshot '${e.snapshot}' not found. Available snapshots:\n${r.map((e) => ` - ${e.timestamp}`).join("\n") || " (none)"}`);
|
|
2140
2190
|
if (!e.skipConfirmation) {
|
|
2141
2191
|
let n = (await import("node:readline")).createInterface({
|
|
@@ -2158,7 +2208,7 @@ function ci() {
|
|
|
2158
2208
|
}
|
|
2159
2209
|
//#endregion
|
|
2160
2210
|
//#region src/registry_v1/flags.ts
|
|
2161
|
-
function
|
|
2211
|
+
function xi(e) {
|
|
2162
2212
|
let t = e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);
|
|
2163
2213
|
if (t) {
|
|
2164
2214
|
let { src: e, destName: n } = t.groups;
|
|
@@ -2168,33 +2218,33 @@ function li(e) {
|
|
|
2168
2218
|
};
|
|
2169
2219
|
} else return {
|
|
2170
2220
|
src: e,
|
|
2171
|
-
destName:
|
|
2221
|
+
destName: g.basename(e)
|
|
2172
2222
|
};
|
|
2173
2223
|
}
|
|
2174
|
-
function
|
|
2175
|
-
return new
|
|
2224
|
+
function Si(e, t) {
|
|
2225
|
+
return new h(e, t).argParser((e, t) => [...t ?? [], xi(e)]).default([]);
|
|
2176
2226
|
}
|
|
2177
2227
|
//#endregion
|
|
2178
2228
|
//#region src/cmd/upload-package-v1.ts
|
|
2179
|
-
var
|
|
2229
|
+
var Ci = [
|
|
2180
2230
|
"registry",
|
|
2181
2231
|
"organization",
|
|
2182
2232
|
"package",
|
|
2183
2233
|
"version"
|
|
2184
2234
|
];
|
|
2185
|
-
function
|
|
2186
|
-
let e = new
|
|
2187
|
-
return e.addOption(new
|
|
2188
|
-
let t = new
|
|
2189
|
-
for (let t of
|
|
2190
|
-
e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await
|
|
2235
|
+
function wi() {
|
|
2236
|
+
let e = new m("upload-package-v1").description("Uploads V1 package and refreshes the registry");
|
|
2237
|
+
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(Si("-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) => {
|
|
2238
|
+
let t = new b(), n = f.parse({});
|
|
2239
|
+
for (let t of Ci) e[t] && (n[t] = e[t]);
|
|
2240
|
+
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" }))));
|
|
2191
2241
|
for (let t of e.file) n.files[t.destName] = t.src;
|
|
2192
2242
|
let r = await d(n);
|
|
2193
|
-
t.info(
|
|
2243
|
+
t.info(ce.stringify(r.conf));
|
|
2194
2244
|
let i = r.createRegistry(t), a = r.fullPackageName, o = i.constructNewPackage(a);
|
|
2195
2245
|
for (let [e, n] of Object.entries(r.conf.files)) {
|
|
2196
2246
|
t.info(`Uploading ${n} -> ${e} ...`);
|
|
2197
|
-
let r = await
|
|
2247
|
+
let r = await _.promises.readFile(n);
|
|
2198
2248
|
await o.addFile(e, r);
|
|
2199
2249
|
}
|
|
2200
2250
|
t.info("Uploading meta information..."), await o.writeMeta(r.conf.meta), await o.finish(), e.refresh && await i.updateIfNeeded();
|
|
@@ -2202,12 +2252,12 @@ function fi() {
|
|
|
2202
2252
|
}
|
|
2203
2253
|
//#endregion
|
|
2204
2254
|
//#region src/cmd/structure/check.ts
|
|
2205
|
-
function
|
|
2206
|
-
let t = new
|
|
2255
|
+
function Ti(e) {
|
|
2256
|
+
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.");
|
|
2207
2257
|
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) => {
|
|
2208
|
-
let r = new
|
|
2258
|
+
let r = new b(), i = t.length > 0 ? t : ["."], a = g.join(e, "src", "structure", "templates"), o = !1;
|
|
2209
2259
|
for (let e of i) {
|
|
2210
|
-
let t = await
|
|
2260
|
+
let t = await mi({
|
|
2211
2261
|
blockPath: e,
|
|
2212
2262
|
isSdkInternal: !!n.sdkInternal,
|
|
2213
2263
|
updateDepsOnly: !1,
|
|
@@ -2215,41 +2265,41 @@ function pi(e) {
|
|
|
2215
2265
|
templatesRoot: a,
|
|
2216
2266
|
log: (e) => r.info(e)
|
|
2217
2267
|
});
|
|
2218
|
-
r.info(
|
|
2268
|
+
r.info(hi(e, t.changes)), t.changes.length > 0 && (o = !0);
|
|
2219
2269
|
}
|
|
2220
2270
|
if (o) throw Error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.");
|
|
2221
2271
|
}), t;
|
|
2222
2272
|
}
|
|
2223
2273
|
//#endregion
|
|
2224
2274
|
//#region src/structure/init-block-constructor.ts
|
|
2225
|
-
var
|
|
2275
|
+
var $ = ["python"], Ei = class extends Error {
|
|
2226
2276
|
constructor(e) {
|
|
2227
2277
|
super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
|
|
2228
2278
|
}
|
|
2229
2279
|
};
|
|
2230
|
-
async function
|
|
2280
|
+
async function Di(e, t, n, r) {
|
|
2231
2281
|
if (e !== void 0 && e !== "") return e;
|
|
2232
|
-
if (n) throw new
|
|
2282
|
+
if (n) throw new Ei(t);
|
|
2233
2283
|
return r();
|
|
2234
2284
|
}
|
|
2235
|
-
async function
|
|
2236
|
-
let t = await
|
|
2285
|
+
async function Oi(e) {
|
|
2286
|
+
let t = await Di(e.npmOrg, "npm-org", e.nonInteractive, () => he({
|
|
2237
2287
|
message: "npm org (e.g. @platforma-open):",
|
|
2238
2288
|
default: "@platforma-open"
|
|
2239
|
-
})), n = await
|
|
2240
|
-
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await
|
|
2289
|
+
})), n = await Di(e.orgScope, "org-scope", e.nonInteractive, () => he({ message: "org scope (e.g. my-org):" })), r = await Di(e.shortName, "short-name", e.nonInteractive, () => he({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
|
|
2290
|
+
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await me({
|
|
2241
2291
|
message: "Include a software module?",
|
|
2242
2292
|
default: !1
|
|
2243
2293
|
}) : e.withSoftware;
|
|
2244
2294
|
let a;
|
|
2245
2295
|
if (i) {
|
|
2246
|
-
if (a = await
|
|
2296
|
+
if (a = await Di(e.platform, "platform", e.nonInteractive, () => ge({
|
|
2247
2297
|
message: "Software platform:",
|
|
2248
|
-
choices:
|
|
2298
|
+
choices: $.map((e) => ({
|
|
2249
2299
|
name: e,
|
|
2250
2300
|
value: e
|
|
2251
2301
|
}))
|
|
2252
|
-
})),
|
|
2302
|
+
})), !$.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${$.join(", ")} ${$.length === 1 ? "is" : "are"} supported at v1.`);
|
|
2253
2303
|
} else if (e.platform) throw Error("--platform was given but software is disabled (--no-software).");
|
|
2254
2304
|
return {
|
|
2255
2305
|
facadeName: `${t}/${n}.${r}`,
|
|
@@ -2260,20 +2310,20 @@ async function _i(e) {
|
|
|
2260
2310
|
softwarePlatform: a
|
|
2261
2311
|
};
|
|
2262
2312
|
}
|
|
2263
|
-
async function
|
|
2264
|
-
let t = e.vars, n =
|
|
2313
|
+
async function ki(e) {
|
|
2314
|
+
let t = e.vars, n = Dn(t), r = new ke(e.blockPath), i = new Ae(e.templatesRoot), a = On({
|
|
2265
2315
|
blockVars: t,
|
|
2266
2316
|
modules: n,
|
|
2267
2317
|
isSdkInternal: !1,
|
|
2268
2318
|
version: 2,
|
|
2269
2319
|
dryRun: !1
|
|
2270
|
-
}), o =
|
|
2320
|
+
}), o = or.filter(er), s, c;
|
|
2271
2321
|
try {
|
|
2272
|
-
s = await
|
|
2322
|
+
s = await tr(o), c = await rr(lr);
|
|
2273
2323
|
} catch (e) {
|
|
2274
2324
|
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)}`);
|
|
2275
2325
|
}
|
|
2276
|
-
return
|
|
2326
|
+
return vn(fi, r, a, {
|
|
2277
2327
|
templates: i,
|
|
2278
2328
|
initMode: !0,
|
|
2279
2329
|
registryLookup: s,
|
|
@@ -2282,12 +2332,12 @@ async function vi(e) {
|
|
|
2282
2332
|
}
|
|
2283
2333
|
//#endregion
|
|
2284
2334
|
//#region src/cmd/structure/init.ts
|
|
2285
|
-
function
|
|
2286
|
-
let t = new
|
|
2287
|
-
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
|
|
2288
|
-
let r = new
|
|
2335
|
+
function Ai(e) {
|
|
2336
|
+
let t = new m("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
|
|
2337
|
+
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) => {
|
|
2338
|
+
let r = new b(), i = n.withSoftware === !0, a = n.software === !1;
|
|
2289
2339
|
if (i && a) throw Error("--with-software and --no-software are mutually exclusive.");
|
|
2290
|
-
let o = i ? !0 : a ? !1 : void 0, s = await
|
|
2340
|
+
let o = i ? !0 : a ? !1 : void 0, s = await Oi({
|
|
2291
2341
|
npmOrg: n.npmOrg,
|
|
2292
2342
|
orgScope: n.orgScope,
|
|
2293
2343
|
shortName: n.shortName,
|
|
@@ -2295,25 +2345,25 @@ function yi(e) {
|
|
|
2295
2345
|
platform: n.platform,
|
|
2296
2346
|
nonInteractive: n.nonInteractive
|
|
2297
2347
|
});
|
|
2298
|
-
await
|
|
2348
|
+
await ki({
|
|
2299
2349
|
vars: s,
|
|
2300
|
-
blockPath: t ?
|
|
2301
|
-
templatesRoot:
|
|
2350
|
+
blockPath: t ? g.resolve(t) : g.resolve(process.cwd(), s.shortName),
|
|
2351
|
+
templatesRoot: g.join(e, "src", "structure", "templates"),
|
|
2302
2352
|
log: (e) => r.info(e)
|
|
2303
2353
|
});
|
|
2304
2354
|
}), t;
|
|
2305
2355
|
}
|
|
2306
2356
|
//#endregion
|
|
2307
2357
|
//#region src/cmd/software/knobs.ts
|
|
2308
|
-
var
|
|
2358
|
+
var ji = ["dev", "release"], Mi = [
|
|
2309
2359
|
"docker",
|
|
2310
2360
|
"binary",
|
|
2311
2361
|
"all",
|
|
2312
2362
|
"none"
|
|
2313
|
-
],
|
|
2314
|
-
function
|
|
2363
|
+
], Ni = ["local", "remote"];
|
|
2364
|
+
function Pi(e) {
|
|
2315
2365
|
if (e.usePublished) {
|
|
2316
|
-
if (e.variant === "docker" || e.variant === "all") throw
|
|
2366
|
+
if (e.variant === "docker" || e.variant === "all") throw y.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);
|
|
2317
2367
|
return { kind: "binary-existing" };
|
|
2318
2368
|
}
|
|
2319
2369
|
return e.variant === "none" ? { kind: "no-software" } : e.location === void 0 ? { kind: "bare" } : {
|
|
@@ -2325,33 +2375,33 @@ function Ci(e) {
|
|
|
2325
2375
|
}
|
|
2326
2376
|
//#endregion
|
|
2327
2377
|
//#region src/cmd/software/ecr-login.ts
|
|
2328
|
-
var
|
|
2329
|
-
function
|
|
2378
|
+
var Fi = "public.ecr.aws", Ii = "us-east-1";
|
|
2379
|
+
function Li(e) {
|
|
2330
2380
|
if (process.env.AWS_ACCESS_KEY_ID || process.env.AWS_PROFILE) return;
|
|
2331
|
-
let t = process.env.PL_AWS_PROFILE ??
|
|
2381
|
+
let t = process.env.PL_AWS_PROFILE ?? se.AWS_DEV_PROFILE;
|
|
2332
2382
|
process.env.AWS_PROFILE = t, e?.debug(`Using AWS profile '${t}' for dev push credentials`);
|
|
2333
2383
|
}
|
|
2334
|
-
function
|
|
2384
|
+
function Ri(e) {
|
|
2335
2385
|
return new URL(`https://${e}`).hostname;
|
|
2336
2386
|
}
|
|
2337
|
-
function
|
|
2338
|
-
return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ??
|
|
2387
|
+
function zi() {
|
|
2388
|
+
return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ?? se.AWS_DEV_PROFILE}`;
|
|
2339
2389
|
}
|
|
2340
|
-
async function
|
|
2341
|
-
let n =
|
|
2342
|
-
if (n !==
|
|
2390
|
+
async function Bi(e, t) {
|
|
2391
|
+
let n = Ri(e);
|
|
2392
|
+
if (n !== Fi) throw y.CLIError(`automatic docker login is only supported for '${Fi}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);
|
|
2343
2393
|
t?.info(`Logging in to ECR registry '${n}'...`);
|
|
2344
2394
|
let r, i;
|
|
2345
2395
|
try {
|
|
2346
|
-
let e = (await new
|
|
2396
|
+
let e = (await new ve({ region: Ii }).send(new ye({}))).authorizationData?.authorizationToken;
|
|
2347
2397
|
if (!e) throw Error("empty authorization token");
|
|
2348
2398
|
let t = Buffer.from(e, "base64").toString("utf8"), n = t.indexOf(":");
|
|
2349
2399
|
if (n < 0) throw Error("malformed authorization token (no ':' separator)");
|
|
2350
2400
|
r = t.slice(0, n), i = t.slice(n + 1);
|
|
2351
2401
|
} catch (e) {
|
|
2352
|
-
throw
|
|
2402
|
+
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` + zi());
|
|
2353
2403
|
}
|
|
2354
|
-
let a =
|
|
2404
|
+
let a = _e("docker", [
|
|
2355
2405
|
"login",
|
|
2356
2406
|
"--username",
|
|
2357
2407
|
r,
|
|
@@ -2366,16 +2416,16 @@ async function ki(e, t) {
|
|
|
2366
2416
|
],
|
|
2367
2417
|
env: {
|
|
2368
2418
|
...process.env,
|
|
2369
|
-
HOME: process.env.HOME ||
|
|
2419
|
+
HOME: process.env.HOME || pe.homedir()
|
|
2370
2420
|
}
|
|
2371
2421
|
});
|
|
2372
|
-
if (a.error || a.status !== 0) throw
|
|
2422
|
+
if (a.error || a.status !== 0) throw y.CLIError(`'docker login ${n}' failed`);
|
|
2373
2423
|
}
|
|
2374
2424
|
//#endregion
|
|
2375
2425
|
//#region src/cmd/software/run-build.ts
|
|
2376
|
-
async function
|
|
2426
|
+
async function Vi(e) {
|
|
2377
2427
|
let { core: t, scenario: n, options: r = {}, logger: i } = e, a = r.ids;
|
|
2378
|
-
t.buildMode =
|
|
2428
|
+
t.buildMode = Hi(n);
|
|
2379
2429
|
let o = () => t.buildSoftwareArchives({
|
|
2380
2430
|
ids: a,
|
|
2381
2431
|
forceBuild: !!r.force,
|
|
@@ -2392,99 +2442,99 @@ async function Ai(e) {
|
|
|
2392
2442
|
r.buildDocker && t.buildDockerImages({
|
|
2393
2443
|
ids: a,
|
|
2394
2444
|
registry: r.dockerRegistry,
|
|
2395
|
-
strictPlatformMatching:
|
|
2445
|
+
strictPlatformMatching: v.isCI()
|
|
2396
2446
|
}), await o(), r.pushDocker && t.publishDockerImages({
|
|
2397
2447
|
ids: a,
|
|
2398
2448
|
pushTo: r.dockerPushTo,
|
|
2399
|
-
strictPlatformMatching:
|
|
2449
|
+
strictPlatformMatching: v.isCI()
|
|
2400
2450
|
});
|
|
2401
2451
|
break;
|
|
2402
2452
|
case "target": {
|
|
2403
|
-
let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f =
|
|
2453
|
+
let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f = Gi(e, r);
|
|
2404
2454
|
l && t.buildDockerImages({
|
|
2405
2455
|
ids: a,
|
|
2406
2456
|
registry: f.pull,
|
|
2407
|
-
strictPlatformMatching:
|
|
2408
|
-
}), u && await o(), d && e === "dev" && (l || u) &&
|
|
2457
|
+
strictPlatformMatching: v.isCI()
|
|
2458
|
+
}), u && await o(), d && e === "dev" && (l || u) && Li(i), l && d && (f.autoLogin && f.push && await Bi(f.push, i), t.publishDockerImages({
|
|
2409
2459
|
ids: a,
|
|
2410
2460
|
pushTo: f.push,
|
|
2411
|
-
strictPlatformMatching:
|
|
2461
|
+
strictPlatformMatching: v.isCI()
|
|
2412
2462
|
})), u && d && await t.publishPackages({
|
|
2413
2463
|
ids: a,
|
|
2414
2464
|
storageURL: r.storageUrl
|
|
2415
2465
|
});
|
|
2416
2466
|
break;
|
|
2417
2467
|
}
|
|
2418
|
-
default:
|
|
2468
|
+
default: y.assertNever(n);
|
|
2419
2469
|
}
|
|
2420
2470
|
t.buildSwJsonFiles({
|
|
2421
2471
|
packageIds: a,
|
|
2422
2472
|
noSoftware: n.kind === "no-software"
|
|
2423
2473
|
});
|
|
2424
2474
|
}
|
|
2425
|
-
function
|
|
2475
|
+
function Hi(e) {
|
|
2426
2476
|
return e.kind !== "target" || e.channel === "release" ? "release" : e.variant !== "docker" && e.location === "remote" ? "dev-remote" : "dev-local";
|
|
2427
2477
|
}
|
|
2428
|
-
function
|
|
2478
|
+
function Ui(e) {
|
|
2429
2479
|
if (!e.includes("://")) return e;
|
|
2430
2480
|
let t = new URL(e);
|
|
2431
2481
|
return t.host + t.pathname;
|
|
2432
2482
|
}
|
|
2433
|
-
function
|
|
2483
|
+
function Wi(e) {
|
|
2434
2484
|
return {
|
|
2435
|
-
registry:
|
|
2485
|
+
registry: Ui(e),
|
|
2436
2486
|
autoLogin: e.startsWith("ecr://")
|
|
2437
2487
|
};
|
|
2438
2488
|
}
|
|
2439
|
-
function
|
|
2440
|
-
let n = e === "dev", r = process.env[n ?
|
|
2489
|
+
function Gi(e, t) {
|
|
2490
|
+
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 ? Wi(a) : {
|
|
2441
2491
|
registry: void 0,
|
|
2442
2492
|
autoLogin: !1
|
|
2443
|
-
}, s = t.dockerRegistry ?? i ?? (n ? a :
|
|
2493
|
+
}, s = t.dockerRegistry ?? i ?? (n ? a : se.DOCKER_REGISTRY);
|
|
2444
2494
|
return {
|
|
2445
|
-
pull: s ?
|
|
2495
|
+
pull: s ? Ui(s) : void 0,
|
|
2446
2496
|
push: o.registry,
|
|
2447
2497
|
autoLogin: o.autoLogin
|
|
2448
2498
|
};
|
|
2449
2499
|
}
|
|
2450
2500
|
//#endregion
|
|
2451
2501
|
//#region src/cmd/software/env.ts
|
|
2452
|
-
var
|
|
2453
|
-
|
|
2502
|
+
var Ki = "PL_BUILD_CHANNEL", qi = "PL_BUILD_VARIANT", Ji = "PL_BUILD_LOCATION", Yi = "PL_BUILD_USE_PUBLISHED";
|
|
2503
|
+
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;
|
|
2454
2504
|
//#endregion
|
|
2455
2505
|
//#region src/cmd/software/build.ts
|
|
2456
|
-
function
|
|
2457
|
-
let e = new
|
|
2458
|
-
return e.addOption(new
|
|
2506
|
+
function Xi() {
|
|
2507
|
+
let e = new m("build").description("Build a software module for a target and write its .sw.json descriptor (build + push in one pass)");
|
|
2508
|
+
return e.addOption(new h("--channel <channel>", "registry channel to build for").choices([...ji]).env(Ki)), e.addOption(new h("--variant <variant>", "artifact kind to build (default: all declared)").choices([...Mi]).env(qi)), e.addOption(new h("--location <location>", "where the artifact lands (local = no push)").choices([...Ni]).env(Ji)), e.addOption(new h("--use-published", "do not build or push; emit a descriptor pointing at the already-published release artifact").env(Yi)), e.addOption(new h("--log-level <level>", "logging level").choices([
|
|
2459
2509
|
"error",
|
|
2460
2510
|
"warn",
|
|
2461
2511
|
"info",
|
|
2462
2512
|
"debug"
|
|
2463
|
-
]).default("info")), e.addOption(new
|
|
2464
|
-
let t =
|
|
2513
|
+
]).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) => {
|
|
2514
|
+
let t = y.createLogger(e.logLevel);
|
|
2465
2515
|
try {
|
|
2466
|
-
let n =
|
|
2516
|
+
let n = Pi({
|
|
2467
2517
|
channel: e.channel,
|
|
2468
2518
|
variant: e.variant,
|
|
2469
2519
|
location: e.location,
|
|
2470
2520
|
usePublished: !!e.usePublished
|
|
2471
|
-
}), r =
|
|
2521
|
+
}), r = oe(t, { packageRoot: e.packageRoot });
|
|
2472
2522
|
r.version = e.version, r.targetPlatform = e.platform, r.allPlatforms = !!e.allPlatforms, r.fullDirHash = !!e.fullDirHash;
|
|
2473
|
-
let i =
|
|
2474
|
-
default:
|
|
2523
|
+
let i = y.shouldDoAction({
|
|
2524
|
+
default: v.isCI(),
|
|
2475
2525
|
enable: e.dockerBuild,
|
|
2476
2526
|
disable: e.dockerNoBuild
|
|
2477
|
-
}), a = i &&
|
|
2478
|
-
default:
|
|
2527
|
+
}), a = i && y.shouldDoAction({
|
|
2528
|
+
default: v.isCI() && !r.isPrivate,
|
|
2479
2529
|
enable: e.dockerAutopush,
|
|
2480
2530
|
disable: e.dockerNoAutopush
|
|
2481
2531
|
});
|
|
2482
|
-
n.kind === "bare" &&
|
|
2532
|
+
n.kind === "bare" && ae({
|
|
2483
2533
|
buildDocker: i,
|
|
2484
2534
|
pushDocker: a,
|
|
2485
2535
|
pushDisabledExplicitly: !!e.dockerNoAutopush,
|
|
2486
2536
|
dockerPackageCount: r.selectedDockerPackages(e.packageId).length
|
|
2487
|
-
}), await
|
|
2537
|
+
}), await Vi({
|
|
2488
2538
|
core: r,
|
|
2489
2539
|
scenario: n,
|
|
2490
2540
|
logger: t,
|
|
@@ -2497,7 +2547,7 @@ function zi() {
|
|
|
2497
2547
|
dockerPushTo: e.dockerPushTo,
|
|
2498
2548
|
buildDocker: i,
|
|
2499
2549
|
pushDocker: a,
|
|
2500
|
-
condaBuild:
|
|
2550
|
+
condaBuild: y.shouldDoAction({
|
|
2501
2551
|
default: !0,
|
|
2502
2552
|
enable: e.condaBuild,
|
|
2503
2553
|
disable: e.condaNoBuild
|
|
@@ -2511,22 +2561,22 @@ function zi() {
|
|
|
2511
2561
|
}
|
|
2512
2562
|
//#endregion
|
|
2513
2563
|
//#region src/cmd/software/index.ts
|
|
2514
|
-
function
|
|
2515
|
-
let e = new
|
|
2516
|
-
return e.addCommand(
|
|
2564
|
+
function Zi() {
|
|
2565
|
+
let e = new m("software").description("Build and publish a block's software modules");
|
|
2566
|
+
return e.addCommand(Xi()), e;
|
|
2517
2567
|
}
|
|
2518
2568
|
//#endregion
|
|
2519
2569
|
//#region src/cli.ts
|
|
2520
|
-
function
|
|
2521
|
-
let t = new
|
|
2522
|
-
t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(
|
|
2523
|
-
let n = new
|
|
2524
|
-
return n.addCommand(
|
|
2570
|
+
function Qi(e = process.cwd()) {
|
|
2571
|
+
let t = new m();
|
|
2572
|
+
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(vi(e)), t.addCommand(yi()), t.addCommand(bi()), t.addCommand(wi()), t.addCommand(Zi());
|
|
2573
|
+
let n = new m("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
|
|
2574
|
+
return n.addCommand(Ti(e)), n.addCommand(Ai(e)), n.addCommand(_i(e)), t.addCommand(n), t;
|
|
2525
2575
|
}
|
|
2526
|
-
async function
|
|
2527
|
-
await
|
|
2576
|
+
async function $i(e, t) {
|
|
2577
|
+
await Qi(t).parseAsync(e);
|
|
2528
2578
|
}
|
|
2529
2579
|
//#endregion
|
|
2530
|
-
export {
|
|
2580
|
+
export { Qi as buildProgram, $i as run };
|
|
2531
2581
|
|
|
2532
2582
|
//# sourceMappingURL=cli.mjs.map
|