@dpuse/dpuse-development 0.3.814 → 0.3.815
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 +8 -8
- package/dist/dpuse-development.es.js +95 -99
- package/dist/dpuse-development.es.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,15 +79,15 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
79
79
|
|
|
80
80
|
| Chunk/Module/File | Composition |
|
|
81
81
|
| :------------------------------------------------------------------------------- | :------------------------------------------ |
|
|
82
|
-
| **dist/dpuse-development.es.js** | 50.
|
|
83
|
-
| src | `██████████████████░░` 87.6% · 44.
|
|
84
|
-
| ↳
|
|
85
|
-
| ↳
|
|
82
|
+
| **dist/dpuse-development.es.js** | 50.5 kB · gzip 16.1 kB · 60.0% of the build |
|
|
83
|
+
| src | `██████████████████░░` 87.6% · 44.2 kB |
|
|
84
|
+
| ↳ documentQualitySecurity.ts | `▒▒▒▒░░░░░░░░░░░░░░░░` 19.6% · 9.9 kB |
|
|
85
|
+
| ↳ documentDependencies.ts | `▒▒▒▒░░░░░░░░░░░░░░░░` 19.5% · 9.9 kB |
|
|
86
86
|
| ↳ documentBundleSizes.ts | `▒▒░░░░░░░░░░░░░░░░░░` 9.9% · 5.0 kB |
|
|
87
|
-
| ↳ checkConfigFiles.ts | `▒░░░░░░░░░░░░░░░░░░░` 7.
|
|
88
|
-
| ↳ documentUsage.ts | `▒░░░░░░░░░░░░░░░░░░░` 5.
|
|
87
|
+
| ↳ checkConfigFiles.ts | `▒░░░░░░░░░░░░░░░░░░░` 7.2% · 3.6 kB |
|
|
88
|
+
| ↳ documentUsage.ts | `▒░░░░░░░░░░░░░░░░░░░` 5.4% · 2.7 kB |
|
|
89
89
|
| ↳ documentActions.ts | `▒░░░░░░░░░░░░░░░░░░░` 3.5% · 1.8 kB |
|
|
90
|
-
| ↳ checkDependencies.ts | `▒░░░░░░░░░░░░░░░░░░░` 3.
|
|
90
|
+
| ↳ checkDependencies.ts | `▒░░░░░░░░░░░░░░░░░░░` 3.4% · 1.7 kB |
|
|
91
91
|
| ↳ cloudflare.ts | `▒░░░░░░░░░░░░░░░░░░░` 3.0% · 1.5 kB |
|
|
92
92
|
| ↳ documentOpening.ts | `▒░░░░░░░░░░░░░░░░░░░` 2.9% · 1.5 kB |
|
|
93
93
|
| ↳ documentContributingLicense.ts | `░░░░░░░░░░░░░░░░░░░░` 2.4% · 1.2 kB |
|
|
@@ -97,7 +97,7 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
97
97
|
| ↳ documentProject.ts | `░░░░░░░░░░░░░░░░░░░░` 1.3% · 664 B |
|
|
98
98
|
| ↳ 7 smaller files | `▒░░░░░░░░░░░░░░░░░░░` 4.3% · 2.2 kB |
|
|
99
99
|
| (bundler output, whitespace & JSON) | `██░░░░░░░░░░░░░░░░░░` 12.4% · 6.3 kB |
|
|
100
|
-
| **dist/utilities-CQ2h3IWL.js** | 22.7 kB · gzip 6.3 kB ·
|
|
100
|
+
| **dist/utilities-CQ2h3IWL.js** | 22.7 kB · gzip 6.3 kB · 27.0% of the build |
|
|
101
101
|
| @dpuse/dpuse-shared → dist/dpuse-shared.es.js | `██████████░░░░░░░░░░` 51.8% · 11.8 kB |
|
|
102
102
|
| src → index.ts | `███████░░░░░░░░░░░░░` 34.8% · 7.9 kB |
|
|
103
103
|
| valibot → dist/index.mjs | `░░░░░░░░░░░░░░░░░░░░` 1.8% · 413 B |
|
|
@@ -277,18 +277,18 @@ async function He(e) {
|
|
|
277
277
|
async function Ue(e, t, r) {
|
|
278
278
|
b(`${e} Insert licenses into 'README.md'`);
|
|
279
279
|
let i = await c(A), a = await M(), o = `${L(t, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
280
|
-
for (let e of a.values()) o +=
|
|
280
|
+
for (let e of a.values()) o += R(e);
|
|
281
281
|
let s = [];
|
|
282
|
-
i.dependencies != null &&
|
|
282
|
+
i.dependencies != null && z(i.dependencies, a, r, s, 0);
|
|
283
283
|
let l = `${ze}\n\n${s.join("\n")}`;
|
|
284
284
|
await n(`${k}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${l}`, D, O);
|
|
285
285
|
}
|
|
286
286
|
async function We(e, t, r, i) {
|
|
287
287
|
b(`${e} Insert licenses into 'README.md'`);
|
|
288
|
-
let a = await M(), o = a.values().toArray().toSorted((e, t) => e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en")), s = `${L(t, !0)}\n\n|Dependency|Version|
|
|
289
|
-
for (let e of o) s +=
|
|
288
|
+
let a = await M(), o = a.values().toArray().toSorted((e, t) => e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en")), s = `${L(t, !0)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
289
|
+
for (let e of o) s += R(e);
|
|
290
290
|
let l = await c(A), u = Object.entries(l.dependencies ?? {}).toSorted(([e], [t]) => Number(!i.has(e)) - Number(!i.has(t))), d = [];
|
|
291
|
-
|
|
291
|
+
B(u, {
|
|
292
292
|
licensesByKey: a,
|
|
293
293
|
shippedKeys: r,
|
|
294
294
|
shownKeys: /* @__PURE__ */ new Set()
|
|
@@ -437,37 +437,33 @@ async function tt(e, t) {
|
|
|
437
437
|
publishedDate: ""
|
|
438
438
|
};
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function R(e) {
|
|
441
441
|
let t = e.licenseFileLink == null || e.licenseFileLink === "" ? "⚠️ No license file" : `[LICENSE](licenses/${e.licenseFileLink})`;
|
|
442
442
|
return `|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${t}|\n`;
|
|
443
443
|
}
|
|
444
|
-
function
|
|
445
|
-
let t = e.licenseFileLink == null || e.licenseFileLink === "" ? "⚠️ No license file" : `[LICENSE](licenses/${e.licenseFileLink})`;
|
|
446
|
-
return `|[${e.name}](${e.repository})|${e.installedVersion}|${V(e).replace(/^ — /, "")}|${e.licenseTypes}|${t}|\n`;
|
|
447
|
-
}
|
|
448
|
-
function R(e, t, n, r, i) {
|
|
444
|
+
function z(e, t, n, r, i) {
|
|
449
445
|
let a = " ".repeat(i);
|
|
450
446
|
for (let [o, s] of Object.entries(e)) {
|
|
451
447
|
if (s.version === void 0) continue;
|
|
452
448
|
let e = s.version;
|
|
453
|
-
n.has(`${o}@${e}`) || (r.push(
|
|
449
|
+
n.has(`${o}@${e}`) || (r.push(V(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && z(s.dependencies, t, n, r, i + 1));
|
|
454
450
|
}
|
|
455
451
|
}
|
|
456
|
-
function
|
|
452
|
+
function B(e, t, n, r, i) {
|
|
457
453
|
for (let [a, o] of e) {
|
|
458
454
|
if (o.version === void 0) continue;
|
|
459
455
|
let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
|
|
460
456
|
if (!t.shippedKeys.has(e)) {
|
|
461
|
-
|
|
457
|
+
B(s, t, n, r, !0);
|
|
462
458
|
continue;
|
|
463
459
|
}
|
|
464
|
-
i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(
|
|
460
|
+
i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(V(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), B(s, t, n, r + 1, !1));
|
|
465
461
|
}
|
|
466
462
|
}
|
|
467
|
-
function
|
|
468
|
-
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${
|
|
463
|
+
function V(e, t, n, r) {
|
|
464
|
+
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${nt(n)}`;
|
|
469
465
|
}
|
|
470
|
-
function
|
|
466
|
+
function nt(e) {
|
|
471
467
|
if (e == null) return "";
|
|
472
468
|
let t = e.publishedDate ? H(e.publishedDate.split("T", 1)[0]) : "";
|
|
473
469
|
if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
|
|
@@ -483,31 +479,31 @@ function H(e) {
|
|
|
483
479
|
}
|
|
484
480
|
//#endregion
|
|
485
481
|
//#region src/actions/documentOpening.ts
|
|
486
|
-
var
|
|
487
|
-
async function
|
|
482
|
+
var rt = "<!-- OPENING_START -->", it = "<!-- OPENING_END -->";
|
|
483
|
+
async function at() {
|
|
488
484
|
try {
|
|
489
485
|
f("Document Opening"), b("1️⃣ Insert opening content into 'README.md'");
|
|
490
|
-
let e = await c("package.json"), r = await c("config.json"), { owner: i, repo: a } = t(e, "document opening"), s =
|
|
491
|
-
await n(u,
|
|
486
|
+
let e = await c("package.json"), r = await c("config.json"), { owner: i, repo: a } = t(e, "document opening"), s = ot(e), l = ct(r), u = lt(i, a, s, _(r.id).publishedTo === "npm" ? st(e) : void 0, e.description, l);
|
|
487
|
+
await n(u, rt, it), o("Opening documented");
|
|
492
488
|
} catch (e) {
|
|
493
489
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
494
490
|
}
|
|
495
491
|
}
|
|
496
|
-
function
|
|
492
|
+
function ot(e) {
|
|
497
493
|
let t = e.license;
|
|
498
494
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
499
495
|
return t;
|
|
500
496
|
}
|
|
501
|
-
function
|
|
497
|
+
function st(e) {
|
|
502
498
|
let t = e.name;
|
|
503
499
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
|
|
504
500
|
return t;
|
|
505
501
|
}
|
|
506
|
-
function
|
|
502
|
+
function ct(e) {
|
|
507
503
|
let t = e.description.en?.trim();
|
|
508
504
|
return t === void 0 || t === "" ? void 0 : t;
|
|
509
505
|
}
|
|
510
|
-
function
|
|
506
|
+
function lt(e, t, n, r, i, a) {
|
|
511
507
|
let o = `https://github.com/${e}/${t}`;
|
|
512
508
|
return `[}-blue.svg)](./LICENSE)
|
|
513
509
|
[](${o}/releases/latest)${r === void 0 ? "" : `\n[](https://www.npmjs.com/package/${r})`}
|
|
@@ -529,7 +525,7 @@ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the applicati
|
|
|
529
525
|
}
|
|
530
526
|
//#endregion
|
|
531
527
|
//#region src/actions/documentQualitySecurity.ts
|
|
532
|
-
var
|
|
528
|
+
var ut = {
|
|
533
529
|
"Branch-Protection": 3,
|
|
534
530
|
"Code-Review": 0,
|
|
535
531
|
Contributors: 0
|
|
@@ -622,10 +618,10 @@ async function Et(e, t, n) {
|
|
|
622
618
|
i(".github/dependabot.yml"),
|
|
623
619
|
i(l)
|
|
624
620
|
]), [c, u, d, f] = await Promise.all([
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
621
|
+
U(`repos/${e}/${t}`),
|
|
622
|
+
U(`repos/${e}/${t}/private-vulnerability-reporting`),
|
|
623
|
+
U(`repos/${e}/${t}/vulnerability-alerts`),
|
|
624
|
+
U(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
|
|
629
625
|
]), p = c === void 0 ? void 0 : JSON.parse(c).security_and_analysis, m = (e) => p?.[e] === void 0 ? void 0 : p[e].status === "enabled", h = new Set((f === void 0 ? [] : JSON.parse(f).check_runs).map((e) => e.app?.slug)), g = o?.match(/package-ecosystem:/g)?.length ?? 0, _ = o?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
|
|
630
626
|
return {
|
|
631
627
|
codeQLLanguages: (a ?? "").matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || s !== null).map(([, e = ""]) => _t[e] ?? e).toArray(),
|
|
@@ -645,7 +641,7 @@ async function Et(e, t, n) {
|
|
|
645
641
|
testsInCI: r?.includes("npm test") ?? !1
|
|
646
642
|
};
|
|
647
643
|
}
|
|
648
|
-
async function
|
|
644
|
+
async function U(e) {
|
|
649
645
|
try {
|
|
650
646
|
let { stdout: t } = await bt("gh", ["api", e]);
|
|
651
647
|
return t;
|
|
@@ -667,15 +663,15 @@ async function Ot(e) {
|
|
|
667
663
|
}
|
|
668
664
|
}
|
|
669
665
|
function kt(e) {
|
|
670
|
-
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || dt.has(e) ||
|
|
666
|
+
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || dt.has(e) || ut[e] !== void 0 && t >= ut[e]);
|
|
671
667
|
}
|
|
672
668
|
function At(e) {
|
|
673
669
|
return e === !1 ? " These are handled manually." : "";
|
|
674
670
|
}
|
|
675
|
-
function
|
|
671
|
+
function W(e) {
|
|
676
672
|
return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
|
|
677
673
|
}
|
|
678
|
-
function
|
|
674
|
+
function G(e, t) {
|
|
679
675
|
return t.length === 0 ? "" : `### ${e}
|
|
680
676
|
|
|
681
677
|
|Check|Status|What it does|
|
|
@@ -690,78 +686,78 @@ function jt(e, t, n, r) {
|
|
|
690
686
|
function Mt(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
691
687
|
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\`.` : "", c = [[
|
|
692
688
|
"Unit tests",
|
|
693
|
-
|
|
689
|
+
W(i.testsInCI),
|
|
694
690
|
`[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
|
|
695
691
|
], [
|
|
696
692
|
"Property-based tests",
|
|
697
|
-
|
|
693
|
+
W(i.propertyTests),
|
|
698
694
|
`[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)}`
|
|
699
695
|
]];
|
|
700
696
|
n !== void 0 && c.push([
|
|
701
697
|
"Test coverage",
|
|
702
|
-
|
|
698
|
+
W(!0),
|
|
703
699
|
`${jt(e, t, "Coverage", gt)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(mt)}%.`
|
|
704
700
|
]);
|
|
705
701
|
let l = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, u = [[
|
|
706
702
|
"Code analysis",
|
|
707
|
-
|
|
703
|
+
W(i.sonarCloud),
|
|
708
704
|
`${i.sonarCloud ? l : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
|
|
709
705
|
], [
|
|
710
706
|
"Linting",
|
|
711
|
-
|
|
707
|
+
W(i.lintInCI),
|
|
712
708
|
`[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
|
|
713
709
|
]];
|
|
714
710
|
r !== void 0 && u.unshift([
|
|
715
711
|
"Code health",
|
|
716
|
-
|
|
712
|
+
W(!0),
|
|
717
713
|
`[${jt(e, t, "Fallow code health", ne)}](./${s}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
|
|
718
714
|
]);
|
|
719
715
|
let d = i.codeQLLanguages.length > 0, f = `[](${a}/security/code-scanning) `, p = i.codeQLQueries === "security-extended" ? "using the extended security queries" : "using the default queries", m = d ? ` ${i.codeQLLanguages.join(" and ")}` : "", h = [
|
|
720
716
|
[
|
|
721
717
|
"Push protection",
|
|
722
|
-
|
|
718
|
+
W(i.pushProtection),
|
|
723
719
|
"[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
|
|
724
720
|
],
|
|
725
721
|
[
|
|
726
722
|
"Static analysis",
|
|
727
|
-
|
|
723
|
+
W(d),
|
|
728
724
|
`${d ? f : ""}[CodeQL](https://codeql.github.com) scans${m} for security vulnerabilities, ${p}, on every push and pull request to \`main\` and weekly.`
|
|
729
725
|
],
|
|
730
726
|
[
|
|
731
727
|
"Secret scanning",
|
|
732
|
-
|
|
728
|
+
W(i.secretScanning),
|
|
733
729
|
"[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
|
|
734
730
|
]
|
|
735
731
|
], g = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", _ = [
|
|
736
732
|
[
|
|
737
733
|
"Vulnerability audit",
|
|
738
|
-
|
|
734
|
+
W(i.npmAuditInCI),
|
|
739
735
|
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)}`
|
|
740
736
|
],
|
|
741
737
|
[
|
|
742
738
|
"Supply chain risk",
|
|
743
|
-
|
|
739
|
+
W(i.socket),
|
|
744
740
|
"[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
|
|
745
741
|
],
|
|
746
742
|
[
|
|
747
743
|
"Security alerts",
|
|
748
|
-
|
|
744
|
+
W(i.dependabotAlerts),
|
|
749
745
|
`${g} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
|
|
750
746
|
],
|
|
751
747
|
[
|
|
752
748
|
"Security updates",
|
|
753
|
-
|
|
749
|
+
W(i.dependabotSecurityUpdates),
|
|
754
750
|
`${g} opens pull requests that update vulnerable dependencies.${At(i.dependabotSecurityUpdates)}`
|
|
755
751
|
],
|
|
756
752
|
[
|
|
757
753
|
"Version updates",
|
|
758
|
-
|
|
754
|
+
W(i.dependabotVersionUpdates),
|
|
759
755
|
`${g} opens pull requests for new dependency versions.${At(i.dependabotVersionUpdates)}`
|
|
760
756
|
]
|
|
761
757
|
];
|
|
762
758
|
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.
|
|
763
759
|
|
|
764
|
-
${
|
|
760
|
+
${G("Testing", c)}${G("Code Quality", u)}${G("Security Analysis", h)}${G("Dependencies", _)}`;
|
|
765
761
|
}
|
|
766
762
|
function Nt(e, t, n, r, i) {
|
|
767
763
|
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && kt(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.";
|
|
@@ -787,7 +783,7 @@ var Pt = "<!-- USAGE_START -->", Ft = "<!-- USAGE_END -->", It = /* @__PURE__ */
|
|
|
787
783
|
async function Vt() {
|
|
788
784
|
try {
|
|
789
785
|
f("Document Usage"), b("1️⃣ Insert usage content into 'README.md'");
|
|
790
|
-
let [e, t] = await Promise.all([c("package.json"), c("config.json")]), r = Ht(e), i = Ut(r), a =
|
|
786
|
+
let [e, t] = await Promise.all([c("package.json"), c("config.json")]), r = Ht(e), i = Ut(r), a = K(e.engines?.node), s = K(e.engines?.npm), l = K(e.devDependencies?.typescript), u = Wt(_(t.id), e.name), d = `${r.replace(/\.git$/, "")}/blob/main/package.json`, p = Gt(u, r, i, a, s, l, `${e.name === "@dpuse/dpuse-development" ? zt : Bt} See the \`scripts\` block in [package.json](${d}) for details.`);
|
|
791
787
|
await n(p, Pt, Ft), o("Usage documented");
|
|
792
788
|
} catch (e) {
|
|
793
789
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
@@ -801,7 +797,7 @@ function Ht(e) {
|
|
|
801
797
|
function Ut(e) {
|
|
802
798
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
803
799
|
}
|
|
804
|
-
function
|
|
800
|
+
function K(e) {
|
|
805
801
|
if (e == null) throw Error("package.json version range is required to document usage.");
|
|
806
802
|
let t = /\d+(?:\.\d+)*/.exec(e);
|
|
807
803
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
@@ -841,19 +837,19 @@ ${o}`;
|
|
|
841
837
|
}
|
|
842
838
|
//#endregion
|
|
843
839
|
//#region src/actions/documentApiReference.ts
|
|
844
|
-
var
|
|
840
|
+
var q = "API_REFERENCE.md";
|
|
845
841
|
async function Kt() {
|
|
846
842
|
try {
|
|
847
843
|
f("Document API Reference");
|
|
848
844
|
let { writeAPIReference: e } = await import("./apiReference-Fj5_02JP.js");
|
|
849
|
-
await e("1️⃣ ",
|
|
845
|
+
await e("1️⃣ ", q), o("API reference documented");
|
|
850
846
|
} catch (e) {
|
|
851
847
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
852
848
|
}
|
|
853
849
|
}
|
|
854
850
|
//#endregion
|
|
855
851
|
//#region src/actions/documentBundleSizes.ts
|
|
856
|
-
var qt = "bundle-analysis-reports/sonda/index.json", Jt = "<!-- BUNDLE_START -->", Yt = "<!-- BUNDLE_END -->",
|
|
852
|
+
var qt = "bundle-analysis-reports/sonda/index.json", Jt = "<!-- BUNDLE_START -->", Yt = "<!-- BUNDLE_END -->", J = " ", Y = 20, Xt = "█", Zt = "▒", Qt = 100 / Y / 2, $t = 100 / Y, en = "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._", tn = "Bars show each row's share of its output file.", nn = "↳ rows are part of the row above.", X = "(bundler output, whitespace & JSON)", rn = `${X} = 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.`;
|
|
857
853
|
async function an(e) {
|
|
858
854
|
try {
|
|
859
855
|
f("Document Bundle Sizes"), b("1️⃣ Read bundle analysis report");
|
|
@@ -868,31 +864,31 @@ async function an(e) {
|
|
|
868
864
|
function on(e, t) {
|
|
869
865
|
let n = pn(e), r = n.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), i = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, vn(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
|
|
870
866
|
for (let [e, o] of i) {
|
|
871
|
-
let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted(sn), s = i.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), c = s > 0 && r > 0 ? ` · ${
|
|
867
|
+
let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted(sn), s = i.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), c = s > 0 && r > 0 ? ` · ${Sn(s, r)} of the build` : "";
|
|
872
868
|
a.push(`| **${e}** | ${yn(o)}${c} |`, ...cn(i, s, t));
|
|
873
869
|
}
|
|
874
870
|
return a.join("\n");
|
|
875
871
|
}
|
|
876
872
|
function sn(e, t) {
|
|
877
|
-
return e[0] ===
|
|
873
|
+
return e[0] === X == (t[0] === X) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === X ? 1 : -1;
|
|
878
874
|
}
|
|
879
875
|
function cn(e, t, n) {
|
|
880
876
|
let r = [];
|
|
881
877
|
for (let [i, { sizes: a, files: o }] of e) {
|
|
882
878
|
if (o.size === 1) {
|
|
883
879
|
let e = fn(o);
|
|
884
|
-
r.push(`| ${
|
|
880
|
+
r.push(`| ${J}${dn(i, e)} | ${Z(a.uncompressed, t)} |`);
|
|
885
881
|
continue;
|
|
886
882
|
}
|
|
887
|
-
r.push(`| ${
|
|
883
|
+
r.push(`| ${J}${i} | ${Z(a.uncompressed, t)} |`), n || r.push(...ln(o, t));
|
|
888
884
|
}
|
|
889
885
|
return r;
|
|
890
886
|
}
|
|
891
887
|
function ln(e, t) {
|
|
892
|
-
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = un(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${
|
|
888
|
+
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = un(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${J}${J}↳ ${e} | ${Z(n.uncompressed, t, Zt)} |`);
|
|
893
889
|
if (r > 0) {
|
|
894
890
|
let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
|
|
895
|
-
i.push(`| ${
|
|
891
|
+
i.push(`| ${J}${J}↳ ${String(r)} smaller files | ${Z(e, t, Zt)} |`);
|
|
896
892
|
}
|
|
897
893
|
return i;
|
|
898
894
|
}
|
|
@@ -906,7 +902,7 @@ function un(e, t) {
|
|
|
906
902
|
}
|
|
907
903
|
return n >= 2 ? n : 0;
|
|
908
904
|
}
|
|
909
|
-
function
|
|
905
|
+
function Z(e, t, n = Xt) {
|
|
910
906
|
return `${bn(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
|
|
911
907
|
}
|
|
912
908
|
function dn(e, t) {
|
|
@@ -924,12 +920,12 @@ function pn(e) {
|
|
|
924
920
|
let { group: e, file: i } = hn(r.name, t), a = vn(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
|
|
925
921
|
n.set(r.parent, o);
|
|
926
922
|
let s = o.get(e) ?? {
|
|
927
|
-
sizes:
|
|
923
|
+
sizes: Q(),
|
|
928
924
|
files: /* @__PURE__ */ new Map()
|
|
929
925
|
};
|
|
930
|
-
o.set(e, s),
|
|
931
|
-
let c = s.files.get(i) ??
|
|
932
|
-
s.files.set(i, c),
|
|
926
|
+
o.set(e, s), xn(s.sizes, a);
|
|
927
|
+
let c = s.files.get(i) ?? Q();
|
|
928
|
+
s.files.set(i, c), xn(c, a);
|
|
933
929
|
}
|
|
934
930
|
return n;
|
|
935
931
|
}
|
|
@@ -946,7 +942,7 @@ function hn(e, t) {
|
|
|
946
942
|
};
|
|
947
943
|
}
|
|
948
944
|
return e === "[unassigned]" ? {
|
|
949
|
-
group:
|
|
945
|
+
group: X,
|
|
950
946
|
file: ""
|
|
951
947
|
} : e.startsWith("\0") ? {
|
|
952
948
|
group: "(runtime)",
|
|
@@ -976,19 +972,19 @@ function yn(e) {
|
|
|
976
972
|
return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
|
|
977
973
|
}
|
|
978
974
|
function bn(e, t = Xt) {
|
|
979
|
-
let n = Math.round(e / 100 *
|
|
980
|
-
return `\`${t.repeat(n)}${"░".repeat(
|
|
975
|
+
let n = Math.round(e / 100 * Y);
|
|
976
|
+
return `\`${t.repeat(n)}${"░".repeat(Y - n)}\` ${e.toFixed(1)}%`;
|
|
981
977
|
}
|
|
982
|
-
function
|
|
978
|
+
function Q() {
|
|
983
979
|
return {
|
|
984
980
|
uncompressed: 0,
|
|
985
981
|
gzip: 0
|
|
986
982
|
};
|
|
987
983
|
}
|
|
988
|
-
function
|
|
984
|
+
function xn(e, t) {
|
|
989
985
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
990
986
|
}
|
|
991
|
-
function
|
|
987
|
+
function Sn(e, t) {
|
|
992
988
|
return `${(e / t * 100).toFixed(1)}%`;
|
|
993
989
|
}
|
|
994
990
|
function $(e) {
|
|
@@ -996,15 +992,15 @@ function $(e) {
|
|
|
996
992
|
}
|
|
997
993
|
//#endregion
|
|
998
994
|
//#region src/actions/documentProject.ts
|
|
999
|
-
async function
|
|
995
|
+
async function Cn(e = "MIT", t = !1) {
|
|
1000
996
|
try {
|
|
1001
997
|
let n = await c("config.json"), r = _(n.id).typeId === "connector";
|
|
1002
|
-
await
|
|
1003
|
-
let a = await i(
|
|
1004
|
-
a ? await Kt() : b(`ℹ️ '${
|
|
998
|
+
await at(), r && await Ne(), await Vt(), await Ve(e), await i("bundle-analysis-reports/sonda/index.json") === null ? b(`ℹ️ Bundle sizes NOT documented, as there is no '${qt}' yet. Build the project first.`) : await an({ moduleLevel: t }), await xt(), await Pe();
|
|
999
|
+
let a = await i(q) !== null;
|
|
1000
|
+
a ? await Kt() : b(`ℹ️ '${q}' NOT required by this project`), await x("ℹ️ Format generated files", "prettier", [
|
|
1005
1001
|
"--write",
|
|
1006
1002
|
"README.md",
|
|
1007
|
-
...a ? [
|
|
1003
|
+
...a ? [q] : []
|
|
1008
1004
|
]);
|
|
1009
1005
|
} catch (e) {
|
|
1010
1006
|
console.error("❌ Error documenting project", e), process.exit(1);
|
|
@@ -1012,7 +1008,7 @@ async function wn(e = "MIT", t = !1) {
|
|
|
1012
1008
|
}
|
|
1013
1009
|
//#endregion
|
|
1014
1010
|
//#region src/actions/formatCode.ts
|
|
1015
|
-
async function
|
|
1011
|
+
async function wn() {
|
|
1016
1012
|
try {
|
|
1017
1013
|
f("Format Code");
|
|
1018
1014
|
let e = [
|
|
@@ -1033,7 +1029,7 @@ async function Tn() {
|
|
|
1033
1029
|
}
|
|
1034
1030
|
//#endregion
|
|
1035
1031
|
//#region src/actions/lintCode.ts
|
|
1036
|
-
async function
|
|
1032
|
+
async function Tn() {
|
|
1037
1033
|
try {
|
|
1038
1034
|
f("Lint Code"), await x("1️⃣ Lint", "eslint", ["."]), o("Code linted");
|
|
1039
1035
|
} catch (e) {
|
|
@@ -1042,7 +1038,7 @@ async function En() {
|
|
|
1042
1038
|
}
|
|
1043
1039
|
//#endregion
|
|
1044
1040
|
//#region src/utilities/cloudflare.ts
|
|
1045
|
-
async function
|
|
1041
|
+
async function En() {
|
|
1046
1042
|
let e = await c("config.json"), t = {
|
|
1047
1043
|
body: JSON.stringify(e),
|
|
1048
1044
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1050,7 +1046,7 @@ async function Dn() {
|
|
|
1050
1046
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
1051
1047
|
if (!n.ok) throw Error(await n.text());
|
|
1052
1048
|
}
|
|
1053
|
-
async function
|
|
1049
|
+
async function Dn(e, t) {
|
|
1054
1050
|
async function n(e, t, r) {
|
|
1055
1051
|
for (let i of r) {
|
|
1056
1052
|
let r = `${e}/${i}`, a = `${t}/${i}`;
|
|
@@ -1068,7 +1064,7 @@ async function On(e, t) {
|
|
|
1068
1064
|
let r = await v(`${e}/${t}/`);
|
|
1069
1065
|
await n(`${e}/${t}`, t, r);
|
|
1070
1066
|
}
|
|
1071
|
-
async function
|
|
1067
|
+
async function On(e) {
|
|
1072
1068
|
let t = e.id, n = {
|
|
1073
1069
|
body: JSON.stringify(e),
|
|
1074
1070
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1076,7 +1072,7 @@ async function kn(e) {
|
|
|
1076
1072
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
1077
1073
|
if (!r.ok) throw Error(await r.text());
|
|
1078
1074
|
}
|
|
1079
|
-
async function
|
|
1075
|
+
async function kn(e, t) {
|
|
1080
1076
|
let n = `v${e.version ?? "unknown"}`;
|
|
1081
1077
|
async function r(e, r = "") {
|
|
1082
1078
|
let i = await v(e, { withFileTypes: !0 });
|
|
@@ -1100,34 +1096,34 @@ async function An(e, t) {
|
|
|
1100
1096
|
}
|
|
1101
1097
|
//#endregion
|
|
1102
1098
|
//#region src/actions/publishProject.ts
|
|
1103
|
-
async function
|
|
1099
|
+
async function An() {
|
|
1104
1100
|
try {
|
|
1105
1101
|
f("Publish Project");
|
|
1106
1102
|
let e = await c("package.json"), t = await c("config.json"), n = _(t.id);
|
|
1107
|
-
n.publishedTo === "npm" ? await x("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : b("1️⃣ Publishing to npm NOT required"), await
|
|
1103
|
+
n.publishedTo === "npm" ? await x("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : b("1️⃣ Publishing to npm NOT required"), await jn("2️⃣ ", e, t, n), o(`Project version '${e.version ?? "unknown"}' published.`);
|
|
1108
1104
|
} catch (e) {
|
|
1109
1105
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1110
1106
|
}
|
|
1111
1107
|
}
|
|
1112
|
-
async function
|
|
1113
|
-
if (r.typeId === "app") b(`${e} Register module`), await
|
|
1114
|
-
else if (r.typeId === "engine") b(`${e} Register module`), await
|
|
1108
|
+
async function jn(e, t, n, r) {
|
|
1109
|
+
if (r.typeId === "app") b(`${e} Register module`), await En();
|
|
1110
|
+
else if (r.typeId === "engine") b(`${e} Register module`), await kn(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await On(n);
|
|
1115
1111
|
else if (r.uploadGroupName === void 0) b(`${e} Registration NOT required`);
|
|
1116
1112
|
else {
|
|
1117
1113
|
b(`${e} Register module`);
|
|
1118
1114
|
let i = n.id.split("-").slice(2).join("-");
|
|
1119
|
-
await
|
|
1115
|
+
await kn(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await On(n);
|
|
1120
1116
|
}
|
|
1121
1117
|
}
|
|
1122
1118
|
//#endregion
|
|
1123
1119
|
//#region src/actions/releaseProject.ts
|
|
1124
|
-
async function
|
|
1120
|
+
async function Mn(e = "MIT", t = !1) {
|
|
1125
1121
|
try {
|
|
1126
1122
|
f("Release Project");
|
|
1127
1123
|
let n = await c("package.json"), r = await c("config.json"), i = _(r.id);
|
|
1128
1124
|
await y("1️⃣ ", n);
|
|
1129
1125
|
let a = await g("2️⃣ ", n, i);
|
|
1130
|
-
if (await he("3️⃣ ", n), b("4️⃣ Regenerate README"), await
|
|
1126
|
+
if (await he("3️⃣ ", n), b("4️⃣ Regenerate README"), await Cn(e, t), await d("5️⃣ Stage changes", "git", ["add", "."]), await d("6️⃣ Commit changes", "git", [
|
|
1131
1127
|
"commit",
|
|
1132
1128
|
"-m",
|
|
1133
1129
|
`v${n.version ?? "unknown"}`
|
|
@@ -1135,7 +1131,7 @@ async function Nn(e = "MIT", t = !1) {
|
|
|
1135
1131
|
"push",
|
|
1136
1132
|
"origin",
|
|
1137
1133
|
"main:main"
|
|
1138
|
-
]), await
|
|
1134
|
+
]), await jn("8️⃣ ", n, a, i), i.publishedTo === "npm") {
|
|
1139
1135
|
let e = `v${n.version ?? "unknown"}`;
|
|
1140
1136
|
await x("9️⃣ Create GitHub release", "gh", [
|
|
1141
1137
|
"release",
|
|
@@ -1154,7 +1150,7 @@ async function Nn(e = "MIT", t = !1) {
|
|
|
1154
1150
|
}
|
|
1155
1151
|
//#endregion
|
|
1156
1152
|
//#region src/actions/syncProjectWithGitHub.ts
|
|
1157
|
-
async function
|
|
1153
|
+
async function Nn() {
|
|
1158
1154
|
try {
|
|
1159
1155
|
f("Synchronise Project with GitHub");
|
|
1160
1156
|
let e = await c("package.json"), t = await c("config.json"), n = _(t.id);
|
|
@@ -1173,12 +1169,12 @@ async function Pn() {
|
|
|
1173
1169
|
}
|
|
1174
1170
|
//#endregion
|
|
1175
1171
|
//#region src/actions/testProject.ts
|
|
1176
|
-
var
|
|
1172
|
+
var Pn = [
|
|
1177
1173
|
"1️⃣ ",
|
|
1178
1174
|
"2️⃣ ",
|
|
1179
1175
|
"3️⃣ ",
|
|
1180
1176
|
"4️⃣ "
|
|
1181
|
-
],
|
|
1177
|
+
], Fn = [{
|
|
1182
1178
|
id: "unit",
|
|
1183
1179
|
label: "Run unit tests",
|
|
1184
1180
|
command: "vitest",
|
|
@@ -1191,13 +1187,13 @@ var Fn = [
|
|
|
1191
1187
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1192
1188
|
configFileName: "playwright.config.ts"
|
|
1193
1189
|
}];
|
|
1194
|
-
async function
|
|
1190
|
+
async function In(e = ["unit"]) {
|
|
1195
1191
|
try {
|
|
1196
1192
|
f("Test Project");
|
|
1197
1193
|
let t = 0;
|
|
1198
|
-
for (let n of
|
|
1194
|
+
for (let n of Fn) {
|
|
1199
1195
|
if (!e.includes(n.id) || await i(n.configFileName) === null) continue;
|
|
1200
|
-
let r = `${
|
|
1196
|
+
let r = `${Pn[t] ?? ""} ${n.label}`;
|
|
1201
1197
|
await x(r, n.command, n.arguments), t += 1;
|
|
1202
1198
|
}
|
|
1203
1199
|
if (t === 0) {
|
|
@@ -1210,4 +1206,4 @@ async function Ln(e = ["unit"]) {
|
|
|
1210
1206
|
}
|
|
1211
1207
|
}
|
|
1212
1208
|
//#endregion
|
|
1213
|
-
export { fe as auditDependencies, me as buildProject, De as checkProject,
|
|
1209
|
+
export { fe as auditDependencies, me as buildProject, De as checkProject, Cn as documentProject, wn as formatCode, Tn as lintCode, An as publishProject, Mn as releaseProject, Nn as syncProjectWithGitHub, In as testProject, Dn as uploadDirectoryToR2 };
|