@dpuse/dpuse-development 1.0.145 → 1.0.148
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 +18 -18
- package/dist/{apiReference-CdMhhAl1.js → apiReference-Bg5HYM1L.js} +2 -3
- package/dist/{apiReference-CdMhhAl1.js.map → apiReference-Bg5HYM1L.js.map} +1 -1
- package/dist/dpuse-development.es.js +356 -362
- package/dist/dpuse-development.es.js.map +1 -1
- package/dist/{utilities-D98znirs.js → utilities-DH1goyH8.js} +182 -188
- package/dist/utilities-DH1goyH8.js.map +1 -0
- package/dist/vite.es.js +1 -2
- package/package.json +8 -8
- package/dist/utilities-D98znirs.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, k as v, l as y, m as ee, n as te, o as ne, p as b, r as re, s as ie, t as ae, u as oe, v as x, w as S, x as C, y as w } from "./utilities-
|
|
1
|
+
import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, k as v, l as y, m as ee, n as te, o as ne, p as b, r as re, s as ie, t as ae, u as oe, v as x, w as S, x as C, y as w } from "./utilities-DH1goyH8.js";
|
|
2
2
|
import { SHIPPED_PACKAGES_FILE_NAME as se } from "./vite.es.js";
|
|
3
3
|
import { existsSync as ce, promises as T } from "node:fs";
|
|
4
4
|
import E from "node:path";
|
|
@@ -10,7 +10,7 @@ import { init as pe } from "license-checker-rseidelsohn";
|
|
|
10
10
|
import { setTimeout as me } from "node:timers/promises";
|
|
11
11
|
import he from "spdx-satisfies";
|
|
12
12
|
import ge from "node:os";
|
|
13
|
-
|
|
13
|
+
// src/actions/auditDependencies_.json
|
|
14
14
|
var _e = [
|
|
15
15
|
{
|
|
16
16
|
id: "GHSA-fx2h-pf6j-xcff",
|
|
@@ -93,8 +93,7 @@ function Ce(e) {
|
|
|
93
93
|
for (let e of n) for (let n of e.via) typeof n != "string" && t.set(n.url, n);
|
|
94
94
|
return t.values().toArray();
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
//#region src/actions/buildProject.ts
|
|
96
|
+
// src/actions/buildProject.ts
|
|
98
97
|
var we = "build:wasm";
|
|
99
98
|
async function Te() {
|
|
100
99
|
try {
|
|
@@ -106,8 +105,7 @@ async function Te() {
|
|
|
106
105
|
async function Ee(e, t) {
|
|
107
106
|
t.scripts?.[we] != null && await r(`${e} Build WebAssembly`, "npm", ["run", we]), await r(`${e} Bundle project`, "vite", ["build"]);
|
|
108
107
|
}
|
|
109
|
-
|
|
110
|
-
//#region src/actions/checkConfigFiles.ts
|
|
108
|
+
// src/actions/checkConfigFiles.ts
|
|
111
109
|
var D = "@dpuse/dpuse-development/prettierrc", De = "dpuse-development";
|
|
112
110
|
async function Oe() {
|
|
113
111
|
try {
|
|
@@ -207,8 +205,7 @@ async function O(e, t, n = [], r = (e) => e) {
|
|
|
207
205
|
console.info(`❌ File '${t}' is NOT the same`);
|
|
208
206
|
}
|
|
209
207
|
}
|
|
210
|
-
|
|
211
|
-
//#region src/actions/checkDependencies.ts
|
|
208
|
+
// src/actions/checkDependencies.ts
|
|
212
209
|
async function Le() {
|
|
213
210
|
try {
|
|
214
211
|
l("Check Dependencies"), await r("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), w("2️⃣ Check using 'npm-check-updates'");
|
|
@@ -237,11 +234,15 @@ async function Le() {
|
|
|
237
234
|
"--no-fund"
|
|
238
235
|
], !0), await be("4️⃣ Name the advisories above that the CI audit ignores");
|
|
239
236
|
let t = await Re();
|
|
240
|
-
t.length > 0 ? await r("5️⃣ Move install-script pins to installed versions", "npm", [
|
|
237
|
+
if (t.length > 0 ? await r("5️⃣ Move install-script pins to installed versions", "npm", [
|
|
241
238
|
"install-scripts",
|
|
242
239
|
"approve",
|
|
243
240
|
...t
|
|
244
|
-
]) : w("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin"
|
|
241
|
+
]) : w("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin") {
|
|
242
|
+
let e = await ze();
|
|
243
|
+
await r("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]), await Be(e);
|
|
244
|
+
} else w("6️⃣ Skipped removing unused install-script entries (macOS only)");
|
|
245
|
+
t.length > 0 && await r("7️⃣ Run install scripts skipped in steps 3 and 4", "npm", [
|
|
245
246
|
"rebuild",
|
|
246
247
|
...t,
|
|
247
248
|
"--no-strict-allow-scripts"
|
|
@@ -256,55 +257,65 @@ async function Le() {
|
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
259
|
async function Re() {
|
|
259
|
-
let
|
|
260
|
+
let e = await ze(), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
|
|
260
261
|
return [...new Set(t)];
|
|
261
262
|
}
|
|
262
|
-
//#endregion
|
|
263
|
-
//#region src/actions/checkProject.ts
|
|
264
263
|
async function ze() {
|
|
264
|
+
let { allowScripts: e = {} } = await C(E.resolve(process.cwd(), "package.json"));
|
|
265
|
+
return e;
|
|
266
|
+
}
|
|
267
|
+
async function Be(e) {
|
|
268
|
+
let t = E.resolve(process.cwd(), "package.json"), n = await C(t), r = n.allowScripts ?? {}, i = Object.keys(e).filter((e) => !Object.hasOwn(r, e));
|
|
269
|
+
if (i.length === 0) return;
|
|
270
|
+
let { packages: a = {} } = await C(E.resolve(process.cwd(), "package-lock.json")), o = Object.entries(a), s = i.filter((e) => {
|
|
271
|
+
let t = e.lastIndexOf("@"), n = t > 0 ? e.slice(0, t) : e, r = t > 0 ? e.slice(t + 1) : void 0;
|
|
272
|
+
return o.some(([e, t]) => e.endsWith(`node_modules/${n}`) && t.hasInstallScript === !0 && (r === void 0 || t.version === r));
|
|
273
|
+
});
|
|
274
|
+
s.length !== 0 && (n.allowScripts = Object.fromEntries(Object.entries(e).filter(([e]) => Object.hasOwn(r, e) || s.includes(e))), await v(t, n), w(`6️⃣ Restored install-script entries the lockfile still needs: ${s.join(", ")}`));
|
|
275
|
+
}
|
|
276
|
+
// src/actions/checkProject.ts
|
|
277
|
+
async function Ve() {
|
|
265
278
|
await Oe(), await Le();
|
|
266
279
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
var Be = "<!-- SUPPORTED_ACTIONS_START -->", Ve = "<!-- SUPPORTED_ACTIONS_END -->", He = "Connectors conform to a unified interface contract by implementing a specific subset of standard actions. These standardised actions allow the DPUse application to interact with any underlying data source in the same way, enabling Connectors to be built independently and loaded dynamically at runtime.", Ue = {
|
|
280
|
+
// src/actions/documentActions.ts
|
|
281
|
+
var He = "<!-- SUPPORTED_ACTIONS_START -->", Ue = "<!-- SUPPORTED_ACTIONS_END -->", We = "Connectors conform to a unified interface contract by implementing a specific subset of standard actions. These standardised actions allow the DPUse application to interact with any underlying data source in the same way, enabling Connectors to be built independently and loaded dynamically at runtime.", Ge = {
|
|
270
282
|
source: "This connector is a Source connector that supports only read actions. Connectors can also function as a Destination (write-only) or Bidirectional (read/write), depending on the actions they support.",
|
|
271
283
|
destination: "This connector is a Destination connector that supports only write actions. Connectors can also function as a Source (read-only) or Bidirectional (read/write), depending on the actions they support.",
|
|
272
284
|
bidirectional: "This connector is a Bidirectional connector that supports both read and write actions. Connectors can also function as a Source (read-only) or Destination (write-only), depending on the actions they support.",
|
|
273
285
|
unknown: "This connector does not yet implement any read or write actions, so its type cannot be determined. Connectors function as a Source (read-only), a Destination (write-only), or Bidirectional (read/write), depending on the actions they support."
|
|
274
|
-
},
|
|
275
|
-
async function
|
|
286
|
+
}, Ke = "The table below lists all connector actions and highlights those supported by this connector.";
|
|
287
|
+
async function qe() {
|
|
276
288
|
try {
|
|
277
289
|
l("Document Actions"), w("1️⃣ Insert actions description and table into 'README.md'");
|
|
278
|
-
let t = (await C("config.json")).actionNames ?? [], n = i(t), r = a(t), o = `## Supported Actions\n\n${
|
|
279
|
-
await e(o,
|
|
290
|
+
let t = (await C("config.json")).actionNames ?? [], n = i(t), r = a(t), o = `## Supported Actions\n\n${We}\n\n${Ge[n]} ${Ke}\n\n${r}`;
|
|
291
|
+
await e(o, He, Ue), x("Actions documented");
|
|
280
292
|
} catch (e) {
|
|
281
293
|
console.error("❌ Error documenting actions", e), process.exit(1);
|
|
282
294
|
}
|
|
283
295
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
async function Ke() {
|
|
296
|
+
// src/actions/documentContributingLicense.ts
|
|
297
|
+
async function Je() {
|
|
287
298
|
try {
|
|
288
299
|
l("Document Contributing & License");
|
|
289
|
-
let [t, n] = await Promise.all([C("package.json"), C("config.json")]), { owner: r, repository: i } = S(t, "document contributing and license"), a =
|
|
290
|
-
w("1️⃣ Insert contributing and license content into 'README.md'"), await d(), await e(
|
|
300
|
+
let [t, n] = await Promise.all([C("package.json"), C("config.json")]), { owner: r, repository: i } = S(t, "document contributing and license"), a = Ye(t), o = Xe(n.firstCreatedAt);
|
|
301
|
+
w("1️⃣ Insert contributing and license content into 'README.md'"), await d(), await e(Ze(r, i, a, o), te, ae), x("Contributing & license documented");
|
|
291
302
|
} catch (e) {
|
|
292
303
|
console.error("❌ Error documenting contributing and license", e), process.exit(1);
|
|
293
304
|
}
|
|
294
305
|
}
|
|
295
|
-
function
|
|
306
|
+
function Ye(e) {
|
|
296
307
|
let t = e.author, n = typeof t == "string" ? t : t?.name;
|
|
297
308
|
if (n == null || n === "") throw Error("package.json 'author' field is required to document contributing and license.");
|
|
298
309
|
let r = n.indexOf("<"), i = r === -1 ? -1 : n.indexOf(">", r);
|
|
299
310
|
return i === -1 ? n.trim() : [n.slice(0, r).trim(), n.slice(i + 1).trim()].filter((e) => e !== "").join(" ");
|
|
300
311
|
}
|
|
301
|
-
function
|
|
312
|
+
function Xe(e) {
|
|
302
313
|
let t = (/* @__PURE__ */ new Date()).getFullYear();
|
|
303
314
|
if (e == null) return String(t);
|
|
304
315
|
let n = new Date(e).getFullYear();
|
|
305
316
|
return n === t ? String(t) : `${String(n)}-present`;
|
|
306
317
|
}
|
|
307
|
-
function
|
|
318
|
+
function Ze(e, t, n, r) {
|
|
308
319
|
return `## Contributing
|
|
309
320
|
|
|
310
321
|
This repository is maintained solely by its owner and does not, at present, accept external contributions into the canonical repo. Its source is published openly under the MIT License — every DPUse project is fully open source except DPUse Engine, which remains closed and proprietary.
|
|
@@ -317,10 +328,9 @@ This project is licensed under the MIT License, permitting free use, modificatio
|
|
|
317
328
|
|
|
318
329
|
[MIT](./LICENSE) © ${r} ${n}`;
|
|
319
330
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
async function nt(e, n) {
|
|
331
|
+
// src/utilities/rustCrates.ts
|
|
332
|
+
var k = "licenses/cargoMetadata.json", A = "licenses/cargoTree.txt", Qe = 1e3, $e = 1e4, et = "dpuse-development (https://github.com/dpuse/dpuse-development)", tt = /^(?:copying|licen[cs]e|unlicense)/i, nt = "wasm32-unknown-unknown";
|
|
333
|
+
async function rt(e, n) {
|
|
324
334
|
if (await t("rust/Cargo.toml") === null) return null;
|
|
325
335
|
let r = [
|
|
326
336
|
"--manifest-path",
|
|
@@ -333,22 +343,22 @@ async function nt(e, n) {
|
|
|
333
343
|
"--edges",
|
|
334
344
|
"normal,no-proc-macro",
|
|
335
345
|
"--target",
|
|
336
|
-
|
|
346
|
+
nt,
|
|
337
347
|
"--prefix",
|
|
338
348
|
"depth",
|
|
339
349
|
"--format",
|
|
340
350
|
"{p}|{l}|{r}"
|
|
341
351
|
];
|
|
342
|
-
await o(e, "cargo", i,
|
|
352
|
+
await o(e, "cargo", i, A), await o(e, "cargo", [
|
|
343
353
|
"metadata",
|
|
344
354
|
...r,
|
|
345
355
|
"--format-version",
|
|
346
356
|
"1",
|
|
347
357
|
"--filter-platform",
|
|
348
|
-
|
|
358
|
+
nt
|
|
349
359
|
], k);
|
|
350
|
-
let a =
|
|
351
|
-
await T.rm(
|
|
360
|
+
let a = it(await s(A)), c = await C(k);
|
|
361
|
+
await T.rm(A, { force: !0 }), await T.rm(k, { force: !0 });
|
|
352
362
|
let l = /* @__PURE__ */ new Map();
|
|
353
363
|
for (let e of a) e.isOwn || l.has(`${e.name}@${e.version}`) || l.set(`${e.name}@${e.version}`, {
|
|
354
364
|
name: e.name,
|
|
@@ -361,9 +371,9 @@ async function nt(e, n) {
|
|
|
361
371
|
latestPublishedDate: ""
|
|
362
372
|
});
|
|
363
373
|
let u = l.values().toArray();
|
|
364
|
-
|
|
365
|
-
for (let e of u) e.licenseFiles = await
|
|
366
|
-
return await
|
|
374
|
+
at(u, n);
|
|
375
|
+
for (let e of u) e.licenseFiles = await ct(e, c);
|
|
376
|
+
return await lt(e, u), {
|
|
367
377
|
crates: u,
|
|
368
378
|
treeItems: a.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
|
|
369
379
|
name: e,
|
|
@@ -373,7 +383,7 @@ async function nt(e, n) {
|
|
|
373
383
|
}))
|
|
374
384
|
};
|
|
375
385
|
}
|
|
376
|
-
function
|
|
386
|
+
function it(e) {
|
|
377
387
|
let t = [];
|
|
378
388
|
for (let n of e.split("\n")) {
|
|
379
389
|
let [e = "", r = "", i = ""] = n.trim().split("|", 3), a = /^\d+/.exec(e)?.[0];
|
|
@@ -390,30 +400,30 @@ function rt(e) {
|
|
|
390
400
|
}
|
|
391
401
|
return t;
|
|
392
402
|
}
|
|
393
|
-
function
|
|
394
|
-
let n = t.split(";").filter((e) =>
|
|
403
|
+
function at(e, t) {
|
|
404
|
+
let n = t.split(";").filter((e) => ot(e)), r = e.filter((e) => !st(e.licenseExpression, n));
|
|
395
405
|
if (r.length === 0) return;
|
|
396
406
|
let i = r.map((e) => `${e.name}@${e.version} (${e.licenseExpression === "" ? "no licence" : e.licenseExpression})`).join(", ");
|
|
397
407
|
throw Error(`Rust crates with licences not allowed: ${i}.`);
|
|
398
408
|
}
|
|
399
|
-
function
|
|
409
|
+
function ot(e) {
|
|
400
410
|
try {
|
|
401
411
|
return he(e, [e]);
|
|
402
412
|
} catch {
|
|
403
413
|
return !1;
|
|
404
414
|
}
|
|
405
415
|
}
|
|
406
|
-
function
|
|
416
|
+
function st(e, t) {
|
|
407
417
|
try {
|
|
408
418
|
return he(e.replaceAll("/", " OR "), t);
|
|
409
419
|
} catch {
|
|
410
420
|
return !1;
|
|
411
421
|
}
|
|
412
422
|
}
|
|
413
|
-
async function
|
|
423
|
+
async function ct(e, t) {
|
|
414
424
|
let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
|
|
415
425
|
if (n == null) return [];
|
|
416
|
-
let r = E.dirname(n.manifest_path), i = (await T.readdir(r)).filter((e) =>
|
|
426
|
+
let r = E.dirname(n.manifest_path), i = (await T.readdir(r)).filter((e) => tt.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
|
|
417
427
|
await T.mkdir("licenses/downloads", { recursive: !0 });
|
|
418
428
|
let a = [];
|
|
419
429
|
for (let t of i) {
|
|
@@ -425,14 +435,14 @@ async function st(e, t) {
|
|
|
425
435
|
}
|
|
426
436
|
return a;
|
|
427
437
|
}
|
|
428
|
-
async function
|
|
438
|
+
async function lt(e, t) {
|
|
429
439
|
w(`${e} - fetch release dates from crates.io`);
|
|
430
440
|
for (let [e, n] of t.entries()) {
|
|
431
|
-
e > 0 && await me(
|
|
441
|
+
e > 0 && await me(Qe), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
|
|
432
442
|
try {
|
|
433
443
|
let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, {
|
|
434
|
-
headers: { "User-Agent":
|
|
435
|
-
signal: AbortSignal.timeout(
|
|
444
|
+
headers: { "User-Agent": et },
|
|
445
|
+
signal: AbortSignal.timeout($e)
|
|
436
446
|
});
|
|
437
447
|
if (!e.ok) continue;
|
|
438
448
|
let t = await e.json(), r = new Map((t.versions ?? []).map((e) => [e.num, e.created_at]));
|
|
@@ -440,79 +450,78 @@ async function ct(e, t) {
|
|
|
440
450
|
} catch {}
|
|
441
451
|
}
|
|
442
452
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
async function pt(e = "MIT") {
|
|
453
|
+
// src/actions/documentDependencies.ts
|
|
454
|
+
var j = "<!-- DEPENDENCY_LICENSES_START -->", M = "<!-- DEPENDENCY_LICENSES_END -->", N = "## Dependency Licenses", ut = `bundle-analysis-reports/${se}`, P = "licenses/licenseTree.json", dt = "Packages flagged ❗ have a newer version available; ⚠️ indicates a package that hasn't been updated in the last 6 months or longer. Neither flag necessarily indicates a problem: we let new releases stabilise before upgrading, and some packages are mature and stable (have limited or no dependencies), so they require no active development.", ft = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${dt}`, pt = `The dependency tree below shows how each package in the table above is reached — direct and transitive — along with its installed version, release date, and update status. A package that does not ship itself, such as one whose parts are bundled separately, is left out and what ships beneath it is shown in its place. ${dt}`;
|
|
455
|
+
async function mt(e = "MIT") {
|
|
447
456
|
try {
|
|
448
457
|
l("Document Dependencies");
|
|
449
458
|
let t = await C("package.json"), n = t.name ?? "";
|
|
450
459
|
if (re.has(n)) {
|
|
451
|
-
await
|
|
460
|
+
await ht(n), x("Dependencies documented");
|
|
452
461
|
return;
|
|
453
462
|
}
|
|
454
463
|
await m("1️⃣ Clear downloaded licenses", "licenses/downloads");
|
|
455
|
-
let r = await
|
|
464
|
+
let r = await wt(), i = await Tt();
|
|
456
465
|
if (i === null) {
|
|
457
|
-
let n =
|
|
458
|
-
await
|
|
466
|
+
let n = kt(r);
|
|
467
|
+
await Ct("2️⃣ Identify production licenses", e, [t.name ?? "", ...n], !0), await o("3️⃣ Identify transitive dependencies", "npm", [
|
|
459
468
|
"ls",
|
|
460
469
|
"--all",
|
|
461
470
|
"--json",
|
|
462
471
|
"--omit=dev"
|
|
463
|
-
],
|
|
472
|
+
], P), await gt("4️⃣ ", e, new Set(n));
|
|
464
473
|
} else {
|
|
465
|
-
let n =
|
|
466
|
-
await
|
|
474
|
+
let n = Et(i, r), a = Dt(r), s = a.filter((e) => !n.has(e));
|
|
475
|
+
await Ct("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), Ot(n, new Set(a)), await o("3️⃣ Identify transitive dependencies", "npm", [
|
|
467
476
|
"ls",
|
|
468
477
|
"--all",
|
|
469
478
|
"--json"
|
|
470
|
-
],
|
|
471
|
-
let c = await
|
|
479
|
+
], P, !0);
|
|
480
|
+
let c = await rt("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
|
|
472
481
|
allowedLicenses: e,
|
|
473
|
-
productionNames:
|
|
482
|
+
productionNames: xt(t),
|
|
474
483
|
rustCrates: c,
|
|
475
484
|
shippedKeys: n
|
|
476
485
|
};
|
|
477
|
-
await
|
|
486
|
+
await _t(c === null ? "4️⃣ " : "5️⃣ ", l);
|
|
478
487
|
}
|
|
479
488
|
x("Dependencies documented");
|
|
480
489
|
} catch (e) {
|
|
481
490
|
console.error("❌ Error documenting dependencies", e), process.exit(1);
|
|
482
491
|
}
|
|
483
492
|
}
|
|
484
|
-
async function
|
|
493
|
+
async function ht(t) {
|
|
485
494
|
w(`1️⃣ Skip: ${t} is a development-only tool and is never part of a production release.`);
|
|
486
495
|
let n = `> [!WARNING]\n> Dependency licenses are not documented here: ${t} is a development-only tool and is never part of a production release.`;
|
|
487
|
-
await e(`${
|
|
496
|
+
await e(`${N}\n\n${n}`, j, M);
|
|
488
497
|
}
|
|
489
|
-
async function
|
|
498
|
+
async function gt(t, n, r) {
|
|
490
499
|
w(`${t} Insert licenses into 'README.md'`);
|
|
491
|
-
let i = await C(
|
|
492
|
-
for (let e of a.values()) o +=
|
|
500
|
+
let i = await C(P), a = await St(), o = `${Nt(n, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
501
|
+
for (let e of a.values()) o += I(e);
|
|
493
502
|
let s = [];
|
|
494
|
-
i.dependencies != null &&
|
|
495
|
-
let c = `${
|
|
496
|
-
await e(`${
|
|
503
|
+
i.dependencies != null && Lt(i.dependencies, a, r, s, 0);
|
|
504
|
+
let c = `${ft}\n\n${s.join("\n")}`;
|
|
505
|
+
await e(`${N}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${c}`, j, M);
|
|
497
506
|
}
|
|
498
|
-
async function
|
|
507
|
+
async function _t(t, n) {
|
|
499
508
|
w(`${t} Insert licenses into 'README.md'`);
|
|
500
|
-
let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = n, s = await
|
|
501
|
-
for (let e of s.values().toArray().toSorted(
|
|
502
|
-
for (let e of c.values().toArray().toSorted(
|
|
503
|
-
let f = await C(
|
|
504
|
-
|
|
509
|
+
let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = n, s = await St(), c = new Map((a?.crates ?? []).map((e) => [`${e.name}@${e.version}`, yt(e)])), l = a !== null, u = l ? "|Type|Dependency|Version|License(s)|Document|\n|:-|:-|:-:|:-|:-|" : "|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|", d = `${Nt(r, !0, l)}\n\n${u}\n`;
|
|
510
|
+
for (let e of s.values().toArray().toSorted(vt)) d += I(e, l ? "JavaScript" : void 0);
|
|
511
|
+
for (let e of c.values().toArray().toSorted(vt)) d += I(e, "Rust");
|
|
512
|
+
let f = await C(P), p = Object.entries(f.dependencies ?? {}).toSorted(([e], [t]) => Number(!i.has(e)) - Number(!i.has(t))), m = [];
|
|
513
|
+
L(p, {
|
|
505
514
|
licensesByKey: s,
|
|
506
515
|
shippedKeys: o,
|
|
507
516
|
shownKeys: /* @__PURE__ */ new Set()
|
|
508
517
|
}, m, 0, !1);
|
|
509
|
-
let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) =>
|
|
510
|
-
await e(`${
|
|
518
|
+
let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) => bt(e, c)).join("\n"), _ = l ? `${pt}\n\n#### JavaScript\n\n${h}\n\n#### Rust\n\n${g}` : `${pt}\n\n${h}`;
|
|
519
|
+
await e(`${N}\n\n${d.trimEnd()}\n\n### Dependency Tree\n\n${_}`, j, M);
|
|
511
520
|
}
|
|
512
|
-
function
|
|
521
|
+
function vt(e, t) {
|
|
513
522
|
return e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en");
|
|
514
523
|
}
|
|
515
|
-
function
|
|
524
|
+
function yt(e) {
|
|
516
525
|
return {
|
|
517
526
|
name: e.name,
|
|
518
527
|
repository: e.repository,
|
|
@@ -525,26 +534,26 @@ function vt(e) {
|
|
|
525
534
|
licenseFiles: e.licenseFiles
|
|
526
535
|
};
|
|
527
536
|
}
|
|
528
|
-
function
|
|
537
|
+
function bt(e, t) {
|
|
529
538
|
let n = " ".repeat(e.depth);
|
|
530
|
-
return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` :
|
|
539
|
+
return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` : R(e.name, e.version, t.get(`${e.name}@${e.version}`), n);
|
|
531
540
|
}
|
|
532
|
-
function
|
|
541
|
+
function xt(e) {
|
|
533
542
|
return /* @__PURE__ */ new Set([
|
|
534
543
|
...Object.keys(e.dependencies ?? {}),
|
|
535
544
|
...Object.keys(e.optionalDependencies ?? {}),
|
|
536
545
|
...Object.keys(e.peerDependencies ?? {})
|
|
537
546
|
]);
|
|
538
547
|
}
|
|
539
|
-
async function
|
|
548
|
+
async function St() {
|
|
540
549
|
let e = await C("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
|
|
541
|
-
for (let [n, r] of Object.entries(e)) t.set(n,
|
|
550
|
+
for (let [n, r] of Object.entries(e)) t.set(n, Ft(n, r));
|
|
542
551
|
return await Promise.all(t.values().map(async (e) => {
|
|
543
|
-
let t = await
|
|
552
|
+
let t = await It(e.name, e.installedVersion);
|
|
544
553
|
e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
|
|
545
554
|
})), t;
|
|
546
555
|
}
|
|
547
|
-
async function
|
|
556
|
+
async function Ct(e, t, n, r) {
|
|
548
557
|
w(e), await new Promise((e, i) => {
|
|
549
558
|
let a = {
|
|
550
559
|
start: process.cwd(),
|
|
@@ -562,58 +571,58 @@ async function St(e, t, n, r) {
|
|
|
562
571
|
});
|
|
563
572
|
});
|
|
564
573
|
}
|
|
565
|
-
async function
|
|
574
|
+
async function wt() {
|
|
566
575
|
let e = await t("package-lock.json");
|
|
567
576
|
return e === null ? {} : JSON.parse(e).packages ?? {};
|
|
568
577
|
}
|
|
569
|
-
async function
|
|
570
|
-
let e = await t(
|
|
578
|
+
async function Tt() {
|
|
579
|
+
let e = await t(ut);
|
|
571
580
|
return e === null ? null : JSON.parse(e);
|
|
572
581
|
}
|
|
573
|
-
function
|
|
582
|
+
function Et(e, t) {
|
|
574
583
|
let n = new Set(e.packages);
|
|
575
584
|
for (let r of e.external) {
|
|
576
|
-
let e =
|
|
577
|
-
if (e !== void 0) for (let r of [e, ...
|
|
585
|
+
let e = Mt(t, "", r);
|
|
586
|
+
if (e !== void 0) for (let r of [e, ...At(t, e)]) {
|
|
578
587
|
let e = t[r];
|
|
579
|
-
e?.version !== void 0 && n.add(
|
|
588
|
+
e?.version !== void 0 && n.add(F(r, e));
|
|
580
589
|
}
|
|
581
590
|
}
|
|
582
591
|
return n;
|
|
583
592
|
}
|
|
584
|
-
function
|
|
593
|
+
function Dt(e) {
|
|
585
594
|
let t = /* @__PURE__ */ new Set();
|
|
586
|
-
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(
|
|
595
|
+
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(F(n, r));
|
|
587
596
|
return [...t];
|
|
588
597
|
}
|
|
589
|
-
function
|
|
598
|
+
function Ot(e, t) {
|
|
590
599
|
let n = [...e.difference(t)];
|
|
591
600
|
n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
|
|
592
601
|
}
|
|
593
|
-
function
|
|
602
|
+
function F(e, t) {
|
|
594
603
|
return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
|
|
595
604
|
}
|
|
596
|
-
function
|
|
597
|
-
let t =
|
|
605
|
+
function kt(e) {
|
|
606
|
+
let t = At(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
598
607
|
for (let [i, a] of Object.entries(e)) {
|
|
599
608
|
if (i === "" || a.version === void 0) continue;
|
|
600
|
-
let e =
|
|
609
|
+
let e = F(i, a);
|
|
601
610
|
t.has(i) ? n.add(e) : r.add(e);
|
|
602
611
|
}
|
|
603
612
|
return r.values().filter((e) => !n.has(e)).toArray();
|
|
604
613
|
}
|
|
605
|
-
function
|
|
614
|
+
function At(e, t) {
|
|
606
615
|
let n = /* @__PURE__ */ new Set(), r = [t];
|
|
607
616
|
for (; r.length > 0;) {
|
|
608
617
|
let t = r.pop() ?? "", i = e[t];
|
|
609
|
-
if (i !== void 0) for (let a of
|
|
610
|
-
let i =
|
|
618
|
+
if (i !== void 0) for (let a of jt(i)) {
|
|
619
|
+
let i = Mt(e, t, a);
|
|
611
620
|
i === void 0 || n.has(i) || (n.add(i), r.push(i));
|
|
612
621
|
}
|
|
613
622
|
}
|
|
614
623
|
return n;
|
|
615
624
|
}
|
|
616
|
-
function
|
|
625
|
+
function jt(e) {
|
|
617
626
|
let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
|
|
618
627
|
return [
|
|
619
628
|
...Object.keys(e.dependencies ?? {}),
|
|
@@ -621,7 +630,7 @@ function At(e) {
|
|
|
621
630
|
...t
|
|
622
631
|
];
|
|
623
632
|
}
|
|
624
|
-
function
|
|
633
|
+
function Mt(e, t, n) {
|
|
625
634
|
let r = t;
|
|
626
635
|
for (;;) {
|
|
627
636
|
let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
|
|
@@ -631,14 +640,14 @@ function jt(e, t, n) {
|
|
|
631
640
|
r = a === -1 ? "" : r.slice(0, a);
|
|
632
641
|
}
|
|
633
642
|
}
|
|
634
|
-
function
|
|
635
|
-
let r =
|
|
643
|
+
function Nt(e, t, n = !1) {
|
|
644
|
+
let r = Pt(e.split(";")), i = n ? "[license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn) and [cargo tree](https://doc.rust-lang.org/cargo/commands/cargo-tree.html)" : "[license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn)", a = "The following table lists every package whose code, styles or assets are included in this project's build, as recorded by the build itself. Modules loaded at run time are not included; each documents its own.";
|
|
636
645
|
return `License data is updated each time \`npm run document\` is run, using ${i}. ${t ? n ? `${a} It also lists every Rust crate compiled into its WebAssembly, as resolved by Cargo; macros and other crates used only while compiling put none of their code in it, so are left out.` : a : "The following table lists all production dependencies. This project has no build record, so the list is taken from its declared dependencies."} These dependencies have been checked and confirmed to use ${r}, all of which allow commercial use. All are used unmodified, so any licence conditions that apply only to modified versions are not triggered. Developers cloning this repository should independently verify development dependencies.`;
|
|
637
646
|
}
|
|
638
|
-
function
|
|
647
|
+
function Pt(e) {
|
|
639
648
|
return e.length === 1 ? e[0] ?? "" : e.length === 2 ? `${String(e[0])} or ${String(e[1])}` : `${e.slice(0, -1).join(", ")}, or ${String(e.at(-1))}`;
|
|
640
649
|
}
|
|
641
|
-
function
|
|
650
|
+
function Ft(e, t) {
|
|
642
651
|
let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
|
|
643
652
|
return {
|
|
644
653
|
name: r,
|
|
@@ -655,7 +664,7 @@ function Pt(e, t) {
|
|
|
655
664
|
}]
|
|
656
665
|
};
|
|
657
666
|
}
|
|
658
|
-
async function
|
|
667
|
+
async function It(e, t) {
|
|
659
668
|
try {
|
|
660
669
|
let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
|
|
661
670
|
if (n.ok) {
|
|
@@ -673,80 +682,79 @@ async function Ft(e, t) {
|
|
|
673
682
|
publishedDate: ""
|
|
674
683
|
};
|
|
675
684
|
}
|
|
676
|
-
function
|
|
685
|
+
function I(e, t) {
|
|
677
686
|
let n = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
|
|
678
687
|
return `${t === void 0 ? "" : `|${t}`}|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${n}|\n`;
|
|
679
688
|
}
|
|
680
|
-
function
|
|
689
|
+
function Lt(e, t, n, r, i) {
|
|
681
690
|
let a = " ".repeat(i);
|
|
682
691
|
for (let [o, s] of Object.entries(e)) {
|
|
683
692
|
if (s.version === void 0) continue;
|
|
684
693
|
let e = s.version;
|
|
685
|
-
n.has(`${o}@${e}`) || (r.push(
|
|
694
|
+
n.has(`${o}@${e}`) || (r.push(R(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && Lt(s.dependencies, t, n, r, i + 1));
|
|
686
695
|
}
|
|
687
696
|
}
|
|
688
|
-
function
|
|
697
|
+
function L(e, t, n, r, i) {
|
|
689
698
|
for (let [a, o] of e) {
|
|
690
699
|
if (o.version === void 0) continue;
|
|
691
700
|
let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
|
|
692
|
-
t.shippedKeys.has(e) ? i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(
|
|
701
|
+
t.shippedKeys.has(e) ? i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(R(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), L(s, t, n, r + 1, !1)) : L(s, t, n, r, !0);
|
|
693
702
|
}
|
|
694
703
|
}
|
|
695
|
-
function
|
|
696
|
-
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${
|
|
704
|
+
function R(e, t, n, r) {
|
|
705
|
+
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${Rt(n)}`;
|
|
697
706
|
}
|
|
698
|
-
function
|
|
707
|
+
function Rt(e) {
|
|
699
708
|
if (e == null) return "";
|
|
700
|
-
let t = e.publishedDate ?
|
|
709
|
+
let t = e.publishedDate ? zt(e.publishedDate.split("T", 1)[0]) : "";
|
|
701
710
|
if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
|
|
702
|
-
let n = e.latestPublishedDate ?
|
|
711
|
+
let n = e.latestPublishedDate ? zt(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `latest: ${e.latestVersion} ❗` : `latest: ${e.latestVersion} — ${n} ❗`;
|
|
703
712
|
return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
|
|
704
713
|
}
|
|
705
|
-
function
|
|
714
|
+
function zt(e) {
|
|
706
715
|
if (e == null || e === "") return "n/a";
|
|
707
716
|
let t = e.split("T", 1)[0];
|
|
708
717
|
if (t == null || t === "") return "n/a";
|
|
709
718
|
let n = new Date(t), r = /* @__PURE__ */ new Date(), i = (r.getFullYear() - n.getFullYear()) * 12 + (r.getMonth() - n.getMonth());
|
|
710
719
|
return r.getDate() < n.getDate() && --i, i === 0 ? `this month: ${t}` : i === 1 ? `1 mth ago: ${t}` : i <= 6 ? `${String(i)} mths ago: ${t}` : `${String(i)} mths ago: ${t} ⚠️`;
|
|
711
720
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
async function Vt() {
|
|
721
|
+
// src/actions/documentOpening.ts
|
|
722
|
+
var Bt = "<!-- OPENING_START -->", Vt = "<!-- OPENING_END -->";
|
|
723
|
+
async function Ht() {
|
|
716
724
|
try {
|
|
717
725
|
l("Document Opening"), w("1️⃣ Insert opening content into 'README.md'");
|
|
718
|
-
let t = await C("package.json"), n = await C("config.json"), { owner: r, repository: i } = S(t, "document opening"), a =
|
|
726
|
+
let t = await C("package.json"), n = await C("config.json"), { owner: r, repository: i } = S(t, "document opening"), a = Wt(t), o = Kt(n), s = g(n.id), c = s.uploadGroupName === void 0 ? void 0 : n.id, u = s.publishedTo === "npm" ? Gt(t) : void 0, d = qt(r, i, a, {
|
|
719
727
|
description: t.description,
|
|
720
728
|
dpuseModuleId: c,
|
|
721
729
|
introduction: o,
|
|
722
730
|
npmPackageName: u,
|
|
723
731
|
version: t.version
|
|
724
732
|
});
|
|
725
|
-
await e(d,
|
|
733
|
+
await e(d, Bt, Vt), x("Opening documented");
|
|
726
734
|
} catch (e) {
|
|
727
735
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
728
736
|
}
|
|
729
737
|
}
|
|
730
|
-
function
|
|
738
|
+
function Ut(e) {
|
|
731
739
|
return e === void 0 ? "blue" : /^v?0/.test(e) || /alpha|beta|snapshot|dev|pre|rc/i.test(e) ? "orange" : "blue";
|
|
732
740
|
}
|
|
733
|
-
function
|
|
741
|
+
function Wt(e) {
|
|
734
742
|
let t = e.license;
|
|
735
743
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
736
744
|
return t;
|
|
737
745
|
}
|
|
738
|
-
function
|
|
746
|
+
function Gt(e) {
|
|
739
747
|
let t = e.name;
|
|
740
748
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
|
|
741
749
|
return t;
|
|
742
750
|
}
|
|
743
|
-
function
|
|
751
|
+
function Kt(e) {
|
|
744
752
|
let t = e.description.en?.trim();
|
|
745
753
|
return t === void 0 || t === "" ? void 0 : t;
|
|
746
754
|
}
|
|
747
|
-
function
|
|
755
|
+
function qt(e, t, n, r) {
|
|
748
756
|
let { description: i, dpuseModuleId: a, introduction: o, npmPackageName: s, version: c } = r, l = `https://github.com/${e}/${t}`, u = n.replaceAll("-", "--"), d = encodeURIComponent(`https://api.dpuse.app/configs/${a ?? ""}`);
|
|
749
|
-
return `[](./LICENSE)${a === void 0 ? "" : `\n[](./LICENSE)${a === void 0 ? "" : `\n[})](${l}/releases/latest)`}${s === void 0 ? "" : `\n[](https://www.npmjs.com/package/${s})`}
|
|
750
758
|
[](${l}/actions/workflows/ci.yml)${i == null || i === "" ? "" : `\n\n${i}`}
|
|
751
759
|
|
|
752
760
|
[Report a Vulnerability](${l}/security/advisories/new) · [Open an Issue](${l}/issues)
|
|
@@ -763,33 +771,32 @@ function Kt(e, t, n, r) {
|
|
|
763
771
|
|
|
764
772
|
In addition, DPUse provides [Tools](https://www.dpuse.app) used by the application, and you can use them to construct connectors and presenters.${o === void 0 ? "" : `\n\n## Introduction\n\n${o}`}`;
|
|
765
773
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
var qt = {
|
|
774
|
+
// src/actions/documentQualitySecurity.ts
|
|
775
|
+
var Jt = {
|
|
769
776
|
"Branch-Protection": 3,
|
|
770
777
|
"Code-Review": 0,
|
|
771
778
|
Contributors: 0
|
|
772
|
-
},
|
|
779
|
+
}, Yt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Xt = "coverage/coverage-final.json", Zt = "coverage/coverage-summary.json", Qt = 80, $t = 60, en = "code-health-reports/vitest/badge.json", tn = {
|
|
773
780
|
actions: "GitHub Actions",
|
|
774
781
|
"javascript-typescript": "JavaScript/TypeScript",
|
|
775
782
|
rust: "Rust"
|
|
776
|
-
},
|
|
783
|
+
}, nn = {
|
|
777
784
|
A: "brightgreen",
|
|
778
785
|
B: "green",
|
|
779
786
|
C: "yellow",
|
|
780
787
|
D: "orange",
|
|
781
788
|
F: "red"
|
|
782
|
-
},
|
|
783
|
-
async function
|
|
789
|
+
}, rn = `${u}/health.json`, an = le(ue);
|
|
790
|
+
async function on() {
|
|
784
791
|
try {
|
|
785
792
|
l("Document Quality & Security");
|
|
786
|
-
let t = await C("package.json"), n = await
|
|
793
|
+
let t = await C("package.json"), n = await sn(t), r = await ln(t, n === void 0 ? [] : ["--coverage", Xt]), { owner: i, repository: a } = S(t, "document quality and security");
|
|
787
794
|
w("4️⃣ Read security checks and settings");
|
|
788
|
-
let o = await
|
|
795
|
+
let o = await dn(i, a, t);
|
|
789
796
|
w("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
|
|
790
|
-
let [s, c] = await Promise.all([
|
|
797
|
+
let [s, c] = await Promise.all([fn(`https://github.com/${i}/${a}`), pn(`github.com/${i}/${a}`)]);
|
|
791
798
|
w("6️⃣ Insert quality and security content into 'README.md'");
|
|
792
|
-
let u =
|
|
799
|
+
let u = vn(i, a, {
|
|
793
800
|
coveragePercent: n,
|
|
794
801
|
fallowHealth: r,
|
|
795
802
|
securitySettings: o
|
|
@@ -799,7 +806,7 @@ async function an() {
|
|
|
799
806
|
console.error("❌ Error documenting quality and security", e), process.exit(1);
|
|
800
807
|
}
|
|
801
808
|
}
|
|
802
|
-
async function
|
|
809
|
+
async function sn(e) {
|
|
803
810
|
if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
|
|
804
811
|
w("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
|
|
805
812
|
return;
|
|
@@ -809,25 +816,25 @@ async function on(e) {
|
|
|
809
816
|
"--passWithNoTests",
|
|
810
817
|
"--coverage"
|
|
811
818
|
]);
|
|
812
|
-
let n = await t(
|
|
819
|
+
let n = await t(Zt);
|
|
813
820
|
if (n === null) return;
|
|
814
821
|
let i = JSON.parse(n).total.lines.pct;
|
|
815
|
-
if (i !== "Unknown") return await
|
|
822
|
+
if (i !== "Unknown") return await cn(i), i;
|
|
816
823
|
}
|
|
817
|
-
async function
|
|
824
|
+
async function cn(e) {
|
|
818
825
|
let t = [
|
|
819
826
|
"red",
|
|
820
827
|
"yellow",
|
|
821
828
|
"brightgreen"
|
|
822
|
-
], n = Number(e >=
|
|
823
|
-
await v(
|
|
829
|
+
], n = Number(e >= $t) + Number(e >= Qt);
|
|
830
|
+
await v(en, {
|
|
824
831
|
schemaVersion: 1,
|
|
825
832
|
label: "coverage",
|
|
826
833
|
message: `${e.toFixed(1)}%`,
|
|
827
834
|
color: t[n]
|
|
828
835
|
});
|
|
829
836
|
}
|
|
830
|
-
async function
|
|
837
|
+
async function ln(e, t) {
|
|
831
838
|
if (e.devDependencies?.fallow == null) {
|
|
832
839
|
w("2️⃣ Code health NOT measured, as Fallow is not installed"), w("3️⃣ Code health report NOT required");
|
|
833
840
|
return;
|
|
@@ -838,32 +845,32 @@ async function cn(e, t) {
|
|
|
838
845
|
"--format",
|
|
839
846
|
"json",
|
|
840
847
|
...t
|
|
841
|
-
],
|
|
842
|
-
let n = await C(
|
|
843
|
-
return await
|
|
848
|
+
], rn), await o("3️⃣ Write code health report", "fallow", ["--format", "markdown"], ne, !0);
|
|
849
|
+
let n = await C(rn);
|
|
850
|
+
return await un(n), n;
|
|
844
851
|
}
|
|
845
|
-
async function
|
|
852
|
+
async function un(e) {
|
|
846
853
|
let { score: t, grade: n } = e.health_score;
|
|
847
854
|
await v(_, {
|
|
848
855
|
schemaVersion: 1,
|
|
849
856
|
label: "fallow",
|
|
850
857
|
message: `${n} (${String(Math.round(t))})`,
|
|
851
|
-
color:
|
|
858
|
+
color: nn[n] ?? "lightgrey"
|
|
852
859
|
});
|
|
853
860
|
}
|
|
854
|
-
async function
|
|
861
|
+
async function dn(e, n, r) {
|
|
855
862
|
let [i, a, o] = await Promise.all([
|
|
856
863
|
t(".github/workflows/ci.yml"),
|
|
857
864
|
t(".github/dependabot.yml"),
|
|
858
865
|
t(y)
|
|
859
866
|
]), s = await t(".github/workflows/codeql.yml") ?? "", [c, l, u, d] = await Promise.all([
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
867
|
+
z(`repos/${e}/${n}`),
|
|
868
|
+
z(`repos/${e}/${n}/private-vulnerability-reporting`),
|
|
869
|
+
z(`repos/${e}/${n}/vulnerability-alerts`),
|
|
870
|
+
z(`repos/${e}/${n}/commits/main/check-runs?per_page=100`)
|
|
864
871
|
]), f = c === void 0 ? void 0 : JSON.parse(c).security_and_analysis, p = (e) => f?.[e] === void 0 ? void 0 : f[e].status === "enabled", m = new Set((d === void 0 ? [] : JSON.parse(d).check_runs).map((e) => e.app?.slug)), h = a?.match(/package-ecosystem:/g)?.length ?? 0, g = a?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
|
|
865
872
|
return {
|
|
866
|
-
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) =>
|
|
873
|
+
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => tn[e] ?? e).toArray(),
|
|
867
874
|
codeQLQueries: /queries: ([\w-]+)/.exec(s)?.[1],
|
|
868
875
|
dependabotAlerts: u !== void 0,
|
|
869
876
|
dependabotSecurityUpdates: p("dependabot_security_updates"),
|
|
@@ -880,37 +887,37 @@ async function un(e, n, r) {
|
|
|
880
887
|
testsInCI: i?.includes("npm test") ?? !1
|
|
881
888
|
};
|
|
882
889
|
}
|
|
883
|
-
async function
|
|
890
|
+
async function z(e) {
|
|
884
891
|
try {
|
|
885
|
-
let { stdout: t } = await
|
|
892
|
+
let { stdout: t } = await an("gh", ["api", e]);
|
|
886
893
|
return t;
|
|
887
894
|
} catch (e) {
|
|
888
895
|
if (String(e.stderr).includes("HTTP 404")) return;
|
|
889
896
|
throw e;
|
|
890
897
|
}
|
|
891
898
|
}
|
|
892
|
-
async function
|
|
899
|
+
async function fn(e) {
|
|
893
900
|
let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
|
|
894
901
|
if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
|
|
895
902
|
return (await t.json()).find((t) => t.repo_url === e)?.id;
|
|
896
903
|
}
|
|
897
|
-
async function
|
|
904
|
+
async function pn(e) {
|
|
898
905
|
let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
|
|
899
906
|
if (t.status !== 404) {
|
|
900
907
|
if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
|
|
901
908
|
return await t.json();
|
|
902
909
|
}
|
|
903
910
|
}
|
|
904
|
-
function pn(e) {
|
|
905
|
-
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Jt.has(e) || qt[e] !== void 0 && t >= qt[e]);
|
|
906
|
-
}
|
|
907
911
|
function mn(e) {
|
|
912
|
+
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Yt.has(e) || Jt[e] !== void 0 && t >= Jt[e]);
|
|
913
|
+
}
|
|
914
|
+
function hn(e) {
|
|
908
915
|
return e === !1 ? " These are handled manually." : "";
|
|
909
916
|
}
|
|
910
|
-
function
|
|
917
|
+
function B(e) {
|
|
911
918
|
return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
|
|
912
919
|
}
|
|
913
|
-
function
|
|
920
|
+
function V(e, t) {
|
|
914
921
|
return t.length === 0 ? "" : `### ${e}
|
|
915
922
|
|
|
916
923
|
|Check|Status|What it does|
|
|
@@ -919,90 +926,90 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
|
|
|
919
926
|
|
|
920
927
|
`;
|
|
921
928
|
}
|
|
922
|
-
function
|
|
929
|
+
function gn(e, t, n, r) {
|
|
923
930
|
return `})`;
|
|
924
931
|
}
|
|
925
|
-
function
|
|
932
|
+
function _n(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
926
933
|
let a = `https://github.com/${e}/${t}`, o = (e) => e ? ` Part of the [CI workflow](${a}/actions/workflows/ci.yml) on every push and pull request to \`main\`.` : "", s = [[
|
|
927
934
|
"Unit tests",
|
|
928
|
-
|
|
935
|
+
B(i.testsInCI),
|
|
929
936
|
`[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
|
|
930
937
|
], [
|
|
931
938
|
"Property-based tests",
|
|
932
|
-
|
|
939
|
+
B(i.propertyTests),
|
|
933
940
|
`[fast-check](https://fast-check.dev) runs many random inputs per test to find edge cases, alongside the unit tests.${o(i.propertyTests && i.testsInCI)}`
|
|
934
941
|
]];
|
|
935
942
|
n !== void 0 && s.push([
|
|
936
943
|
"Test coverage",
|
|
937
|
-
|
|
938
|
-
`${
|
|
944
|
+
B(!0),
|
|
945
|
+
`${gn(e, t, "Coverage", en)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(Qt)}%.`
|
|
939
946
|
]);
|
|
940
947
|
let c = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, l = [[
|
|
941
948
|
"Code analysis",
|
|
942
|
-
|
|
949
|
+
B(i.sonarCloud),
|
|
943
950
|
`${i.sonarCloud ? c : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
|
|
944
951
|
], [
|
|
945
952
|
"Linting",
|
|
946
|
-
|
|
953
|
+
B(i.lintInCI),
|
|
947
954
|
`[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
|
|
948
955
|
]];
|
|
949
956
|
r !== void 0 && l.unshift([
|
|
950
957
|
"Code health",
|
|
951
|
-
|
|
952
|
-
`[${
|
|
958
|
+
B(!0),
|
|
959
|
+
`[${gn(e, t, "Fallow code health", _)}](./${ne}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
|
|
953
960
|
]);
|
|
954
961
|
let u = i.codeQLLanguages.length > 0, d = `[](${a}/security/code-scanning) `, f = i.codeQLQueries === "security-extended" ? "using the extended security queries" : "using the default queries", p = u ? ` ${i.codeQLLanguages.join(" and ")}` : "", m = [
|
|
955
962
|
[
|
|
956
963
|
"Push protection",
|
|
957
|
-
|
|
964
|
+
B(i.pushProtection),
|
|
958
965
|
"[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
|
|
959
966
|
],
|
|
960
967
|
[
|
|
961
968
|
"Static analysis",
|
|
962
|
-
|
|
969
|
+
B(u),
|
|
963
970
|
`${u ? d : ""}[CodeQL](https://codeql.github.com) scans${p} for security vulnerabilities, ${f}, on every push and pull request to \`main\` and weekly.`
|
|
964
971
|
],
|
|
965
972
|
[
|
|
966
973
|
"Secret scanning",
|
|
967
|
-
|
|
974
|
+
B(i.secretScanning),
|
|
968
975
|
"[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
|
|
969
976
|
]
|
|
970
977
|
], h = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", g = [
|
|
971
978
|
[
|
|
972
979
|
"Vulnerability audit",
|
|
973
|
-
|
|
980
|
+
B(i.npmAuditInCI),
|
|
974
981
|
i.npmAuditLevel === void 0 ? `[npm audit](https://docs.npmjs.com/cli/commands/npm-audit) fails when a shipped dependency has any known vulnerability, or a development dependency has a high or critical one.${o(i.npmAuditInCI)}` : `[npm audit](https://docs.npmjs.com/cli/commands/npm-audit) fails when a dependency has a known vulnerability of ${i.npmAuditLevel} severity or above.${o(i.npmAuditInCI)}`
|
|
975
982
|
],
|
|
976
983
|
[
|
|
977
984
|
"Supply chain risk",
|
|
978
|
-
|
|
985
|
+
B(i.socket),
|
|
979
986
|
"[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
|
|
980
987
|
],
|
|
981
988
|
[
|
|
982
989
|
"Security alerts",
|
|
983
|
-
|
|
990
|
+
B(i.dependabotAlerts),
|
|
984
991
|
`${h} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
|
|
985
992
|
],
|
|
986
993
|
[
|
|
987
994
|
"Security updates",
|
|
988
|
-
|
|
989
|
-
`${h} opens pull requests that update vulnerable dependencies.${
|
|
995
|
+
B(i.dependabotSecurityUpdates),
|
|
996
|
+
`${h} opens pull requests that update vulnerable dependencies.${hn(i.dependabotSecurityUpdates)}`
|
|
990
997
|
],
|
|
991
998
|
[
|
|
992
999
|
"Version updates",
|
|
993
|
-
|
|
994
|
-
`${h} opens pull requests for new dependency versions.${
|
|
1000
|
+
B(i.dependabotVersionUpdates),
|
|
1001
|
+
`${h} opens pull requests for new dependency versions.${hn(i.dependabotVersionUpdates)}`
|
|
995
1002
|
]
|
|
996
1003
|
];
|
|
997
1004
|
return `This section is updated each time \`npm run document\` is run. Settings come from the repository's workflow files and GitHub. Test coverage and the Fallow score are measured at the same time.
|
|
998
1005
|
|
|
999
|
-
${
|
|
1006
|
+
${V("Testing", s)}${V("Code Quality", l)}${V("Security Analysis", m)}${V("Dependencies", g)}`;
|
|
1000
1007
|
}
|
|
1001
|
-
function
|
|
1002
|
-
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 &&
|
|
1008
|
+
function vn(e, t, n, r, i) {
|
|
1009
|
+
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && mn(i) ? "\n\n> [!NOTE]\n> Apart from the Best Practices badge above, the remaining Scorecard gaps need multi-person review or a pull-request workflow, which this solo-maintained project doesn't use." : "", l = r === void 0 ? "" : `[](${s})\n`, u = n.securitySettings.privateVulnerabilityReporting === !0 ? `Use [GitHub private vulnerability reporting](${a}/security/advisories/new) instead. See [SECURITY.md](./SECURITY.md) for the full disclosure policy, contact details, and expected response times.` : "See [SECURITY.md](./SECURITY.md) for how to report one privately, the full disclosure policy, and expected response times.";
|
|
1003
1010
|
return `## Quality & Security
|
|
1004
1011
|
|
|
1005
|
-
${
|
|
1012
|
+
${_n(e, t, n)}### OpenSSF 🚧
|
|
1006
1013
|
|
|
1007
1014
|
${l}[](https://scorecard.dev/viewer/?uri=${o})
|
|
1008
1015
|
|
|
@@ -1012,39 +1019,38 @@ This project is working towards the [OpenSSF Best Practices](https://www.bestpra
|
|
|
1012
1019
|
|
|
1013
1020
|
Please do not open public GitHub issues for security vulnerabilities. ${u}`;
|
|
1014
1021
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
var vn = "<!-- USAGE_START -->", yn = "<!-- USAGE_END -->", bn = /* @__PURE__ */ new Set([
|
|
1022
|
+
// src/actions/documentUsage.ts
|
|
1023
|
+
var yn = "<!-- USAGE_START -->", bn = "<!-- USAGE_END -->", xn = /* @__PURE__ */ new Set([
|
|
1018
1024
|
"connector",
|
|
1019
1025
|
"cookbook",
|
|
1020
1026
|
"presenter"
|
|
1021
|
-
]),
|
|
1022
|
-
async function
|
|
1027
|
+
]), Sn = /* @__PURE__ */ new Set(["development", "eslint"]), Cn = "> [!WARNING]\n> This project is not designed for general use. It is custom built for the DPUse CI/CD process. You are welcome to clone and customise it for your own purposes, but you will need to adapt it to your own project structure and tooling.", wn = "This repository manages itself using the actions it implements.", Tn = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
|
|
1028
|
+
async function En() {
|
|
1023
1029
|
try {
|
|
1024
1030
|
l("Document Usage"), w("1️⃣ Insert usage content into 'README.md'");
|
|
1025
|
-
let [t, n] = await Promise.all([C("package.json"), C("config.json")]), r =
|
|
1026
|
-
await e(d,
|
|
1031
|
+
let [t, n] = await Promise.all([C("package.json"), C("config.json")]), r = Dn(t), i = On(r), a = H(t.engines?.node), o = H(t.engines?.npm), s = H(t.devDependencies?.typescript), c = kn(g(n.id), t.name), u = `${r.replace(/\.git$/, "")}/blob/main/package.json`, d = An(c, r, i, a, o, s, `${t.name === "@dpuse/dpuse-development" ? wn : Tn} See the \`scripts\` block in [package.json](${u}) for details.`);
|
|
1032
|
+
await e(d, yn, bn), x("Usage documented");
|
|
1027
1033
|
} catch (e) {
|
|
1028
1034
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
1029
1035
|
}
|
|
1030
1036
|
}
|
|
1031
|
-
function
|
|
1037
|
+
function Dn(e) {
|
|
1032
1038
|
let t = e.repository, n = typeof t == "string" ? t : t?.url;
|
|
1033
1039
|
if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
|
|
1034
1040
|
return n.replace(/^git\+/, "");
|
|
1035
1041
|
}
|
|
1036
|
-
function
|
|
1042
|
+
function On(e) {
|
|
1037
1043
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
1038
1044
|
}
|
|
1039
|
-
function
|
|
1045
|
+
function H(e) {
|
|
1040
1046
|
if (e == null) throw Error("package.json version range is required to document usage.");
|
|
1041
1047
|
let t = /\d+(?:\.\d+)*/.exec(e);
|
|
1042
1048
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
1043
1049
|
return t[0];
|
|
1044
1050
|
}
|
|
1045
|
-
function
|
|
1051
|
+
function kn(e, t) {
|
|
1046
1052
|
let { typeId: n } = e;
|
|
1047
|
-
if (
|
|
1053
|
+
if (xn.has(n)) return `This ${n} is automatically uploaded to the DPUse Engine cloud once released and becomes instantly available to all new browser app instances, with existing instances notified of the update.
|
|
1048
1054
|
|
|
1049
1055
|
You may view or clone this repository for your own purposes, such as building a new, similar ${n}, though there is currently no process to accept third-party ${n}s into DPUse at this stage.`;
|
|
1050
1056
|
if (e.publishedTo === "npm") {
|
|
@@ -1055,11 +1061,11 @@ You may view or clone this repository for your own purposes, such as building a
|
|
|
1055
1061
|
npm install ${t}
|
|
1056
1062
|
\`\`\`
|
|
1057
1063
|
|
|
1058
|
-
${
|
|
1064
|
+
${Sn.has(n) ? `${Cn}\n\n` : ""}To work on the source instead, clone this repository.`;
|
|
1059
1065
|
}
|
|
1060
1066
|
return "You may view or clone this repository for your own purposes.";
|
|
1061
1067
|
}
|
|
1062
|
-
function
|
|
1068
|
+
function An(e, t, n, r, i, a, o) {
|
|
1063
1069
|
return `## Usage
|
|
1064
1070
|
|
|
1065
1071
|
${e}
|
|
@@ -1074,64 +1080,62 @@ _Requires [Node.js](https://nodejs.org/) ${r} or later, [npm](https://www.npmjs.
|
|
|
1074
1080
|
|
|
1075
1081
|
${o}`;
|
|
1076
1082
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
async function An() {
|
|
1083
|
+
// src/actions/documentApiReference.ts
|
|
1084
|
+
var U = "API_REFERENCE.md";
|
|
1085
|
+
async function jn() {
|
|
1081
1086
|
try {
|
|
1082
1087
|
l("Document API Reference");
|
|
1083
|
-
let { writeAPIReference: e } = await import("./apiReference-
|
|
1084
|
-
await e("1️⃣ ",
|
|
1088
|
+
let { writeAPIReference: e } = await import("./apiReference-Bg5HYM1L.js");
|
|
1089
|
+
await e("1️⃣ ", U), x("API reference documented");
|
|
1085
1090
|
} catch (e) {
|
|
1086
1091
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
1087
1092
|
}
|
|
1088
1093
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
async function qn(n) {
|
|
1094
|
+
// src/actions/documentBundleSizes.ts
|
|
1095
|
+
var Mn = "bundle-analysis-reports/sonda/index.json", Nn = "bundle-analysis-reports/sonda/worker.json", Pn = "<!-- BUNDLE_START -->", Fn = "<!-- BUNDLE_END -->", W = " ", G = 20, In = "█", Ln = "▒", Rn = 100 / G / 2, zn = 100 / G, Bn = 48, Vn = "This report is updated with each release, from the bundle the release builds, using [Sonda](https://sonda.dev/), which analyses final source maps to reveal the actual effects of tree-shaking and minification rather than relying on pre-build estimates.\n\n_Note: Sonda's Vite reports currently exclude CSS files, since Vite does not generate source maps for CSS._", Hn = "Bars show each row's share of its output file.", Un = "↳ rows are part of the row above.", Wn = "+ n more = the row also holds n more files from the same package or folder, each no larger than the one named. A package can appear under several output files, each holding different files, never the same file twice.", K = "(bundler output, whitespace & JSON)", q = "(inlined worker)", Gn = `${q} = a Web Worker built separately and embedded in its output file as text. Where the build records what it contains, its rows list that; any few bytes over are the escaping needed to embed it.`, J = "(Rust WebAssembly as base64", Kn = `${J}…) = the compiled Rust code, embedded as base64 text, about a third larger than the binary it decodes to, which is the size given.`, qn = `${K} = bytes Sonda can't trace to a source file: whitespace (indentation and line breaks), code the bundler generates (region comments, the combined import/export lines, its small runtime helper and wrappers), and imported JSON such as \`config.json\`, which the bundler doesn't map. The JSON and the generated code are real bytes that ship; the whitespace mostly disappears once compressed.`;
|
|
1096
|
+
async function Jn(n) {
|
|
1093
1097
|
try {
|
|
1094
1098
|
l("Document Bundle Sizes"), w("1️⃣ Read bundle analysis report");
|
|
1095
|
-
let r = await C(
|
|
1099
|
+
let r = await C(Mn), i = await t(Nn), a = i === null ? void 0 : JSON.parse(i), o = /* @__PURE__ */ new Map();
|
|
1096
1100
|
for (let e of r.resources) e.kind === "asset" && o.set(e.name, await t(e.name));
|
|
1097
1101
|
w("2️⃣ Insert table into 'README.md'");
|
|
1098
|
-
let s =
|
|
1102
|
+
let s = Yn(r, {
|
|
1099
1103
|
assetContents: o,
|
|
1100
1104
|
isModuleLevel: n?.moduleLevel ?? !1,
|
|
1101
1105
|
workerJson: a
|
|
1102
1106
|
}), c = [
|
|
1103
|
-
s.includes("↳") ? `${
|
|
1104
|
-
/ \+ \d+ more \|/.test(s) ?
|
|
1105
|
-
s.includes(K) ? Wn : "",
|
|
1107
|
+
s.includes("↳") ? `${Hn} ${Un}` : Hn,
|
|
1108
|
+
/ \+ \d+ more \|/.test(s) ? Wn : "",
|
|
1106
1109
|
s.includes(q) ? Gn : "",
|
|
1107
|
-
Kn
|
|
1110
|
+
s.includes(J) ? Kn : "",
|
|
1111
|
+
qn
|
|
1108
1112
|
].filter((e) => e !== "");
|
|
1109
|
-
await e(`## Bundle Analysis\n\n${
|
|
1113
|
+
await e(`## Bundle Analysis\n\n${Vn}\n\n${s}\n\n${c.join("\n\n")}`, Pn, Fn), x("Bundle sizes documented");
|
|
1110
1114
|
} catch (e) {
|
|
1111
1115
|
console.error("❌ Error documenting bundle sizes", e), process.exit(1);
|
|
1112
1116
|
}
|
|
1113
1117
|
}
|
|
1114
|
-
function
|
|
1115
|
-
let { assetContents: n, isModuleLevel: r, workerJson: i } = t, a =
|
|
1118
|
+
function Yn(e, t) {
|
|
1119
|
+
let { assetContents: n, isModuleLevel: r, workerJson: i } = t, a = ur(e), o = i === void 0 ? void 0 : ur(i).values().next().value;
|
|
1116
1120
|
for (let [e, t] of a) {
|
|
1117
1121
|
let r = n.get(e);
|
|
1118
|
-
r != null &&
|
|
1122
|
+
r != null && Xn(t, r, o);
|
|
1119
1123
|
}
|
|
1120
|
-
let s = a.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), c = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name,
|
|
1124
|
+
let s = a.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), c = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, hr(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), l = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
|
|
1121
1125
|
for (let [e, t] of c) {
|
|
1122
|
-
let n = [...a.get(e) ?? /* @__PURE__ */ new Map()].toSorted(
|
|
1123
|
-
l.push(
|
|
1126
|
+
let n = [...a.get(e) ?? /* @__PURE__ */ new Map()].toSorted(ir), i = n.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), o = i > 0 && s > 0 ? ` · ${br(i, s)} of the build` : "";
|
|
1127
|
+
l.push(Q(`**${Z(e)}**`, `${gr(t)}${o}`), ...ar(n, i, r));
|
|
1124
1128
|
}
|
|
1125
1129
|
return l.join("\n");
|
|
1126
1130
|
}
|
|
1127
|
-
function
|
|
1128
|
-
let r =
|
|
1129
|
-
|
|
1131
|
+
function Xn(e, t, n) {
|
|
1132
|
+
let r = Zn(t), i = Qn(r ?? ""), a = Qn(t);
|
|
1133
|
+
er(e, {
|
|
1130
1134
|
bytes: a.bytes - i.bytes,
|
|
1131
1135
|
binaryBytes: a.binaryBytes - i.binaryBytes
|
|
1132
|
-
}), r !== void 0 &&
|
|
1136
|
+
}), r !== void 0 && tr(e, Buffer.byteLength(r), i, n);
|
|
1133
1137
|
}
|
|
1134
|
-
function
|
|
1138
|
+
function Zn(e) {
|
|
1135
1139
|
if (!e.includes("new Worker(")) return;
|
|
1136
1140
|
let t = /encodeURIComponent\((\w+)\)/.exec(e)?.[1];
|
|
1137
1141
|
if (t === void 0) return;
|
|
@@ -1141,30 +1145,30 @@ function Xn(e) {
|
|
|
1141
1145
|
for (; a < e.length && e[a] !== r;) a += e[a] === "\\" ? 2 : 1;
|
|
1142
1146
|
return e.slice(i, a);
|
|
1143
1147
|
}
|
|
1144
|
-
function
|
|
1148
|
+
function Qn(e) {
|
|
1145
1149
|
let t = {
|
|
1146
1150
|
bytes: 0,
|
|
1147
1151
|
binaryBytes: 0
|
|
1148
1152
|
};
|
|
1149
1153
|
for (let n of e.matchAll(/data:application\/wasm;base64,([A-Za-z\d+/]*={0,2})/g)) {
|
|
1150
1154
|
let e = n[1] ?? "";
|
|
1151
|
-
t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) -
|
|
1155
|
+
t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) - $n(e);
|
|
1152
1156
|
}
|
|
1153
1157
|
return t;
|
|
1154
1158
|
}
|
|
1155
|
-
function
|
|
1159
|
+
function $n(e) {
|
|
1156
1160
|
return e.endsWith("==") ? 2 : +!!e.endsWith("=");
|
|
1157
1161
|
}
|
|
1158
|
-
function
|
|
1162
|
+
function er(e, t) {
|
|
1159
1163
|
if (t.bytes <= 0) return;
|
|
1160
|
-
let n = [e.get("wasm"), e.get(
|
|
1164
|
+
let n = [e.get("wasm"), e.get(K)].flatMap((e) => e === void 0 ? [] : e.files.entries().map(([t, n]) => ({
|
|
1161
1165
|
group: e,
|
|
1162
1166
|
fileName: t,
|
|
1163
1167
|
sizes: n
|
|
1164
1168
|
})).toArray()).find(({ sizes: e }) => e.uncompressed >= t.bytes);
|
|
1165
1169
|
if (n === void 0) return;
|
|
1166
|
-
|
|
1167
|
-
let r = `${
|
|
1170
|
+
rr(e, n.group, n.fileName, n.sizes, t.bytes);
|
|
1171
|
+
let r = `${J}, ${$(t.binaryBytes)} binary)`;
|
|
1168
1172
|
e.set(r, {
|
|
1169
1173
|
sizes: {
|
|
1170
1174
|
uncompressed: t.bytes,
|
|
@@ -1176,15 +1180,15 @@ function $n(e, t) {
|
|
|
1176
1180
|
}]])
|
|
1177
1181
|
});
|
|
1178
1182
|
}
|
|
1179
|
-
function
|
|
1180
|
-
let i = e.get(
|
|
1183
|
+
function tr(e, t, n, r) {
|
|
1184
|
+
let i = e.get(K), a = i?.files.get("");
|
|
1181
1185
|
if (i === void 0 || a === void 0 || a.uncompressed < t) return;
|
|
1182
|
-
|
|
1186
|
+
rr(e, i, "", a, t);
|
|
1183
1187
|
let o = r === void 0 ? /* @__PURE__ */ new Map([["", {
|
|
1184
1188
|
uncompressed: t,
|
|
1185
1189
|
gzip: 0
|
|
1186
|
-
}]]) :
|
|
1187
|
-
e.set(
|
|
1190
|
+
}]]) : nr(r, t, n);
|
|
1191
|
+
e.set(q, {
|
|
1188
1192
|
sizes: {
|
|
1189
1193
|
uncompressed: t,
|
|
1190
1194
|
gzip: 0
|
|
@@ -1192,92 +1196,92 @@ function er(e, t, n, r) {
|
|
|
1192
1196
|
files: o
|
|
1193
1197
|
});
|
|
1194
1198
|
}
|
|
1195
|
-
function
|
|
1196
|
-
|
|
1199
|
+
function nr(e, t, n) {
|
|
1200
|
+
er(e, n);
|
|
1197
1201
|
let r = /* @__PURE__ */ new Map();
|
|
1198
1202
|
for (let [t, n] of e) if (t === "src") for (let [e, t] of n.files) r.set(e, { ...t });
|
|
1199
1203
|
else {
|
|
1200
|
-
let e = n.files.size === 1 ?
|
|
1204
|
+
let e = n.files.size === 1 ? X(t, lr(n.files)) : t;
|
|
1201
1205
|
r.set(e, { ...n.sizes });
|
|
1202
1206
|
}
|
|
1203
|
-
let i = r.values().reduce((e, t) => e + t.uncompressed, 0), a = r.get(
|
|
1204
|
-
return a.uncompressed += Math.max(0, t - i), a.uncompressed > 0 && r.set(
|
|
1207
|
+
let i = r.values().reduce((e, t) => e + t.uncompressed, 0), a = r.get(K) ?? vr();
|
|
1208
|
+
return a.uncompressed += Math.max(0, t - i), a.uncompressed > 0 && r.set(K, a), r;
|
|
1205
1209
|
}
|
|
1206
|
-
function
|
|
1210
|
+
function rr(e, t, n, r, i) {
|
|
1207
1211
|
if (r.uncompressed -= i, t.sizes.uncompressed -= i, r.uncompressed <= 0 && t.files.delete(n), !(t.sizes.uncompressed > 0)) for (let [n, r] of e) r === t && e.delete(n);
|
|
1208
1212
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return e[0] ===
|
|
1213
|
+
function ir(e, t) {
|
|
1214
|
+
return e[0] === K == (t[0] === K) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === K ? 1 : -1;
|
|
1211
1215
|
}
|
|
1212
|
-
function
|
|
1216
|
+
function ar(e, t, n) {
|
|
1213
1217
|
let r = [];
|
|
1214
1218
|
for (let [i, { sizes: a, files: o }] of e) if (o.size === 1) {
|
|
1215
|
-
let e =
|
|
1216
|
-
r.push(
|
|
1217
|
-
} else r.push(
|
|
1219
|
+
let e = lr(o);
|
|
1220
|
+
r.push(Q(`${W}${Z(X(i, e))}`, Y(a.uncompressed, t)));
|
|
1221
|
+
} else r.push(Q(`${W}${cr(i, o)}`, Y(a.uncompressed, t))), n || r.push(...or(o, t));
|
|
1218
1222
|
return r;
|
|
1219
1223
|
}
|
|
1220
|
-
function
|
|
1221
|
-
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r =
|
|
1224
|
+
function or(e, t) {
|
|
1225
|
+
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = sr(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => Q(`${W}${W}↳ ${Z(e)}`, Y(n.uncompressed, t, Ln)));
|
|
1222
1226
|
if (r > 0) {
|
|
1223
1227
|
let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
|
|
1224
|
-
i.push(
|
|
1228
|
+
i.push(Q(`${W}${W}↳ ${String(r)} smaller files`, Y(e, t, Ln)));
|
|
1225
1229
|
}
|
|
1226
1230
|
return i;
|
|
1227
1231
|
}
|
|
1228
|
-
function
|
|
1232
|
+
function sr(e, t) {
|
|
1229
1233
|
if (t <= 0) return 0;
|
|
1230
1234
|
let n = 0, r = 0;
|
|
1231
1235
|
for (let [, i] of e.toReversed()) {
|
|
1232
|
-
let e = i.uncompressed / t * 100 <
|
|
1236
|
+
let e = i.uncompressed / t * 100 < Rn, a = (r + i.uncompressed) / t * 100 <= zn;
|
|
1233
1237
|
if (!e || !a) break;
|
|
1234
1238
|
n++, r += i.uncompressed;
|
|
1235
1239
|
}
|
|
1236
1240
|
return n >= 2 ? n : 0;
|
|
1237
1241
|
}
|
|
1238
|
-
function
|
|
1239
|
-
return `${
|
|
1242
|
+
function Y(e, t, n = In) {
|
|
1243
|
+
return `${_r(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
|
|
1240
1244
|
}
|
|
1241
|
-
function
|
|
1245
|
+
function X(e, t) {
|
|
1242
1246
|
return t === "" ? e : `${e} → ${t}`;
|
|
1243
1247
|
}
|
|
1244
|
-
function
|
|
1245
|
-
if (e ===
|
|
1248
|
+
function cr(e, t) {
|
|
1249
|
+
if (e === q) return e;
|
|
1246
1250
|
let [n] = [...t].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed)[0] ?? [""];
|
|
1247
|
-
return `${X(
|
|
1251
|
+
return `${Z(X(e, n))} + ${String(t.size - 1)} more`;
|
|
1248
1252
|
}
|
|
1249
|
-
function
|
|
1250
|
-
let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(
|
|
1253
|
+
function Z(e) {
|
|
1254
|
+
let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(Bn - n.length, 2);
|
|
1251
1255
|
return r.length > i ? `${n}<abbr title="${r.replaceAll("&", "&").replaceAll("\"", """)}">…${r.slice(r.length - (i - 1))}</abbr>` : e;
|
|
1252
1256
|
}
|
|
1253
|
-
function
|
|
1257
|
+
function Q(e, t) {
|
|
1254
1258
|
return `| ${e} | ${t.replaceAll(" ", " ")} |`;
|
|
1255
1259
|
}
|
|
1256
|
-
function
|
|
1260
|
+
function lr(e) {
|
|
1257
1261
|
let [t] = e.keys();
|
|
1258
1262
|
if (t === void 0) throw Error("Expected exactly one file");
|
|
1259
1263
|
return t;
|
|
1260
1264
|
}
|
|
1261
|
-
function
|
|
1262
|
-
let t =
|
|
1265
|
+
function ur(e) {
|
|
1266
|
+
let t = dr(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1263
1267
|
for (let r of e.resources) {
|
|
1264
1268
|
if (r.kind !== "chunk" || !r.parent) continue;
|
|
1265
|
-
let { group: e, file: i } =
|
|
1269
|
+
let { group: e, file: i } = fr(r.name, t), a = hr(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
|
|
1266
1270
|
n.set(r.parent, o);
|
|
1267
1271
|
let s = o.get(e) ?? {
|
|
1268
|
-
sizes:
|
|
1272
|
+
sizes: vr(),
|
|
1269
1273
|
files: /* @__PURE__ */ new Map()
|
|
1270
1274
|
};
|
|
1271
|
-
o.set(e, s),
|
|
1272
|
-
let c = s.files.get(i) ??
|
|
1273
|
-
s.files.set(i, c),
|
|
1275
|
+
o.set(e, s), yr(s.sizes, a);
|
|
1276
|
+
let c = s.files.get(i) ?? vr();
|
|
1277
|
+
s.files.set(i, c), yr(c, a);
|
|
1274
1278
|
}
|
|
1275
1279
|
return n;
|
|
1276
1280
|
}
|
|
1277
|
-
function
|
|
1281
|
+
function dr(e) {
|
|
1278
1282
|
return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
|
|
1279
1283
|
}
|
|
1280
|
-
function
|
|
1284
|
+
function fr(e, t) {
|
|
1281
1285
|
let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
|
|
1282
1286
|
if (n) {
|
|
1283
1287
|
let [t, r] = n;
|
|
@@ -1287,73 +1291,71 @@ function dr(e, t) {
|
|
|
1287
1291
|
};
|
|
1288
1292
|
}
|
|
1289
1293
|
return e === "[unassigned]" ? {
|
|
1290
|
-
group:
|
|
1294
|
+
group: K,
|
|
1291
1295
|
file: ""
|
|
1292
1296
|
} : e.startsWith("\0") ? {
|
|
1293
1297
|
group: "(runtime)",
|
|
1294
1298
|
file: e.slice(1)
|
|
1295
1299
|
} : e.startsWith("rust/") ? {
|
|
1296
1300
|
group: "wasm",
|
|
1297
|
-
file:
|
|
1301
|
+
file: pr(e)
|
|
1298
1302
|
} : {
|
|
1299
1303
|
group: "src",
|
|
1300
|
-
file:
|
|
1304
|
+
file: mr(e)
|
|
1301
1305
|
};
|
|
1302
1306
|
}
|
|
1303
|
-
function
|
|
1304
|
-
let t = e.split("/", 2)[1] ?? "", n =
|
|
1307
|
+
function pr(e) {
|
|
1308
|
+
let t = e.split("/", 2)[1] ?? "", n = mr(e);
|
|
1305
1309
|
return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
|
|
1306
1310
|
}
|
|
1307
|
-
function
|
|
1311
|
+
function mr(e) {
|
|
1308
1312
|
return e.split("/").at(-1) ?? e;
|
|
1309
1313
|
}
|
|
1310
|
-
function
|
|
1314
|
+
function hr(e) {
|
|
1311
1315
|
return {
|
|
1312
1316
|
uncompressed: e.uncompressed,
|
|
1313
1317
|
gzip: e.gzip ?? 0
|
|
1314
1318
|
};
|
|
1315
1319
|
}
|
|
1316
|
-
function
|
|
1320
|
+
function gr(e) {
|
|
1317
1321
|
return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
|
|
1318
1322
|
}
|
|
1319
|
-
function
|
|
1320
|
-
let n = Math.round(e / 100 *
|
|
1321
|
-
return `\`${t.repeat(n)}${"░".repeat(
|
|
1323
|
+
function _r(e, t = In) {
|
|
1324
|
+
let n = Math.round(e / 100 * G);
|
|
1325
|
+
return `\`${t.repeat(n)}${"░".repeat(G - n)}\` ${e.toFixed(1)}%`;
|
|
1322
1326
|
}
|
|
1323
|
-
function
|
|
1327
|
+
function vr() {
|
|
1324
1328
|
return {
|
|
1325
1329
|
uncompressed: 0,
|
|
1326
1330
|
gzip: 0
|
|
1327
1331
|
};
|
|
1328
1332
|
}
|
|
1329
|
-
function
|
|
1333
|
+
function yr(e, t) {
|
|
1330
1334
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
1331
1335
|
}
|
|
1332
|
-
function
|
|
1336
|
+
function br(e, t) {
|
|
1333
1337
|
return `${(e / t * 100).toFixed(1)}%`;
|
|
1334
1338
|
}
|
|
1335
1339
|
function $(e) {
|
|
1336
1340
|
return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
|
|
1337
1341
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
async function yr(e = "MIT", n = !1) {
|
|
1342
|
+
// src/actions/documentProject.ts
|
|
1343
|
+
async function xr(e = "MIT", n = !1) {
|
|
1341
1344
|
try {
|
|
1342
1345
|
let i = await C("config.json"), a = g(i.id).typeId === "connector";
|
|
1343
|
-
await
|
|
1344
|
-
let o = await t(
|
|
1345
|
-
o ? await
|
|
1346
|
+
await Ht(), a && await qe(), await En(), await mt(e), await t("bundle-analysis-reports/sonda/index.json") === null ? w(`ℹ️ Bundle sizes NOT documented, as there is no '${Mn}' yet. Build the project first.`) : await Jn({ moduleLevel: n }), await on(), await Je();
|
|
1347
|
+
let o = await t(U) !== null;
|
|
1348
|
+
o ? await jn() : w(`ℹ️ '${U}' NOT required by this project`), await r("ℹ️ Format generated files", "prettier", [
|
|
1346
1349
|
"--write",
|
|
1347
1350
|
"README.md",
|
|
1348
|
-
...o ? [
|
|
1351
|
+
...o ? [U] : []
|
|
1349
1352
|
]);
|
|
1350
1353
|
} catch (e) {
|
|
1351
1354
|
console.error("❌ Error documenting project", e), process.exit(1);
|
|
1352
1355
|
}
|
|
1353
1356
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
async function br() {
|
|
1357
|
+
// src/actions/formatCode.ts
|
|
1358
|
+
async function Sr() {
|
|
1357
1359
|
try {
|
|
1358
1360
|
l("Format Code");
|
|
1359
1361
|
let e = [
|
|
@@ -1372,23 +1374,21 @@ async function br() {
|
|
|
1372
1374
|
console.error("❌ Error formatting code", e), process.exit(1);
|
|
1373
1375
|
}
|
|
1374
1376
|
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
async function xr() {
|
|
1377
|
+
// src/actions/lintCode.ts
|
|
1378
|
+
async function Cr() {
|
|
1378
1379
|
try {
|
|
1379
1380
|
l("Lint Code"), await r("1️⃣ Lint", "eslint", ["."]), x("Code linted");
|
|
1380
1381
|
} catch (e) {
|
|
1381
1382
|
console.error("❌ Error linting code", e), process.exit(1);
|
|
1382
1383
|
}
|
|
1383
1384
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
var Sr = {
|
|
1385
|
+
// src/utilities/cloudflare.ts
|
|
1386
|
+
var wr = {
|
|
1387
1387
|
".css": "text/css",
|
|
1388
1388
|
".js": "application/javascript",
|
|
1389
1389
|
".wasm": "application/wasm"
|
|
1390
|
-
},
|
|
1391
|
-
async function
|
|
1390
|
+
}, Tr = "dpuse-sample-data-eu";
|
|
1391
|
+
async function Er() {
|
|
1392
1392
|
let e = await C("config.json"), t = {
|
|
1393
1393
|
body: JSON.stringify(e),
|
|
1394
1394
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1396,12 +1396,12 @@ async function wr() {
|
|
|
1396
1396
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
1397
1397
|
if (!n.ok) throw Error(await n.text());
|
|
1398
1398
|
}
|
|
1399
|
-
async function
|
|
1400
|
-
let n = await
|
|
1401
|
-
for (let [e, t] of r) await
|
|
1399
|
+
async function Dr(e, t) {
|
|
1400
|
+
let n = await Mr(`${e}/${t}`, t), r = Map.groupBy(n, ({ key: e }) => c(e));
|
|
1401
|
+
for (let [e, t] of r) await jr(t, ["--content-type", e]);
|
|
1402
1402
|
}
|
|
1403
|
-
async function
|
|
1404
|
-
await
|
|
1403
|
+
async function Or(e) {
|
|
1404
|
+
await Dr(e, "application"), await Dr(e, "fileStore"), await jr(["applicationIndex.json", "fileStoreIndex.json"].map((t) => ({
|
|
1405
1405
|
file: `${e}/${t}`,
|
|
1406
1406
|
key: t
|
|
1407
1407
|
})), [
|
|
@@ -1411,7 +1411,7 @@ async function Er(e) {
|
|
|
1411
1411
|
"no-cache"
|
|
1412
1412
|
]);
|
|
1413
1413
|
}
|
|
1414
|
-
async function
|
|
1414
|
+
async function kr(e) {
|
|
1415
1415
|
let t = e.id, n = {
|
|
1416
1416
|
body: JSON.stringify(e),
|
|
1417
1417
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1419,13 +1419,13 @@ async function Dr(e) {
|
|
|
1419
1419
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
1420
1420
|
if (!r.ok) throw Error(await r.text());
|
|
1421
1421
|
}
|
|
1422
|
-
async function
|
|
1422
|
+
async function Ar(e, t) {
|
|
1423
1423
|
let n = `v${e.version ?? "unknown"}`;
|
|
1424
1424
|
async function r(e, r = "") {
|
|
1425
1425
|
let i = await ee(e, { withFileTypes: !0 });
|
|
1426
1426
|
for (let a of i) {
|
|
1427
1427
|
if (a.isDirectory() || a.name.endsWith(".map")) continue;
|
|
1428
|
-
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c =
|
|
1428
|
+
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = wr[E.extname(a.name)] ?? "application/octet-stream";
|
|
1429
1429
|
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await b(void 0, "wrangler", [
|
|
1430
1430
|
"r2",
|
|
1431
1431
|
"object",
|
|
@@ -1441,7 +1441,7 @@ async function Or(e, t) {
|
|
|
1441
1441
|
}
|
|
1442
1442
|
await r("dist");
|
|
1443
1443
|
}
|
|
1444
|
-
async function
|
|
1444
|
+
async function jr(e, t) {
|
|
1445
1445
|
if (e.length === 0) return;
|
|
1446
1446
|
let n = await T.mkdtemp(E.join(ge.tmpdir(), "dpuse-r2-bulk-")), r = E.join(n, "files.json");
|
|
1447
1447
|
try {
|
|
@@ -1449,7 +1449,7 @@ async function kr(e, t) {
|
|
|
1449
1449
|
"r2",
|
|
1450
1450
|
"bulk",
|
|
1451
1451
|
"put",
|
|
1452
|
-
|
|
1452
|
+
Tr,
|
|
1453
1453
|
"--filename",
|
|
1454
1454
|
r,
|
|
1455
1455
|
...t,
|
|
@@ -1463,21 +1463,20 @@ async function kr(e, t) {
|
|
|
1463
1463
|
});
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
|
-
async function
|
|
1466
|
+
async function Mr(e, t) {
|
|
1467
1467
|
let n = await ee(e), r = [];
|
|
1468
1468
|
for (let i of n) {
|
|
1469
1469
|
if (i.startsWith(".")) continue;
|
|
1470
1470
|
let n = `${e}/${i}`, a = `${t}/${i}`;
|
|
1471
|
-
(await h(n)).isDirectory() ? r.push(...await
|
|
1471
|
+
(await h(n)).isDirectory() ? r.push(...await Mr(n, a)) : r.push({
|
|
1472
1472
|
file: n,
|
|
1473
1473
|
key: a
|
|
1474
1474
|
});
|
|
1475
1475
|
}
|
|
1476
1476
|
return r;
|
|
1477
1477
|
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
async function jr() {
|
|
1478
|
+
// src/actions/publishProject.ts
|
|
1479
|
+
async function Nr() {
|
|
1481
1480
|
try {
|
|
1482
1481
|
l("Publish Project");
|
|
1483
1482
|
let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
|
|
@@ -1487,30 +1486,29 @@ async function jr() {
|
|
|
1487
1486
|
"app",
|
|
1488
1487
|
"kb"
|
|
1489
1488
|
].includes(n.publishedTo);
|
|
1490
|
-
i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await
|
|
1489
|
+
i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await Pr(i ? "3️⃣ " : "2️⃣ ", e, t, n), n.publishedTo === "sampleData" && (w("3️⃣ Upload sample data"), await Or("public")), x(`Project version '${e.version ?? "unknown"}' published.`);
|
|
1491
1490
|
} catch (e) {
|
|
1492
1491
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1493
1492
|
}
|
|
1494
1493
|
}
|
|
1495
|
-
async function
|
|
1496
|
-
if (r.typeId === "app") w(`${e} Register module`), await
|
|
1497
|
-
else if (r.typeId === "engine") w(`${e} Register module`), await
|
|
1494
|
+
async function Pr(e, t, n, r) {
|
|
1495
|
+
if (r.typeId === "app") w(`${e} Register module`), await Er();
|
|
1496
|
+
else if (r.typeId === "engine") w(`${e} Register module`), await Ar(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await kr(n);
|
|
1498
1497
|
else if (r.uploadGroupName === void 0) w(`${e} Registration NOT required`);
|
|
1499
1498
|
else {
|
|
1500
1499
|
w(`${e} Register module`);
|
|
1501
1500
|
let i = n.id.split("-").slice(2).join("-");
|
|
1502
|
-
await
|
|
1501
|
+
await Ar(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await kr(n);
|
|
1503
1502
|
}
|
|
1504
1503
|
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
async function Nr(e = "MIT", t = !1) {
|
|
1504
|
+
// src/actions/releaseProject.ts
|
|
1505
|
+
async function Fr(e = "MIT", t = !1) {
|
|
1508
1506
|
try {
|
|
1509
1507
|
l("Release Project");
|
|
1510
1508
|
let n = await C("package.json"), i = await C("config.json"), a = g(i.id);
|
|
1511
1509
|
await p("1️⃣ ", n);
|
|
1512
1510
|
let o = await oe("2️⃣ ", n, a);
|
|
1513
|
-
if (await Ee("3️⃣ ", n), w("4️⃣ Regenerate README"), await
|
|
1511
|
+
if (await Ee("3️⃣ ", n), w("4️⃣ Regenerate README"), await xr(e, t), await b("5️⃣ Stage changes", "git", ["add", "."]), await b("6️⃣ Commit changes", "git", [
|
|
1514
1512
|
"commit",
|
|
1515
1513
|
"-m",
|
|
1516
1514
|
`v${n.version ?? "unknown"}`
|
|
@@ -1518,7 +1516,7 @@ async function Nr(e = "MIT", t = !1) {
|
|
|
1518
1516
|
"push",
|
|
1519
1517
|
"origin",
|
|
1520
1518
|
"main:main"
|
|
1521
|
-
]), await
|
|
1519
|
+
]), await Pr("8️⃣ ", n, o, a), a.publishedTo === "npm") {
|
|
1522
1520
|
let e = `v${n.version ?? "unknown"}`;
|
|
1523
1521
|
await r("9️⃣ Trigger GitHub release", "gh", [
|
|
1524
1522
|
"release",
|
|
@@ -1535,9 +1533,8 @@ async function Nr(e = "MIT", t = !1) {
|
|
|
1535
1533
|
console.error("❌ Error releasing project", e), process.exit(1);
|
|
1536
1534
|
}
|
|
1537
1535
|
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
async function Pr() {
|
|
1536
|
+
// src/actions/syncProjectWithGitHub.ts
|
|
1537
|
+
async function Ir() {
|
|
1541
1538
|
try {
|
|
1542
1539
|
l("Synchronise Project with GitHub");
|
|
1543
1540
|
let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
|
|
@@ -1554,14 +1551,13 @@ async function Pr() {
|
|
|
1554
1551
|
console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
|
|
1555
1552
|
}
|
|
1556
1553
|
}
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
var Fr = [
|
|
1554
|
+
// src/actions/testProject.ts
|
|
1555
|
+
var Lr = [
|
|
1560
1556
|
"1️⃣ ",
|
|
1561
1557
|
"2️⃣ ",
|
|
1562
1558
|
"3️⃣ ",
|
|
1563
1559
|
"4️⃣ "
|
|
1564
|
-
],
|
|
1560
|
+
], Rr = [{
|
|
1565
1561
|
id: "unit",
|
|
1566
1562
|
label: "Run unit tests",
|
|
1567
1563
|
command: "vitest",
|
|
@@ -1574,13 +1570,13 @@ var Fr = [
|
|
|
1574
1570
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1575
1571
|
configFileName: "playwright.config.ts"
|
|
1576
1572
|
}];
|
|
1577
|
-
async function
|
|
1573
|
+
async function zr(e = ["unit"]) {
|
|
1578
1574
|
try {
|
|
1579
1575
|
l("Test Project");
|
|
1580
1576
|
let n = 0;
|
|
1581
|
-
for (let i of
|
|
1577
|
+
for (let i of Rr) {
|
|
1582
1578
|
if (!e.includes(i.id) || await t(i.configFileName) === null) continue;
|
|
1583
|
-
let a = `${
|
|
1579
|
+
let a = `${Lr[n] ?? ""} ${i.label}`;
|
|
1584
1580
|
await r(a, i.command, i.arguments), n += 1;
|
|
1585
1581
|
}
|
|
1586
1582
|
if (n === 0) {
|
|
@@ -1592,9 +1588,8 @@ async function Lr(e = ["unit"]) {
|
|
|
1592
1588
|
console.error("❌ Error testing project", e), process.exit(1);
|
|
1593
1589
|
}
|
|
1594
1590
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
async function Rr() {
|
|
1591
|
+
// src/actions/triggerGitHubRelease.ts
|
|
1592
|
+
async function Br() {
|
|
1598
1593
|
try {
|
|
1599
1594
|
l("Trigger GitHub Release");
|
|
1600
1595
|
let e = `v${(await C("package.json")).version ?? "unknown"}`;
|
|
@@ -1611,5 +1606,4 @@ async function Rr() {
|
|
|
1611
1606
|
console.error("❌ Error triggering GitHub release", e), process.exit(1);
|
|
1612
1607
|
}
|
|
1613
1608
|
}
|
|
1614
|
-
|
|
1615
|
-
export { ye as auditDependencies, Te as buildProject, ze as checkProject, yr as documentProject, br as formatCode, xr as lintCode, jr as publishProject, Nr as releaseProject, c as resolveSampleDataContentType, Pr as syncProjectWithGitHub, Lr as testProject, Rr as triggerGitHubRelease, Tr as uploadDirectoryToR2 };
|
|
1609
|
+
export { ye as auditDependencies, Te as buildProject, Ve as checkProject, xr as documentProject, Sr as formatCode, Cr as lintCode, Nr as publishProject, Fr as releaseProject, c as resolveSampleDataContentType, Ir as syncProjectWithGitHub, zr as testProject, Br as triggerGitHubRelease, Dr as uploadDirectoryToR2 };
|