@dpuse/dpuse-development 1.0.157 → 1.0.158
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.
|
@@ -387,8 +387,8 @@ async function at(e, n) {
|
|
|
387
387
|
});
|
|
388
388
|
let u = l.values().toArray();
|
|
389
389
|
st(u, n);
|
|
390
|
-
for (let e of u) e.licenseFiles = await
|
|
391
|
-
return await
|
|
390
|
+
for (let e of u) e.licenseFiles = await lt(e, c);
|
|
391
|
+
return await ut(e, u), {
|
|
392
392
|
crates: u,
|
|
393
393
|
treeItems: a.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
|
|
394
394
|
name: e,
|
|
@@ -398,6 +398,13 @@ async function at(e, n) {
|
|
|
398
398
|
}))
|
|
399
399
|
};
|
|
400
400
|
}
|
|
401
|
+
function M(e) {
|
|
402
|
+
try {
|
|
403
|
+
return he(e, [e]);
|
|
404
|
+
} catch {
|
|
405
|
+
return !1;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
401
408
|
function ot(e) {
|
|
402
409
|
let t = [];
|
|
403
410
|
for (let n of e.split("\n")) {
|
|
@@ -416,26 +423,19 @@ function ot(e) {
|
|
|
416
423
|
return t;
|
|
417
424
|
}
|
|
418
425
|
function st(e, t) {
|
|
419
|
-
let n = t.split(";").filter((e) =>
|
|
426
|
+
let n = t.split(";").filter((e) => M(e)), r = e.filter((e) => !ct(e.licenseExpression, n));
|
|
420
427
|
if (r.length === 0) return;
|
|
421
428
|
let i = r.map((e) => `${e.name}@${e.version} (${e.licenseExpression === "" ? "no licence" : e.licenseExpression})`).join(", ");
|
|
422
429
|
throw Error(`Rust crates with licences not allowed: ${i}.`);
|
|
423
430
|
}
|
|
424
|
-
function ct(e) {
|
|
425
|
-
try {
|
|
426
|
-
return he(e, [e]);
|
|
427
|
-
} catch {
|
|
428
|
-
return !1;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
function lt(e, t) {
|
|
431
|
+
function ct(e, t) {
|
|
432
432
|
try {
|
|
433
433
|
return he(e.replaceAll("/", " OR "), t);
|
|
434
434
|
} catch {
|
|
435
435
|
return !1;
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
async function
|
|
438
|
+
async function lt(e, t) {
|
|
439
439
|
let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
|
|
440
440
|
if (n == null) return [];
|
|
441
441
|
let r = E.dirname(n.manifest_path), i = (await T.readdir(r)).filter((e) => rt.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
|
|
@@ -450,7 +450,7 @@ async function ut(e, t) {
|
|
|
450
450
|
}
|
|
451
451
|
return a;
|
|
452
452
|
}
|
|
453
|
-
async function
|
|
453
|
+
async function ut(e, t) {
|
|
454
454
|
w(`${e} - fetch release dates from crates.io`);
|
|
455
455
|
for (let [e, n] of t.entries()) {
|
|
456
456
|
e > 0 && await me(et), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
|
|
@@ -466,77 +466,77 @@ async function dt(e, t) {
|
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
// src/actions/documentDependencies.ts
|
|
469
|
-
var
|
|
470
|
-
async function
|
|
469
|
+
var N = "<!-- DEPENDENCY_LICENSES_START -->", dt = "<!-- DEPENDENCY_LICENSES_END -->", P = "## Dependency Licenses", ft = `bundle-analysis-reports/${se}`, F = "licenses/licenseTree.json", pt = 1e4, mt = "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.", ht = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${mt}`, gt = `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. ${mt}`;
|
|
470
|
+
async function _t(e = "MIT") {
|
|
471
471
|
try {
|
|
472
472
|
l("Document Dependencies");
|
|
473
473
|
let t = await C("package.json"), n = t.name ?? "";
|
|
474
474
|
if (re.has(n)) {
|
|
475
|
-
await
|
|
475
|
+
await vt(n), x("Dependencies documented");
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
478
|
await m("1️⃣ Clear downloaded licenses", "licenses/downloads");
|
|
479
|
-
let r = await
|
|
479
|
+
let r = await Dt(), i = await Ot();
|
|
480
480
|
if (i === null) {
|
|
481
|
-
let n =
|
|
482
|
-
await
|
|
481
|
+
let n = Mt(r);
|
|
482
|
+
await Et("2️⃣ Identify production licenses", e, [t.name ?? "", ...n], !0), await o("3️⃣ Identify transitive dependencies", "npm", [
|
|
483
483
|
"ls",
|
|
484
484
|
"--all",
|
|
485
485
|
"--json",
|
|
486
486
|
"--omit=dev"
|
|
487
|
-
], F), await
|
|
487
|
+
], F), await yt("4️⃣ ", e, new Set(n));
|
|
488
488
|
} else {
|
|
489
|
-
let n =
|
|
490
|
-
await
|
|
489
|
+
let n = kt(i, r), a = At(r), s = a.filter((e) => !n.has(e));
|
|
490
|
+
await Et("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), jt(n, new Set(a)), await o("3️⃣ Identify transitive dependencies", "npm", [
|
|
491
491
|
"ls",
|
|
492
492
|
"--all",
|
|
493
493
|
"--json"
|
|
494
494
|
], F, !0);
|
|
495
495
|
let c = await at("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
|
|
496
496
|
allowedLicenses: e,
|
|
497
|
-
productionNames:
|
|
497
|
+
productionNames: wt(t),
|
|
498
498
|
rustCrates: c,
|
|
499
499
|
shippedKeys: n
|
|
500
500
|
};
|
|
501
|
-
await
|
|
501
|
+
await bt(c === null ? "4️⃣ " : "5️⃣ ", l);
|
|
502
502
|
}
|
|
503
503
|
x("Dependencies documented");
|
|
504
504
|
} catch (e) {
|
|
505
505
|
console.error("❌ Error documenting dependencies", e), process.exit(1);
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
async function
|
|
508
|
+
async function vt(t) {
|
|
509
509
|
w(`1️⃣ Skip: ${t} is a development-only tool and is never part of a production release.`);
|
|
510
510
|
let n = `> [!WARNING]\n> Dependency licenses are not documented here: ${t} is a development-only tool and is never part of a production release.`;
|
|
511
|
-
await e(`${P}\n\n${n}`,
|
|
511
|
+
await e(`${P}\n\n${n}`, N, dt);
|
|
512
512
|
}
|
|
513
|
-
async function
|
|
513
|
+
async function yt(t, n, r) {
|
|
514
514
|
w(`${t} Insert licenses into 'README.md'`);
|
|
515
|
-
let i = await C(F), a = await
|
|
515
|
+
let i = await C(F), a = await Tt(), o = `${It(n, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
516
516
|
for (let e of a.values()) o += L(e);
|
|
517
517
|
let s = [];
|
|
518
|
-
i.dependencies != null &&
|
|
519
|
-
let c = `${
|
|
520
|
-
await e(`${P}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${c}`,
|
|
518
|
+
i.dependencies != null && Bt(i.dependencies, a, r, s, 0);
|
|
519
|
+
let c = `${ht}\n\n${s.join("\n")}`;
|
|
520
|
+
await e(`${P}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${c}`, N, dt);
|
|
521
521
|
}
|
|
522
|
-
async function
|
|
522
|
+
async function bt(t, n) {
|
|
523
523
|
w(`${t} Insert licenses into 'README.md'`);
|
|
524
|
-
let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = n, s = await
|
|
525
|
-
for (let e of s.values().toArray().toSorted(
|
|
526
|
-
for (let e of c.values().toArray().toSorted(
|
|
524
|
+
let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = n, s = await Tt(), c = new Map((a?.crates ?? []).map((e) => [`${e.name}@${e.version}`, St(e)])), l = a !== null, u = l ? "|Type|Dependency|Version|License(s)|Document|\n|:-|:-|:-:|:-|:-|" : "|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|", d = `${It(r, !0, l)}\n\n${u}\n`;
|
|
525
|
+
for (let e of s.values().toArray().toSorted(xt)) d += L(e, l ? "JavaScript" : void 0);
|
|
526
|
+
for (let e of c.values().toArray().toSorted(xt)) d += L(e, "Rust");
|
|
527
527
|
let f = await C(F), p = Object.entries(f.dependencies ?? {}).toSorted(([e], [t]) => Number(!i.has(e)) - Number(!i.has(t))), m = [];
|
|
528
528
|
R(p, {
|
|
529
529
|
licensesByKey: s,
|
|
530
530
|
shippedKeys: o,
|
|
531
531
|
shownKeys: /* @__PURE__ */ new Set()
|
|
532
|
-
}, m, 0
|
|
533
|
-
let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) =>
|
|
534
|
-
await e(`${P}\n\n${d.trimEnd()}\n\n### Dependency Tree\n\n${_}`,
|
|
532
|
+
}, m, 0);
|
|
533
|
+
let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) => Ct(e, c)).join("\n"), _ = l ? `${gt}\n\n#### JavaScript\n\n${h}\n\n#### Rust\n\n${g}` : `${gt}\n\n${h}`;
|
|
534
|
+
await e(`${P}\n\n${d.trimEnd()}\n\n### Dependency Tree\n\n${_}`, N, dt);
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function xt(e, t) {
|
|
537
537
|
return e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en");
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function St(e) {
|
|
540
540
|
return {
|
|
541
541
|
name: e.name,
|
|
542
542
|
repository: e.repository,
|
|
@@ -549,26 +549,28 @@ function xt(e) {
|
|
|
549
549
|
licenseFiles: e.licenseFiles
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function Ct(e, t) {
|
|
553
553
|
let n = " ".repeat(e.depth);
|
|
554
554
|
return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` : z(e.name, e.version, t.get(`${e.name}@${e.version}`), n);
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function wt(e) {
|
|
557
557
|
return /* @__PURE__ */ new Set([
|
|
558
558
|
...Object.keys(e.dependencies ?? {}),
|
|
559
559
|
...Object.keys(e.optionalDependencies ?? {}),
|
|
560
560
|
...Object.keys(e.peerDependencies ?? {})
|
|
561
561
|
]);
|
|
562
562
|
}
|
|
563
|
-
async function
|
|
563
|
+
async function Tt() {
|
|
564
564
|
let e = await C("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
|
|
565
|
-
for (let [n, r] of Object.entries(e)) t.set(n,
|
|
566
|
-
|
|
567
|
-
let t = await
|
|
565
|
+
for (let [n, r] of Object.entries(e)) t.set(n, Rt(n, r));
|
|
566
|
+
await Promise.all(t.values().map(async (e) => {
|
|
567
|
+
let t = await zt(e.name, e.installedVersion);
|
|
568
568
|
e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
|
|
569
|
-
}))
|
|
569
|
+
}));
|
|
570
|
+
let n = [...t.values().flatMap((e) => e.latestVersion === "" ? [e.name] : [])].join(", ");
|
|
571
|
+
return n !== "" && console.warn(`⚠️ No answer from the npm registry, so shown without release dates: ${n}`), t;
|
|
570
572
|
}
|
|
571
|
-
async function
|
|
573
|
+
async function Et(e, t, n, r) {
|
|
572
574
|
w(e), await new Promise((e, i) => {
|
|
573
575
|
let a = {
|
|
574
576
|
start: process.cwd(),
|
|
@@ -586,39 +588,39 @@ async function Tt(e, t, n, r) {
|
|
|
586
588
|
});
|
|
587
589
|
});
|
|
588
590
|
}
|
|
589
|
-
async function
|
|
591
|
+
async function Dt() {
|
|
590
592
|
let e = await t("package-lock.json");
|
|
591
593
|
return e === null ? {} : JSON.parse(e).packages ?? {};
|
|
592
594
|
}
|
|
593
|
-
async function
|
|
595
|
+
async function Ot() {
|
|
594
596
|
let e = await t(ft);
|
|
595
597
|
return e === null ? null : JSON.parse(e);
|
|
596
598
|
}
|
|
597
|
-
function
|
|
599
|
+
function kt(e, t) {
|
|
598
600
|
let n = new Set(e.packages);
|
|
599
601
|
for (let r of e.external) {
|
|
600
|
-
let e =
|
|
601
|
-
if (e !== void 0) for (let r of [e, ...
|
|
602
|
+
let e = Ft(t, "", r);
|
|
603
|
+
if (e !== void 0) for (let r of [e, ...Nt(t, e)]) {
|
|
602
604
|
let e = t[r];
|
|
603
605
|
e?.version !== void 0 && n.add(I(r, e));
|
|
604
606
|
}
|
|
605
607
|
}
|
|
606
608
|
return n;
|
|
607
609
|
}
|
|
608
|
-
function
|
|
610
|
+
function At(e) {
|
|
609
611
|
let t = /* @__PURE__ */ new Set();
|
|
610
612
|
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(I(n, r));
|
|
611
613
|
return [...t];
|
|
612
614
|
}
|
|
613
|
-
function
|
|
615
|
+
function jt(e, t) {
|
|
614
616
|
let n = [...e.difference(t)];
|
|
615
617
|
n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
|
|
616
618
|
}
|
|
617
619
|
function I(e, t) {
|
|
618
620
|
return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
|
|
619
621
|
}
|
|
620
|
-
function
|
|
621
|
-
let t =
|
|
622
|
+
function Mt(e) {
|
|
623
|
+
let t = Nt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
622
624
|
for (let [i, a] of Object.entries(e)) {
|
|
623
625
|
if (i === "" || a.version === void 0) continue;
|
|
624
626
|
let e = I(i, a);
|
|
@@ -626,18 +628,18 @@ function jt(e) {
|
|
|
626
628
|
}
|
|
627
629
|
return r.values().filter((e) => !n.has(e)).toArray();
|
|
628
630
|
}
|
|
629
|
-
function
|
|
631
|
+
function Nt(e, t) {
|
|
630
632
|
let n = /* @__PURE__ */ new Set(), r = [t];
|
|
631
633
|
for (; r.length > 0;) {
|
|
632
634
|
let t = r.pop() ?? "", i = e[t];
|
|
633
|
-
if (i !== void 0) for (let a of
|
|
634
|
-
let i =
|
|
635
|
+
if (i !== void 0) for (let a of Pt(i)) {
|
|
636
|
+
let i = Ft(e, t, a);
|
|
635
637
|
i === void 0 || n.has(i) || (n.add(i), r.push(i));
|
|
636
638
|
}
|
|
637
639
|
}
|
|
638
640
|
return n;
|
|
639
641
|
}
|
|
640
|
-
function
|
|
642
|
+
function Pt(e) {
|
|
641
643
|
let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
|
|
642
644
|
return [
|
|
643
645
|
...Object.keys(e.dependencies ?? {}),
|
|
@@ -645,7 +647,7 @@ function Nt(e) {
|
|
|
645
647
|
...t
|
|
646
648
|
];
|
|
647
649
|
}
|
|
648
|
-
function
|
|
650
|
+
function Ft(e, t, n) {
|
|
649
651
|
let r = t;
|
|
650
652
|
for (;;) {
|
|
651
653
|
let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
|
|
@@ -655,14 +657,14 @@ function Pt(e, t, n) {
|
|
|
655
657
|
r = a === -1 ? "" : r.slice(0, a);
|
|
656
658
|
}
|
|
657
659
|
}
|
|
658
|
-
function
|
|
659
|
-
let r =
|
|
660
|
-
return `License data is updated each time \`npm run document\` is run, using ${
|
|
660
|
+
function It(e, t, n = !1) {
|
|
661
|
+
let r = e.split(";"), i = r.filter((e) => M(e)), a = r.filter((e) => !M(e)), o = [i.length === 0 ? "" : `${Lt(i)}, all of which allow commercial use`, a.length === 0 ? "" : `${Lt(a)}, whose own terms decide whether commercial use is allowed`].filter((e) => e !== "").join(", or "), s = 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)", c = "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.";
|
|
662
|
+
return `License data is updated each time \`npm run document\` is run, using ${s}. ${t ? n ? `${c} 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.` : c : "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 ${o}. All are used as published. Where the build has to adjust a dependency so it can be bundled, the adjustment only affects how its files are located and loaded, never what the code does. Developers cloning this repository should independently verify development dependencies.`;
|
|
661
663
|
}
|
|
662
|
-
function
|
|
664
|
+
function Lt(e) {
|
|
663
665
|
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))}`;
|
|
664
666
|
}
|
|
665
|
-
function
|
|
667
|
+
function Rt(e, t) {
|
|
666
668
|
let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
|
|
667
669
|
return {
|
|
668
670
|
name: r,
|
|
@@ -679,9 +681,9 @@ function Lt(e, t) {
|
|
|
679
681
|
}]
|
|
680
682
|
};
|
|
681
683
|
}
|
|
682
|
-
async function
|
|
684
|
+
async function zt(e, t) {
|
|
683
685
|
try {
|
|
684
|
-
let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}
|
|
686
|
+
let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`, { signal: AbortSignal.timeout(pt) });
|
|
685
687
|
if (n.ok) {
|
|
686
688
|
let e = await n.json(), r = new Map(Object.entries(e["dist-tags"] ?? {})), i = new Map(Object.entries(e.time ?? {})), a = r.get("latest") ?? "", o = i.get(t) ?? "";
|
|
687
689
|
return {
|
|
@@ -701,32 +703,33 @@ function L(e, t) {
|
|
|
701
703
|
let n = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
|
|
702
704
|
return `${t === void 0 ? "" : `|${t}`}|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${n}|\n`;
|
|
703
705
|
}
|
|
704
|
-
function
|
|
706
|
+
function Bt(e, t, n, r, i) {
|
|
705
707
|
let a = " ".repeat(i);
|
|
706
708
|
for (let [o, s] of Object.entries(e)) {
|
|
707
709
|
if (s.version === void 0) continue;
|
|
708
710
|
let e = s.version;
|
|
709
|
-
n.has(`${o}@${e}`) || (r.push(z(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null &&
|
|
711
|
+
n.has(`${o}@${e}`) || (r.push(z(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && Bt(s.dependencies, t, n, r, i + 1));
|
|
710
712
|
}
|
|
711
713
|
}
|
|
712
714
|
function R(e, t, n, r, i) {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
715
|
+
let a = i ?? /* @__PURE__ */ new Set();
|
|
716
|
+
for (let [o, s] of e) {
|
|
717
|
+
if (s.version === void 0) continue;
|
|
718
|
+
let e = `${o}@${s.version}`, c = Object.entries(s.dependencies ?? {});
|
|
719
|
+
t.shippedKeys.has(e) ? a.has(e) || i !== void 0 && t.shownKeys.has(e) || (a.add(e), t.shownKeys.add(e), n.push(z(o, s.version, t.licensesByKey.get(e), " ".repeat(r))), R(c, t, n, r + 1)) : R(c, t, n, r, a);
|
|
717
720
|
}
|
|
718
721
|
}
|
|
719
722
|
function z(e, t, n, r) {
|
|
720
|
-
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${
|
|
723
|
+
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${Vt(n)}`;
|
|
721
724
|
}
|
|
722
|
-
function
|
|
725
|
+
function Vt(e) {
|
|
723
726
|
if (e == null) return "";
|
|
724
|
-
let t = e.publishedDate ?
|
|
725
|
-
if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
|
|
726
|
-
let
|
|
727
|
-
return t === "" ? ` — → ${
|
|
727
|
+
let t = e.publishedDate ? Ht(e.publishedDate.split("T", 1)[0]) : "", n = e.publishedDate !== "" && e.latestPublishedDate !== "" && Date.parse(e.latestPublishedDate) <= Date.parse(e.publishedDate);
|
|
728
|
+
if (e.latestVersion === "" || e.latestVersion === e.installedVersion || n) return t === "" ? "" : ` — ${t}`;
|
|
729
|
+
let r = e.latestPublishedDate ? Ht(e.latestPublishedDate.split("T", 1)[0]) : "", i = r === "" ? `latest: ${e.latestVersion} ❗` : `latest: ${e.latestVersion} — ${r} ❗`;
|
|
730
|
+
return t === "" ? ` — → ${i}` : ` — ${t} → ${i}`;
|
|
728
731
|
}
|
|
729
|
-
function
|
|
732
|
+
function Ht(e) {
|
|
730
733
|
if (e == null || e === "") return "n/a";
|
|
731
734
|
let t = e.split("T", 1)[0];
|
|
732
735
|
if (t == null || t === "") return "n/a";
|
|
@@ -734,42 +737,42 @@ function Vt(e) {
|
|
|
734
737
|
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} ⚠️`;
|
|
735
738
|
}
|
|
736
739
|
// src/actions/documentOpening.ts
|
|
737
|
-
var
|
|
738
|
-
async function
|
|
740
|
+
var Ut = "<!-- OPENING_START -->", Wt = "<!-- OPENING_END -->";
|
|
741
|
+
async function Gt() {
|
|
739
742
|
try {
|
|
740
743
|
l("Document Opening"), w("1️⃣ Insert opening content into 'README.md'");
|
|
741
|
-
let t = await C("package.json"), n = await C("config.json"), { owner: r, repository: i } = S(t, "document opening"), a =
|
|
744
|
+
let t = await C("package.json"), n = await C("config.json"), { owner: r, repository: i } = S(t, "document opening"), a = qt(t), o = Yt(n), s = g(n.id), c = s.uploadGroupName === void 0 ? void 0 : n.id, u = s.publishedTo === "npm" ? Jt(t) : void 0, d = Xt(r, i, a, {
|
|
742
745
|
description: t.description,
|
|
743
746
|
dpuseModuleId: c,
|
|
744
747
|
introduction: o,
|
|
745
748
|
npmPackageName: u,
|
|
746
749
|
version: t.version
|
|
747
750
|
});
|
|
748
|
-
await e(d,
|
|
751
|
+
await e(d, Ut, Wt), x("Opening documented");
|
|
749
752
|
} catch (e) {
|
|
750
753
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
751
754
|
}
|
|
752
755
|
}
|
|
753
|
-
function
|
|
756
|
+
function Kt(e) {
|
|
754
757
|
return e === void 0 ? "blue" : /^v?0/.test(e) || /alpha|beta|snapshot|dev|pre|rc/i.test(e) ? "orange" : "blue";
|
|
755
758
|
}
|
|
756
|
-
function
|
|
759
|
+
function qt(e) {
|
|
757
760
|
let t = e.license;
|
|
758
761
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
759
762
|
return t;
|
|
760
763
|
}
|
|
761
|
-
function
|
|
764
|
+
function Jt(e) {
|
|
762
765
|
let t = e.name;
|
|
763
766
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
|
|
764
767
|
return t;
|
|
765
768
|
}
|
|
766
|
-
function
|
|
769
|
+
function Yt(e) {
|
|
767
770
|
let t = e.description.en?.trim();
|
|
768
771
|
return t === void 0 || t === "" ? void 0 : t;
|
|
769
772
|
}
|
|
770
|
-
function
|
|
773
|
+
function Xt(e, t, n, r) {
|
|
771
774
|
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 ?? ""}`);
|
|
772
|
-
return `[](./LICENSE)${a === void 0 ? "" : `\n[](./LICENSE)${a === void 0 ? "" : `\n[})](${l}/releases/latest)`}${s === void 0 ? "" : `\n[](https://www.npmjs.com/package/${s})`}
|
|
773
776
|
[](${l}/actions/workflows/ci.yml)${i == null || i === "" ? "" : `\n\n${i}`}
|
|
774
777
|
|
|
775
778
|
[Report a Vulnerability](${l}/security/advisories/new) · [Open an Issue](${l}/issues)
|
|
@@ -787,31 +790,31 @@ function Yt(e, t, n, r) {
|
|
|
787
790
|
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}`}`;
|
|
788
791
|
}
|
|
789
792
|
// src/actions/documentQualitySecurity.ts
|
|
790
|
-
var
|
|
793
|
+
var Zt = {
|
|
791
794
|
"Branch-Protection": 3,
|
|
792
795
|
"Code-Review": 0,
|
|
793
796
|
Contributors: 0
|
|
794
|
-
},
|
|
797
|
+
}, Qt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), $t = "coverage/coverage-final.json", en = "coverage/coverage-summary.json", tn = 80, nn = 60, rn = "code-health-reports/vitest/badge.json", an = {
|
|
795
798
|
actions: "GitHub Actions",
|
|
796
799
|
"javascript-typescript": "JavaScript/TypeScript",
|
|
797
800
|
rust: "Rust"
|
|
798
|
-
},
|
|
801
|
+
}, on = {
|
|
799
802
|
A: "brightgreen",
|
|
800
803
|
B: "green",
|
|
801
804
|
C: "yellow",
|
|
802
805
|
D: "orange",
|
|
803
806
|
F: "red"
|
|
804
|
-
},
|
|
805
|
-
async function
|
|
807
|
+
}, sn = `${u}/health.json`, cn = le(ue);
|
|
808
|
+
async function ln() {
|
|
806
809
|
try {
|
|
807
810
|
l("Document Quality & Security");
|
|
808
|
-
let t = await C("package.json"), n = await
|
|
811
|
+
let t = await C("package.json"), n = await un(t), r = await fn(t, n === void 0 ? [] : ["--coverage", $t]), { owner: i, repository: a } = S(t, "document quality and security");
|
|
809
812
|
w("4️⃣ Read security checks and settings");
|
|
810
|
-
let o = await
|
|
813
|
+
let o = await mn(i, a, t);
|
|
811
814
|
w("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
|
|
812
|
-
let [s, c] = await Promise.all([
|
|
815
|
+
let [s, c] = await Promise.all([hn(`https://github.com/${i}/${a}`), gn(`github.com/${i}/${a}`)]);
|
|
813
816
|
w("6️⃣ Insert quality and security content into 'README.md'");
|
|
814
|
-
let u =
|
|
817
|
+
let u = xn(i, a, {
|
|
815
818
|
coveragePercent: n,
|
|
816
819
|
fallowHealth: r,
|
|
817
820
|
securitySettings: o
|
|
@@ -821,7 +824,7 @@ async function cn() {
|
|
|
821
824
|
console.error("❌ Error documenting quality and security", e), process.exit(1);
|
|
822
825
|
}
|
|
823
826
|
}
|
|
824
|
-
async function
|
|
827
|
+
async function un(e) {
|
|
825
828
|
if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
|
|
826
829
|
w("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
|
|
827
830
|
return;
|
|
@@ -831,25 +834,25 @@ async function ln(e) {
|
|
|
831
834
|
"--passWithNoTests",
|
|
832
835
|
"--coverage"
|
|
833
836
|
]);
|
|
834
|
-
let n = await t(
|
|
837
|
+
let n = await t(en);
|
|
835
838
|
if (n === null) return;
|
|
836
839
|
let i = JSON.parse(n).total.lines.pct;
|
|
837
|
-
if (i !== "Unknown") return await
|
|
840
|
+
if (i !== "Unknown") return await dn(i), i;
|
|
838
841
|
}
|
|
839
|
-
async function
|
|
842
|
+
async function dn(e) {
|
|
840
843
|
let t = [
|
|
841
844
|
"red",
|
|
842
845
|
"yellow",
|
|
843
846
|
"brightgreen"
|
|
844
|
-
], n = Number(e >=
|
|
845
|
-
await v(
|
|
847
|
+
], n = Number(e >= nn) + Number(e >= tn);
|
|
848
|
+
await v(rn, {
|
|
846
849
|
schemaVersion: 1,
|
|
847
850
|
label: "coverage",
|
|
848
851
|
message: `${e.toFixed(1)}%`,
|
|
849
852
|
color: t[n]
|
|
850
853
|
});
|
|
851
854
|
}
|
|
852
|
-
async function
|
|
855
|
+
async function fn(e, t) {
|
|
853
856
|
if (e.devDependencies?.fallow == null) {
|
|
854
857
|
w("2️⃣ Code health NOT measured, as Fallow is not installed"), w("3️⃣ Code health report NOT required");
|
|
855
858
|
return;
|
|
@@ -860,20 +863,20 @@ async function dn(e, t) {
|
|
|
860
863
|
"--format",
|
|
861
864
|
"json",
|
|
862
865
|
...t
|
|
863
|
-
],
|
|
864
|
-
let n = await C(
|
|
865
|
-
return await
|
|
866
|
+
], sn), await o("3️⃣ Write code health report", "fallow", ["--format", "markdown"], ne, !0);
|
|
867
|
+
let n = await C(sn);
|
|
868
|
+
return await pn(n), n;
|
|
866
869
|
}
|
|
867
|
-
async function
|
|
870
|
+
async function pn(e) {
|
|
868
871
|
let { score: t, grade: n } = e.health_score;
|
|
869
872
|
await v(_, {
|
|
870
873
|
schemaVersion: 1,
|
|
871
874
|
label: "fallow",
|
|
872
875
|
message: `${n} (${String(Math.round(t))})`,
|
|
873
|
-
color:
|
|
876
|
+
color: on[n] ?? "lightgrey"
|
|
874
877
|
});
|
|
875
878
|
}
|
|
876
|
-
async function
|
|
879
|
+
async function mn(e, n, r) {
|
|
877
880
|
let [i, a, o] = await Promise.all([
|
|
878
881
|
t(".github/workflows/ci.yml"),
|
|
879
882
|
t(".github/dependabot.yml"),
|
|
@@ -885,7 +888,7 @@ async function pn(e, n, r) {
|
|
|
885
888
|
B(`repos/${e}/${n}/commits/main/check-runs?per_page=100`)
|
|
886
889
|
]), 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;
|
|
887
890
|
return {
|
|
888
|
-
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) =>
|
|
891
|
+
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => an[e] ?? e).toArray(),
|
|
889
892
|
codeQLQueries: /queries: ([\w-]+)/.exec(s)?.[1],
|
|
890
893
|
dependabotAlerts: u !== void 0,
|
|
891
894
|
dependabotSecurityUpdates: p("dependabot_security_updates"),
|
|
@@ -904,29 +907,29 @@ async function pn(e, n, r) {
|
|
|
904
907
|
}
|
|
905
908
|
async function B(e) {
|
|
906
909
|
try {
|
|
907
|
-
let { stdout: t } = await
|
|
910
|
+
let { stdout: t } = await cn("gh", ["api", e]);
|
|
908
911
|
return t;
|
|
909
912
|
} catch (e) {
|
|
910
913
|
if (String(e.stderr).includes("HTTP 404")) return;
|
|
911
914
|
throw e;
|
|
912
915
|
}
|
|
913
916
|
}
|
|
914
|
-
async function
|
|
917
|
+
async function hn(e) {
|
|
915
918
|
let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
|
|
916
919
|
if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
|
|
917
920
|
return (await t.json()).find((t) => t.repo_url === e)?.id;
|
|
918
921
|
}
|
|
919
|
-
async function
|
|
922
|
+
async function gn(e) {
|
|
920
923
|
let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
|
|
921
924
|
if (t.status !== 404) {
|
|
922
925
|
if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
|
|
923
926
|
return await t.json();
|
|
924
927
|
}
|
|
925
928
|
}
|
|
926
|
-
function gn(e) {
|
|
927
|
-
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Zt.has(e) || Xt[e] !== void 0 && t >= Xt[e]);
|
|
928
|
-
}
|
|
929
929
|
function _n(e) {
|
|
930
|
+
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Qt.has(e) || Zt[e] !== void 0 && t >= Zt[e]);
|
|
931
|
+
}
|
|
932
|
+
function vn(e) {
|
|
930
933
|
return e === !1 ? " These are handled manually." : "";
|
|
931
934
|
}
|
|
932
935
|
function V(e) {
|
|
@@ -941,10 +944,10 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
|
|
|
941
944
|
|
|
942
945
|
`;
|
|
943
946
|
}
|
|
944
|
-
function
|
|
947
|
+
function yn(e, t, n, r) {
|
|
945
948
|
return `})`;
|
|
946
949
|
}
|
|
947
|
-
function
|
|
950
|
+
function bn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
948
951
|
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 = [[
|
|
949
952
|
"Unit tests",
|
|
950
953
|
V(i.testsInCI),
|
|
@@ -957,7 +960,7 @@ function yn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
|
|
|
957
960
|
n !== void 0 && s.push([
|
|
958
961
|
"Test coverage",
|
|
959
962
|
V(!0),
|
|
960
|
-
`${
|
|
963
|
+
`${yn(e, t, "Coverage", rn)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(tn)}%.`
|
|
961
964
|
]);
|
|
962
965
|
let c = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, l = [[
|
|
963
966
|
"Code analysis",
|
|
@@ -971,7 +974,7 @@ function yn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
|
|
|
971
974
|
r !== void 0 && l.unshift([
|
|
972
975
|
"Code health",
|
|
973
976
|
V(!0),
|
|
974
|
-
`[${
|
|
977
|
+
`[${yn(e, t, "Fallow code health", _)}](./${ne}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
|
|
975
978
|
]);
|
|
976
979
|
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 = [
|
|
977
980
|
[
|
|
@@ -1008,23 +1011,23 @@ function yn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
|
|
|
1008
1011
|
[
|
|
1009
1012
|
"Security updates",
|
|
1010
1013
|
V(i.dependabotSecurityUpdates),
|
|
1011
|
-
`${h} opens pull requests that update vulnerable dependencies.${
|
|
1014
|
+
`${h} opens pull requests that update vulnerable dependencies.${vn(i.dependabotSecurityUpdates)}`
|
|
1012
1015
|
],
|
|
1013
1016
|
[
|
|
1014
1017
|
"Version updates",
|
|
1015
1018
|
V(i.dependabotVersionUpdates),
|
|
1016
|
-
`${h} opens pull requests for new dependency versions.${
|
|
1019
|
+
`${h} opens pull requests for new dependency versions.${vn(i.dependabotVersionUpdates)}`
|
|
1017
1020
|
]
|
|
1018
1021
|
];
|
|
1019
1022
|
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.
|
|
1020
1023
|
|
|
1021
1024
|
${H("Testing", s)}${H("Code Quality", l)}${H("Security Analysis", m)}${H("Dependencies", g)}`;
|
|
1022
1025
|
}
|
|
1023
|
-
function
|
|
1024
|
-
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 &&
|
|
1026
|
+
function xn(e, t, n, r, i) {
|
|
1027
|
+
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && _n(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.";
|
|
1025
1028
|
return `## Quality & Security
|
|
1026
1029
|
|
|
1027
|
-
${
|
|
1030
|
+
${bn(e, t, n)}### OpenSSF 🚧
|
|
1028
1031
|
|
|
1029
1032
|
${l}[](https://scorecard.dev/viewer/?uri=${o})
|
|
1030
1033
|
|
|
@@ -1035,26 +1038,26 @@ This project is working towards the [OpenSSF Best Practices](https://www.bestpra
|
|
|
1035
1038
|
Please do not open public GitHub issues for security vulnerabilities. ${u}`;
|
|
1036
1039
|
}
|
|
1037
1040
|
// src/actions/documentUsage.ts
|
|
1038
|
-
var
|
|
1041
|
+
var Sn = "<!-- USAGE_START -->", Cn = "<!-- USAGE_END -->", wn = /* @__PURE__ */ new Set([
|
|
1039
1042
|
"connector",
|
|
1040
1043
|
"cookbook",
|
|
1041
1044
|
"presenter"
|
|
1042
|
-
]),
|
|
1043
|
-
async function
|
|
1045
|
+
]), Tn = /* @__PURE__ */ new Set(["development", "eslint"]), En = "> [!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.", Dn = "This repository manages itself using the actions it implements.", On = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
|
|
1046
|
+
async function kn() {
|
|
1044
1047
|
try {
|
|
1045
1048
|
l("Document Usage"), w("1️⃣ Insert usage content into 'README.md'");
|
|
1046
|
-
let [t, n] = await Promise.all([C("package.json"), C("config.json")]), r =
|
|
1047
|
-
await e(d,
|
|
1049
|
+
let [t, n] = await Promise.all([C("package.json"), C("config.json")]), r = An(t), i = jn(r), a = U(t.engines?.node), o = U(t.engines?.npm), s = U(t.devDependencies?.typescript), c = Mn(g(n.id), t.name), u = `${r.replace(/\.git$/, "")}/blob/main/package.json`, d = Nn(c, r, i, a, o, s, `${t.name === "@dpuse/dpuse-development" ? Dn : On} See the \`scripts\` block in [package.json](${u}) for details.`);
|
|
1050
|
+
await e(d, Sn, Cn), x("Usage documented");
|
|
1048
1051
|
} catch (e) {
|
|
1049
1052
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
1050
1053
|
}
|
|
1051
1054
|
}
|
|
1052
|
-
function
|
|
1055
|
+
function An(e) {
|
|
1053
1056
|
let t = e.repository, n = typeof t == "string" ? t : t?.url;
|
|
1054
1057
|
if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
|
|
1055
1058
|
return n.replace(/^git\+/, "");
|
|
1056
1059
|
}
|
|
1057
|
-
function
|
|
1060
|
+
function jn(e) {
|
|
1058
1061
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
1059
1062
|
}
|
|
1060
1063
|
function U(e) {
|
|
@@ -1063,9 +1066,9 @@ function U(e) {
|
|
|
1063
1066
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
1064
1067
|
return t[0];
|
|
1065
1068
|
}
|
|
1066
|
-
function
|
|
1069
|
+
function Mn(e, t) {
|
|
1067
1070
|
let { typeId: n } = e;
|
|
1068
|
-
if (
|
|
1071
|
+
if (wn.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.
|
|
1069
1072
|
|
|
1070
1073
|
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.`;
|
|
1071
1074
|
if (e.publishedTo === "npm") {
|
|
@@ -1076,11 +1079,11 @@ You may view or clone this repository for your own purposes, such as building a
|
|
|
1076
1079
|
npm install ${t}
|
|
1077
1080
|
\`\`\`
|
|
1078
1081
|
|
|
1079
|
-
${
|
|
1082
|
+
${Tn.has(n) ? `${En}\n\n` : ""}To work on the source instead, clone this repository.`;
|
|
1080
1083
|
}
|
|
1081
1084
|
return "You may view or clone this repository for your own purposes.";
|
|
1082
1085
|
}
|
|
1083
|
-
function
|
|
1086
|
+
function Nn(e, t, n, r, i, a, o) {
|
|
1084
1087
|
return `## Usage
|
|
1085
1088
|
|
|
1086
1089
|
${e}
|
|
@@ -1097,7 +1100,7 @@ ${o}`;
|
|
|
1097
1100
|
}
|
|
1098
1101
|
// src/actions/documentApiReference.ts
|
|
1099
1102
|
var W = "API_REFERENCE.md";
|
|
1100
|
-
async function
|
|
1103
|
+
async function Pn() {
|
|
1101
1104
|
try {
|
|
1102
1105
|
l("Document API Reference");
|
|
1103
1106
|
let { writeAPIReference: e } = await import("./apiReference-BdQJPhGc.js");
|
|
@@ -1107,36 +1110,36 @@ async function Nn() {
|
|
|
1107
1110
|
}
|
|
1108
1111
|
}
|
|
1109
1112
|
// src/actions/documentBundleSizes.ts
|
|
1110
|
-
var
|
|
1111
|
-
async function
|
|
1113
|
+
var Fn = "bundle-analysis-reports/sonda/index.json", In = "bundle-analysis-reports/sonda/worker.json", Ln = "dist", Rn = /^\.|\.map$|\.d\.ts$|^shipped-packages\.json$/, zn = "<!-- BUNDLE_START -->", Bn = "<!-- BUNDLE_END -->", G = " ", Vn = 20, Hn = "█", Un = "▒", Wn = 48, Gn = "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._", Kn = "Bars show each row's share of its output file.", qn = "↳ rows are part of the row above.", Jn = "A file with no rows beneath it is shipped as it is, such as WebAssembly, so it has no breakdown. Source maps and type declarations are left out.", Yn = "+ 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)", Xn = `${q} = a Web Worker built separately and embedded in its output file as text. Its rows list what it contains.`, J = "(Rust WebAssembly as base64", Zn = `${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.`;
|
|
1114
|
+
async function $n() {
|
|
1112
1115
|
try {
|
|
1113
1116
|
l("Document Bundle Sizes"), w("1️⃣ Read bundle analysis report");
|
|
1114
|
-
let n = await C(
|
|
1117
|
+
let n = await C(Fn), r = await t(In), i = r === null ? void 0 : JSON.parse(r), a = /* @__PURE__ */ new Map();
|
|
1115
1118
|
for (let e of [...n.resources, ...i?.resources ?? []]) e.kind === "asset" && a.set(e.name, await t(e.name));
|
|
1116
|
-
let o = await
|
|
1119
|
+
let o = await er(new Set(a.keys()));
|
|
1117
1120
|
w("2️⃣ Insert table into 'README.md'");
|
|
1118
|
-
let s =
|
|
1121
|
+
let s = nr(n, {
|
|
1119
1122
|
assetContents: a,
|
|
1120
1123
|
otherFiles: o,
|
|
1121
1124
|
workerJson: i
|
|
1122
1125
|
}), c = [
|
|
1123
|
-
s.includes("↳") ? `${
|
|
1124
|
-
o.length > 0 ?
|
|
1125
|
-
/ \+ \d+ more \|/.test(s) ?
|
|
1126
|
-
s.includes(q) ?
|
|
1127
|
-
s.includes(J) ?
|
|
1128
|
-
|
|
1126
|
+
s.includes("↳") ? `${Kn} ${qn}` : Kn,
|
|
1127
|
+
o.length > 0 ? Jn : "",
|
|
1128
|
+
/ \+ \d+ more \|/.test(s) ? Yn : "",
|
|
1129
|
+
s.includes(q) ? Xn : "",
|
|
1130
|
+
s.includes(J) ? Zn : "",
|
|
1131
|
+
Qn
|
|
1129
1132
|
].filter((e) => e !== "");
|
|
1130
|
-
await e(`## Bundle Analysis\n\n${
|
|
1133
|
+
await e(`## Bundle Analysis\n\n${Gn}\n\n${s}\n\n${c.join("\n\n")}`, zn, Bn), x("Bundle sizes documented");
|
|
1131
1134
|
} catch (e) {
|
|
1132
1135
|
console.error("❌ Error documenting bundle sizes", e), process.exit(1);
|
|
1133
1136
|
}
|
|
1134
1137
|
}
|
|
1135
|
-
async function
|
|
1136
|
-
let t = [], n = await
|
|
1138
|
+
async function er(e) {
|
|
1139
|
+
let t = [], n = await tr();
|
|
1137
1140
|
for (let r of n) {
|
|
1138
1141
|
let n = `${r.parentPath}/${r.name}`;
|
|
1139
|
-
if (!r.isFile() ||
|
|
1142
|
+
if (!r.isFile() || Rn.test(r.name) || e.has(n)) continue;
|
|
1140
1143
|
let i = await T.readFile(n);
|
|
1141
1144
|
t.push([n, {
|
|
1142
1145
|
uncompressed: i.byteLength,
|
|
@@ -1145,9 +1148,9 @@ async function $n(e) {
|
|
|
1145
1148
|
}
|
|
1146
1149
|
return t;
|
|
1147
1150
|
}
|
|
1148
|
-
async function
|
|
1151
|
+
async function tr() {
|
|
1149
1152
|
try {
|
|
1150
|
-
return await T.readdir(
|
|
1153
|
+
return await T.readdir(Ln, {
|
|
1151
1154
|
recursive: !0,
|
|
1152
1155
|
withFileTypes: !0
|
|
1153
1156
|
});
|
|
@@ -1156,47 +1159,47 @@ async function er() {
|
|
|
1156
1159
|
throw e;
|
|
1157
1160
|
}
|
|
1158
1161
|
}
|
|
1159
|
-
function
|
|
1160
|
-
let { assetContents: n, otherFiles: r, workerJson: i } = t, a =
|
|
1162
|
+
function nr(e, t) {
|
|
1163
|
+
let { assetContents: n, otherFiles: r, workerJson: i } = t, a = pr(e), o = [...e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, vr(e)]), ...r].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), s = Z();
|
|
1161
1164
|
for (let [, e] of o) Q(s, e);
|
|
1162
|
-
let c = i === void 0 ? void 0 :
|
|
1165
|
+
let c = i === void 0 ? void 0 : rr(i, n), l = c === void 0 ? void 0 : o.find(([e]) => (a.get(e)?.get(K)?.sizes.uncompressed ?? 0) >= c.bytes)?.[0];
|
|
1163
1166
|
for (let [e, t] of a) {
|
|
1164
|
-
let r =
|
|
1165
|
-
c !== void 0 && e === l ? (
|
|
1167
|
+
let r = ir(n.get(e) ?? "");
|
|
1168
|
+
c !== void 0 && e === l ? (or(t, c), Y(t, {
|
|
1166
1169
|
bytes: r.bytes - c.wasm.bytes,
|
|
1167
1170
|
binaryBytes: r.binaryBytes - c.wasm.binaryBytes
|
|
1168
1171
|
})) : Y(t, r);
|
|
1169
1172
|
}
|
|
1170
1173
|
let u = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
|
|
1171
|
-
o.length > 1 && u.push(X(`**All ${String(o.length)} files**`,
|
|
1174
|
+
o.length > 1 && u.push(X(`**All ${String(o.length)} files**`, yr(s)));
|
|
1172
1175
|
for (let [e, t] of o) {
|
|
1173
|
-
let n = a.get(e) ?? /* @__PURE__ */ new Map(), r = n.values().reduce((e, t) => e + t.sizes.uncompressed, 0), i = s.uncompressed > 0 ? ` · ${
|
|
1174
|
-
u.push(X(`**${
|
|
1176
|
+
let n = a.get(e) ?? /* @__PURE__ */ new Map(), r = n.values().reduce((e, t) => e + t.sizes.uncompressed, 0), i = s.uncompressed > 0 ? ` · ${xr(t.uncompressed, s.uncompressed)} of the build` : "";
|
|
1177
|
+
u.push(X(`**${fr(e)}**`, `${yr(t)}${i}`), ...lr(n, r));
|
|
1175
1178
|
}
|
|
1176
1179
|
return u.join("\n");
|
|
1177
1180
|
}
|
|
1178
|
-
function
|
|
1179
|
-
let [n, r] =
|
|
1181
|
+
function rr(e, t) {
|
|
1182
|
+
let [n, r] = pr(e).entries().next().value ?? [];
|
|
1180
1183
|
if (n === void 0 || r === void 0) return;
|
|
1181
|
-
let i = r.values().reduce((e, t) => e + t.sizes.uncompressed, 0), a =
|
|
1184
|
+
let i = r.values().reduce((e, t) => e + t.sizes.uncompressed, 0), a = ir(t.get(n) ?? "");
|
|
1182
1185
|
return Y(r, a), {
|
|
1183
1186
|
bytes: i,
|
|
1184
1187
|
groups: r,
|
|
1185
1188
|
wasm: a
|
|
1186
1189
|
};
|
|
1187
1190
|
}
|
|
1188
|
-
function
|
|
1191
|
+
function ir(e) {
|
|
1189
1192
|
let t = {
|
|
1190
1193
|
bytes: 0,
|
|
1191
1194
|
binaryBytes: 0
|
|
1192
1195
|
};
|
|
1193
1196
|
for (let n of e.matchAll(/data:application\/wasm;base64,([A-Za-z\d+/]*={0,2})/g)) {
|
|
1194
1197
|
let e = n[1] ?? "";
|
|
1195
|
-
t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) -
|
|
1198
|
+
t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) - ar(e);
|
|
1196
1199
|
}
|
|
1197
1200
|
return t;
|
|
1198
1201
|
}
|
|
1199
|
-
function
|
|
1202
|
+
function ar(e) {
|
|
1200
1203
|
return e.endsWith("==") ? 2 : +!!e.endsWith("=");
|
|
1201
1204
|
}
|
|
1202
1205
|
function Y(e, t) {
|
|
@@ -1207,7 +1210,7 @@ function Y(e, t) {
|
|
|
1207
1210
|
sizes: n
|
|
1208
1211
|
})).toArray()).find(({ sizes: e }) => e.uncompressed >= t.bytes);
|
|
1209
1212
|
if (n === void 0) return;
|
|
1210
|
-
|
|
1213
|
+
sr(e, n.group, n.fileName, n.sizes, t.bytes);
|
|
1211
1214
|
let r = `${J}, ${$(t.binaryBytes)} binary)`;
|
|
1212
1215
|
e.set(r, {
|
|
1213
1216
|
sizes: {
|
|
@@ -1220,10 +1223,10 @@ function Y(e, t) {
|
|
|
1220
1223
|
}]])
|
|
1221
1224
|
});
|
|
1222
1225
|
}
|
|
1223
|
-
function
|
|
1226
|
+
function or(e, t) {
|
|
1224
1227
|
let n = e.get(K), r = n?.files.get("");
|
|
1225
1228
|
if (n === void 0 || r === void 0) return;
|
|
1226
|
-
|
|
1229
|
+
sr(e, n, "", r, t.bytes);
|
|
1227
1230
|
let i = {
|
|
1228
1231
|
uncompressed: t.bytes,
|
|
1229
1232
|
gzip: 0
|
|
@@ -1234,35 +1237,35 @@ function ar(e, t) {
|
|
|
1234
1237
|
parts: t.groups
|
|
1235
1238
|
});
|
|
1236
1239
|
}
|
|
1237
|
-
function
|
|
1240
|
+
function sr(e, t, n, r, i) {
|
|
1238
1241
|
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);
|
|
1239
1242
|
}
|
|
1240
|
-
function
|
|
1243
|
+
function cr(e, t) {
|
|
1241
1244
|
return e[0] === K == (t[0] === K) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === K ? 1 : -1;
|
|
1242
1245
|
}
|
|
1243
|
-
function
|
|
1246
|
+
function lr(e, t, n = !1) {
|
|
1244
1247
|
let r = n ? `${G}${G}↳ ` : G;
|
|
1245
|
-
return [...e].toSorted(
|
|
1248
|
+
return [...e].toSorted(cr).flatMap(([e, i]) => [X(`${r}${dr(e, i.files)}`, ur(i.sizes.uncompressed, t, n ? Un : Hn)), ...i.parts === void 0 ? [] : lr(i.parts, t, !0)]);
|
|
1246
1249
|
}
|
|
1247
|
-
function
|
|
1248
|
-
return `${
|
|
1250
|
+
function ur(e, t, n) {
|
|
1251
|
+
return `${br(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
|
|
1249
1252
|
}
|
|
1250
|
-
function
|
|
1251
|
-
let [n] = [...t].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed)[0] ?? [""], r =
|
|
1253
|
+
function dr(e, t) {
|
|
1254
|
+
let [n] = [...t].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed)[0] ?? [""], r = fr(n === "" ? e : `${e} → ${n}`);
|
|
1252
1255
|
return t.size > 1 ? `${r} + ${String(t.size - 1)} more` : r;
|
|
1253
1256
|
}
|
|
1254
|
-
function
|
|
1255
|
-
let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(
|
|
1257
|
+
function fr(e) {
|
|
1258
|
+
let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(Wn - n.length, 2);
|
|
1256
1259
|
return r.length > i ? `${n}<abbr title="${r.replaceAll("&", "&").replaceAll("\"", """)}">…${r.slice(r.length - (i - 1))}</abbr>` : e;
|
|
1257
1260
|
}
|
|
1258
1261
|
function X(e, t) {
|
|
1259
1262
|
return `| ${e} | ${t.replaceAll(" ", " ")} |`;
|
|
1260
1263
|
}
|
|
1261
|
-
function
|
|
1262
|
-
let t =
|
|
1264
|
+
function pr(e) {
|
|
1265
|
+
let t = mr(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1263
1266
|
for (let r of e.resources) {
|
|
1264
1267
|
if (r.kind !== "chunk" || !r.parent) continue;
|
|
1265
|
-
let { group: e, file: i } =
|
|
1268
|
+
let { group: e, file: i } = hr(r.name, t), a = vr(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
|
|
1266
1269
|
n.set(r.parent, o);
|
|
1267
1270
|
let s = o.get(e) ?? {
|
|
1268
1271
|
sizes: Z(),
|
|
@@ -1274,10 +1277,10 @@ function fr(e) {
|
|
|
1274
1277
|
}
|
|
1275
1278
|
return n;
|
|
1276
1279
|
}
|
|
1277
|
-
function
|
|
1280
|
+
function mr(e) {
|
|
1278
1281
|
return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
|
|
1279
1282
|
}
|
|
1280
|
-
function
|
|
1283
|
+
function hr(e, t) {
|
|
1281
1284
|
let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
|
|
1282
1285
|
if (n) {
|
|
1283
1286
|
let [t, r] = n;
|
|
@@ -1294,31 +1297,31 @@ function mr(e, t) {
|
|
|
1294
1297
|
file: e.slice(1)
|
|
1295
1298
|
} : e.startsWith("rust/") ? {
|
|
1296
1299
|
group: "wasm",
|
|
1297
|
-
file:
|
|
1300
|
+
file: gr(e)
|
|
1298
1301
|
} : {
|
|
1299
1302
|
group: "src",
|
|
1300
|
-
file:
|
|
1303
|
+
file: _r(e)
|
|
1301
1304
|
};
|
|
1302
1305
|
}
|
|
1303
|
-
function
|
|
1304
|
-
let t = e.split("/", 2)[1] ?? "", n =
|
|
1306
|
+
function gr(e) {
|
|
1307
|
+
let t = e.split("/", 2)[1] ?? "", n = _r(e);
|
|
1305
1308
|
return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
|
|
1306
1309
|
}
|
|
1307
|
-
function
|
|
1310
|
+
function _r(e) {
|
|
1308
1311
|
return e.split("/").at(-1) ?? e;
|
|
1309
1312
|
}
|
|
1310
|
-
function
|
|
1313
|
+
function vr(e) {
|
|
1311
1314
|
return {
|
|
1312
1315
|
uncompressed: e.uncompressed,
|
|
1313
1316
|
gzip: e.gzip ?? 0
|
|
1314
1317
|
};
|
|
1315
1318
|
}
|
|
1316
|
-
function
|
|
1319
|
+
function yr(e) {
|
|
1317
1320
|
return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
|
|
1318
1321
|
}
|
|
1319
|
-
function
|
|
1320
|
-
let n = Math.round(e / 100 *
|
|
1321
|
-
return `\`${t.repeat(n)}${"░".repeat(
|
|
1322
|
+
function br(e, t) {
|
|
1323
|
+
let n = Math.round(e / 100 * Vn);
|
|
1324
|
+
return `\`${t.repeat(n)}${"░".repeat(Vn - n)}\` ${e.toFixed(1)}%`;
|
|
1322
1325
|
}
|
|
1323
1326
|
function Z() {
|
|
1324
1327
|
return {
|
|
@@ -1329,19 +1332,19 @@ function Z() {
|
|
|
1329
1332
|
function Q(e, t) {
|
|
1330
1333
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
1331
1334
|
}
|
|
1332
|
-
function
|
|
1335
|
+
function xr(e, t) {
|
|
1333
1336
|
return `${(e / t * 100).toFixed(1)}%`;
|
|
1334
1337
|
}
|
|
1335
1338
|
function $(e) {
|
|
1336
1339
|
return e < 1024 ? `${String(e)} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} kB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
1337
1340
|
}
|
|
1338
1341
|
// src/actions/documentProject.ts
|
|
1339
|
-
async function
|
|
1342
|
+
async function Sr(e = "MIT") {
|
|
1340
1343
|
try {
|
|
1341
1344
|
let n = await C("config.json"), i = g(n.id).typeId === "connector";
|
|
1342
|
-
await
|
|
1345
|
+
await Gt(), i && await Ye(), await kn(), await _t(e), await t("bundle-analysis-reports/sonda/index.json") === null ? w(`ℹ️ Bundle sizes NOT documented, as there is no '${Fn}' yet. Build the project first.`) : await $n(), await ln(), await Xe();
|
|
1343
1346
|
let a = await t(W) !== null;
|
|
1344
|
-
a ? await
|
|
1347
|
+
a ? await Pn() : w(`ℹ️ '${W}' NOT required by this project`), await r("ℹ️ Format generated files", "prettier", [
|
|
1345
1348
|
"--write",
|
|
1346
1349
|
"README.md",
|
|
1347
1350
|
...a ? [W] : []
|
|
@@ -1351,7 +1354,7 @@ async function xr(e = "MIT") {
|
|
|
1351
1354
|
}
|
|
1352
1355
|
}
|
|
1353
1356
|
// src/actions/formatCode.ts
|
|
1354
|
-
async function
|
|
1357
|
+
async function Cr() {
|
|
1355
1358
|
try {
|
|
1356
1359
|
l("Format Code");
|
|
1357
1360
|
let e = [
|
|
@@ -1371,7 +1374,7 @@ async function Sr() {
|
|
|
1371
1374
|
}
|
|
1372
1375
|
}
|
|
1373
1376
|
// src/actions/lintCode.ts
|
|
1374
|
-
async function
|
|
1377
|
+
async function wr() {
|
|
1375
1378
|
try {
|
|
1376
1379
|
l("Lint Code"), await r("1️⃣ Lint", "eslint", ["."]), x("Code linted");
|
|
1377
1380
|
} catch (e) {
|
|
@@ -1379,12 +1382,12 @@ async function Cr() {
|
|
|
1379
1382
|
}
|
|
1380
1383
|
}
|
|
1381
1384
|
// src/utilities/cloudflare.ts
|
|
1382
|
-
var
|
|
1385
|
+
var Tr = {
|
|
1383
1386
|
".css": "text/css",
|
|
1384
1387
|
".js": "application/javascript",
|
|
1385
1388
|
".wasm": "application/wasm"
|
|
1386
|
-
},
|
|
1387
|
-
async function
|
|
1389
|
+
}, Er = "dpuse-sample-data-eu";
|
|
1390
|
+
async function Dr() {
|
|
1388
1391
|
let e = await C("config.json"), t = {
|
|
1389
1392
|
body: JSON.stringify(e),
|
|
1390
1393
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1392,12 +1395,12 @@ async function Er() {
|
|
|
1392
1395
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
1393
1396
|
if (!n.ok) throw Error(await n.text());
|
|
1394
1397
|
}
|
|
1395
|
-
async function
|
|
1396
|
-
let n = await
|
|
1397
|
-
for (let [e, t] of r) await
|
|
1398
|
+
async function Or(e, t) {
|
|
1399
|
+
let n = await Nr(`${e}/${t}`, t), r = Map.groupBy(n, ({ key: e }) => c(e));
|
|
1400
|
+
for (let [e, t] of r) await Mr(t, ["--content-type", e]);
|
|
1398
1401
|
}
|
|
1399
|
-
async function
|
|
1400
|
-
await
|
|
1402
|
+
async function kr(e) {
|
|
1403
|
+
await Or(e, "application"), await Or(e, "fileStore"), await Mr(["applicationIndex.json", "fileStoreIndex.json"].map((t) => ({
|
|
1401
1404
|
file: `${e}/${t}`,
|
|
1402
1405
|
key: t
|
|
1403
1406
|
})), [
|
|
@@ -1407,7 +1410,7 @@ async function Or(e) {
|
|
|
1407
1410
|
"no-cache"
|
|
1408
1411
|
]);
|
|
1409
1412
|
}
|
|
1410
|
-
async function
|
|
1413
|
+
async function Ar(e) {
|
|
1411
1414
|
let t = e.id, n = {
|
|
1412
1415
|
body: JSON.stringify(e),
|
|
1413
1416
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1415,13 +1418,13 @@ async function kr(e) {
|
|
|
1415
1418
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
1416
1419
|
if (!r.ok) throw Error(await r.text());
|
|
1417
1420
|
}
|
|
1418
|
-
async function
|
|
1421
|
+
async function jr(e, t) {
|
|
1419
1422
|
let n = `v${e.version ?? "unknown"}`;
|
|
1420
1423
|
async function r(e, r = "") {
|
|
1421
1424
|
let i = await ee(e, { withFileTypes: !0 });
|
|
1422
1425
|
for (let a of i) {
|
|
1423
1426
|
if (a.isDirectory() || a.name.endsWith(".map")) continue;
|
|
1424
|
-
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c =
|
|
1427
|
+
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = Tr[E.extname(a.name)] ?? "application/octet-stream";
|
|
1425
1428
|
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await b(void 0, "wrangler", [
|
|
1426
1429
|
"r2",
|
|
1427
1430
|
"object",
|
|
@@ -1437,7 +1440,7 @@ async function Ar(e, t) {
|
|
|
1437
1440
|
}
|
|
1438
1441
|
await r("dist");
|
|
1439
1442
|
}
|
|
1440
|
-
async function
|
|
1443
|
+
async function Mr(e, t) {
|
|
1441
1444
|
if (e.length === 0) return;
|
|
1442
1445
|
let n = await T.mkdtemp(E.join(_e.tmpdir(), "dpuse-r2-bulk-")), r = E.join(n, "files.json");
|
|
1443
1446
|
try {
|
|
@@ -1445,7 +1448,7 @@ async function jr(e, t) {
|
|
|
1445
1448
|
"r2",
|
|
1446
1449
|
"bulk",
|
|
1447
1450
|
"put",
|
|
1448
|
-
|
|
1451
|
+
Er,
|
|
1449
1452
|
"--filename",
|
|
1450
1453
|
r,
|
|
1451
1454
|
...t,
|
|
@@ -1459,12 +1462,12 @@ async function jr(e, t) {
|
|
|
1459
1462
|
});
|
|
1460
1463
|
}
|
|
1461
1464
|
}
|
|
1462
|
-
async function
|
|
1465
|
+
async function Nr(e, t) {
|
|
1463
1466
|
let n = await ee(e), r = [];
|
|
1464
1467
|
for (let i of n) {
|
|
1465
1468
|
if (i.startsWith(".")) continue;
|
|
1466
1469
|
let n = `${e}/${i}`, a = `${t}/${i}`;
|
|
1467
|
-
(await h(n)).isDirectory() ? r.push(...await
|
|
1470
|
+
(await h(n)).isDirectory() ? r.push(...await Nr(n, a)) : r.push({
|
|
1468
1471
|
file: n,
|
|
1469
1472
|
key: a
|
|
1470
1473
|
});
|
|
@@ -1472,7 +1475,7 @@ async function Mr(e, t) {
|
|
|
1472
1475
|
return r;
|
|
1473
1476
|
}
|
|
1474
1477
|
// src/actions/publishProject.ts
|
|
1475
|
-
async function
|
|
1478
|
+
async function Pr() {
|
|
1476
1479
|
try {
|
|
1477
1480
|
l("Publish Project");
|
|
1478
1481
|
let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
|
|
@@ -1482,23 +1485,23 @@ async function Nr() {
|
|
|
1482
1485
|
"app",
|
|
1483
1486
|
"kb"
|
|
1484
1487
|
].includes(n.publishedTo);
|
|
1485
|
-
i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await
|
|
1488
|
+
i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await Fr(i ? "3️⃣ " : "2️⃣ ", e, t, n), n.publishedTo === "sampleData" && (w("3️⃣ Upload sample data"), await kr("public")), x(`Project version '${e.version ?? "unknown"}' published.`);
|
|
1486
1489
|
} catch (e) {
|
|
1487
1490
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1488
1491
|
}
|
|
1489
1492
|
}
|
|
1490
|
-
async function
|
|
1491
|
-
if (r.typeId === "app") w(`${e} Register module`), await
|
|
1492
|
-
else if (r.typeId === "engine") w(`${e} Register module`), await
|
|
1493
|
+
async function Fr(e, t, n, r) {
|
|
1494
|
+
if (r.typeId === "app") w(`${e} Register module`), await Dr();
|
|
1495
|
+
else if (r.typeId === "engine") w(`${e} Register module`), await jr(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await Ar(n);
|
|
1493
1496
|
else if (r.uploadGroupName === void 0) w(`${e} Registration NOT required`);
|
|
1494
1497
|
else {
|
|
1495
1498
|
w(`${e} Register module`);
|
|
1496
1499
|
let i = n.id.split("-").slice(2).join("-");
|
|
1497
|
-
await
|
|
1500
|
+
await jr(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await Ar(n);
|
|
1498
1501
|
}
|
|
1499
1502
|
}
|
|
1500
1503
|
// src/actions/syncProjectWithGitHub.ts
|
|
1501
|
-
async function
|
|
1504
|
+
async function Ir() {
|
|
1502
1505
|
try {
|
|
1503
1506
|
l("Synchronise Project with GitHub");
|
|
1504
1507
|
let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
|
|
@@ -1516,12 +1519,12 @@ async function Fr() {
|
|
|
1516
1519
|
}
|
|
1517
1520
|
}
|
|
1518
1521
|
// src/actions/testProject.ts
|
|
1519
|
-
var
|
|
1522
|
+
var Lr = [
|
|
1520
1523
|
"1️⃣ ",
|
|
1521
1524
|
"2️⃣ ",
|
|
1522
1525
|
"3️⃣ ",
|
|
1523
1526
|
"4️⃣ "
|
|
1524
|
-
],
|
|
1527
|
+
], Rr = [{
|
|
1525
1528
|
id: "unit",
|
|
1526
1529
|
label: "Run unit tests",
|
|
1527
1530
|
command: "vitest",
|
|
@@ -1534,13 +1537,13 @@ var Ir = [
|
|
|
1534
1537
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1535
1538
|
configFileName: "playwright.config.ts"
|
|
1536
1539
|
}];
|
|
1537
|
-
async function
|
|
1540
|
+
async function zr(e = ["unit"]) {
|
|
1538
1541
|
try {
|
|
1539
1542
|
l("Test Project");
|
|
1540
1543
|
let n = 0;
|
|
1541
|
-
for (let i of
|
|
1544
|
+
for (let i of Rr) {
|
|
1542
1545
|
if (!e.includes(i.id) || await t(i.configFileName) === null) continue;
|
|
1543
|
-
let a = `${
|
|
1546
|
+
let a = `${Lr[n] ?? ""} ${i.label}`;
|
|
1544
1547
|
await r(a, i.command, i.arguments), n += 1;
|
|
1545
1548
|
}
|
|
1546
1549
|
if (n === 0) {
|
|
@@ -1553,7 +1556,7 @@ async function Rr(e = ["unit"]) {
|
|
|
1553
1556
|
}
|
|
1554
1557
|
}
|
|
1555
1558
|
// src/actions/triggerGitHubRelease.ts
|
|
1556
|
-
async function
|
|
1559
|
+
async function Br() {
|
|
1557
1560
|
try {
|
|
1558
1561
|
l("Trigger GitHub Release");
|
|
1559
1562
|
let e = `v${(await C("package.json")).version ?? "unknown"}`;
|
|
@@ -1570,4 +1573,4 @@ async function zr() {
|
|
|
1570
1573
|
console.error("❌ Error triggering GitHub release", e), process.exit(1);
|
|
1571
1574
|
}
|
|
1572
1575
|
}
|
|
1573
|
-
export { Se as auditDependencies, De as buildProject, Ue as checkProject,
|
|
1576
|
+
export { Se as auditDependencies, De as buildProject, Ue as checkProject, Sr as documentProject, Cr as formatCode, wr as lintCode, Pr as publishProject, c as resolveSampleDataContentType, Ir as syncProjectWithGitHub, zr as testProject, Br as triggerGitHubRelease, Or as uploadDirectoryToR2 };
|