@platforma-sdk/block-tools 2.5.91 → 2.6.0
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/README.md +38 -2
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +208 -129
- package/dist/cli.mjs.map +1 -1
- package/dist/cmd/index.d.ts +14 -10
- package/dist/cmd/list-overview-snapshots.d.ts +9 -0
- package/dist/cmd/restore-overview-from-snapshot.d.ts +10 -0
- package/dist/config-DjpRXRy9.js +3 -0
- package/dist/config-DjpRXRy9.js.map +1 -0
- package/dist/config-XBQ2O39y.mjs +2020 -0
- package/dist/config-XBQ2O39y.mjs.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/registry_v1/config_schema.d.ts +5 -5
- package/dist/v2/model/block_description.d.ts +7329 -1422
- package/dist/v2/model/block_meta.d.ts +481 -88
- package/dist/v2/registry/registry.d.ts +16 -1
- package/dist/v2/registry/registry_reader.d.ts +2 -3
- package/dist/v2/registry/schema_internal.d.ts +7 -1
- package/package.json +5 -5
- package/src/cmd/index.ts +14 -10
- package/src/cmd/list-overview-snapshots.ts +46 -0
- package/src/cmd/restore-overview-from-snapshot.ts +78 -0
- package/src/v2/registry/registry.test.ts +176 -4
- package/src/v2/registry/registry.ts +146 -13
- package/src/v2/registry/registry_reader.ts +5 -6
- package/src/v2/registry/schema_internal.ts +16 -1
- package/src/v2/registry/schema_public.ts +5 -5
- package/dist/config-VnABe7ki.mjs +0 -1951
- package/dist/config-VnABe7ki.mjs.map +0 -1
- package/dist/config-t7F2nAAr.js +0 -3
- package/dist/config-t7F2nAAr.js.map +0 -1
- package/dist/v2/registry/schema_public.d.ts +0 -18475
package/dist/cli.mjs
CHANGED
|
@@ -1,228 +1,257 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Command as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var q = (l, e, t) => e in l ? D(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
|
+
var i = (l, e, t) => q(l, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Command as m, Flags as s } from "@oclif/core";
|
|
5
|
+
import d from "node:path";
|
|
6
|
+
import f from "node:fs";
|
|
7
7
|
import "zod";
|
|
8
8
|
import "mime-types";
|
|
9
9
|
import "tar";
|
|
10
10
|
import "@milaboratories/resolve-helper";
|
|
11
|
-
import { l as
|
|
12
|
-
import { StableChannel as
|
|
11
|
+
import { l as Y, B as M, a as B, s as R, b as N, c as J, d as H, M as U, P as K, g as z } from "./config-XBQ2O39y.mjs";
|
|
12
|
+
import { StableChannel as F, overrideDescriptionVersion as W, BlockPackManifest as _, overrideManifestVersion as Z } from "@milaboratories/pl-model-middle-layer";
|
|
13
13
|
import "@milaboratories/pl-model-common";
|
|
14
14
|
import "@milaboratories/ts-helpers";
|
|
15
15
|
import "canonicalize";
|
|
16
16
|
import "lru-cache";
|
|
17
|
+
import { OclifLoggerAdapter as p } from "@milaboratories/ts-helpers-oclif";
|
|
17
18
|
import "undici";
|
|
18
19
|
import "@milaboratories/pl-http";
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
const u = class u extends f {
|
|
20
|
+
import $ from "yaml";
|
|
21
|
+
const h = class h extends m {
|
|
22
22
|
async run() {
|
|
23
|
-
const { flags: e } = await this.parse(
|
|
24
|
-
|
|
23
|
+
const { flags: e } = await this.parse(h), t = d.resolve(e.modulePath), a = await Y(t), r = await M.parseAsync(
|
|
24
|
+
B(t).parse(a.meta)
|
|
25
25
|
);
|
|
26
|
-
await
|
|
26
|
+
await f.promises.writeFile(d.resolve(e.destination), JSON.stringify(r));
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
modulePath:
|
|
29
|
+
i(h, "description", "Extracts meta information from blocks package.json and outputs meta.json with embedded binary and textual information linked from the meta section."), i(h, "flags", {
|
|
30
|
+
modulePath: s.string({
|
|
31
31
|
char: "i",
|
|
32
32
|
summary: "input module path",
|
|
33
33
|
helpValue: "<path>",
|
|
34
34
|
default: "."
|
|
35
35
|
}),
|
|
36
|
-
destination:
|
|
36
|
+
destination: s.string({
|
|
37
37
|
char: "o",
|
|
38
38
|
summary: "output meta.json file",
|
|
39
39
|
helpValue: "<path>",
|
|
40
40
|
required: !0
|
|
41
41
|
})
|
|
42
42
|
});
|
|
43
|
-
let
|
|
44
|
-
async function
|
|
43
|
+
let A = h;
|
|
44
|
+
async function Q(l) {
|
|
45
45
|
try {
|
|
46
|
-
return await
|
|
46
|
+
return await f.promises.readFile(l, "utf8");
|
|
47
47
|
} catch (e) {
|
|
48
48
|
if (e.code === "ENOENT")
|
|
49
49
|
return;
|
|
50
50
|
throw e;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
const
|
|
53
|
+
const g = class g extends m {
|
|
54
54
|
async run() {
|
|
55
|
-
const { flags: e } = await this.parse(
|
|
56
|
-
let { model:
|
|
57
|
-
if (
|
|
58
|
-
const { config:
|
|
59
|
-
if (!
|
|
55
|
+
const { flags: e } = await this.parse(g), t = d.resolve(e.modulePath);
|
|
56
|
+
let { model: a, platforma: r } = require(t);
|
|
57
|
+
if (a || (a = r), !a) throw new Error('"model" export not found');
|
|
58
|
+
const { config: o } = a;
|
|
59
|
+
if (!o)
|
|
60
60
|
throw new Error(
|
|
61
61
|
'Malformed "model" object, check it is created with "BlockModel" and ".done()" is executed as the call in the chain.'
|
|
62
62
|
);
|
|
63
|
-
if (!("canRun" in
|
|
63
|
+
if (!("canRun" in o || "inputsValid" in o) || !("outputs" in o) || !("sections" in o))
|
|
64
64
|
throw new Error('"config" has unexpected structure');
|
|
65
|
-
const
|
|
66
|
-
|
|
65
|
+
const c = await Q(e.sourceBundle);
|
|
66
|
+
c !== void 0 && (o.code = {
|
|
67
67
|
type: "plain",
|
|
68
|
-
content:
|
|
69
|
-
}), await
|
|
68
|
+
content: c
|
|
69
|
+
}), await f.promises.writeFile(d.resolve(e.destination), JSON.stringify(o));
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
|
|
73
|
-
modulePath:
|
|
72
|
+
i(g, "description", "Extracts and outputs block model JSON from pre-built block model module"), i(g, "flags", {
|
|
73
|
+
modulePath: s.string({
|
|
74
74
|
char: "i",
|
|
75
75
|
summary: "input module path",
|
|
76
76
|
helpValue: "<path>",
|
|
77
77
|
default: "."
|
|
78
78
|
}),
|
|
79
|
-
sourceBundle:
|
|
79
|
+
sourceBundle: s.string({
|
|
80
80
|
char: "b",
|
|
81
81
|
summary: "bundled model code to embed into the model for callback-based rendering to work",
|
|
82
82
|
helpValue: "<path>",
|
|
83
83
|
default: "./dist/bundle.js"
|
|
84
84
|
}),
|
|
85
|
-
destination:
|
|
85
|
+
destination: s.string({
|
|
86
86
|
char: "o",
|
|
87
87
|
summary: "output model file",
|
|
88
88
|
helpValue: "<path>",
|
|
89
89
|
default: "./dist/model.json"
|
|
90
90
|
})
|
|
91
91
|
});
|
|
92
|
-
let
|
|
93
|
-
const
|
|
92
|
+
let V = g;
|
|
93
|
+
const y = class y extends m {
|
|
94
94
|
async run() {
|
|
95
|
-
const { flags: e } = await this.parse(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
const { flags: e } = await this.parse(y), t = R(e.registry), r = await new N(t, new p(this)).listGlobalOverviewSnapshots();
|
|
96
|
+
if (e.json)
|
|
97
|
+
this.log(JSON.stringify(r, null, 2));
|
|
98
|
+
else if (r.length === 0)
|
|
99
|
+
this.log("No snapshots found.");
|
|
100
|
+
else {
|
|
101
|
+
this.log(`Found ${r.length} snapshot(s):
|
|
102
|
+
`);
|
|
103
|
+
for (const o of r)
|
|
104
|
+
this.log(` ${o.timestamp}`), this.log(` Path: ${o.path}`), this.log("");
|
|
105
|
+
}
|
|
100
106
|
}
|
|
101
107
|
};
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
i(y, "description", "List all available global overview snapshots in the registry"), i(y, "flags", {
|
|
109
|
+
registry: s.string({
|
|
110
|
+
char: "r",
|
|
111
|
+
summary: "full address of the registry",
|
|
112
|
+
helpValue: "<address>",
|
|
113
|
+
env: "PL_REGISTRY",
|
|
114
|
+
required: !0
|
|
115
|
+
}),
|
|
116
|
+
json: s.boolean({
|
|
117
|
+
summary: "output in JSON format",
|
|
118
|
+
default: !1
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
let I = y;
|
|
122
|
+
const w = class w extends m {
|
|
123
|
+
async run() {
|
|
124
|
+
const { flags: e } = await this.parse(w);
|
|
125
|
+
let t = await Y(d.resolve(e.modulePath));
|
|
126
|
+
e["version-override"] && (t = W(t, e["version-override"]));
|
|
127
|
+
const a = R(e.registry), r = new N(a, new p(this));
|
|
128
|
+
e.unmark ? await r.removePackageFromChannel(t.id, e.channel) : await r.addPackageToChannel(t.id, e.channel), e.refresh && await r.updateIfNeeded();
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
i(w, "description", "Mark target block stable"), i(w, "flags", {
|
|
132
|
+
modulePath: s.string({
|
|
104
133
|
char: "i",
|
|
105
134
|
summary: "input module path",
|
|
106
135
|
helpValue: "<path>",
|
|
107
136
|
default: "."
|
|
108
137
|
}),
|
|
109
|
-
channel:
|
|
138
|
+
channel: s.string({
|
|
110
139
|
char: "c",
|
|
111
140
|
hidden: !0,
|
|
112
141
|
summary: "custom channel",
|
|
113
142
|
helpValue: "<channel name>",
|
|
114
|
-
default:
|
|
143
|
+
default: F
|
|
115
144
|
}),
|
|
116
|
-
"version-override":
|
|
145
|
+
"version-override": s.file({
|
|
117
146
|
char: "v",
|
|
118
147
|
summary: "override package version"
|
|
119
148
|
}),
|
|
120
|
-
registry:
|
|
149
|
+
registry: s.string({
|
|
121
150
|
char: "r",
|
|
122
151
|
summary: "full address of the registry",
|
|
123
152
|
helpValue: "<address>",
|
|
124
153
|
env: "PL_REGISTRY",
|
|
125
154
|
required: !0
|
|
126
155
|
}),
|
|
127
|
-
refresh:
|
|
156
|
+
refresh: s.boolean({
|
|
128
157
|
summary: "refresh repository after adding the package",
|
|
129
158
|
default: !0,
|
|
130
159
|
allowNo: !0,
|
|
131
160
|
env: "PL_REGISTRY_REFRESH"
|
|
132
161
|
}),
|
|
133
|
-
unmark:
|
|
162
|
+
unmark: s.boolean({
|
|
134
163
|
summary: 'reverses meaning of this command, flag can be used to remove "stable" flag from the package',
|
|
135
164
|
default: !1
|
|
136
165
|
})
|
|
137
166
|
});
|
|
138
|
-
let
|
|
139
|
-
const
|
|
167
|
+
let x = w;
|
|
168
|
+
const v = class v extends m {
|
|
140
169
|
async run() {
|
|
141
|
-
const { flags: e } = await this.parse(
|
|
142
|
-
await
|
|
170
|
+
const { flags: e } = await this.parse(v), t = await J(d.resolve(e.modulePath));
|
|
171
|
+
await H(t, d.resolve(e.destinationPath));
|
|
143
172
|
}
|
|
144
173
|
};
|
|
145
|
-
|
|
146
|
-
modulePath:
|
|
174
|
+
i(v, "description", "Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder"), i(v, "flags", {
|
|
175
|
+
modulePath: s.string({
|
|
147
176
|
char: "i",
|
|
148
177
|
summary: "input module path",
|
|
149
178
|
helpValue: "<path>",
|
|
150
179
|
default: "."
|
|
151
180
|
}),
|
|
152
|
-
destinationPath:
|
|
181
|
+
destinationPath: s.string({
|
|
153
182
|
char: "o",
|
|
154
183
|
summary: "output folder",
|
|
155
184
|
helpValue: "<path>",
|
|
156
185
|
default: "./block-pack"
|
|
157
186
|
})
|
|
158
187
|
});
|
|
159
|
-
let
|
|
160
|
-
function
|
|
161
|
-
const
|
|
162
|
-
for (const
|
|
163
|
-
e[
|
|
164
|
-
return
|
|
188
|
+
let L = v;
|
|
189
|
+
function O(l, e) {
|
|
190
|
+
const t = { ...l };
|
|
191
|
+
for (const a in e)
|
|
192
|
+
e[a] && typeof e[a] == "object" && !Array.isArray(e[a]) && t[a] && typeof t[a] == "object" && !Array.isArray(t[a]) ? t[a] = O(t[a], e[a]) : t[a] = e[a];
|
|
193
|
+
return t;
|
|
165
194
|
}
|
|
166
|
-
const
|
|
195
|
+
const b = class b extends m {
|
|
167
196
|
async run() {
|
|
168
|
-
const { flags: e } = await this.parse(
|
|
169
|
-
let
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
this.log(`Manifest root = ${
|
|
173
|
-
const
|
|
197
|
+
const { flags: e } = await this.parse(b), t = d.resolve(e.manifest), a = JSON.parse(await f.promises.readFile(t, { encoding: "utf-8" }));
|
|
198
|
+
let r = _.parse(a);
|
|
199
|
+
r = O(a, r);
|
|
200
|
+
const o = d.dirname(t);
|
|
201
|
+
this.log(`Manifest root = ${o}`), e["version-override"] && (r = Z(r, e["version-override"]));
|
|
202
|
+
const c = R(e.registry), n = new N(c, new p(this));
|
|
174
203
|
await n.publishPackage(
|
|
175
|
-
|
|
176
|
-
async (
|
|
177
|
-
), e.unstable || (this.log(`Adding package to ${
|
|
204
|
+
r,
|
|
205
|
+
async (u) => Buffer.from(await f.promises.readFile(d.resolve(o, u)))
|
|
206
|
+
), e.unstable || (this.log(`Adding package to ${F} channel...`), await n.addPackageToChannel(r.description.id, F)), e.refresh && await n.updateIfNeeded();
|
|
178
207
|
}
|
|
179
208
|
};
|
|
180
|
-
|
|
181
|
-
registry:
|
|
209
|
+
i(b, "description", "Publishes the block package and refreshes the registry (for v2 block-pack schema)"), i(b, "flags", {
|
|
210
|
+
registry: s.string({
|
|
182
211
|
char: "r",
|
|
183
212
|
summary: "full address of the registry",
|
|
184
213
|
helpValue: "<address>",
|
|
185
214
|
env: "PL_REGISTRY",
|
|
186
215
|
required: !0
|
|
187
216
|
}),
|
|
188
|
-
manifest:
|
|
217
|
+
manifest: s.file({
|
|
189
218
|
char: "m",
|
|
190
219
|
summary: "manifest file path",
|
|
191
220
|
exists: !0,
|
|
192
|
-
default: `./block-pack/${
|
|
221
|
+
default: `./block-pack/${U}`
|
|
193
222
|
}),
|
|
194
|
-
"version-override":
|
|
223
|
+
"version-override": s.file({
|
|
195
224
|
char: "v",
|
|
196
225
|
summary: "override package version"
|
|
197
226
|
}),
|
|
198
|
-
refresh:
|
|
227
|
+
refresh: s.boolean({
|
|
199
228
|
summary: "refresh repository after adding the package",
|
|
200
229
|
default: !0,
|
|
201
230
|
allowNo: !0,
|
|
202
231
|
env: "PL_REGISTRY_REFRESH"
|
|
203
232
|
}),
|
|
204
|
-
unstable:
|
|
233
|
+
unstable: s.boolean({
|
|
205
234
|
summary: "do not add the published package to stable channel",
|
|
206
235
|
default: !1,
|
|
207
236
|
env: "PL_PUBLISH_UNSTABLE"
|
|
208
237
|
})
|
|
209
238
|
});
|
|
210
|
-
let
|
|
211
|
-
const
|
|
239
|
+
let G = b;
|
|
240
|
+
const k = class k extends m {
|
|
212
241
|
async run() {
|
|
213
|
-
const { flags: e } = await this.parse(
|
|
214
|
-
await new
|
|
242
|
+
const { flags: e } = await this.parse(k), t = R(e.registry);
|
|
243
|
+
await new N(t, new p(this)).updateIfNeeded(e.mode);
|
|
215
244
|
}
|
|
216
245
|
};
|
|
217
|
-
|
|
218
|
-
registry:
|
|
246
|
+
i(k, "description", "Refresh overview files based on published but not proecessed artefacts"), i(k, "flags", {
|
|
247
|
+
registry: s.string({
|
|
219
248
|
char: "r",
|
|
220
249
|
summary: "full address of the registry",
|
|
221
250
|
helpValue: "<address>",
|
|
222
251
|
env: "PL_REGISTRY",
|
|
223
252
|
required: !0
|
|
224
253
|
}),
|
|
225
|
-
mode:
|
|
254
|
+
mode: s.string({
|
|
226
255
|
char: "m",
|
|
227
256
|
summary: 'refresh mode (allowed valiues: "force", "normal", "dry-run")',
|
|
228
257
|
helpValue: "<mode>",
|
|
@@ -231,92 +260,142 @@ o(w, "description", "Refresh overview files based on published but not proecesse
|
|
|
231
260
|
default: "normal"
|
|
232
261
|
})
|
|
233
262
|
});
|
|
234
|
-
let
|
|
235
|
-
|
|
236
|
-
|
|
263
|
+
let T = k;
|
|
264
|
+
const P = class P extends m {
|
|
265
|
+
async run() {
|
|
266
|
+
const { flags: e } = await this.parse(P), t = R(e.registry), a = new N(t, new p(this)), r = await a.listGlobalOverviewSnapshots();
|
|
267
|
+
if (r.find((c) => c.timestamp === e.snapshot) || this.error(`Snapshot '${e.snapshot}' not found. Available snapshots:
|
|
268
|
+
${r.map((c) => ` - ${c.timestamp}`).join(`
|
|
269
|
+
`) || " (none)"}`), !e["skip-confirmation"]) {
|
|
270
|
+
const n = (await import("node:readline")).createInterface({
|
|
271
|
+
input: process.stdin,
|
|
272
|
+
output: process.stdout
|
|
273
|
+
}), u = await new Promise((S) => {
|
|
274
|
+
n.question(
|
|
275
|
+
`⚠️ This will overwrite the current global overview with snapshot '${e.snapshot}'.
|
|
276
|
+
Are you sure you want to continue? (y/N): `,
|
|
277
|
+
S
|
|
278
|
+
);
|
|
279
|
+
});
|
|
280
|
+
if (n.close(), u.toLowerCase() !== "y" && u.toLowerCase() !== "yes") {
|
|
281
|
+
this.log("Restore cancelled.");
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
try {
|
|
286
|
+
await a.restoreGlobalOverviewFromSnapshot(e.snapshot), this.log(`✅ Successfully restored global overview from snapshot '${e.snapshot}'`);
|
|
287
|
+
} catch (c) {
|
|
288
|
+
this.error(`Failed to restore from snapshot: ${c}`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
i(P, "description", "Restore global overview from a snapshot"), i(P, "flags", {
|
|
293
|
+
registry: s.string({
|
|
294
|
+
char: "r",
|
|
295
|
+
summary: "full address of the registry",
|
|
296
|
+
helpValue: "<address>",
|
|
297
|
+
env: "PL_REGISTRY",
|
|
298
|
+
required: !0
|
|
299
|
+
}),
|
|
300
|
+
snapshot: s.string({
|
|
301
|
+
char: "s",
|
|
302
|
+
summary: "snapshot timestamp ID to restore from",
|
|
303
|
+
helpValue: "<timestamp>",
|
|
304
|
+
required: !0
|
|
305
|
+
}),
|
|
306
|
+
"skip-confirmation": s.boolean({
|
|
307
|
+
summary: "skip confirmation prompt (use with caution)",
|
|
308
|
+
default: !1
|
|
309
|
+
})
|
|
310
|
+
});
|
|
311
|
+
let C = P;
|
|
312
|
+
function X(l) {
|
|
313
|
+
const e = l.match(/(?<destName>[^\/\\]+)=(?<src>.*)/);
|
|
237
314
|
if (e) {
|
|
238
|
-
const { src:
|
|
239
|
-
return { src:
|
|
315
|
+
const { src: t, destName: a } = e.groups;
|
|
316
|
+
return { src: t, destName: a };
|
|
240
317
|
} else
|
|
241
|
-
return { src:
|
|
318
|
+
return { src: l, destName: d.basename(l) };
|
|
242
319
|
}
|
|
243
|
-
const
|
|
320
|
+
const ee = s.custom({
|
|
244
321
|
summary: "target files to upload",
|
|
245
322
|
helpValue: "file_path | package_name=file_path",
|
|
246
|
-
parse: async (
|
|
247
|
-
}),
|
|
323
|
+
parse: async (l) => X(l)
|
|
324
|
+
}), te = ["registry", "organization", "package", "version"], E = class E extends m {
|
|
248
325
|
async run() {
|
|
249
|
-
const { flags: e } = await this.parse(
|
|
250
|
-
for (const n of
|
|
251
|
-
e.meta && (e.meta.endsWith(".json") ?
|
|
252
|
-
await
|
|
253
|
-
) : e.meta.endsWith(".yaml") && (
|
|
254
|
-
await
|
|
326
|
+
const { flags: e } = await this.parse(E), t = K.parse({});
|
|
327
|
+
for (const n of te) e[n] && (t[n] = e[n]);
|
|
328
|
+
e.meta && (e.meta.endsWith(".json") ? t.meta = JSON.parse(
|
|
329
|
+
await f.promises.readFile(e.meta, { encoding: "utf-8" })
|
|
330
|
+
) : e.meta.endsWith(".yaml") && (t.meta = $.parse(
|
|
331
|
+
await f.promises.readFile(e.meta, { encoding: "utf-8" })
|
|
255
332
|
)));
|
|
256
333
|
for (const n of e.file)
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
this.log(
|
|
260
|
-
const
|
|
261
|
-
for (const [n,
|
|
262
|
-
this.log(`Uploading ${
|
|
263
|
-
const
|
|
264
|
-
await
|
|
334
|
+
t.files[n.destName] = n.src;
|
|
335
|
+
const a = await z(t);
|
|
336
|
+
this.log($.stringify(a.conf));
|
|
337
|
+
const r = a.createRegistry(new p(this)), o = a.fullPackageName, c = r.constructNewPackage(o);
|
|
338
|
+
for (const [n, u] of Object.entries(a.conf.files)) {
|
|
339
|
+
this.log(`Uploading ${u} -> ${n} ...`);
|
|
340
|
+
const S = await f.promises.readFile(u);
|
|
341
|
+
await c.addFile(n, S);
|
|
265
342
|
}
|
|
266
|
-
this.log("Uploading meta information..."), await
|
|
343
|
+
this.log("Uploading meta information..."), await c.writeMeta(a.conf.meta), await c.finish(), e.refresh && await r.updateIfNeeded();
|
|
267
344
|
}
|
|
268
345
|
};
|
|
269
|
-
|
|
270
|
-
registry:
|
|
346
|
+
i(E, "description", "Uploads V1 package and refreshes the registry"), i(E, "flags", {
|
|
347
|
+
registry: s.string({
|
|
271
348
|
char: "r",
|
|
272
349
|
summary: "full address of the registry or alias from .pl.reg",
|
|
273
350
|
helpValue: "<address|alias>",
|
|
274
351
|
env: "PL_REGISTRY"
|
|
275
352
|
}),
|
|
276
|
-
organization:
|
|
353
|
+
organization: s.string({
|
|
277
354
|
char: "o",
|
|
278
355
|
summary: "target organisation",
|
|
279
356
|
env: "PL_PACKAGE_ORGANIZATION"
|
|
280
357
|
}),
|
|
281
|
-
package:
|
|
358
|
+
package: s.string({
|
|
282
359
|
char: "p",
|
|
283
360
|
summary: "target package",
|
|
284
361
|
env: "PL_PACKAGE_NAME"
|
|
285
362
|
}),
|
|
286
|
-
version:
|
|
363
|
+
version: s.string({
|
|
287
364
|
char: "v",
|
|
288
365
|
summary: "target version",
|
|
289
366
|
env: "PL_PACKAGE_VERSION"
|
|
290
367
|
}),
|
|
291
|
-
meta:
|
|
368
|
+
meta: s.file({
|
|
292
369
|
char: "m",
|
|
293
370
|
summary: "json file containing meta information to associate with tha package",
|
|
294
371
|
exists: !0
|
|
295
372
|
}),
|
|
296
|
-
file:
|
|
373
|
+
file: ee({
|
|
297
374
|
char: "f",
|
|
298
375
|
summary: "package files",
|
|
299
376
|
multiple: !0,
|
|
300
377
|
default: []
|
|
301
378
|
}),
|
|
302
|
-
refresh:
|
|
379
|
+
refresh: s.boolean({
|
|
303
380
|
summary: "refresh repository after adding the package",
|
|
304
381
|
default: !0,
|
|
305
382
|
allowNo: !0,
|
|
306
383
|
env: "PL_REGISTRY_REFRESH"
|
|
307
384
|
})
|
|
308
385
|
});
|
|
309
|
-
let
|
|
310
|
-
const
|
|
311
|
-
"build-meta":
|
|
312
|
-
"build-model":
|
|
313
|
-
"
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
"
|
|
386
|
+
let j = E;
|
|
387
|
+
const be = {
|
|
388
|
+
"build-meta": A,
|
|
389
|
+
"build-model": V,
|
|
390
|
+
"list-overview-snapshots": I,
|
|
391
|
+
"mark-stable": x,
|
|
392
|
+
pack: L,
|
|
393
|
+
publish: G,
|
|
394
|
+
"refresh-registry": T,
|
|
395
|
+
"restore-overview-from-snapshot": C,
|
|
396
|
+
"upload-package-v1": j
|
|
318
397
|
};
|
|
319
398
|
export {
|
|
320
|
-
|
|
399
|
+
be as COMMANDS
|
|
321
400
|
};
|
|
322
401
|
//# sourceMappingURL=cli.mjs.map
|