@dpuse/dpuse-development 1.0.107 → 1.0.109
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 +24 -21
- package/dist/dpuse-development.es.js +332 -233
- package/dist/dpuse-development.es.js.map +1 -1
- package/package.json +5 -5
|
@@ -404,75 +404,77 @@ async function rt(e, t) {
|
|
|
404
404
|
}
|
|
405
405
|
//#endregion
|
|
406
406
|
//#region src/actions/documentDependencies.ts
|
|
407
|
-
var j = "<!-- DEPENDENCY_LICENSES_START -->", M = "<!-- DEPENDENCY_LICENSES_END -->", N = "## Dependency Licenses", it = `bundle-analysis-reports/${oe}`, P = "licenses/licenseTree.json",
|
|
408
|
-
async function
|
|
407
|
+
var j = "<!-- DEPENDENCY_LICENSES_START -->", M = "<!-- DEPENDENCY_LICENSES_END -->", N = "## Dependency Licenses", it = `bundle-analysis-reports/${oe}`, P = "licenses/licenseTree.json", at = "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.", ot = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${at}`, st = `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. ${at}`;
|
|
408
|
+
async function ct(e = "MIT") {
|
|
409
409
|
try {
|
|
410
410
|
s("Document Dependencies");
|
|
411
411
|
let n = await C("package.json"), r = n.name ?? "";
|
|
412
412
|
if (ne.has(r)) {
|
|
413
|
-
await
|
|
413
|
+
await lt(r), x("Dependencies documented");
|
|
414
414
|
return;
|
|
415
415
|
}
|
|
416
416
|
await f("1️⃣ Clear downloaded licenses", "licenses/downloads");
|
|
417
|
-
let i = await
|
|
417
|
+
let i = await vt(), a = await yt();
|
|
418
418
|
if (a === null) {
|
|
419
|
-
let r =
|
|
420
|
-
await
|
|
419
|
+
let r = Ct(i);
|
|
420
|
+
await _t("2️⃣ Identify production licenses", e, [n.name ?? "", ...r], !0), await t("3️⃣ Identify transitive dependencies", "npm", [
|
|
421
421
|
"ls",
|
|
422
422
|
"--all",
|
|
423
423
|
"--json",
|
|
424
424
|
"--omit=dev"
|
|
425
|
-
], P), await
|
|
425
|
+
], P), await ut("4️⃣ ", e, new Set(r));
|
|
426
426
|
} else {
|
|
427
|
-
let r =
|
|
428
|
-
await
|
|
427
|
+
let r = bt(a, i), o = xt(i), s = o.filter((e) => !r.has(e));
|
|
428
|
+
await _t("2️⃣ Identify shipped licenses", e, [n.name ?? "", ...s], !1), St(r, new Set(o)), await t("3️⃣ Identify transitive dependencies", "npm", [
|
|
429
429
|
"ls",
|
|
430
430
|
"--all",
|
|
431
431
|
"--json"
|
|
432
432
|
], P, !0);
|
|
433
433
|
let c = await Ze("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
|
|
434
434
|
allowedLicenses: e,
|
|
435
|
-
productionNames:
|
|
435
|
+
productionNames: ht(n),
|
|
436
436
|
rustCrates: c,
|
|
437
437
|
shippedKeys: r
|
|
438
438
|
};
|
|
439
|
-
await
|
|
439
|
+
await dt(c === null ? "4️⃣ " : "5️⃣ ", l);
|
|
440
440
|
}
|
|
441
441
|
x("Dependencies documented");
|
|
442
442
|
} catch (e) {
|
|
443
443
|
console.error("❌ Error documenting dependencies", e), process.exit(1);
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
async function
|
|
446
|
+
async function lt(e) {
|
|
447
447
|
w(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`);
|
|
448
448
|
let t = `> [!WARNING]\n> Dependency licenses are not documented here: ${e} is a development-only tool and is never part of a production release.`;
|
|
449
449
|
await _(`${N}\n\n${t}`, j, M);
|
|
450
450
|
}
|
|
451
|
-
async function
|
|
451
|
+
async function ut(e, t, n) {
|
|
452
452
|
w(`${e} Insert licenses into 'README.md'`);
|
|
453
|
-
let r = await C(P), i = await
|
|
454
|
-
for (let e of i.values()) a +=
|
|
453
|
+
let r = await C(P), i = await gt(), a = `${Dt(t, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
454
|
+
for (let e of i.values()) a += I(e);
|
|
455
455
|
let o = [];
|
|
456
|
-
r.dependencies != null &&
|
|
457
|
-
let s = `${
|
|
456
|
+
r.dependencies != null && jt(r.dependencies, i, n, o, 0);
|
|
457
|
+
let s = `${ot}\n\n${o.join("\n")}`;
|
|
458
458
|
await _(`${N}\n\n${a.trimEnd()}\n\n### Dependency Tree\n\n${s}`, j, M);
|
|
459
459
|
}
|
|
460
|
-
async function
|
|
460
|
+
async function dt(e, t) {
|
|
461
461
|
w(`${e} Insert licenses into 'README.md'`);
|
|
462
|
-
let { allowedLicenses: n, productionNames: r, rustCrates: i, shippedKeys: a } = t, o = await
|
|
463
|
-
for (let e of
|
|
464
|
-
|
|
465
|
-
|
|
462
|
+
let { allowedLicenses: n, productionNames: r, rustCrates: i, shippedKeys: a } = t, o = await gt(), s = new Map((i?.crates ?? []).map((e) => [`${e.name}@${e.version}`, pt(e)])), c = i !== null, l = c ? "|Type|Dependency|Version|License(s)|Document|\n|:-|:-|:-:|:-|:-|" : "|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|", u = `${Dt(n, !0, c)}\n\n${l}\n`;
|
|
463
|
+
for (let e of o.values().toArray().toSorted(ft)) u += I(e, c ? "JavaScript" : void 0);
|
|
464
|
+
for (let e of s.values().toArray().toSorted(ft)) u += I(e, "Rust");
|
|
465
|
+
let d = await C(P), f = Object.entries(d.dependencies ?? {}).toSorted(([e], [t]) => Number(!r.has(e)) - Number(!r.has(t))), p = [];
|
|
466
|
+
L(f, {
|
|
466
467
|
licensesByKey: o,
|
|
467
468
|
shippedKeys: a,
|
|
468
469
|
shownKeys: /* @__PURE__ */ new Set()
|
|
469
|
-
},
|
|
470
|
-
let p = i?.treeItems ?? []
|
|
471
|
-
|
|
472
|
-
let m = `${ot}\n\n${f.join("\n")}`;
|
|
473
|
-
await _(`${N}\n\n${l.trimEnd()}\n\n### Dependency Tree\n\n${m}`, j, M);
|
|
470
|
+
}, p, 0, !1);
|
|
471
|
+
let m = p.length === 0 ? "None." : p.join("\n"), h = (i?.treeItems ?? []).map((e) => mt(e, s)).join("\n"), g = c ? `${st}\n\n#### JavaScript\n\n${m}\n\n#### Rust\n\n${h}` : `${st}\n\n${m}`;
|
|
472
|
+
await _(`${N}\n\n${u.trimEnd()}\n\n### Dependency Tree\n\n${g}`, j, M);
|
|
474
473
|
}
|
|
475
|
-
function
|
|
474
|
+
function ft(e, t) {
|
|
475
|
+
return e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en");
|
|
476
|
+
}
|
|
477
|
+
function pt(e) {
|
|
476
478
|
return {
|
|
477
479
|
name: e.name,
|
|
478
480
|
repository: e.repository,
|
|
@@ -485,26 +487,26 @@ function dt(e) {
|
|
|
485
487
|
licenseFiles: e.licenseFiles
|
|
486
488
|
};
|
|
487
489
|
}
|
|
488
|
-
function
|
|
490
|
+
function mt(e, t) {
|
|
489
491
|
let n = " ".repeat(e.depth);
|
|
490
|
-
return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` :
|
|
492
|
+
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);
|
|
491
493
|
}
|
|
492
|
-
function
|
|
494
|
+
function ht(e) {
|
|
493
495
|
return /* @__PURE__ */ new Set([
|
|
494
496
|
...Object.keys(e.dependencies ?? {}),
|
|
495
497
|
...Object.keys(e.optionalDependencies ?? {}),
|
|
496
498
|
...Object.keys(e.peerDependencies ?? {})
|
|
497
499
|
]);
|
|
498
500
|
}
|
|
499
|
-
async function
|
|
501
|
+
async function gt() {
|
|
500
502
|
let e = await C("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
|
|
501
|
-
for (let [n, r] of Object.entries(e)) t.set(n,
|
|
503
|
+
for (let [n, r] of Object.entries(e)) t.set(n, kt(n, r));
|
|
502
504
|
return await Promise.all(t.values().map(async (e) => {
|
|
503
|
-
let t = await
|
|
505
|
+
let t = await At(e.name, e.installedVersion);
|
|
504
506
|
e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
|
|
505
507
|
})), t;
|
|
506
508
|
}
|
|
507
|
-
async function
|
|
509
|
+
async function _t(e, t, n, r) {
|
|
508
510
|
w(e), await new Promise((e, i) => {
|
|
509
511
|
let a = {
|
|
510
512
|
start: process.cwd(),
|
|
@@ -522,58 +524,58 @@ async function mt(e, t, n, r) {
|
|
|
522
524
|
});
|
|
523
525
|
});
|
|
524
526
|
}
|
|
525
|
-
async function
|
|
527
|
+
async function vt() {
|
|
526
528
|
let t = await e("package-lock.json");
|
|
527
529
|
return t === null ? {} : JSON.parse(t).packages ?? {};
|
|
528
530
|
}
|
|
529
|
-
async function
|
|
531
|
+
async function yt() {
|
|
530
532
|
let t = await e(it);
|
|
531
533
|
return t === null ? null : JSON.parse(t);
|
|
532
534
|
}
|
|
533
|
-
function
|
|
535
|
+
function bt(e, t) {
|
|
534
536
|
let n = new Set(e.packages);
|
|
535
537
|
for (let r of e.external) {
|
|
536
|
-
let e =
|
|
537
|
-
if (e !== void 0) for (let r of [e, ...
|
|
538
|
+
let e = Et(t, "", r);
|
|
539
|
+
if (e !== void 0) for (let r of [e, ...wt(t, e)]) {
|
|
538
540
|
let e = t[r];
|
|
539
|
-
e?.version !== void 0 && n.add(
|
|
541
|
+
e?.version !== void 0 && n.add(F(r, e));
|
|
540
542
|
}
|
|
541
543
|
}
|
|
542
544
|
return n;
|
|
543
545
|
}
|
|
544
|
-
function
|
|
546
|
+
function xt(e) {
|
|
545
547
|
let t = /* @__PURE__ */ new Set();
|
|
546
|
-
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(
|
|
548
|
+
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(F(n, r));
|
|
547
549
|
return [...t];
|
|
548
550
|
}
|
|
549
|
-
function
|
|
551
|
+
function St(e, t) {
|
|
550
552
|
let n = [...e.difference(t)];
|
|
551
553
|
n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
|
|
552
554
|
}
|
|
553
|
-
function
|
|
555
|
+
function F(e, t) {
|
|
554
556
|
return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
|
|
555
557
|
}
|
|
556
|
-
function
|
|
557
|
-
let t =
|
|
558
|
+
function Ct(e) {
|
|
559
|
+
let t = wt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
558
560
|
for (let [i, a] of Object.entries(e)) {
|
|
559
561
|
if (i === "" || a.version === void 0) continue;
|
|
560
|
-
let e =
|
|
562
|
+
let e = F(i, a);
|
|
561
563
|
t.has(i) ? n.add(e) : r.add(e);
|
|
562
564
|
}
|
|
563
565
|
return r.values().filter((e) => !n.has(e)).toArray();
|
|
564
566
|
}
|
|
565
|
-
function
|
|
567
|
+
function wt(e, t) {
|
|
566
568
|
let n = /* @__PURE__ */ new Set(), r = [t];
|
|
567
569
|
for (; r.length > 0;) {
|
|
568
570
|
let t = r.pop() ?? "", i = e[t];
|
|
569
|
-
if (i !== void 0) for (let a of
|
|
570
|
-
let i =
|
|
571
|
+
if (i !== void 0) for (let a of Tt(i)) {
|
|
572
|
+
let i = Et(e, t, a);
|
|
571
573
|
i === void 0 || n.has(i) || (n.add(i), r.push(i));
|
|
572
574
|
}
|
|
573
575
|
}
|
|
574
576
|
return n;
|
|
575
577
|
}
|
|
576
|
-
function
|
|
578
|
+
function Tt(e) {
|
|
577
579
|
let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
|
|
578
580
|
return [
|
|
579
581
|
...Object.keys(e.dependencies ?? {}),
|
|
@@ -581,7 +583,7 @@ function St(e) {
|
|
|
581
583
|
...t
|
|
582
584
|
];
|
|
583
585
|
}
|
|
584
|
-
function
|
|
586
|
+
function Et(e, t, n) {
|
|
585
587
|
let r = t;
|
|
586
588
|
for (;;) {
|
|
587
589
|
let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
|
|
@@ -591,14 +593,14 @@ function Ct(e, t, n) {
|
|
|
591
593
|
r = a === -1 ? "" : r.slice(0, a);
|
|
592
594
|
}
|
|
593
595
|
}
|
|
594
|
-
function
|
|
595
|
-
let r =
|
|
596
|
+
function Dt(e, t, n = !1) {
|
|
597
|
+
let r = Ot(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.";
|
|
596
598
|
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.`;
|
|
597
599
|
}
|
|
598
|
-
function
|
|
600
|
+
function Ot(e) {
|
|
599
601
|
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))}`;
|
|
600
602
|
}
|
|
601
|
-
function
|
|
603
|
+
function kt(e, t) {
|
|
602
604
|
let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
|
|
603
605
|
return {
|
|
604
606
|
name: r,
|
|
@@ -615,7 +617,7 @@ function Et(e, t) {
|
|
|
615
617
|
}]
|
|
616
618
|
};
|
|
617
619
|
}
|
|
618
|
-
async function
|
|
620
|
+
async function At(e, t) {
|
|
619
621
|
try {
|
|
620
622
|
let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
|
|
621
623
|
if (n.ok) {
|
|
@@ -633,73 +635,73 @@ async function Dt(e, t) {
|
|
|
633
635
|
publishedDate: ""
|
|
634
636
|
};
|
|
635
637
|
}
|
|
636
|
-
function
|
|
637
|
-
let
|
|
638
|
-
return
|
|
638
|
+
function I(e, t) {
|
|
639
|
+
let n = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
|
|
640
|
+
return `${t === void 0 ? "" : `|${t}`}|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${n}|\n`;
|
|
639
641
|
}
|
|
640
|
-
function
|
|
642
|
+
function jt(e, t, n, r, i) {
|
|
641
643
|
let a = " ".repeat(i);
|
|
642
644
|
for (let [o, s] of Object.entries(e)) {
|
|
643
645
|
if (s.version === void 0) continue;
|
|
644
646
|
let e = s.version;
|
|
645
|
-
n.has(`${o}@${e}`) || (r.push(
|
|
647
|
+
n.has(`${o}@${e}`) || (r.push(R(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && jt(s.dependencies, t, n, r, i + 1));
|
|
646
648
|
}
|
|
647
649
|
}
|
|
648
|
-
function
|
|
650
|
+
function L(e, t, n, r, i) {
|
|
649
651
|
for (let [a, o] of e) {
|
|
650
652
|
if (o.version === void 0) continue;
|
|
651
653
|
let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
|
|
652
654
|
if (!t.shippedKeys.has(e)) {
|
|
653
|
-
|
|
655
|
+
L(s, t, n, r, !0);
|
|
654
656
|
continue;
|
|
655
657
|
}
|
|
656
|
-
i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(
|
|
658
|
+
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));
|
|
657
659
|
}
|
|
658
660
|
}
|
|
659
|
-
function
|
|
660
|
-
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${
|
|
661
|
+
function R(e, t, n, r) {
|
|
662
|
+
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${Mt(n)}`;
|
|
661
663
|
}
|
|
662
|
-
function
|
|
664
|
+
function Mt(e) {
|
|
663
665
|
if (e == null) return "";
|
|
664
|
-
let t = e.publishedDate ?
|
|
666
|
+
let t = e.publishedDate ? z(e.publishedDate.split("T", 1)[0]) : "";
|
|
665
667
|
if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
|
|
666
|
-
let n = e.latestPublishedDate ?
|
|
668
|
+
let n = e.latestPublishedDate ? z(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `latest: ${e.latestVersion} ❗` : `latest: ${e.latestVersion} — ${n} ❗`;
|
|
667
669
|
return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
|
|
668
670
|
}
|
|
669
|
-
function
|
|
671
|
+
function z(e) {
|
|
670
672
|
if (e == null || e === "") return "n/a";
|
|
671
673
|
let t = e.split("T", 1)[0];
|
|
672
674
|
if (t == null || t === "") return "n/a";
|
|
673
675
|
let n = new Date(t), r = /* @__PURE__ */ new Date(), i = (r.getFullYear() - n.getFullYear()) * 12 + (r.getMonth() - n.getMonth());
|
|
674
|
-
return r.getDate() < n.getDate() && --i, i === 0 ? `this month: ${t}` : i === 1 ?
|
|
676
|
+
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} ⚠️`;
|
|
675
677
|
}
|
|
676
678
|
//#endregion
|
|
677
679
|
//#region src/actions/documentOpening.ts
|
|
678
|
-
var
|
|
679
|
-
async function
|
|
680
|
+
var Nt = "<!-- OPENING_START -->", Pt = "<!-- OPENING_END -->";
|
|
681
|
+
async function Ft() {
|
|
680
682
|
try {
|
|
681
683
|
s("Document Opening"), w("1️⃣ Insert opening content into 'README.md'");
|
|
682
|
-
let e = await C("package.json"), t = await C("config.json"), { owner: n, repository: r } = S(e, "document opening"), i =
|
|
683
|
-
await _(c,
|
|
684
|
+
let e = await C("package.json"), t = await C("config.json"), { owner: n, repository: r } = S(e, "document opening"), i = It(e), a = Rt(t), o = m(t.id), c = zt(n, r, i, o.uploadGroupName === void 0 ? void 0 : t.id, o.publishedTo === "npm" ? Lt(e) : void 0, e.description, a);
|
|
685
|
+
await _(c, Nt, Pt), x("Opening documented");
|
|
684
686
|
} catch (e) {
|
|
685
687
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
686
688
|
}
|
|
687
689
|
}
|
|
688
|
-
function
|
|
690
|
+
function It(e) {
|
|
689
691
|
let t = e.license;
|
|
690
692
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
691
693
|
return t;
|
|
692
694
|
}
|
|
693
|
-
function
|
|
695
|
+
function Lt(e) {
|
|
694
696
|
let t = e.name;
|
|
695
697
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
|
|
696
698
|
return t;
|
|
697
699
|
}
|
|
698
|
-
function
|
|
700
|
+
function Rt(e) {
|
|
699
701
|
let t = e.description.en?.trim();
|
|
700
702
|
return t === void 0 || t === "" ? void 0 : t;
|
|
701
703
|
}
|
|
702
|
-
function
|
|
704
|
+
function zt(e, t, n, r, i, a, o) {
|
|
703
705
|
let s = `https://github.com/${e}/${t}`, c = n.replaceAll("-", "--"), l = encodeURIComponent(`https://api.dpuse.app/configs/${r ?? ""}`);
|
|
704
706
|
return `[](./LICENSE)${r === void 0 ? "" : `\n[](${s}/releases/latest)`}${i === void 0 ? "" : `\n[](https://www.npmjs.com/package/${i})`}
|
|
705
707
|
[](${s}/actions/workflows/ci.yml)${a == null || a === "" ? "" : `\n\n${a}`}
|
|
@@ -720,31 +722,31 @@ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the applicati
|
|
|
720
722
|
}
|
|
721
723
|
//#endregion
|
|
722
724
|
//#region src/actions/documentQualitySecurity.ts
|
|
723
|
-
var
|
|
725
|
+
var Bt = {
|
|
724
726
|
"Branch-Protection": 3,
|
|
725
727
|
"Code-Review": 0,
|
|
726
728
|
Contributors: 0
|
|
727
|
-
},
|
|
729
|
+
}, Vt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Ht = "coverage/coverage-final.json", Ut = "coverage/coverage-summary.json", Wt = 80, Gt = 60, Kt = "code-health-reports/vitest/badge.json", qt = {
|
|
728
730
|
actions: "GitHub Actions",
|
|
729
731
|
"javascript-typescript": "JavaScript/TypeScript",
|
|
730
732
|
rust: "Rust"
|
|
731
|
-
},
|
|
733
|
+
}, Jt = {
|
|
732
734
|
A: "brightgreen",
|
|
733
735
|
B: "green",
|
|
734
736
|
C: "yellow",
|
|
735
737
|
D: "orange",
|
|
736
738
|
F: "red"
|
|
737
|
-
},
|
|
738
|
-
async function
|
|
739
|
+
}, Yt = `${c}/health.json`, Xt = ce(le);
|
|
740
|
+
async function Zt() {
|
|
739
741
|
try {
|
|
740
742
|
s("Document Quality & Security");
|
|
741
|
-
let e = await C("package.json"), t = await
|
|
743
|
+
let e = await C("package.json"), t = await Qt(e), n = await en(e, t === void 0 ? [] : ["--coverage", Ht]), { owner: r, repository: i } = S(e, "document quality and security");
|
|
742
744
|
w("4️⃣ Read security checks and settings");
|
|
743
|
-
let a = await
|
|
745
|
+
let a = await nn(r, i, e);
|
|
744
746
|
w("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
|
|
745
|
-
let [o, c] = await Promise.all([
|
|
747
|
+
let [o, c] = await Promise.all([rn(`https://github.com/${r}/${i}`), an(`github.com/${r}/${i}`)]);
|
|
746
748
|
w("6️⃣ Insert quality and security content into 'README.md'");
|
|
747
|
-
let d =
|
|
749
|
+
let d = un(r, i, {
|
|
748
750
|
coveragePercent: t,
|
|
749
751
|
fallowHealth: n,
|
|
750
752
|
securitySettings: a
|
|
@@ -754,7 +756,7 @@ async function qt() {
|
|
|
754
756
|
console.error("❌ Error documenting quality and security", e), process.exit(1);
|
|
755
757
|
}
|
|
756
758
|
}
|
|
757
|
-
async function
|
|
759
|
+
async function Qt(t) {
|
|
758
760
|
if (t.devDependencies?.["@vitest/coverage-v8"] == null) {
|
|
759
761
|
w("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
|
|
760
762
|
return;
|
|
@@ -764,25 +766,25 @@ async function Jt(t) {
|
|
|
764
766
|
"--passWithNoTests",
|
|
765
767
|
"--coverage"
|
|
766
768
|
]);
|
|
767
|
-
let n = await e(
|
|
769
|
+
let n = await e(Ut);
|
|
768
770
|
if (n === null) return;
|
|
769
771
|
let r = JSON.parse(n).total.lines.pct;
|
|
770
|
-
return await
|
|
772
|
+
return await $t(r), r;
|
|
771
773
|
}
|
|
772
|
-
async function
|
|
774
|
+
async function $t(e) {
|
|
773
775
|
let t = [
|
|
774
776
|
"red",
|
|
775
777
|
"yellow",
|
|
776
778
|
"brightgreen"
|
|
777
|
-
], n = Number(e >=
|
|
778
|
-
await i(
|
|
779
|
+
], n = Number(e >= Gt) + Number(e >= Wt);
|
|
780
|
+
await i(Kt, {
|
|
779
781
|
schemaVersion: 1,
|
|
780
782
|
label: "coverage",
|
|
781
783
|
message: `${e.toFixed(1)}%`,
|
|
782
784
|
color: t[n]
|
|
783
785
|
});
|
|
784
786
|
}
|
|
785
|
-
async function
|
|
787
|
+
async function en(e, n) {
|
|
786
788
|
if (e.devDependencies?.fallow == null) {
|
|
787
789
|
w("2️⃣ Code health NOT measured, as Fallow is not installed"), w("3️⃣ Code health report NOT required");
|
|
788
790
|
return;
|
|
@@ -793,32 +795,32 @@ async function Xt(e, n) {
|
|
|
793
795
|
"--format",
|
|
794
796
|
"json",
|
|
795
797
|
...n
|
|
796
|
-
],
|
|
797
|
-
let r = await C(
|
|
798
|
-
return await
|
|
798
|
+
], Yt), await t("3️⃣ Write code health report", "fallow", ["--format", "markdown"], te, !0);
|
|
799
|
+
let r = await C(Yt);
|
|
800
|
+
return await tn(r), r;
|
|
799
801
|
}
|
|
800
|
-
async function
|
|
802
|
+
async function tn(e) {
|
|
801
803
|
let { score: t, grade: n } = e.health_score;
|
|
802
804
|
await i(h, {
|
|
803
805
|
schemaVersion: 1,
|
|
804
806
|
label: "fallow",
|
|
805
807
|
message: `${n} (${String(Math.round(t))})`,
|
|
806
|
-
color:
|
|
808
|
+
color: Jt[n] ?? "lightgrey"
|
|
807
809
|
});
|
|
808
810
|
}
|
|
809
|
-
async function
|
|
811
|
+
async function nn(t, n, r) {
|
|
810
812
|
let [i, a, o] = await Promise.all([
|
|
811
813
|
e(".github/workflows/ci.yml"),
|
|
812
814
|
e(".github/dependabot.yml"),
|
|
813
815
|
e(v)
|
|
814
816
|
]), s = await e(".github/workflows/codeql.yml") ?? "", [c, l, u, d] = await Promise.all([
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
817
|
+
B(`repos/${t}/${n}`),
|
|
818
|
+
B(`repos/${t}/${n}/private-vulnerability-reporting`),
|
|
819
|
+
B(`repos/${t}/${n}/vulnerability-alerts`),
|
|
820
|
+
B(`repos/${t}/${n}/commits/main/check-runs?per_page=100`)
|
|
819
821
|
]), 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;
|
|
820
822
|
return {
|
|
821
|
-
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) =>
|
|
823
|
+
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => qt[e] ?? e).toArray(),
|
|
822
824
|
codeQLQueries: /queries: ([\w-]+)/.exec(s)?.[1],
|
|
823
825
|
dependabotAlerts: u !== void 0,
|
|
824
826
|
dependabotSecurityUpdates: p("dependabot_security_updates"),
|
|
@@ -835,37 +837,37 @@ async function Qt(t, n, r) {
|
|
|
835
837
|
testsInCI: i?.includes("npm test") ?? !1
|
|
836
838
|
};
|
|
837
839
|
}
|
|
838
|
-
async function
|
|
840
|
+
async function B(e) {
|
|
839
841
|
try {
|
|
840
|
-
let { stdout: t } = await
|
|
842
|
+
let { stdout: t } = await Xt("gh", ["api", e]);
|
|
841
843
|
return t;
|
|
842
844
|
} catch (e) {
|
|
843
845
|
if (String(e.stderr).includes("HTTP 404")) return;
|
|
844
846
|
throw e;
|
|
845
847
|
}
|
|
846
848
|
}
|
|
847
|
-
async function
|
|
849
|
+
async function rn(e) {
|
|
848
850
|
let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
|
|
849
851
|
if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
|
|
850
852
|
return (await t.json()).find((t) => t.repo_url === e)?.id;
|
|
851
853
|
}
|
|
852
|
-
async function
|
|
854
|
+
async function an(e) {
|
|
853
855
|
let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
|
|
854
856
|
if (t.status !== 404) {
|
|
855
857
|
if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
|
|
856
858
|
return await t.json();
|
|
857
859
|
}
|
|
858
860
|
}
|
|
859
|
-
function
|
|
860
|
-
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 ||
|
|
861
|
+
function on(e) {
|
|
862
|
+
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Vt.has(e) || Bt[e] !== void 0 && t >= Bt[e]);
|
|
861
863
|
}
|
|
862
|
-
function
|
|
864
|
+
function sn(e) {
|
|
863
865
|
return e === !1 ? " These are handled manually." : "";
|
|
864
866
|
}
|
|
865
|
-
function
|
|
867
|
+
function V(e) {
|
|
866
868
|
return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
|
|
867
869
|
}
|
|
868
|
-
function
|
|
870
|
+
function H(e, t) {
|
|
869
871
|
return t.length === 0 ? "" : `### ${e}
|
|
870
872
|
|
|
871
873
|
|Check|Status|What it does|
|
|
@@ -874,90 +876,90 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
|
|
|
874
876
|
|
|
875
877
|
`;
|
|
876
878
|
}
|
|
877
|
-
function
|
|
879
|
+
function cn(e, t, n, r) {
|
|
878
880
|
return `})`;
|
|
879
881
|
}
|
|
880
|
-
function
|
|
882
|
+
function ln(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
881
883
|
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 = [[
|
|
882
884
|
"Unit tests",
|
|
883
|
-
|
|
885
|
+
V(i.testsInCI),
|
|
884
886
|
`[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
|
|
885
887
|
], [
|
|
886
888
|
"Property-based tests",
|
|
887
|
-
|
|
889
|
+
V(i.propertyTests),
|
|
888
890
|
`[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)}`
|
|
889
891
|
]];
|
|
890
892
|
n !== void 0 && s.push([
|
|
891
893
|
"Test coverage",
|
|
892
|
-
|
|
893
|
-
`${
|
|
894
|
+
V(!0),
|
|
895
|
+
`${cn(e, t, "Coverage", Kt)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(Wt)}%.`
|
|
894
896
|
]);
|
|
895
897
|
let c = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, l = [[
|
|
896
898
|
"Code analysis",
|
|
897
|
-
|
|
899
|
+
V(i.sonarCloud),
|
|
898
900
|
`${i.sonarCloud ? c : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
|
|
899
901
|
], [
|
|
900
902
|
"Linting",
|
|
901
|
-
|
|
903
|
+
V(i.lintInCI),
|
|
902
904
|
`[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
|
|
903
905
|
]];
|
|
904
906
|
r !== void 0 && l.unshift([
|
|
905
907
|
"Code health",
|
|
906
|
-
|
|
907
|
-
`[${
|
|
908
|
+
V(!0),
|
|
909
|
+
`[${cn(e, t, "Fallow code health", h)}](./${te}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
|
|
908
910
|
]);
|
|
909
911
|
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 = [
|
|
910
912
|
[
|
|
911
913
|
"Push protection",
|
|
912
|
-
|
|
914
|
+
V(i.pushProtection),
|
|
913
915
|
"[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
|
|
914
916
|
],
|
|
915
917
|
[
|
|
916
918
|
"Static analysis",
|
|
917
|
-
|
|
919
|
+
V(u),
|
|
918
920
|
`${u ? d : ""}[CodeQL](https://codeql.github.com) scans${p} for security vulnerabilities, ${f}, on every push and pull request to \`main\` and weekly.`
|
|
919
921
|
],
|
|
920
922
|
[
|
|
921
923
|
"Secret scanning",
|
|
922
|
-
|
|
924
|
+
V(i.secretScanning),
|
|
923
925
|
"[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
|
|
924
926
|
]
|
|
925
927
|
], g = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", _ = [
|
|
926
928
|
[
|
|
927
929
|
"Vulnerability audit",
|
|
928
|
-
|
|
930
|
+
V(i.npmAuditInCI),
|
|
929
931
|
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)}`
|
|
930
932
|
],
|
|
931
933
|
[
|
|
932
934
|
"Supply chain risk",
|
|
933
|
-
|
|
935
|
+
V(i.socket),
|
|
934
936
|
"[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
|
|
935
937
|
],
|
|
936
938
|
[
|
|
937
939
|
"Security alerts",
|
|
938
|
-
|
|
940
|
+
V(i.dependabotAlerts),
|
|
939
941
|
`${g} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
|
|
940
942
|
],
|
|
941
943
|
[
|
|
942
944
|
"Security updates",
|
|
943
|
-
|
|
944
|
-
`${g} opens pull requests that update vulnerable dependencies.${
|
|
945
|
+
V(i.dependabotSecurityUpdates),
|
|
946
|
+
`${g} opens pull requests that update vulnerable dependencies.${sn(i.dependabotSecurityUpdates)}`
|
|
945
947
|
],
|
|
946
948
|
[
|
|
947
949
|
"Version updates",
|
|
948
|
-
|
|
949
|
-
`${g} opens pull requests for new dependency versions.${
|
|
950
|
+
V(i.dependabotVersionUpdates),
|
|
951
|
+
`${g} opens pull requests for new dependency versions.${sn(i.dependabotVersionUpdates)}`
|
|
950
952
|
]
|
|
951
953
|
];
|
|
952
954
|
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.
|
|
953
955
|
|
|
954
|
-
${
|
|
956
|
+
${H("Testing", s)}${H("Code Quality", l)}${H("Security Analysis", m)}${H("Dependencies", _)}`;
|
|
955
957
|
}
|
|
956
|
-
function
|
|
957
|
-
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 &&
|
|
958
|
+
function un(e, t, n, r, i) {
|
|
959
|
+
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && on(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.";
|
|
958
960
|
return `## Quality & Security
|
|
959
961
|
|
|
960
|
-
${
|
|
962
|
+
${ln(e, t, n)}### OpenSSF 🚧
|
|
961
963
|
|
|
962
964
|
${l}[](https://scorecard.dev/viewer/?uri=${o})
|
|
963
965
|
|
|
@@ -969,37 +971,37 @@ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
|
|
|
969
971
|
}
|
|
970
972
|
//#endregion
|
|
971
973
|
//#region src/actions/documentUsage.ts
|
|
972
|
-
var
|
|
974
|
+
var dn = "<!-- USAGE_START -->", fn = "<!-- USAGE_END -->", pn = /* @__PURE__ */ new Set([
|
|
973
975
|
"connector",
|
|
974
976
|
"cookbook",
|
|
975
977
|
"presenter"
|
|
976
|
-
]),
|
|
977
|
-
async function
|
|
978
|
+
]), mn = /* @__PURE__ */ new Set(["development", "eslint"]), hn = "> [!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.", gn = "This repository manages itself using the actions it implements.", _n = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
|
|
979
|
+
async function vn() {
|
|
978
980
|
try {
|
|
979
981
|
s("Document Usage"), w("1️⃣ Insert usage content into 'README.md'");
|
|
980
|
-
let [e, t] = await Promise.all([C("package.json"), C("config.json")]), n =
|
|
981
|
-
await _(u,
|
|
982
|
+
let [e, t] = await Promise.all([C("package.json"), C("config.json")]), n = yn(e), r = bn(n), i = U(e.engines?.node), a = U(e.engines?.npm), o = U(e.devDependencies?.typescript), c = xn(m(t.id), e.name), l = `${n.replace(/\.git$/, "")}/blob/main/package.json`, u = Sn(c, n, r, i, a, o, `${e.name === "@dpuse/dpuse-development" ? gn : _n} See the \`scripts\` block in [package.json](${l}) for details.`);
|
|
983
|
+
await _(u, dn, fn), x("Usage documented");
|
|
982
984
|
} catch (e) {
|
|
983
985
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
984
986
|
}
|
|
985
987
|
}
|
|
986
|
-
function
|
|
988
|
+
function yn(e) {
|
|
987
989
|
let t = e.repository, n = typeof t == "string" ? t : t?.url;
|
|
988
990
|
if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
|
|
989
991
|
return n.replace(/^git\+/, "");
|
|
990
992
|
}
|
|
991
|
-
function
|
|
993
|
+
function bn(e) {
|
|
992
994
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
993
995
|
}
|
|
994
|
-
function
|
|
996
|
+
function U(e) {
|
|
995
997
|
if (e == null) throw Error("package.json version range is required to document usage.");
|
|
996
998
|
let t = /\d+(?:\.\d+)*/.exec(e);
|
|
997
999
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
998
1000
|
return t[0];
|
|
999
1001
|
}
|
|
1000
|
-
function
|
|
1002
|
+
function xn(e, t) {
|
|
1001
1003
|
let { typeId: n } = e;
|
|
1002
|
-
if (
|
|
1004
|
+
if (pn.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.
|
|
1003
1005
|
|
|
1004
1006
|
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.`;
|
|
1005
1007
|
if (e.publishedTo === "npm") {
|
|
@@ -1010,11 +1012,11 @@ You may view or clone this repository for your own purposes, such as building a
|
|
|
1010
1012
|
npm install ${t}
|
|
1011
1013
|
\`\`\`
|
|
1012
1014
|
|
|
1013
|
-
${
|
|
1015
|
+
${mn.has(n) ? `${hn}\n\n` : ""}To work on the source instead, clone this repository.`;
|
|
1014
1016
|
}
|
|
1015
1017
|
return "You may view or clone this repository for your own purposes.";
|
|
1016
1018
|
}
|
|
1017
|
-
function
|
|
1019
|
+
function Sn(e, t, n, r, i, a, o) {
|
|
1018
1020
|
return `## Usage
|
|
1019
1021
|
|
|
1020
1022
|
${e}
|
|
@@ -1031,102 +1033,199 @@ ${o}`;
|
|
|
1031
1033
|
}
|
|
1032
1034
|
//#endregion
|
|
1033
1035
|
//#region src/actions/documentApiReference.ts
|
|
1034
|
-
var
|
|
1035
|
-
async function
|
|
1036
|
+
var W = "API_REFERENCE.md";
|
|
1037
|
+
async function Cn() {
|
|
1036
1038
|
try {
|
|
1037
1039
|
s("Document API Reference");
|
|
1038
1040
|
let { writeAPIReference: e } = await import("./apiReference-cMfpNKxR.js");
|
|
1039
|
-
await e("1️⃣ ",
|
|
1041
|
+
await e("1️⃣ ", W), x("API reference documented");
|
|
1040
1042
|
} catch (e) {
|
|
1041
1043
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
1042
1044
|
}
|
|
1043
1045
|
}
|
|
1044
1046
|
//#endregion
|
|
1045
1047
|
//#region src/actions/documentBundleSizes.ts
|
|
1046
|
-
var
|
|
1047
|
-
async function
|
|
1048
|
+
var wn = "bundle-analysis-reports/sonda/index.json", Tn = "bundle-analysis-reports/sonda/worker.json", En = "<!-- BUNDLE_START -->", Dn = "<!-- BUNDLE_END -->", G = " ", K = 20, On = "█", kn = "▒", An = 100 / K / 2, jn = 100 / K, Mn = "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._", Nn = "Bars show each row's share of its output file.", Pn = "↳ rows are part of the row above.", q = "(bundler output, whitespace & JSON)", J = "(inlined worker)", Fn = `${J} = 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.`, Y = "(Rust WebAssembly as base64", In = `${Y}…) = the compiled Rust code, embedded as base64 text, about a third larger than the binary it decodes to, which is the size given.`, Ln = `${q} = 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.`;
|
|
1049
|
+
async function Rn(t) {
|
|
1048
1050
|
try {
|
|
1049
1051
|
s("Document Bundle Sizes"), w("1️⃣ Read bundle analysis report");
|
|
1050
|
-
let
|
|
1052
|
+
let n = await C(wn), r = await e(Tn), i = r === null ? void 0 : JSON.parse(r), a = /* @__PURE__ */ new Map();
|
|
1053
|
+
for (let t of n.resources) t.kind === "asset" && a.set(t.name, await e(t.name));
|
|
1051
1054
|
w("2️⃣ Insert table into 'README.md'");
|
|
1052
|
-
let
|
|
1053
|
-
|
|
1055
|
+
let o = zn(n, {
|
|
1056
|
+
assetContents: a,
|
|
1057
|
+
isModuleLevel: t?.moduleLevel ?? !1,
|
|
1058
|
+
workerJson: i
|
|
1059
|
+
}), c = [
|
|
1060
|
+
o.includes("↳") ? `${Nn} ${Pn}` : Nn,
|
|
1061
|
+
o.includes(J) ? Fn : "",
|
|
1062
|
+
o.includes(Y) ? In : "",
|
|
1063
|
+
Ln
|
|
1064
|
+
].filter((e) => e !== "");
|
|
1065
|
+
await _(`## Bundle Analysis\n\n${Mn}\n\n${o}\n\n${c.join("\n\n")}`, En, Dn), x("Bundle sizes documented");
|
|
1054
1066
|
} catch (e) {
|
|
1055
1067
|
console.error("❌ Error documenting bundle sizes", e), process.exit(1);
|
|
1056
1068
|
}
|
|
1057
1069
|
}
|
|
1058
|
-
function
|
|
1059
|
-
let
|
|
1060
|
-
for (let [e,
|
|
1061
|
-
let
|
|
1062
|
-
|
|
1070
|
+
function zn(e, t) {
|
|
1071
|
+
let { assetContents: n, isModuleLevel: r, workerJson: i } = t, a = Z(e), o = i === void 0 ? void 0 : Z(i).values().next().value;
|
|
1072
|
+
for (let [e, t] of a) {
|
|
1073
|
+
let r = n.get(e);
|
|
1074
|
+
r != null && Bn(t, r, o);
|
|
1063
1075
|
}
|
|
1064
|
-
|
|
1076
|
+
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, ir(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), l = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
|
|
1077
|
+
for (let [e, t] of c) {
|
|
1078
|
+
let n = [...a.get(e) ?? /* @__PURE__ */ new Map()].toSorted(Jn), i = n.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), o = i > 0 && s > 0 ? ` · ${cr(i, s)} of the build` : "";
|
|
1079
|
+
l.push(`| **${e}** | ${ar(t)}${o} |`, ...Yn(n, i, r));
|
|
1080
|
+
}
|
|
1081
|
+
return l.join("\n");
|
|
1082
|
+
}
|
|
1083
|
+
function Bn(e, t, n) {
|
|
1084
|
+
let r = Vn(t), i = Hn(r ?? ""), a = Hn(t);
|
|
1085
|
+
Wn(e, {
|
|
1086
|
+
bytes: a.bytes - i.bytes,
|
|
1087
|
+
binaryBytes: a.binaryBytes - i.binaryBytes
|
|
1088
|
+
}), r !== void 0 && Gn(e, Buffer.byteLength(r), i, n);
|
|
1065
1089
|
}
|
|
1066
|
-
function
|
|
1067
|
-
|
|
1090
|
+
function Vn(e) {
|
|
1091
|
+
if (!e.includes("new Worker(")) return;
|
|
1092
|
+
let t = /encodeURIComponent\((\w+)\)/.exec(e)?.[1];
|
|
1093
|
+
if (t === void 0) return;
|
|
1094
|
+
let n = new RegExp(String.raw`(?:var|let|const)\s+${t}\s*=\s*(["'\`])`).exec(e), r = n?.[1];
|
|
1095
|
+
if (n === null || r === void 0) return;
|
|
1096
|
+
let i = n.index + n[0].length, a = i;
|
|
1097
|
+
for (; a < e.length && e[a] !== r;) a += e[a] === "\\" ? 2 : 1;
|
|
1098
|
+
return e.slice(i, a);
|
|
1068
1099
|
}
|
|
1069
|
-
function
|
|
1100
|
+
function Hn(e) {
|
|
1101
|
+
let t = {
|
|
1102
|
+
bytes: 0,
|
|
1103
|
+
binaryBytes: 0
|
|
1104
|
+
};
|
|
1105
|
+
for (let n of e.matchAll(/data:application\/wasm;base64,([A-Za-z\d+/]*={0,2})/g)) {
|
|
1106
|
+
let e = n[1] ?? "";
|
|
1107
|
+
t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) - Un(e);
|
|
1108
|
+
}
|
|
1109
|
+
return t;
|
|
1110
|
+
}
|
|
1111
|
+
function Un(e) {
|
|
1112
|
+
return e.endsWith("==") ? 2 : +!!e.endsWith("=");
|
|
1113
|
+
}
|
|
1114
|
+
function Wn(e, t) {
|
|
1115
|
+
if (t.bytes <= 0) return;
|
|
1116
|
+
let n = [e.get("wasm"), e.get(q)].flatMap((e) => e === void 0 ? [] : e.files.entries().map(([t, n]) => ({
|
|
1117
|
+
group: e,
|
|
1118
|
+
fileName: t,
|
|
1119
|
+
sizes: n
|
|
1120
|
+
})).toArray()).find(({ sizes: e }) => e.uncompressed >= t.bytes);
|
|
1121
|
+
if (n === void 0) return;
|
|
1122
|
+
qn(e, n.group, n.fileName, n.sizes, t.bytes);
|
|
1123
|
+
let r = `${Y}, ${$(t.binaryBytes)} binary)`;
|
|
1124
|
+
e.set(r, {
|
|
1125
|
+
sizes: {
|
|
1126
|
+
uncompressed: t.bytes,
|
|
1127
|
+
gzip: 0
|
|
1128
|
+
},
|
|
1129
|
+
files: /* @__PURE__ */ new Map([["", {
|
|
1130
|
+
uncompressed: t.bytes,
|
|
1131
|
+
gzip: 0
|
|
1132
|
+
}]])
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
function Gn(e, t, n, r) {
|
|
1136
|
+
let i = e.get(q), a = i?.files.get("");
|
|
1137
|
+
if (i === void 0 || a === void 0 || a.uncompressed < t) return;
|
|
1138
|
+
qn(e, i, "", a, t);
|
|
1139
|
+
let o = r === void 0 ? /* @__PURE__ */ new Map([["", {
|
|
1140
|
+
uncompressed: t,
|
|
1141
|
+
gzip: 0
|
|
1142
|
+
}]]) : Kn(r, t, n);
|
|
1143
|
+
e.set(J, {
|
|
1144
|
+
sizes: {
|
|
1145
|
+
uncompressed: t,
|
|
1146
|
+
gzip: 0
|
|
1147
|
+
},
|
|
1148
|
+
files: o
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
function Kn(e, t, n) {
|
|
1152
|
+
Wn(e, n);
|
|
1153
|
+
let r = /* @__PURE__ */ new Map();
|
|
1154
|
+
for (let [t, n] of e) if (t === "src") for (let [e, t] of n.files) r.set(e, { ...t });
|
|
1155
|
+
else {
|
|
1156
|
+
let e = n.files.size === 1 ? Qn(t, $n(n.files)) : t;
|
|
1157
|
+
r.set(e, { ...n.sizes });
|
|
1158
|
+
}
|
|
1159
|
+
let i = r.values().reduce((e, t) => e + t.uncompressed, 0), a = r.get(q) ?? Q();
|
|
1160
|
+
return a.uncompressed += Math.max(0, t - i), a.uncompressed > 0 && r.set(q, a), r;
|
|
1161
|
+
}
|
|
1162
|
+
function qn(e, t, n, r, i) {
|
|
1163
|
+
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);
|
|
1164
|
+
}
|
|
1165
|
+
function Jn(e, t) {
|
|
1166
|
+
return e[0] === q == (t[0] === q) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === q ? 1 : -1;
|
|
1167
|
+
}
|
|
1168
|
+
function Yn(e, t, n) {
|
|
1070
1169
|
let r = [];
|
|
1071
1170
|
for (let [i, { sizes: a, files: o }] of e) {
|
|
1072
1171
|
if (o.size === 1) {
|
|
1073
|
-
let e =
|
|
1074
|
-
r.push(`| ${
|
|
1172
|
+
let e = $n(o);
|
|
1173
|
+
r.push(`| ${G}${Qn(i, e)} | ${X(a.uncompressed, t)} |`);
|
|
1075
1174
|
continue;
|
|
1076
1175
|
}
|
|
1077
|
-
r.push(`| ${
|
|
1176
|
+
r.push(`| ${G}${i} | ${X(a.uncompressed, t)} |`), n || r.push(...Xn(o, t));
|
|
1078
1177
|
}
|
|
1079
1178
|
return r;
|
|
1080
1179
|
}
|
|
1081
|
-
function
|
|
1082
|
-
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r =
|
|
1180
|
+
function Xn(e, t) {
|
|
1181
|
+
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = Zn(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${G}${G}↳ ${e} | ${X(n.uncompressed, t, kn)} |`);
|
|
1083
1182
|
if (r > 0) {
|
|
1084
1183
|
let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
|
|
1085
|
-
i.push(`| ${
|
|
1184
|
+
i.push(`| ${G}${G}↳ ${String(r)} smaller files | ${X(e, t, kn)} |`);
|
|
1086
1185
|
}
|
|
1087
1186
|
return i;
|
|
1088
1187
|
}
|
|
1089
|
-
function
|
|
1188
|
+
function Zn(e, t) {
|
|
1090
1189
|
if (t <= 0) return 0;
|
|
1091
1190
|
let n = 0, r = 0;
|
|
1092
1191
|
for (let [, i] of e.toReversed()) {
|
|
1093
|
-
let e = i.uncompressed / t * 100 <
|
|
1192
|
+
let e = i.uncompressed / t * 100 < An, a = (r + i.uncompressed) / t * 100 <= jn;
|
|
1094
1193
|
if (!e || !a) break;
|
|
1095
1194
|
n++, r += i.uncompressed;
|
|
1096
1195
|
}
|
|
1097
1196
|
return n >= 2 ? n : 0;
|
|
1098
1197
|
}
|
|
1099
|
-
function
|
|
1100
|
-
return `${
|
|
1198
|
+
function X(e, t, n = On) {
|
|
1199
|
+
return `${or(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
|
|
1101
1200
|
}
|
|
1102
|
-
function
|
|
1201
|
+
function Qn(e, t) {
|
|
1103
1202
|
return t === "" ? e : `${e} → ${t}`;
|
|
1104
1203
|
}
|
|
1105
|
-
function
|
|
1204
|
+
function $n(e) {
|
|
1106
1205
|
let [t] = e.keys();
|
|
1107
1206
|
if (t === void 0) throw Error("Expected exactly one file");
|
|
1108
1207
|
return t;
|
|
1109
1208
|
}
|
|
1110
|
-
function
|
|
1111
|
-
let t =
|
|
1209
|
+
function Z(e) {
|
|
1210
|
+
let t = er(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1112
1211
|
for (let r of e.resources) {
|
|
1113
1212
|
if (r.kind !== "chunk" || !r.parent) continue;
|
|
1114
|
-
let { group: e, file: i } =
|
|
1213
|
+
let { group: e, file: i } = tr(r.name, t), a = ir(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
|
|
1115
1214
|
n.set(r.parent, o);
|
|
1116
1215
|
let s = o.get(e) ?? {
|
|
1117
|
-
sizes:
|
|
1216
|
+
sizes: Q(),
|
|
1118
1217
|
files: /* @__PURE__ */ new Map()
|
|
1119
1218
|
};
|
|
1120
|
-
o.set(e, s),
|
|
1121
|
-
let c = s.files.get(i) ??
|
|
1122
|
-
s.files.set(i, c),
|
|
1219
|
+
o.set(e, s), sr(s.sizes, a);
|
|
1220
|
+
let c = s.files.get(i) ?? Q();
|
|
1221
|
+
s.files.set(i, c), sr(c, a);
|
|
1123
1222
|
}
|
|
1124
1223
|
return n;
|
|
1125
1224
|
}
|
|
1126
|
-
function
|
|
1225
|
+
function er(e) {
|
|
1127
1226
|
return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
|
|
1128
1227
|
}
|
|
1129
|
-
function
|
|
1228
|
+
function tr(e, t) {
|
|
1130
1229
|
let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
|
|
1131
1230
|
if (n) {
|
|
1132
1231
|
let [t, r] = n;
|
|
@@ -1136,49 +1235,49 @@ function Bn(e, t) {
|
|
|
1136
1235
|
};
|
|
1137
1236
|
}
|
|
1138
1237
|
return e === "[unassigned]" ? {
|
|
1139
|
-
group:
|
|
1238
|
+
group: q,
|
|
1140
1239
|
file: ""
|
|
1141
1240
|
} : e.startsWith("\0") ? {
|
|
1142
1241
|
group: "(runtime)",
|
|
1143
1242
|
file: e.slice(1)
|
|
1144
1243
|
} : e.startsWith("rust/") ? {
|
|
1145
1244
|
group: "wasm",
|
|
1146
|
-
file:
|
|
1245
|
+
file: nr(e)
|
|
1147
1246
|
} : {
|
|
1148
1247
|
group: "src",
|
|
1149
|
-
file:
|
|
1248
|
+
file: rr(e)
|
|
1150
1249
|
};
|
|
1151
1250
|
}
|
|
1152
|
-
function
|
|
1153
|
-
let t = e.split("/", 2)[1] ?? "", n =
|
|
1251
|
+
function nr(e) {
|
|
1252
|
+
let t = e.split("/", 2)[1] ?? "", n = rr(e);
|
|
1154
1253
|
return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
|
|
1155
1254
|
}
|
|
1156
|
-
function
|
|
1255
|
+
function rr(e) {
|
|
1157
1256
|
return e.split("/").at(-1) ?? e;
|
|
1158
1257
|
}
|
|
1159
|
-
function
|
|
1258
|
+
function ir(e) {
|
|
1160
1259
|
return {
|
|
1161
1260
|
uncompressed: e.uncompressed,
|
|
1162
1261
|
gzip: e.gzip ?? 0
|
|
1163
1262
|
};
|
|
1164
1263
|
}
|
|
1165
|
-
function
|
|
1264
|
+
function ar(e) {
|
|
1166
1265
|
return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
|
|
1167
1266
|
}
|
|
1168
|
-
function
|
|
1169
|
-
let n = Math.round(e / 100 *
|
|
1170
|
-
return `\`${t.repeat(n)}${"░".repeat(
|
|
1267
|
+
function or(e, t = On) {
|
|
1268
|
+
let n = Math.round(e / 100 * K);
|
|
1269
|
+
return `\`${t.repeat(n)}${"░".repeat(K - n)}\` ${e.toFixed(1)}%`;
|
|
1171
1270
|
}
|
|
1172
|
-
function
|
|
1271
|
+
function Q() {
|
|
1173
1272
|
return {
|
|
1174
1273
|
uncompressed: 0,
|
|
1175
1274
|
gzip: 0
|
|
1176
1275
|
};
|
|
1177
1276
|
}
|
|
1178
|
-
function
|
|
1277
|
+
function sr(e, t) {
|
|
1179
1278
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
1180
1279
|
}
|
|
1181
|
-
function
|
|
1280
|
+
function cr(e, t) {
|
|
1182
1281
|
return `${(e / t * 100).toFixed(1)}%`;
|
|
1183
1282
|
}
|
|
1184
1283
|
function $(e) {
|
|
@@ -1186,15 +1285,15 @@ function $(e) {
|
|
|
1186
1285
|
}
|
|
1187
1286
|
//#endregion
|
|
1188
1287
|
//#region src/actions/documentProject.ts
|
|
1189
|
-
async function
|
|
1288
|
+
async function lr(t = "MIT", n = !1) {
|
|
1190
1289
|
try {
|
|
1191
1290
|
let r = await C("config.json"), i = m(r.id).typeId === "connector";
|
|
1192
|
-
await
|
|
1193
|
-
let a = await e(
|
|
1194
|
-
a ? await
|
|
1291
|
+
await Ft(), i && await Ve(), await vn(), await ct(t), await e("bundle-analysis-reports/sonda/index.json") === null ? w(`ℹ️ Bundle sizes NOT documented, as there is no '${wn}' yet. Build the project first.`) : await Rn({ moduleLevel: n }), await Zt(), await He();
|
|
1292
|
+
let a = await e(W) !== null;
|
|
1293
|
+
a ? await Cn() : w(`ℹ️ '${W}' NOT required by this project`), await o("ℹ️ Format generated files", "prettier", [
|
|
1195
1294
|
"--write",
|
|
1196
1295
|
"README.md",
|
|
1197
|
-
...a ? [
|
|
1296
|
+
...a ? [W] : []
|
|
1198
1297
|
]);
|
|
1199
1298
|
} catch (e) {
|
|
1200
1299
|
console.error("❌ Error documenting project", e), process.exit(1);
|
|
@@ -1202,7 +1301,7 @@ async function Yn(t = "MIT", n = !1) {
|
|
|
1202
1301
|
}
|
|
1203
1302
|
//#endregion
|
|
1204
1303
|
//#region src/actions/formatCode.ts
|
|
1205
|
-
async function
|
|
1304
|
+
async function ur() {
|
|
1206
1305
|
try {
|
|
1207
1306
|
s("Format Code");
|
|
1208
1307
|
let e = [
|
|
@@ -1223,7 +1322,7 @@ async function Xn() {
|
|
|
1223
1322
|
}
|
|
1224
1323
|
//#endregion
|
|
1225
1324
|
//#region src/actions/lintCode.ts
|
|
1226
|
-
async function
|
|
1325
|
+
async function dr() {
|
|
1227
1326
|
try {
|
|
1228
1327
|
s("Lint Code"), await o("1️⃣ Lint", "eslint", ["."]), x("Code linted");
|
|
1229
1328
|
} catch (e) {
|
|
@@ -1232,7 +1331,7 @@ async function Zn() {
|
|
|
1232
1331
|
}
|
|
1233
1332
|
//#endregion
|
|
1234
1333
|
//#region src/utilities/cloudflare.ts
|
|
1235
|
-
async function
|
|
1334
|
+
async function fr() {
|
|
1236
1335
|
let e = await C("config.json"), t = {
|
|
1237
1336
|
body: JSON.stringify(e),
|
|
1238
1337
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1240,7 +1339,7 @@ async function Qn() {
|
|
|
1240
1339
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
1241
1340
|
if (!n.ok) throw Error(await n.text());
|
|
1242
1341
|
}
|
|
1243
|
-
async function
|
|
1342
|
+
async function pr(e, t) {
|
|
1244
1343
|
async function n(e, t, r) {
|
|
1245
1344
|
for (let i of r) {
|
|
1246
1345
|
let r = `${e}/${i}`, a = `${t}/${i}`;
|
|
@@ -1258,7 +1357,7 @@ async function $n(e, t) {
|
|
|
1258
1357
|
let r = await y(`${e}/${t}/`);
|
|
1259
1358
|
await n(`${e}/${t}`, t, r);
|
|
1260
1359
|
}
|
|
1261
|
-
async function
|
|
1360
|
+
async function mr(e) {
|
|
1262
1361
|
let t = e.id, n = {
|
|
1263
1362
|
body: JSON.stringify(e),
|
|
1264
1363
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1266,7 +1365,7 @@ async function er(e) {
|
|
|
1266
1365
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
1267
1366
|
if (!r.ok) throw Error(await r.text());
|
|
1268
1367
|
}
|
|
1269
|
-
async function
|
|
1368
|
+
async function hr(e, t) {
|
|
1270
1369
|
let n = `v${e.version ?? "unknown"}`;
|
|
1271
1370
|
async function r(e, r = "") {
|
|
1272
1371
|
let i = await y(e, { withFileTypes: !0 });
|
|
@@ -1290,34 +1389,34 @@ async function tr(e, t) {
|
|
|
1290
1389
|
}
|
|
1291
1390
|
//#endregion
|
|
1292
1391
|
//#region src/actions/publishProject.ts
|
|
1293
|
-
async function
|
|
1392
|
+
async function gr() {
|
|
1294
1393
|
try {
|
|
1295
1394
|
s("Publish Project");
|
|
1296
1395
|
let e = await C("package.json"), t = await C("config.json"), n = m(t.id);
|
|
1297
|
-
n.publishedTo === "npm" ? await o("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : w("1️⃣ Publishing to npm NOT required"), await
|
|
1396
|
+
n.publishedTo === "npm" ? await o("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : w("1️⃣ Publishing to npm NOT required"), await _r("2️⃣ ", e, t, n), n.publishedTo === "kb" && await o("3️⃣ Deploy", "npm", ["run", "deploy"]), x(`Project version '${e.version ?? "unknown"}' published.`);
|
|
1298
1397
|
} catch (e) {
|
|
1299
1398
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1300
1399
|
}
|
|
1301
1400
|
}
|
|
1302
|
-
async function
|
|
1303
|
-
if (r.typeId === "app") w(`${e} Register module`), await
|
|
1304
|
-
else if (r.typeId === "engine") w(`${e} Register module`), await
|
|
1401
|
+
async function _r(e, t, n, r) {
|
|
1402
|
+
if (r.typeId === "app") w(`${e} Register module`), await fr();
|
|
1403
|
+
else if (r.typeId === "engine") w(`${e} Register module`), await hr(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await mr(n);
|
|
1305
1404
|
else if (r.uploadGroupName === void 0) w(`${e} Registration NOT required`);
|
|
1306
1405
|
else {
|
|
1307
1406
|
w(`${e} Register module`);
|
|
1308
1407
|
let i = n.id.split("-").slice(2).join("-");
|
|
1309
|
-
await
|
|
1408
|
+
await hr(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await mr(n);
|
|
1310
1409
|
}
|
|
1311
1410
|
}
|
|
1312
1411
|
//#endregion
|
|
1313
1412
|
//#region src/actions/releaseProject.ts
|
|
1314
|
-
async function
|
|
1413
|
+
async function vr(e = "MIT", t = !1) {
|
|
1315
1414
|
try {
|
|
1316
1415
|
s("Release Project");
|
|
1317
1416
|
let n = await C("package.json"), r = await C("config.json"), i = m(r.id);
|
|
1318
1417
|
await d("1️⃣ ", n);
|
|
1319
1418
|
let a = await ae("2️⃣ ", n, i);
|
|
1320
|
-
if (await Se("3️⃣ ", n), w("4️⃣ Regenerate README"), await
|
|
1419
|
+
if (await Se("3️⃣ ", n), w("4️⃣ Regenerate README"), await lr(e, t), await b("5️⃣ Stage changes", "git", ["add", "."]), await b("6️⃣ Commit changes", "git", [
|
|
1321
1420
|
"commit",
|
|
1322
1421
|
"-m",
|
|
1323
1422
|
`v${n.version ?? "unknown"}`
|
|
@@ -1325,7 +1424,7 @@ async function ir(e = "MIT", t = !1) {
|
|
|
1325
1424
|
"push",
|
|
1326
1425
|
"origin",
|
|
1327
1426
|
"main:main"
|
|
1328
|
-
]), await
|
|
1427
|
+
]), await _r("8️⃣ ", n, a, i), i.publishedTo === "npm") {
|
|
1329
1428
|
let e = `v${n.version ?? "unknown"}`;
|
|
1330
1429
|
await o("9️⃣ Trigger GitHub release", "gh", [
|
|
1331
1430
|
"release",
|
|
@@ -1344,7 +1443,7 @@ async function ir(e = "MIT", t = !1) {
|
|
|
1344
1443
|
}
|
|
1345
1444
|
//#endregion
|
|
1346
1445
|
//#region src/actions/syncProjectWithGitHub.ts
|
|
1347
|
-
async function
|
|
1446
|
+
async function yr() {
|
|
1348
1447
|
try {
|
|
1349
1448
|
s("Synchronise Project with GitHub");
|
|
1350
1449
|
let e = await C("package.json"), t = await C("config.json"), n = m(t.id);
|
|
@@ -1363,12 +1462,12 @@ async function ar() {
|
|
|
1363
1462
|
}
|
|
1364
1463
|
//#endregion
|
|
1365
1464
|
//#region src/actions/testProject.ts
|
|
1366
|
-
var
|
|
1465
|
+
var br = [
|
|
1367
1466
|
"1️⃣ ",
|
|
1368
1467
|
"2️⃣ ",
|
|
1369
1468
|
"3️⃣ ",
|
|
1370
1469
|
"4️⃣ "
|
|
1371
|
-
],
|
|
1470
|
+
], xr = [{
|
|
1372
1471
|
id: "unit",
|
|
1373
1472
|
label: "Run unit tests",
|
|
1374
1473
|
command: "vitest",
|
|
@@ -1381,13 +1480,13 @@ var or = [
|
|
|
1381
1480
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1382
1481
|
configFileName: "playwright.config.ts"
|
|
1383
1482
|
}];
|
|
1384
|
-
async function
|
|
1483
|
+
async function Sr(t = ["unit"]) {
|
|
1385
1484
|
try {
|
|
1386
1485
|
s("Test Project");
|
|
1387
1486
|
let n = 0;
|
|
1388
|
-
for (let r of
|
|
1487
|
+
for (let r of xr) {
|
|
1389
1488
|
if (!t.includes(r.id) || await e(r.configFileName) === null) continue;
|
|
1390
|
-
let i = `${
|
|
1489
|
+
let i = `${br[n] ?? ""} ${r.label}`;
|
|
1391
1490
|
await o(i, r.command, r.arguments), n += 1;
|
|
1392
1491
|
}
|
|
1393
1492
|
if (n === 0) {
|
|
@@ -1401,7 +1500,7 @@ async function cr(t = ["unit"]) {
|
|
|
1401
1500
|
}
|
|
1402
1501
|
//#endregion
|
|
1403
1502
|
//#region src/actions/triggerGitHubRelease.ts
|
|
1404
|
-
async function
|
|
1503
|
+
async function Cr() {
|
|
1405
1504
|
try {
|
|
1406
1505
|
s("Trigger GitHub Release");
|
|
1407
1506
|
let e = `v${(await C("package.json")).version ?? "unknown"}`;
|
|
@@ -1419,4 +1518,4 @@ async function lr() {
|
|
|
1419
1518
|
}
|
|
1420
1519
|
}
|
|
1421
1520
|
//#endregion
|
|
1422
|
-
export { _e as auditDependencies, xe as buildProject, Fe as checkProject,
|
|
1521
|
+
export { _e as auditDependencies, xe as buildProject, Fe as checkProject, lr as documentProject, ur as formatCode, dr as lintCode, gr as publishProject, vr as releaseProject, yr as syncProjectWithGitHub, Sr as testProject, Cr as triggerGitHubRelease, pr as uploadDirectoryToR2 };
|