@dpuse/dpuse-development 0.3.534 → 0.3.535
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.
|
@@ -6605,86 +6605,16 @@ async function $r(e, t, n = "./") {
|
|
|
6605
6605
|
}
|
|
6606
6606
|
//#endregion
|
|
6607
6607
|
//#region src/operations/auditDependencies.ts
|
|
6608
|
-
|
|
6609
|
-
critical: {
|
|
6610
|
-
color: "D32F2F",
|
|
6611
|
-
label: "critical"
|
|
6612
|
-
},
|
|
6613
|
-
high: {
|
|
6614
|
-
color: "EF6C00",
|
|
6615
|
-
label: "high"
|
|
6616
|
-
},
|
|
6617
|
-
moderate: {
|
|
6618
|
-
color: "FBC02D",
|
|
6619
|
-
label: "moderate"
|
|
6620
|
-
},
|
|
6621
|
-
low: {
|
|
6622
|
-
color: "6D8C31",
|
|
6623
|
-
label: "low"
|
|
6624
|
-
},
|
|
6625
|
-
unknown: {
|
|
6626
|
-
color: "616161",
|
|
6627
|
-
label: "unknown"
|
|
6628
|
-
}
|
|
6629
|
-
}, ti = "<!-- OWASP_BADGES_START -->", ni = "<!-- OWASP_BADGES_END -->";
|
|
6630
|
-
async function ri() {
|
|
6608
|
+
async function ei() {
|
|
6631
6609
|
try {
|
|
6632
|
-
Ar("Audit Dependencies");
|
|
6633
|
-
let e = await Q("package.json"), t = [];
|
|
6634
|
-
try {
|
|
6635
|
-
let e = (await Cr("dependency-check-bin")).toSorted((e, t) => e.localeCompare(t)).at(-1);
|
|
6636
|
-
e != null && e !== "" && t.push("--owasp-bin", `dependency-check-bin/${e}/dependency-check/bin/dependency-check.sh`);
|
|
6637
|
-
} catch {}
|
|
6638
|
-
await Z("1️⃣", "owasp-dependency-check", [
|
|
6639
|
-
...t,
|
|
6640
|
-
"--out",
|
|
6641
|
-
"dependency-check-reports",
|
|
6642
|
-
"--project",
|
|
6643
|
-
e.name ?? "unknown",
|
|
6644
|
-
"--enableRetired",
|
|
6645
|
-
"--nodePackageSkipDevDependencies",
|
|
6646
|
-
"--nvdApiKey",
|
|
6647
|
-
process.env.OWASP_NVD_API_KEY ?? "",
|
|
6648
|
-
"--ossIndexUsername",
|
|
6649
|
-
process.env.SONATYPE_USER_EMAIL ?? "",
|
|
6650
|
-
"--ossIndexPassword",
|
|
6651
|
-
process.env.SONATYPE_USER_TOKEN ?? "",
|
|
6652
|
-
"--noupdate"
|
|
6653
|
-
]), await ii("2️⃣"), await Z("3️⃣ Check using 'npm audit'", "npm", ["audit"]), jr("Dependencies audited.");
|
|
6610
|
+
Ar("Audit Dependencies"), await Z("1️⃣ Check using 'npm audit'", "npm", ["audit"]), jr("Dependencies audited.");
|
|
6654
6611
|
} catch (e) {
|
|
6655
6612
|
console.error("❌ Error auditing dependencies.", e), process.exit(1);
|
|
6656
6613
|
}
|
|
6657
6614
|
}
|
|
6658
|
-
async function ii(e) {
|
|
6659
|
-
$(`${e} Insert OWASP Badge(s) into 'README.md'`);
|
|
6660
|
-
let t = await Q("dependency-check-reports/dependency-check-report.json"), n = {
|
|
6661
|
-
critical: 0,
|
|
6662
|
-
high: 0,
|
|
6663
|
-
moderate: 0,
|
|
6664
|
-
low: 0,
|
|
6665
|
-
unknown: 0
|
|
6666
|
-
};
|
|
6667
|
-
for (let e of t.dependencies) if (e.vulnerabilities != null) for (let t of e.vulnerabilities) {
|
|
6668
|
-
let e = t.severity?.toLowerCase() ?? "unknown";
|
|
6669
|
-
Object.hasOwn(n, e) ? n[e]++ : n.unknown++;
|
|
6670
|
-
}
|
|
6671
|
-
let r = await ai(n);
|
|
6672
|
-
await kr("README.md", Ir(await Er("./README.md"), r.join(" "), ti, ni)), console.info("OWASP audit badge(s) inserted into 'README.md'");
|
|
6673
|
-
}
|
|
6674
|
-
async function ai(e) {
|
|
6675
|
-
let t = await Q("config.json"), n = [];
|
|
6676
|
-
if (Object.values(e).reduce((e, t) => e + t, 0) === 0) console.info("No vulnerabilities found."), n.push(`[](https://dpuse.github.io/${t.id}/dependency-check-reports/dependency-check-report.html)`);
|
|
6677
|
-
else for (let [r, i] of Object.entries(e)) {
|
|
6678
|
-
let e = ei[r];
|
|
6679
|
-
if (console.warn(`⚠️ ${String(i)} ${e.label} vulnerability(ies) found.`), i === 0) continue;
|
|
6680
|
-
let a = `https://img.shields.io/badge/OWASP-${String(i)}%20${e.label}-${e.color}`;
|
|
6681
|
-
n.push(`[](https://dpuse.github.io/${t.id}/dependency-check-reports/dependency-check-report.html)`);
|
|
6682
|
-
}
|
|
6683
|
-
return n;
|
|
6684
|
-
}
|
|
6685
6615
|
//#endregion
|
|
6686
6616
|
//#region src/operations/checkDependencies.ts
|
|
6687
|
-
async function
|
|
6617
|
+
async function ti() {
|
|
6688
6618
|
try {
|
|
6689
6619
|
Ar("Check Dependencies"), await Z("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), await Z("2️⃣ Check using 'npm-check-updates'", "npm-check-updates", [
|
|
6690
6620
|
"-i",
|
|
@@ -6697,8 +6627,8 @@ async function oi() {
|
|
|
6697
6627
|
}
|
|
6698
6628
|
//#endregion
|
|
6699
6629
|
//#region src/operations/documentDependencies.ts
|
|
6700
|
-
var
|
|
6701
|
-
async function
|
|
6630
|
+
var ni = "<!-- DEPENDENCY_LICENSES_START -->", ri = "<!-- DEPENDENCY_LICENSES_END -->", ii = "<!-- DEPENDENCY_TREE_START -->", ai = "<!-- DEPENDENCY_TREE_END -->";
|
|
6631
|
+
async function oi(e = "MIT") {
|
|
6702
6632
|
try {
|
|
6703
6633
|
Ar("Document Dependencies"), await Sr("1️⃣ Clear downloaded licenses", "licenses/downloads"), await wr("2️⃣ Identify production licenses", "license-checker-rseidelsohn", [
|
|
6704
6634
|
"--production",
|
|
@@ -6716,25 +6646,29 @@ async function di(e = "MIT") {
|
|
|
6716
6646
|
"--all",
|
|
6717
6647
|
"--json",
|
|
6718
6648
|
"--omit=dev"
|
|
6719
|
-
], "licenses/licenseTree.json"), await
|
|
6649
|
+
], "licenses/licenseTree.json"), await si("4️⃣"), jr("Dependencies documented.");
|
|
6720
6650
|
} catch (e) {
|
|
6721
6651
|
console.error("❌ Error documenting dependencies.", e), process.exit(1);
|
|
6722
6652
|
}
|
|
6723
6653
|
}
|
|
6724
|
-
async function
|
|
6654
|
+
async function si(e) {
|
|
6725
6655
|
$(`${e} Insert licenses into 'README.md'`);
|
|
6726
|
-
let [t, n] = await Promise.all([
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6656
|
+
let [t, n, r] = await Promise.all([
|
|
6657
|
+
Q("licenses/licenses.json"),
|
|
6658
|
+
Q("licenses/licenseTree.json"),
|
|
6659
|
+
Q("package.json")
|
|
6660
|
+
]), i = `${r.name ?? ""}@${r.version ?? ""}`, a = /* @__PURE__ */ new Map();
|
|
6661
|
+
for (let [e, n] of Object.entries(t)) e !== i && a.set(e, ci(e, n));
|
|
6662
|
+
await Promise.all(a.values().map(async (e) => {
|
|
6663
|
+
let t = await li(e.name, e.installedVersion);
|
|
6730
6664
|
e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
|
|
6731
6665
|
}));
|
|
6732
|
-
let
|
|
6733
|
-
for (let e of
|
|
6734
|
-
let
|
|
6735
|
-
n.dependencies != null &&
|
|
6666
|
+
let o = "|Name|Version|License(s)|Document|\n|-|:-:|-|-|\n";
|
|
6667
|
+
for (let e of a.values()) o += ui(e);
|
|
6668
|
+
let s = [];
|
|
6669
|
+
n.dependencies != null && di(n.dependencies, a, s, 0), await kr("README.md", Ir(Ir(await Er("./README.md"), o, ni, ri), s.join("\n"), ii, ai));
|
|
6736
6670
|
}
|
|
6737
|
-
function
|
|
6671
|
+
function ci(e, t) {
|
|
6738
6672
|
let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
|
|
6739
6673
|
return {
|
|
6740
6674
|
name: r,
|
|
@@ -6748,7 +6682,7 @@ function pi(e, t) {
|
|
|
6748
6682
|
...t.licenseFile != null && { licenseFileLink: t.licenseFile }
|
|
6749
6683
|
};
|
|
6750
6684
|
}
|
|
6751
|
-
async function
|
|
6685
|
+
async function li(e, t) {
|
|
6752
6686
|
try {
|
|
6753
6687
|
let n = await fetch(`https://registry.npmjs.org/${e.replace("/", "%2F")}`);
|
|
6754
6688
|
if (n.ok) {
|
|
@@ -6766,25 +6700,25 @@ async function mi(e, t) {
|
|
|
6766
6700
|
publishedDate: ""
|
|
6767
6701
|
};
|
|
6768
6702
|
}
|
|
6769
|
-
function
|
|
6703
|
+
function ui(e) {
|
|
6770
6704
|
let t = e.licenseFileLink == null || e.licenseFileLink === "" ? "⚠️ No license file" : `[LICENSE](licenses/${e.licenseFileLink})`;
|
|
6771
6705
|
return `|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${t}|\n`;
|
|
6772
6706
|
}
|
|
6773
|
-
function
|
|
6707
|
+
function di(e, t, n, r) {
|
|
6774
6708
|
let i = " ".repeat(r);
|
|
6775
6709
|
for (let [a, o] of Object.entries(e)) {
|
|
6776
|
-
let e = o.version ?? "", s = t.get(`${a}@${e}`), c = s == null ? a : `[${a}](${s.repository})`, l =
|
|
6777
|
-
n.push(`${i}- **${c}** ${e}${l}`), o.dependencies != null &&
|
|
6710
|
+
let e = o.version ?? "", s = t.get(`${a}@${e}`), c = s == null ? a : `[${a}](${s.repository})`, l = fi(s);
|
|
6711
|
+
n.push(`${i}- **${c}** ${e}${l}`), o.dependencies != null && di(o.dependencies, t, n, r + 1);
|
|
6778
6712
|
}
|
|
6779
6713
|
}
|
|
6780
|
-
function
|
|
6714
|
+
function fi(e) {
|
|
6781
6715
|
if (e == null) return "";
|
|
6782
|
-
let t = e.publishedDate ?
|
|
6716
|
+
let t = e.publishedDate ? pi(e.publishedDate.split("T", 1)[0]) : "";
|
|
6783
6717
|
if (!(e.latestVersion !== "" && e.latestVersion !== e.installedVersion)) return t === "" ? "" : ` — ${t}`;
|
|
6784
|
-
let n = e.latestPublishedDate ?
|
|
6718
|
+
let n = e.latestPublishedDate ? pi(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `**latest**: ${e.latestVersion} ❗` : `**latest**: ${e.latestVersion} — ${n} ❗`;
|
|
6785
6719
|
return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
|
|
6786
6720
|
}
|
|
6787
|
-
function
|
|
6721
|
+
function pi(e) {
|
|
6788
6722
|
if (e == null || e === "") return "n/a";
|
|
6789
6723
|
let t = e.split("T", 1)[0];
|
|
6790
6724
|
if (t == null || t === "") return "n/a";
|
|
@@ -6793,7 +6727,7 @@ function vi(e) {
|
|
|
6793
6727
|
}
|
|
6794
6728
|
//#endregion
|
|
6795
6729
|
//#region src/operations/formatCode.ts
|
|
6796
|
-
async function
|
|
6730
|
+
async function mi() {
|
|
6797
6731
|
try {
|
|
6798
6732
|
Ar("Format Code"), await Z("1️⃣ Format", "prettier", [
|
|
6799
6733
|
"--write",
|
|
@@ -6808,7 +6742,7 @@ async function yi() {
|
|
|
6808
6742
|
}
|
|
6809
6743
|
//#endregion
|
|
6810
6744
|
//#region src/operations/lintCode.ts
|
|
6811
|
-
async function
|
|
6745
|
+
async function hi() {
|
|
6812
6746
|
try {
|
|
6813
6747
|
Ar("Lint Code"), await Z("1️⃣ Lint", "eslint", ["."]), jr("Code linted.");
|
|
6814
6748
|
} catch (e) {
|
|
@@ -6817,7 +6751,7 @@ async function bi() {
|
|
|
6817
6751
|
}
|
|
6818
6752
|
//#endregion
|
|
6819
6753
|
//#region src/operations/updateDPUseDependencies.ts
|
|
6820
|
-
var
|
|
6754
|
+
var gi = [
|
|
6821
6755
|
"1️⃣",
|
|
6822
6756
|
"2️⃣",
|
|
6823
6757
|
"3️⃣",
|
|
@@ -6828,23 +6762,23 @@ var xi = [
|
|
|
6828
6762
|
"8️⃣",
|
|
6829
6763
|
"9️⃣"
|
|
6830
6764
|
];
|
|
6831
|
-
async function
|
|
6765
|
+
async function _i(e = []) {
|
|
6832
6766
|
try {
|
|
6833
6767
|
Ar("Update '@dpuse/dpuse' Dependencies");
|
|
6834
6768
|
for (let [t, n] of e.entries()) {
|
|
6835
|
-
let e =
|
|
6836
|
-
n === "eslint" ? await Z(`${e} Update '${n}'`, "npm", ["install", "@dpuse/eslint-config-dpuse@latest"]) : (await Z(`${e} Update '${n}'`, "npm", ["install", `@dpuse/dpuse-${n}@latest`]), n === "development" && await
|
|
6769
|
+
let e = gi.at(t) ?? "🔢";
|
|
6770
|
+
n === "eslint" ? await Z(`${e} Update '${n}'`, "npm", ["install", "@dpuse/eslint-config-dpuse@latest"]) : (await Z(`${e} Update '${n}'`, "npm", ["install", `@dpuse/dpuse-${n}@latest`]), n === "development" && await vi(Mr((await Q("config.json")).id)));
|
|
6837
6771
|
}
|
|
6838
6772
|
jr("'@dpuse/dpuse' dependencies updated.");
|
|
6839
6773
|
} catch (e) {
|
|
6840
6774
|
console.error("❌ Error updating '@dpuse/dpuse' dependencies.", e), process.exit(1);
|
|
6841
6775
|
}
|
|
6842
6776
|
}
|
|
6843
|
-
async function
|
|
6777
|
+
async function vi(e) {
|
|
6844
6778
|
let t = n.dirname(o(import.meta.url));
|
|
6845
|
-
await
|
|
6779
|
+
await yi(t, "../", ".editorconfig"), await yi(t, "../", ".gitattributes"), await yi(t, "../", e.isPublished ? ".gitignore_published" : ".gitignore_unpublished", ".gitignore2"), await yi(t, "../", ".markdownlint.json"), await yi(t, "../", "LICENSE"), await yi(t, "../", "tsconfig.json", "tsconfig2.json"), e.typeId === "eslint" || (await yi(t, "../", "eslint.config.ts", "eslint.config2.ts"), await yi(t, "../", "vite.config.ts", "vite.config2.ts"), await yi(t, "../", "vitest.config.ts", "vitest.config2.ts"));
|
|
6846
6780
|
}
|
|
6847
|
-
async function
|
|
6781
|
+
async function yi(e, t, r, i) {
|
|
6848
6782
|
let a = await Er(n.resolve(e, `${t}${r}`)), o = n.resolve(process.cwd(), r.split("_", 1)[0] ?? r), s = n.resolve(process.cwd(), i ?? r), c;
|
|
6849
6783
|
try {
|
|
6850
6784
|
c = await Er(o);
|
|
@@ -6858,6 +6792,6 @@ async function wi(e, t, r, i) {
|
|
|
6858
6792
|
await kr(s, a), console.info(`ℹ️ File '${i ?? r}' synchronised.`);
|
|
6859
6793
|
}
|
|
6860
6794
|
//#endregion
|
|
6861
|
-
export {
|
|
6795
|
+
export { ei as auditDependencies, Ur as buildProject, ti as checkDependencies, oi as documentDependencies, mi as formatCode, hi as lintCode, Wr as releaseProject, Zr as syncProjectWithGitHub, Qr as testProject, _i as updateDPUseDependencies, Rr as uploadDirectoryToR2 };
|
|
6862
6796
|
|
|
6863
6797
|
//# sourceMappingURL=dpuse-development.es.js.map
|