@dpuse/dpuse-development 1.0.156 → 1.0.157
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 +19 -36
- package/dist/{apiReference-CxbLrkzr.js → apiReference-BdQJPhGc.js} +1 -1
- package/dist/{apiReference-CxbLrkzr.js.map → apiReference-BdQJPhGc.js.map} +1 -1
- package/dist/dpuse-development.es.js +374 -392
- package/dist/dpuse-development.es.js.map +1 -1
- package/dist/types/src/actions/documentBundleSizes.d.ts +1 -3
- package/dist/types/src/actions/documentProject.d.ts +1 -1
- package/dist/{utilities-FE2RzZB9.js → utilities-Cr4u5egW.js} +1 -1
- package/dist/utilities-Cr4u5egW.js.map +1 -0
- package/package.json +4 -4
- package/dist/utilities-FE2RzZB9.js.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as
|
|
2
|
-
import { SHIPPED_PACKAGES_FILE_NAME as
|
|
3
|
-
import { existsSync as
|
|
4
|
-
import
|
|
5
|
-
import { promisify as
|
|
6
|
-
import { execFile as
|
|
7
|
-
import { fileURLToPath as
|
|
8
|
-
import { run as
|
|
9
|
-
import { init as
|
|
10
|
-
import { setTimeout as
|
|
11
|
-
import
|
|
1
|
+
import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, k as v, l as y, m as ee, n as te, o as ne, p as b, r as re, s as ie, t as ae, u as oe, v as x, w as S, x as C, y as w } from "./utilities-Cr4u5egW.js";
|
|
2
|
+
import { SHIPPED_PACKAGES_FILE_NAME as se } from "./vite.es.js";
|
|
3
|
+
import { existsSync as ce, promises as T } from "node:fs";
|
|
4
|
+
import E from "node:path";
|
|
5
|
+
import { promisify as le } from "node:util";
|
|
6
|
+
import { execFile as ue } from "node:child_process";
|
|
7
|
+
import { fileURLToPath as de } from "node:url";
|
|
8
|
+
import { run as fe } from "npm-check-updates";
|
|
9
|
+
import { init as pe } from "license-checker-rseidelsohn";
|
|
10
|
+
import { setTimeout as me } from "node:timers/promises";
|
|
11
|
+
import he from "spdx-satisfies";
|
|
12
|
+
import { gzipSync as ge } from "node:zlib";
|
|
12
13
|
import _e from "node:os";
|
|
13
14
|
// src/actions/auditDependencies_.json
|
|
14
15
|
var ve = [
|
|
@@ -55,8 +56,8 @@ var ve = [
|
|
|
55
56
|
async function Se() {
|
|
56
57
|
try {
|
|
57
58
|
l("Audit Dependencies");
|
|
58
|
-
let e = await
|
|
59
|
-
if (
|
|
59
|
+
let e = await C("package.json");
|
|
60
|
+
if (re.has(e.name ?? "")) w(`1️⃣ Shipped dependencies NOT checked: ${e.name ?? ""} is a development-only tool`);
|
|
60
61
|
else {
|
|
61
62
|
let e = await n("1️⃣ Check shipped dependencies for any vulnerability", "npm", [
|
|
62
63
|
"audit",
|
|
@@ -64,14 +65,14 @@ async function Se() {
|
|
|
64
65
|
"--json"
|
|
65
66
|
]), t = JSON.parse(e);
|
|
66
67
|
if (t.error !== void 0) throw Error(t.error.summary);
|
|
67
|
-
let r = we(
|
|
68
|
+
let r = we(D(t), ye, !0);
|
|
68
69
|
if (r.length > 0) throw Error(`${String(r.length)} vulnerabilities found in shipped dependencies`);
|
|
69
70
|
}
|
|
70
71
|
let t = await n("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--json"]), r = JSON.parse(t);
|
|
71
72
|
if (r.error !== void 0) throw Error(r.error.summary);
|
|
72
|
-
let i = we(
|
|
73
|
+
let i = we(D(r), xe, !1);
|
|
73
74
|
if (i.length > 0) throw Error(`${String(i.length)} high or critical vulnerabilities found`);
|
|
74
|
-
|
|
75
|
+
x("Dependencies audited");
|
|
75
76
|
} catch (e) {
|
|
76
77
|
console.error("❌ Error auditing dependencies", e), process.exit(1);
|
|
77
78
|
}
|
|
@@ -83,7 +84,7 @@ async function Ce(e) {
|
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
86
|
let r = 0;
|
|
86
|
-
for (let e of
|
|
87
|
+
for (let e of D(t)) {
|
|
87
88
|
let t = be.has(e.severity) ? Te(e, xe) : void 0;
|
|
88
89
|
t !== void 0 && (console.warn(`⚠️ ${t.id} ('${e.name}') is on the allow list, so the CI audit ignores it: ${t.reason}`), r++);
|
|
89
90
|
}
|
|
@@ -102,7 +103,7 @@ function Te(e, t) {
|
|
|
102
103
|
let n = e.url.slice(e.url.lastIndexOf("/") + 1);
|
|
103
104
|
return t.find((e) => e.id === n);
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function D(e) {
|
|
106
107
|
let t = /* @__PURE__ */ new Map(), n = Object.values(e.vulnerabilities ?? {});
|
|
107
108
|
for (let e of n) for (let n of e.via) typeof n != "string" && t.set(n.url, n);
|
|
108
109
|
return t.values().toArray();
|
|
@@ -111,7 +112,7 @@ function E(e) {
|
|
|
111
112
|
var Ee = "build:wasm";
|
|
112
113
|
async function De() {
|
|
113
114
|
try {
|
|
114
|
-
l("Build Project"), await Oe("1️⃣ ", await
|
|
115
|
+
l("Build Project"), await Oe("1️⃣ ", await C("package.json")), x("Project built");
|
|
115
116
|
} catch (e) {
|
|
116
117
|
console.error("❌ Error building project", e), process.exit(1);
|
|
117
118
|
}
|
|
@@ -120,14 +121,14 @@ async function Oe(e, t) {
|
|
|
120
121
|
t.scripts?.[Ee] != null && await r(`${e} Build WebAssembly`, "npm", ["run", Ee]), await r(`${e} Bundle project`, "vite", ["build"]);
|
|
121
122
|
}
|
|
122
123
|
// src/actions/checkConfigFiles.ts
|
|
123
|
-
var
|
|
124
|
+
var O = "@dpuse/dpuse-development/prettierrc", ke = "dpuse-development";
|
|
124
125
|
async function Ae() {
|
|
125
126
|
try {
|
|
126
|
-
l("Check configuration files"),
|
|
127
|
-
let e = await
|
|
128
|
-
await
|
|
129
|
-
let o = await t(
|
|
130
|
-
o && await
|
|
127
|
+
l("Check configuration files"), w("1️⃣ Check individual files");
|
|
128
|
+
let e = await C("config.json"), n = await C("package.json"), r = n.private === !0, i = g(e.id), a = E.dirname(de(import.meta.url));
|
|
129
|
+
await k(a, ".editorconfig"), await k(a, ".gitattributes"), await k(a, ".gitignore", [".gitignore_default"]), await k(a, ".markdownlint.json"), await k(a, ".ncurc.json"), await je(i, a), await k(a, "LICENSE"), await Ne(i, a), await Pe(i, a), await Fe(i, a), await Re(i, a), Me(i, n);
|
|
130
|
+
let o = await t(y) !== null;
|
|
131
|
+
o && await k(a, "rust-toolchain.toml"), await k(a, ".github/dependabot.yml", [`.github/dependabot${r ? ".private" : ""}${o ? ".rust" : ""}.yml`]), r ? await Ie(a) : (await Le(a), await k(a, "SECURITY.md", [], (t) => t.replaceAll(ke, () => e.id))), x("Configuration files checked");
|
|
131
132
|
} catch (e) {
|
|
132
133
|
console.error("❌ Error checking configuration files", e), process.exit(1);
|
|
133
134
|
}
|
|
@@ -139,10 +140,10 @@ async function je(e, t) {
|
|
|
139
140
|
"development",
|
|
140
141
|
"eslint",
|
|
141
142
|
"kb"
|
|
142
|
-
].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await
|
|
143
|
+
].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await k(t, "eslint.config.js", ["eslint.config.default.js"]);
|
|
143
144
|
}
|
|
144
145
|
function Me(e, t) {
|
|
145
|
-
e.typeId === "development" ? console.info("ℹ️ File '.prettierrc.json' is the template") : e.typeId === "app" ? console.info("⚠️ File '.prettierrc.json' is UNIQUE to this project") : t.prettier ===
|
|
146
|
+
e.typeId === "development" ? console.info("ℹ️ File '.prettierrc.json' is the template") : e.typeId === "app" ? console.info("⚠️ File '.prettierrc.json' is UNIQUE to this project") : t.prettier === O ? console.info(`ℹ️ Prettier configuration is '${O}'`) : console.info(`❌ Prettier configuration is NOT '${O}'`);
|
|
146
147
|
}
|
|
147
148
|
async function Ne(e, t) {
|
|
148
149
|
["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
|
|
@@ -153,10 +154,10 @@ async function Ne(e, t) {
|
|
|
153
154
|
"presenter",
|
|
154
155
|
"shared",
|
|
155
156
|
"tool"
|
|
156
|
-
].includes(e.typeId) ? await
|
|
157
|
+
].includes(e.typeId) ? await k(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
|
|
157
158
|
}
|
|
158
159
|
async function Pe(e, t) {
|
|
159
|
-
["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await
|
|
160
|
+
["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await k(t, "scripts/tsconfig.json");
|
|
160
161
|
}
|
|
161
162
|
async function Fe(e, t) {
|
|
162
163
|
if ([
|
|
@@ -182,15 +183,15 @@ async function Fe(e, t) {
|
|
|
182
183
|
break;
|
|
183
184
|
default: n = ["vite.config.default.ts"];
|
|
184
185
|
}
|
|
185
|
-
await
|
|
186
|
+
await k(t, "vite.config.ts", n);
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
async function Ie(e) {
|
|
189
|
-
for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await t(n) !== null && await
|
|
190
|
+
for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await t(n) !== null && await k(e, n);
|
|
190
191
|
console.info("ℹ️ CodeQL and Scorecard workflows and file 'SECURITY.md' are NOT required by this project");
|
|
191
192
|
}
|
|
192
193
|
async function Le(e) {
|
|
193
|
-
await
|
|
194
|
+
await k(e, ".github/workflows/ci.yml"), await k(e, ".github/workflows/codeql.yml"), await k(e, ".github/workflows/publish.yml"), await k(e, ".github/workflows/scorecard.yml");
|
|
194
195
|
}
|
|
195
196
|
async function Re(e, t) {
|
|
196
197
|
[
|
|
@@ -198,10 +199,10 @@ async function Re(e, t) {
|
|
|
198
199
|
"api",
|
|
199
200
|
"github",
|
|
200
201
|
"kb"
|
|
201
|
-
].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await
|
|
202
|
+
].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await k(t, "vitest.config.ts");
|
|
202
203
|
}
|
|
203
|
-
async function
|
|
204
|
-
let i =
|
|
204
|
+
async function k(e, t, n = [], r = (e) => e) {
|
|
205
|
+
let i = E.resolve(process.cwd(), t), a = n.length > 0 ? n : [t], o;
|
|
205
206
|
try {
|
|
206
207
|
o = await s(i);
|
|
207
208
|
} catch (e) {
|
|
@@ -210,7 +211,7 @@ async function O(e, t, n = [], r = (e) => e) {
|
|
|
210
211
|
if (o === void 0) console.info(`❌ File '${t}' is MISSING`);
|
|
211
212
|
else {
|
|
212
213
|
for (let n of a) {
|
|
213
|
-
let i =
|
|
214
|
+
let i = E.resolve(e, `../${n}`), a = r(await s(i));
|
|
214
215
|
if (o === a) {
|
|
215
216
|
console.info(`ℹ️ File '${t}' is the same as '${n}'`);
|
|
216
217
|
return;
|
|
@@ -222,14 +223,14 @@ async function O(e, t, n = [], r = (e) => e) {
|
|
|
222
223
|
// src/actions/checkDependencies.ts
|
|
223
224
|
async function ze() {
|
|
224
225
|
try {
|
|
225
|
-
l("Check Dependencies"), await r("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0),
|
|
226
|
+
l("Check Dependencies"), await r("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), w("2️⃣ Check using 'npm-check-updates'");
|
|
226
227
|
let e = {};
|
|
227
228
|
try {
|
|
228
|
-
e = await
|
|
229
|
+
e = await C(E.resolve(process.cwd(), ".ncurc.json"));
|
|
229
230
|
} catch (e) {
|
|
230
231
|
if (e.code !== "ENOENT") throw e;
|
|
231
232
|
}
|
|
232
|
-
await
|
|
233
|
+
await fe({
|
|
233
234
|
interactive: !0,
|
|
234
235
|
upgrade: !0,
|
|
235
236
|
dep: "dev,prod,peer,optional",
|
|
@@ -252,10 +253,10 @@ async function ze() {
|
|
|
252
253
|
"install-scripts",
|
|
253
254
|
"approve",
|
|
254
255
|
...t
|
|
255
|
-
]) :
|
|
256
|
+
]) : w("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin") {
|
|
256
257
|
let e = await Ve();
|
|
257
258
|
await r("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]), await He(e);
|
|
258
|
-
} else
|
|
259
|
+
} else w("6️⃣ Skipped removing unused install-script entries (macOS only)");
|
|
259
260
|
t.length > 0 && await r("7️⃣ Run install scripts skipped in steps 3 and 4", "npm", [
|
|
260
261
|
"rebuild",
|
|
261
262
|
...t,
|
|
@@ -265,7 +266,7 @@ async function ze() {
|
|
|
265
266
|
"--strict-allow-scripts",
|
|
266
267
|
"--no-audit",
|
|
267
268
|
"--no-fund"
|
|
268
|
-
]),
|
|
269
|
+
]), x("Dependencies checked");
|
|
269
270
|
} catch (e) {
|
|
270
271
|
console.error("❌ Error checking dependencies", e), process.exit(1);
|
|
271
272
|
}
|
|
@@ -275,17 +276,17 @@ async function Be() {
|
|
|
275
276
|
return [...new Set(t)];
|
|
276
277
|
}
|
|
277
278
|
async function Ve() {
|
|
278
|
-
let { allowScripts: e = {} } = await
|
|
279
|
+
let { allowScripts: e = {} } = await C(E.resolve(process.cwd(), "package.json"));
|
|
279
280
|
return e;
|
|
280
281
|
}
|
|
281
282
|
async function He(e) {
|
|
282
|
-
let t =
|
|
283
|
+
let t = E.resolve(process.cwd(), "package.json"), n = await C(t), r = n.allowScripts ?? {}, i = Object.keys(e).filter((e) => !Object.hasOwn(r, e));
|
|
283
284
|
if (i.length === 0) return;
|
|
284
|
-
let { packages: a = {} } = await
|
|
285
|
+
let { packages: a = {} } = await C(E.resolve(process.cwd(), "package-lock.json")), o = Object.entries(a), s = i.filter((e) => {
|
|
285
286
|
let t = e.lastIndexOf("@"), n = t > 0 ? e.slice(0, t) : e, r = t > 0 ? e.slice(t + 1) : void 0;
|
|
286
287
|
return o.some(([e, t]) => e.endsWith(`node_modules/${n}`) && t.hasInstallScript === !0 && (r === void 0 || t.version === r));
|
|
287
288
|
});
|
|
288
|
-
s.length !== 0 && (n.allowScripts = Object.fromEntries(Object.entries(e).filter(([e]) => Object.hasOwn(r, e) || s.includes(e))), await
|
|
289
|
+
s.length !== 0 && (n.allowScripts = Object.fromEntries(Object.entries(e).filter(([e]) => Object.hasOwn(r, e) || s.includes(e))), await v(t, n), w(`6️⃣ Restored install-script entries the lockfile still needs: ${s.join(", ")}`));
|
|
289
290
|
}
|
|
290
291
|
// src/actions/checkProject.ts
|
|
291
292
|
async function Ue() {
|
|
@@ -300,9 +301,9 @@ var We = "<!-- SUPPORTED_ACTIONS_START -->", Ge = "<!-- SUPPORTED_ACTIONS_END --
|
|
|
300
301
|
}, Je = "The table below lists all connector actions and highlights those supported by this connector.";
|
|
301
302
|
async function Ye() {
|
|
302
303
|
try {
|
|
303
|
-
l("Document Actions"),
|
|
304
|
-
let t = (await
|
|
305
|
-
await e(o, We, Ge),
|
|
304
|
+
l("Document Actions"), w("1️⃣ Insert actions description and table into 'README.md'");
|
|
305
|
+
let t = (await C("config.json")).actionNames ?? [], n = i(t), r = a(t), o = `## Supported Actions\n\n${Ke}\n\n${qe[n]} ${Je}\n\n${r}`;
|
|
306
|
+
await e(o, We, Ge), x("Actions documented");
|
|
306
307
|
} catch (e) {
|
|
307
308
|
console.error("❌ Error documenting actions", e), process.exit(1);
|
|
308
309
|
}
|
|
@@ -311,8 +312,8 @@ async function Ye() {
|
|
|
311
312
|
async function Xe() {
|
|
312
313
|
try {
|
|
313
314
|
l("Document Contributing & License");
|
|
314
|
-
let [t, n] = await Promise.all([
|
|
315
|
-
|
|
315
|
+
let [t, n] = await Promise.all([C("package.json"), C("config.json")]), { owner: r, repository: i } = S(t, "document contributing and license"), a = Ze(t), o = Qe(n.firstCreatedAt);
|
|
316
|
+
w("1️⃣ Insert contributing and license content into 'README.md'"), await d(), await e($e(r, i, a, o), te, ae), x("Contributing & license documented");
|
|
316
317
|
} catch (e) {
|
|
317
318
|
console.error("❌ Error documenting contributing and license", e), process.exit(1);
|
|
318
319
|
}
|
|
@@ -343,12 +344,12 @@ This project is licensed under the MIT License, permitting free use, modificatio
|
|
|
343
344
|
[MIT](./LICENSE) © ${r} ${n}`;
|
|
344
345
|
}
|
|
345
346
|
// src/utilities/rustCrates.ts
|
|
346
|
-
var
|
|
347
|
+
var A = "licenses/cargoMetadata.json", j = "licenses/cargoTree.txt", et = 1e3, tt = 1e4, nt = "dpuse-development (https://github.com/dpuse/dpuse-development)", rt = /^(?:copying|licen[cs]e|unlicense)/i, it = "wasm32-unknown-unknown";
|
|
347
348
|
async function at(e, n) {
|
|
348
349
|
if (await t("rust/Cargo.toml") === null) return null;
|
|
349
350
|
let r = [
|
|
350
351
|
"--manifest-path",
|
|
351
|
-
|
|
352
|
+
y,
|
|
352
353
|
"--locked"
|
|
353
354
|
], i = [
|
|
354
355
|
"tree",
|
|
@@ -363,16 +364,16 @@ async function at(e, n) {
|
|
|
363
364
|
"--format",
|
|
364
365
|
"{p}|{l}|{r}"
|
|
365
366
|
];
|
|
366
|
-
await o(e, "cargo", i,
|
|
367
|
+
await o(e, "cargo", i, j), await o(e, "cargo", [
|
|
367
368
|
"metadata",
|
|
368
369
|
...r,
|
|
369
370
|
"--format-version",
|
|
370
371
|
"1",
|
|
371
372
|
"--filter-platform",
|
|
372
373
|
it
|
|
373
|
-
],
|
|
374
|
-
let a = ot(await s(
|
|
375
|
-
await
|
|
374
|
+
], A);
|
|
375
|
+
let a = ot(await s(j)), c = await C(A);
|
|
376
|
+
await T.rm(j, { force: !0 }), await T.rm(A, { force: !0 });
|
|
376
377
|
let l = /* @__PURE__ */ new Map();
|
|
377
378
|
for (let e of a) e.isOwn || l.has(`${e.name}@${e.version}`) || l.set(`${e.name}@${e.version}`, {
|
|
378
379
|
name: e.name,
|
|
@@ -422,14 +423,14 @@ function st(e, t) {
|
|
|
422
423
|
}
|
|
423
424
|
function ct(e) {
|
|
424
425
|
try {
|
|
425
|
-
return
|
|
426
|
+
return he(e, [e]);
|
|
426
427
|
} catch {
|
|
427
428
|
return !1;
|
|
428
429
|
}
|
|
429
430
|
}
|
|
430
431
|
function lt(e, t) {
|
|
431
432
|
try {
|
|
432
|
-
return
|
|
433
|
+
return he(e.replaceAll("/", " OR "), t);
|
|
433
434
|
} catch {
|
|
434
435
|
return !1;
|
|
435
436
|
}
|
|
@@ -437,12 +438,12 @@ function lt(e, t) {
|
|
|
437
438
|
async function ut(e, t) {
|
|
438
439
|
let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
|
|
439
440
|
if (n == null) return [];
|
|
440
|
-
let r =
|
|
441
|
-
await
|
|
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"));
|
|
442
|
+
await T.mkdir("licenses/downloads", { recursive: !0 });
|
|
442
443
|
let a = [];
|
|
443
444
|
for (let t of i) {
|
|
444
445
|
let n = `downloads/${e.name}@${e.version}-${t}`;
|
|
445
|
-
await
|
|
446
|
+
await T.copyFile(E.join(r, t), E.join("licenses", n)), a.push({
|
|
446
447
|
label: t,
|
|
447
448
|
path: n
|
|
448
449
|
});
|
|
@@ -450,9 +451,9 @@ async function ut(e, t) {
|
|
|
450
451
|
return a;
|
|
451
452
|
}
|
|
452
453
|
async function dt(e, t) {
|
|
453
|
-
|
|
454
|
+
w(`${e} - fetch release dates from crates.io`);
|
|
454
455
|
for (let [e, n] of t.entries()) {
|
|
455
|
-
e > 0 && await
|
|
456
|
+
e > 0 && await me(et), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
|
|
456
457
|
try {
|
|
457
458
|
let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, {
|
|
458
459
|
headers: { "User-Agent": nt },
|
|
@@ -465,13 +466,13 @@ async function dt(e, t) {
|
|
|
465
466
|
}
|
|
466
467
|
}
|
|
467
468
|
// src/actions/documentDependencies.ts
|
|
468
|
-
var
|
|
469
|
+
var M = "<!-- DEPENDENCY_LICENSES_START -->", N = "<!-- DEPENDENCY_LICENSES_END -->", P = "## Dependency Licenses", ft = `bundle-analysis-reports/${se}`, F = "licenses/licenseTree.json", pt = "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.", mt = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${pt}`, ht = `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. ${pt}`;
|
|
469
470
|
async function gt(e = "MIT") {
|
|
470
471
|
try {
|
|
471
472
|
l("Document Dependencies");
|
|
472
|
-
let t = await
|
|
473
|
-
if (
|
|
474
|
-
await _t(n),
|
|
473
|
+
let t = await C("package.json"), n = t.name ?? "";
|
|
474
|
+
if (re.has(n)) {
|
|
475
|
+
await _t(n), x("Dependencies documented");
|
|
475
476
|
return;
|
|
476
477
|
}
|
|
477
478
|
await m("1️⃣ Clear downloaded licenses", "licenses/downloads");
|
|
@@ -483,14 +484,14 @@ async function gt(e = "MIT") {
|
|
|
483
484
|
"--all",
|
|
484
485
|
"--json",
|
|
485
486
|
"--omit=dev"
|
|
486
|
-
],
|
|
487
|
+
], F), await vt("4️⃣ ", e, new Set(n));
|
|
487
488
|
} else {
|
|
488
489
|
let n = Ot(i, r), a = kt(r), s = a.filter((e) => !n.has(e));
|
|
489
490
|
await Tt("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), At(n, new Set(a)), await o("3️⃣ Identify transitive dependencies", "npm", [
|
|
490
491
|
"ls",
|
|
491
492
|
"--all",
|
|
492
493
|
"--json"
|
|
493
|
-
],
|
|
494
|
+
], F, !0);
|
|
494
495
|
let c = await at("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
|
|
495
496
|
allowedLicenses: e,
|
|
496
497
|
productionNames: Ct(t),
|
|
@@ -499,38 +500,38 @@ async function gt(e = "MIT") {
|
|
|
499
500
|
};
|
|
500
501
|
await yt(c === null ? "4️⃣ " : "5️⃣ ", l);
|
|
501
502
|
}
|
|
502
|
-
|
|
503
|
+
x("Dependencies documented");
|
|
503
504
|
} catch (e) {
|
|
504
505
|
console.error("❌ Error documenting dependencies", e), process.exit(1);
|
|
505
506
|
}
|
|
506
507
|
}
|
|
507
508
|
async function _t(t) {
|
|
508
|
-
|
|
509
|
+
w(`1️⃣ Skip: ${t} is a development-only tool and is never part of a production release.`);
|
|
509
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.`;
|
|
510
|
-
await e(`${
|
|
511
|
+
await e(`${P}\n\n${n}`, M, N);
|
|
511
512
|
}
|
|
512
513
|
async function vt(t, n, r) {
|
|
513
|
-
|
|
514
|
-
let i = await
|
|
515
|
-
for (let e of a.values()) o +=
|
|
514
|
+
w(`${t} Insert licenses into 'README.md'`);
|
|
515
|
+
let i = await C(F), a = await wt(), o = `${Ft(n, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
516
|
+
for (let e of a.values()) o += L(e);
|
|
516
517
|
let s = [];
|
|
517
518
|
i.dependencies != null && zt(i.dependencies, a, r, s, 0);
|
|
518
519
|
let c = `${mt}\n\n${s.join("\n")}`;
|
|
519
|
-
await e(`${
|
|
520
|
+
await e(`${P}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${c}`, M, N);
|
|
520
521
|
}
|
|
521
522
|
async function yt(t, n) {
|
|
522
|
-
|
|
523
|
+
w(`${t} Insert licenses into 'README.md'`);
|
|
523
524
|
let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = n, s = await wt(), c = new Map((a?.crates ?? []).map((e) => [`${e.name}@${e.version}`, xt(e)])), l = a !== null, u = l ? "|Type|Dependency|Version|License(s)|Document|\n|:-|:-|:-:|:-|:-|" : "|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|", d = `${Ft(r, !0, l)}\n\n${u}\n`;
|
|
524
|
-
for (let e of s.values().toArray().toSorted(bt)) d +=
|
|
525
|
-
for (let e of c.values().toArray().toSorted(bt)) d +=
|
|
526
|
-
let f = await
|
|
527
|
-
|
|
525
|
+
for (let e of s.values().toArray().toSorted(bt)) d += L(e, l ? "JavaScript" : void 0);
|
|
526
|
+
for (let e of c.values().toArray().toSorted(bt)) d += L(e, "Rust");
|
|
527
|
+
let f = await C(F), p = Object.entries(f.dependencies ?? {}).toSorted(([e], [t]) => Number(!i.has(e)) - Number(!i.has(t))), m = [];
|
|
528
|
+
R(p, {
|
|
528
529
|
licensesByKey: s,
|
|
529
530
|
shippedKeys: o,
|
|
530
531
|
shownKeys: /* @__PURE__ */ new Set()
|
|
531
532
|
}, m, 0, !1);
|
|
532
|
-
let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) => St(e, c)).join("\n"),
|
|
533
|
-
await e(`${
|
|
533
|
+
let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) => St(e, c)).join("\n"), _ = l ? `${ht}\n\n#### JavaScript\n\n${h}\n\n#### Rust\n\n${g}` : `${ht}\n\n${h}`;
|
|
534
|
+
await e(`${P}\n\n${d.trimEnd()}\n\n### Dependency Tree\n\n${_}`, M, N);
|
|
534
535
|
}
|
|
535
536
|
function bt(e, t) {
|
|
536
537
|
return e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en");
|
|
@@ -550,7 +551,7 @@ function xt(e) {
|
|
|
550
551
|
}
|
|
551
552
|
function St(e, t) {
|
|
552
553
|
let n = " ".repeat(e.depth);
|
|
553
|
-
return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` :
|
|
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);
|
|
554
555
|
}
|
|
555
556
|
function Ct(e) {
|
|
556
557
|
return /* @__PURE__ */ new Set([
|
|
@@ -560,7 +561,7 @@ function Ct(e) {
|
|
|
560
561
|
]);
|
|
561
562
|
}
|
|
562
563
|
async function wt() {
|
|
563
|
-
let e = await
|
|
564
|
+
let e = await C("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
|
|
564
565
|
for (let [n, r] of Object.entries(e)) t.set(n, Lt(n, r));
|
|
565
566
|
return await Promise.all(t.values().map(async (e) => {
|
|
566
567
|
let t = await Rt(e.name, e.installedVersion);
|
|
@@ -568,7 +569,7 @@ async function wt() {
|
|
|
568
569
|
})), t;
|
|
569
570
|
}
|
|
570
571
|
async function Tt(e, t, n, r) {
|
|
571
|
-
|
|
572
|
+
w(e), await new Promise((e, i) => {
|
|
572
573
|
let a = {
|
|
573
574
|
start: process.cwd(),
|
|
574
575
|
production: r,
|
|
@@ -580,7 +581,7 @@ async function Tt(e, t, n, r) {
|
|
|
580
581
|
excludePackages: n.join(";"),
|
|
581
582
|
out: "licenses/licenses.json"
|
|
582
583
|
};
|
|
583
|
-
|
|
584
|
+
pe(a, (t) => {
|
|
584
585
|
t == null ? e() : i(t);
|
|
585
586
|
});
|
|
586
587
|
});
|
|
@@ -599,28 +600,28 @@ function Ot(e, t) {
|
|
|
599
600
|
let e = Pt(t, "", r);
|
|
600
601
|
if (e !== void 0) for (let r of [e, ...Mt(t, e)]) {
|
|
601
602
|
let e = t[r];
|
|
602
|
-
e?.version !== void 0 && n.add(
|
|
603
|
+
e?.version !== void 0 && n.add(I(r, e));
|
|
603
604
|
}
|
|
604
605
|
}
|
|
605
606
|
return n;
|
|
606
607
|
}
|
|
607
608
|
function kt(e) {
|
|
608
609
|
let t = /* @__PURE__ */ new Set();
|
|
609
|
-
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(
|
|
610
|
+
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(I(n, r));
|
|
610
611
|
return [...t];
|
|
611
612
|
}
|
|
612
613
|
function At(e, t) {
|
|
613
614
|
let n = [...e.difference(t)];
|
|
614
615
|
n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
|
|
615
616
|
}
|
|
616
|
-
function
|
|
617
|
+
function I(e, t) {
|
|
617
618
|
return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
|
|
618
619
|
}
|
|
619
620
|
function jt(e) {
|
|
620
621
|
let t = Mt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
621
622
|
for (let [i, a] of Object.entries(e)) {
|
|
622
623
|
if (i === "" || a.version === void 0) continue;
|
|
623
|
-
let e =
|
|
624
|
+
let e = I(i, a);
|
|
624
625
|
t.has(i) ? n.add(e) : r.add(e);
|
|
625
626
|
}
|
|
626
627
|
return r.values().filter((e) => !n.has(e)).toArray();
|
|
@@ -696,7 +697,7 @@ async function Rt(e, t) {
|
|
|
696
697
|
publishedDate: ""
|
|
697
698
|
};
|
|
698
699
|
}
|
|
699
|
-
function
|
|
700
|
+
function L(e, t) {
|
|
700
701
|
let n = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
|
|
701
702
|
return `${t === void 0 ? "" : `|${t}`}|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${n}|\n`;
|
|
702
703
|
}
|
|
@@ -705,27 +706,27 @@ function zt(e, t, n, r, i) {
|
|
|
705
706
|
for (let [o, s] of Object.entries(e)) {
|
|
706
707
|
if (s.version === void 0) continue;
|
|
707
708
|
let e = s.version;
|
|
708
|
-
n.has(`${o}@${e}`) || (r.push(
|
|
709
|
+
n.has(`${o}@${e}`) || (r.push(z(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && zt(s.dependencies, t, n, r, i + 1));
|
|
709
710
|
}
|
|
710
711
|
}
|
|
711
|
-
function
|
|
712
|
+
function R(e, t, n, r, i) {
|
|
712
713
|
for (let [a, o] of e) {
|
|
713
714
|
if (o.version === void 0) continue;
|
|
714
715
|
let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
|
|
715
|
-
t.shippedKeys.has(e) ? i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(
|
|
716
|
+
t.shippedKeys.has(e) ? i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(z(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), R(s, t, n, r + 1, !1)) : R(s, t, n, r, !0);
|
|
716
717
|
}
|
|
717
718
|
}
|
|
718
|
-
function
|
|
719
|
-
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${
|
|
719
|
+
function z(e, t, n, r) {
|
|
720
|
+
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${Bt(n)}`;
|
|
720
721
|
}
|
|
721
|
-
function
|
|
722
|
+
function Bt(e) {
|
|
722
723
|
if (e == null) return "";
|
|
723
|
-
let t = e.publishedDate ?
|
|
724
|
+
let t = e.publishedDate ? Vt(e.publishedDate.split("T", 1)[0]) : "";
|
|
724
725
|
if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
|
|
725
|
-
let n = e.latestPublishedDate ?
|
|
726
|
+
let n = e.latestPublishedDate ? Vt(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `latest: ${e.latestVersion} ❗` : `latest: ${e.latestVersion} — ${n} ❗`;
|
|
726
727
|
return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
|
|
727
728
|
}
|
|
728
|
-
function
|
|
729
|
+
function Vt(e) {
|
|
729
730
|
if (e == null || e === "") return "n/a";
|
|
730
731
|
let t = e.split("T", 1)[0];
|
|
731
732
|
if (t == null || t === "") return "n/a";
|
|
@@ -733,42 +734,42 @@ function Ht(e) {
|
|
|
733
734
|
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} ⚠️`;
|
|
734
735
|
}
|
|
735
736
|
// src/actions/documentOpening.ts
|
|
736
|
-
var
|
|
737
|
-
async function
|
|
737
|
+
var Ht = "<!-- OPENING_START -->", Ut = "<!-- OPENING_END -->";
|
|
738
|
+
async function Wt() {
|
|
738
739
|
try {
|
|
739
|
-
l("Document Opening"),
|
|
740
|
-
let t = await
|
|
740
|
+
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 = Kt(t), o = Jt(n), s = g(n.id), c = s.uploadGroupName === void 0 ? void 0 : n.id, u = s.publishedTo === "npm" ? qt(t) : void 0, d = Yt(r, i, a, {
|
|
741
742
|
description: t.description,
|
|
742
743
|
dpuseModuleId: c,
|
|
743
744
|
introduction: o,
|
|
744
745
|
npmPackageName: u,
|
|
745
746
|
version: t.version
|
|
746
747
|
});
|
|
747
|
-
await e(d,
|
|
748
|
+
await e(d, Ht, Ut), x("Opening documented");
|
|
748
749
|
} catch (e) {
|
|
749
750
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
750
751
|
}
|
|
751
752
|
}
|
|
752
|
-
function
|
|
753
|
+
function Gt(e) {
|
|
753
754
|
return e === void 0 ? "blue" : /^v?0/.test(e) || /alpha|beta|snapshot|dev|pre|rc/i.test(e) ? "orange" : "blue";
|
|
754
755
|
}
|
|
755
|
-
function
|
|
756
|
+
function Kt(e) {
|
|
756
757
|
let t = e.license;
|
|
757
758
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
758
759
|
return t;
|
|
759
760
|
}
|
|
760
|
-
function
|
|
761
|
+
function qt(e) {
|
|
761
762
|
let t = e.name;
|
|
762
763
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
|
|
763
764
|
return t;
|
|
764
765
|
}
|
|
765
|
-
function
|
|
766
|
+
function Jt(e) {
|
|
766
767
|
let t = e.description.en?.trim();
|
|
767
768
|
return t === void 0 || t === "" ? void 0 : t;
|
|
768
769
|
}
|
|
769
|
-
function
|
|
770
|
+
function Yt(e, t, n, r) {
|
|
770
771
|
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 ?? ""}`);
|
|
771
|
-
return `[](./LICENSE)${a === void 0 ? "" : `\n[](./LICENSE)${a === void 0 ? "" : `\n[})](${l}/releases/latest)`}${s === void 0 ? "" : `\n[](https://www.npmjs.com/package/${s})`}
|
|
772
773
|
[](${l}/actions/workflows/ci.yml)${i == null || i === "" ? "" : `\n\n${i}`}
|
|
773
774
|
|
|
774
775
|
[Report a Vulnerability](${l}/security/advisories/new) · [Open an Issue](${l}/issues)
|
|
@@ -786,43 +787,43 @@ function Xt(e, t, n, r) {
|
|
|
786
787
|
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}`}`;
|
|
787
788
|
}
|
|
788
789
|
// src/actions/documentQualitySecurity.ts
|
|
789
|
-
var
|
|
790
|
+
var Xt = {
|
|
790
791
|
"Branch-Protection": 3,
|
|
791
792
|
"Code-Review": 0,
|
|
792
793
|
Contributors: 0
|
|
793
|
-
},
|
|
794
|
+
}, Zt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Qt = "coverage/coverage-final.json", $t = "coverage/coverage-summary.json", en = 80, tn = 60, nn = "code-health-reports/vitest/badge.json", rn = {
|
|
794
795
|
actions: "GitHub Actions",
|
|
795
796
|
"javascript-typescript": "JavaScript/TypeScript",
|
|
796
797
|
rust: "Rust"
|
|
797
|
-
},
|
|
798
|
+
}, an = {
|
|
798
799
|
A: "brightgreen",
|
|
799
800
|
B: "green",
|
|
800
801
|
C: "yellow",
|
|
801
802
|
D: "orange",
|
|
802
803
|
F: "red"
|
|
803
|
-
},
|
|
804
|
-
async function
|
|
804
|
+
}, on = `${u}/health.json`, sn = le(ue);
|
|
805
|
+
async function cn() {
|
|
805
806
|
try {
|
|
806
807
|
l("Document Quality & Security");
|
|
807
|
-
let t = await
|
|
808
|
-
|
|
809
|
-
let o = await
|
|
810
|
-
|
|
811
|
-
let [s, c] = await Promise.all([
|
|
812
|
-
|
|
813
|
-
let u =
|
|
808
|
+
let t = await C("package.json"), n = await ln(t), r = await dn(t, n === void 0 ? [] : ["--coverage", Qt]), { owner: i, repository: a } = S(t, "document quality and security");
|
|
809
|
+
w("4️⃣ Read security checks and settings");
|
|
810
|
+
let o = await pn(i, a, t);
|
|
811
|
+
w("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
|
|
812
|
+
let [s, c] = await Promise.all([mn(`https://github.com/${i}/${a}`), hn(`github.com/${i}/${a}`)]);
|
|
813
|
+
w("6️⃣ Insert quality and security content into 'README.md'");
|
|
814
|
+
let u = bn(i, a, {
|
|
814
815
|
coveragePercent: n,
|
|
815
816
|
fallowHealth: r,
|
|
816
817
|
securitySettings: o
|
|
817
818
|
}, s, c);
|
|
818
|
-
await d(), await e(u, f,
|
|
819
|
+
await d(), await e(u, f, ie), x("Quality & security documented");
|
|
819
820
|
} catch (e) {
|
|
820
821
|
console.error("❌ Error documenting quality and security", e), process.exit(1);
|
|
821
822
|
}
|
|
822
823
|
}
|
|
823
|
-
async function
|
|
824
|
+
async function ln(e) {
|
|
824
825
|
if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
|
|
825
|
-
|
|
826
|
+
w("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
|
|
826
827
|
return;
|
|
827
828
|
}
|
|
828
829
|
await r("1️⃣ Measure test coverage", "vitest", [
|
|
@@ -830,27 +831,27 @@ async function un(e) {
|
|
|
830
831
|
"--passWithNoTests",
|
|
831
832
|
"--coverage"
|
|
832
833
|
]);
|
|
833
|
-
let n = await t(
|
|
834
|
+
let n = await t($t);
|
|
834
835
|
if (n === null) return;
|
|
835
836
|
let i = JSON.parse(n).total.lines.pct;
|
|
836
|
-
if (i !== "Unknown") return await
|
|
837
|
+
if (i !== "Unknown") return await un(i), i;
|
|
837
838
|
}
|
|
838
|
-
async function
|
|
839
|
+
async function un(e) {
|
|
839
840
|
let t = [
|
|
840
841
|
"red",
|
|
841
842
|
"yellow",
|
|
842
843
|
"brightgreen"
|
|
843
|
-
], n = Number(e >=
|
|
844
|
-
await
|
|
844
|
+
], n = Number(e >= tn) + Number(e >= en);
|
|
845
|
+
await v(nn, {
|
|
845
846
|
schemaVersion: 1,
|
|
846
847
|
label: "coverage",
|
|
847
848
|
message: `${e.toFixed(1)}%`,
|
|
848
849
|
color: t[n]
|
|
849
850
|
});
|
|
850
851
|
}
|
|
851
|
-
async function
|
|
852
|
+
async function dn(e, t) {
|
|
852
853
|
if (e.devDependencies?.fallow == null) {
|
|
853
|
-
|
|
854
|
+
w("2️⃣ Code health NOT measured, as Fallow is not installed"), w("3️⃣ Code health report NOT required");
|
|
854
855
|
return;
|
|
855
856
|
}
|
|
856
857
|
await o("2️⃣ Measure code health", "fallow", [
|
|
@@ -859,32 +860,32 @@ async function fn(e, t) {
|
|
|
859
860
|
"--format",
|
|
860
861
|
"json",
|
|
861
862
|
...t
|
|
862
|
-
],
|
|
863
|
-
let n = await
|
|
864
|
-
return await
|
|
863
|
+
], on), await o("3️⃣ Write code health report", "fallow", ["--format", "markdown"], ne, !0);
|
|
864
|
+
let n = await C(on);
|
|
865
|
+
return await fn(n), n;
|
|
865
866
|
}
|
|
866
|
-
async function
|
|
867
|
+
async function fn(e) {
|
|
867
868
|
let { score: t, grade: n } = e.health_score;
|
|
868
|
-
await _
|
|
869
|
+
await v(_, {
|
|
869
870
|
schemaVersion: 1,
|
|
870
871
|
label: "fallow",
|
|
871
872
|
message: `${n} (${String(Math.round(t))})`,
|
|
872
|
-
color:
|
|
873
|
+
color: an[n] ?? "lightgrey"
|
|
873
874
|
});
|
|
874
875
|
}
|
|
875
|
-
async function
|
|
876
|
+
async function pn(e, n, r) {
|
|
876
877
|
let [i, a, o] = await Promise.all([
|
|
877
878
|
t(".github/workflows/ci.yml"),
|
|
878
879
|
t(".github/dependabot.yml"),
|
|
879
|
-
t(
|
|
880
|
+
t(y)
|
|
880
881
|
]), s = await t(".github/workflows/codeql.yml") ?? "", [c, l, u, d] = await Promise.all([
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
882
|
+
B(`repos/${e}/${n}`),
|
|
883
|
+
B(`repos/${e}/${n}/private-vulnerability-reporting`),
|
|
884
|
+
B(`repos/${e}/${n}/vulnerability-alerts`),
|
|
885
|
+
B(`repos/${e}/${n}/commits/main/check-runs?per_page=100`)
|
|
885
886
|
]), 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;
|
|
886
887
|
return {
|
|
887
|
-
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) =>
|
|
888
|
+
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => rn[e] ?? e).toArray(),
|
|
888
889
|
codeQLQueries: /queries: ([\w-]+)/.exec(s)?.[1],
|
|
889
890
|
dependabotAlerts: u !== void 0,
|
|
890
891
|
dependabotSecurityUpdates: p("dependabot_security_updates"),
|
|
@@ -901,37 +902,37 @@ async function mn(e, n, r) {
|
|
|
901
902
|
testsInCI: i?.includes("npm test") ?? !1
|
|
902
903
|
};
|
|
903
904
|
}
|
|
904
|
-
async function
|
|
905
|
+
async function B(e) {
|
|
905
906
|
try {
|
|
906
|
-
let { stdout: t } = await
|
|
907
|
+
let { stdout: t } = await sn("gh", ["api", e]);
|
|
907
908
|
return t;
|
|
908
909
|
} catch (e) {
|
|
909
910
|
if (String(e.stderr).includes("HTTP 404")) return;
|
|
910
911
|
throw e;
|
|
911
912
|
}
|
|
912
913
|
}
|
|
913
|
-
async function
|
|
914
|
+
async function mn(e) {
|
|
914
915
|
let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
|
|
915
916
|
if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
|
|
916
917
|
return (await t.json()).find((t) => t.repo_url === e)?.id;
|
|
917
918
|
}
|
|
918
|
-
async function
|
|
919
|
+
async function hn(e) {
|
|
919
920
|
let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
|
|
920
921
|
if (t.status !== 404) {
|
|
921
922
|
if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
|
|
922
923
|
return await t.json();
|
|
923
924
|
}
|
|
924
925
|
}
|
|
925
|
-
function
|
|
926
|
-
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 ||
|
|
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]);
|
|
927
928
|
}
|
|
928
|
-
function
|
|
929
|
+
function _n(e) {
|
|
929
930
|
return e === !1 ? " These are handled manually." : "";
|
|
930
931
|
}
|
|
931
|
-
function
|
|
932
|
+
function V(e) {
|
|
932
933
|
return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
|
|
933
934
|
}
|
|
934
|
-
function
|
|
935
|
+
function H(e, t) {
|
|
935
936
|
return t.length === 0 ? "" : `### ${e}
|
|
936
937
|
|
|
937
938
|
|Check|Status|What it does|
|
|
@@ -940,90 +941,90 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
|
|
|
940
941
|
|
|
941
942
|
`;
|
|
942
943
|
}
|
|
943
|
-
function
|
|
944
|
+
function vn(e, t, n, r) {
|
|
944
945
|
return `})`;
|
|
945
946
|
}
|
|
946
|
-
function
|
|
947
|
+
function yn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
947
948
|
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 = [[
|
|
948
949
|
"Unit tests",
|
|
949
|
-
|
|
950
|
+
V(i.testsInCI),
|
|
950
951
|
`[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
|
|
951
952
|
], [
|
|
952
953
|
"Property-based tests",
|
|
953
|
-
|
|
954
|
+
V(i.propertyTests),
|
|
954
955
|
`[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)}`
|
|
955
956
|
]];
|
|
956
957
|
n !== void 0 && s.push([
|
|
957
958
|
"Test coverage",
|
|
958
|
-
|
|
959
|
-
`${
|
|
959
|
+
V(!0),
|
|
960
|
+
`${vn(e, t, "Coverage", nn)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(en)}%.`
|
|
960
961
|
]);
|
|
961
962
|
let c = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, l = [[
|
|
962
963
|
"Code analysis",
|
|
963
|
-
|
|
964
|
+
V(i.sonarCloud),
|
|
964
965
|
`${i.sonarCloud ? c : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
|
|
965
966
|
], [
|
|
966
967
|
"Linting",
|
|
967
|
-
|
|
968
|
+
V(i.lintInCI),
|
|
968
969
|
`[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
|
|
969
970
|
]];
|
|
970
971
|
r !== void 0 && l.unshift([
|
|
971
972
|
"Code health",
|
|
972
|
-
|
|
973
|
-
`[${
|
|
973
|
+
V(!0),
|
|
974
|
+
`[${vn(e, t, "Fallow code health", _)}](./${ne}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
|
|
974
975
|
]);
|
|
975
976
|
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 = [
|
|
976
977
|
[
|
|
977
978
|
"Push protection",
|
|
978
|
-
|
|
979
|
+
V(i.pushProtection),
|
|
979
980
|
"[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
|
|
980
981
|
],
|
|
981
982
|
[
|
|
982
983
|
"Static analysis",
|
|
983
|
-
|
|
984
|
+
V(u),
|
|
984
985
|
`${u ? d : ""}[CodeQL](https://codeql.github.com) scans${p} for security vulnerabilities, ${f}, on every push and pull request to \`main\` and weekly.`
|
|
985
986
|
],
|
|
986
987
|
[
|
|
987
988
|
"Secret scanning",
|
|
988
|
-
|
|
989
|
+
V(i.secretScanning),
|
|
989
990
|
"[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
|
|
990
991
|
]
|
|
991
992
|
], h = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", g = [
|
|
992
993
|
[
|
|
993
994
|
"Vulnerability audit",
|
|
994
|
-
|
|
995
|
+
V(i.npmAuditInCI),
|
|
995
996
|
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)}`
|
|
996
997
|
],
|
|
997
998
|
[
|
|
998
999
|
"Supply chain risk",
|
|
999
|
-
|
|
1000
|
+
V(i.socket),
|
|
1000
1001
|
"[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
|
|
1001
1002
|
],
|
|
1002
1003
|
[
|
|
1003
1004
|
"Security alerts",
|
|
1004
|
-
|
|
1005
|
+
V(i.dependabotAlerts),
|
|
1005
1006
|
`${h} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
|
|
1006
1007
|
],
|
|
1007
1008
|
[
|
|
1008
1009
|
"Security updates",
|
|
1009
|
-
|
|
1010
|
-
`${h} opens pull requests that update vulnerable dependencies.${
|
|
1010
|
+
V(i.dependabotSecurityUpdates),
|
|
1011
|
+
`${h} opens pull requests that update vulnerable dependencies.${_n(i.dependabotSecurityUpdates)}`
|
|
1011
1012
|
],
|
|
1012
1013
|
[
|
|
1013
1014
|
"Version updates",
|
|
1014
|
-
|
|
1015
|
-
`${h} opens pull requests for new dependency versions.${
|
|
1015
|
+
V(i.dependabotVersionUpdates),
|
|
1016
|
+
`${h} opens pull requests for new dependency versions.${_n(i.dependabotVersionUpdates)}`
|
|
1016
1017
|
]
|
|
1017
1018
|
];
|
|
1018
1019
|
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.
|
|
1019
1020
|
|
|
1020
|
-
${
|
|
1021
|
+
${H("Testing", s)}${H("Code Quality", l)}${H("Security Analysis", m)}${H("Dependencies", g)}`;
|
|
1021
1022
|
}
|
|
1022
|
-
function
|
|
1023
|
-
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 &&
|
|
1023
|
+
function bn(e, t, n, r, i) {
|
|
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 && gn(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.";
|
|
1024
1025
|
return `## Quality & Security
|
|
1025
1026
|
|
|
1026
|
-
${
|
|
1027
|
+
${yn(e, t, n)}### OpenSSF 🚧
|
|
1027
1028
|
|
|
1028
1029
|
${l}[](https://scorecard.dev/viewer/?uri=${o})
|
|
1029
1030
|
|
|
@@ -1034,37 +1035,37 @@ This project is working towards the [OpenSSF Best Practices](https://www.bestpra
|
|
|
1034
1035
|
Please do not open public GitHub issues for security vulnerabilities. ${u}`;
|
|
1035
1036
|
}
|
|
1036
1037
|
// src/actions/documentUsage.ts
|
|
1037
|
-
var
|
|
1038
|
+
var xn = "<!-- USAGE_START -->", Sn = "<!-- USAGE_END -->", Cn = /* @__PURE__ */ new Set([
|
|
1038
1039
|
"connector",
|
|
1039
1040
|
"cookbook",
|
|
1040
1041
|
"presenter"
|
|
1041
|
-
]),
|
|
1042
|
-
async function
|
|
1042
|
+
]), wn = /* @__PURE__ */ new Set(["development", "eslint"]), Tn = "> [!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.", En = "This repository manages itself using the actions it implements.", Dn = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
|
|
1043
|
+
async function On() {
|
|
1043
1044
|
try {
|
|
1044
|
-
l("Document Usage"),
|
|
1045
|
-
let [t, n] = await Promise.all([
|
|
1046
|
-
await e(d,
|
|
1045
|
+
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 = kn(t), i = An(r), a = U(t.engines?.node), o = U(t.engines?.npm), s = U(t.devDependencies?.typescript), c = jn(g(n.id), t.name), u = `${r.replace(/\.git$/, "")}/blob/main/package.json`, d = Mn(c, r, i, a, o, s, `${t.name === "@dpuse/dpuse-development" ? En : Dn} See the \`scripts\` block in [package.json](${u}) for details.`);
|
|
1047
|
+
await e(d, xn, Sn), x("Usage documented");
|
|
1047
1048
|
} catch (e) {
|
|
1048
1049
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
1049
1050
|
}
|
|
1050
1051
|
}
|
|
1051
|
-
function
|
|
1052
|
+
function kn(e) {
|
|
1052
1053
|
let t = e.repository, n = typeof t == "string" ? t : t?.url;
|
|
1053
1054
|
if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
|
|
1054
1055
|
return n.replace(/^git\+/, "");
|
|
1055
1056
|
}
|
|
1056
|
-
function
|
|
1057
|
+
function An(e) {
|
|
1057
1058
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
1058
1059
|
}
|
|
1059
|
-
function
|
|
1060
|
+
function U(e) {
|
|
1060
1061
|
if (e == null) throw Error("package.json version range is required to document usage.");
|
|
1061
1062
|
let t = /\d+(?:\.\d+)*/.exec(e);
|
|
1062
1063
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
1063
1064
|
return t[0];
|
|
1064
1065
|
}
|
|
1065
|
-
function
|
|
1066
|
+
function jn(e, t) {
|
|
1066
1067
|
let { typeId: n } = e;
|
|
1067
|
-
if (
|
|
1068
|
+
if (Cn.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.
|
|
1068
1069
|
|
|
1069
1070
|
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.`;
|
|
1070
1071
|
if (e.publishedTo === "npm") {
|
|
@@ -1075,11 +1076,11 @@ You may view or clone this repository for your own purposes, such as building a
|
|
|
1075
1076
|
npm install ${t}
|
|
1076
1077
|
\`\`\`
|
|
1077
1078
|
|
|
1078
|
-
${
|
|
1079
|
+
${wn.has(n) ? `${Tn}\n\n` : ""}To work on the source instead, clone this repository.`;
|
|
1079
1080
|
}
|
|
1080
1081
|
return "You may view or clone this repository for your own purposes.";
|
|
1081
1082
|
}
|
|
1082
|
-
function
|
|
1083
|
+
function Mn(e, t, n, r, i, a, o) {
|
|
1083
1084
|
return `## Usage
|
|
1084
1085
|
|
|
1085
1086
|
${e}
|
|
@@ -1095,94 +1096,119 @@ _Requires [Node.js](https://nodejs.org/) ${r} or later, [npm](https://www.npmjs.
|
|
|
1095
1096
|
${o}`;
|
|
1096
1097
|
}
|
|
1097
1098
|
// src/actions/documentApiReference.ts
|
|
1098
|
-
var
|
|
1099
|
-
async function
|
|
1099
|
+
var W = "API_REFERENCE.md";
|
|
1100
|
+
async function Nn() {
|
|
1100
1101
|
try {
|
|
1101
1102
|
l("Document API Reference");
|
|
1102
|
-
let { writeAPIReference: e } = await import("./apiReference-
|
|
1103
|
-
await e("1️⃣ ",
|
|
1103
|
+
let { writeAPIReference: e } = await import("./apiReference-BdQJPhGc.js");
|
|
1104
|
+
await e("1️⃣ ", W), x("API reference documented");
|
|
1104
1105
|
} catch (e) {
|
|
1105
1106
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
1106
1107
|
}
|
|
1107
1108
|
}
|
|
1108
1109
|
// src/actions/documentBundleSizes.ts
|
|
1109
|
-
var
|
|
1110
|
-
async function
|
|
1110
|
+
var Pn = "bundle-analysis-reports/sonda/index.json", Fn = "bundle-analysis-reports/sonda/worker.json", In = "dist", Ln = /^\.|\.map$|\.d\.ts$|^shipped-packages\.json$/, Rn = "<!-- BUNDLE_START -->", zn = "<!-- BUNDLE_END -->", G = " ", Bn = 20, Vn = "█", Hn = "▒", Un = 48, Wn = "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._", Gn = "Bars show each row's share of its output file.", Kn = "↳ rows are part of the row above.", qn = "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.", Jn = "+ 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)", Yn = `${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", Xn = `${J}…) = the compiled Rust code, embedded as base64 text, about a third larger than the binary it decodes to, which is the size given.`, Zn = `${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.`;
|
|
1111
|
+
async function Qn() {
|
|
1111
1112
|
try {
|
|
1112
|
-
l("Document Bundle Sizes"),
|
|
1113
|
-
let
|
|
1114
|
-
for (let e of
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1113
|
+
l("Document Bundle Sizes"), w("1️⃣ Read bundle analysis report");
|
|
1114
|
+
let n = await C(Pn), r = await t(Fn), i = r === null ? void 0 : JSON.parse(r), a = /* @__PURE__ */ new Map();
|
|
1115
|
+
for (let e of [...n.resources, ...i?.resources ?? []]) e.kind === "asset" && a.set(e.name, await t(e.name));
|
|
1116
|
+
let o = await $n(new Set(a.keys()));
|
|
1117
|
+
w("2️⃣ Insert table into 'README.md'");
|
|
1118
|
+
let s = tr(n, {
|
|
1119
|
+
assetContents: a,
|
|
1120
|
+
otherFiles: o,
|
|
1121
|
+
workerJson: i
|
|
1120
1122
|
}), c = [
|
|
1121
1123
|
s.includes("↳") ? `${Gn} ${Kn}` : Gn,
|
|
1122
|
-
|
|
1123
|
-
s
|
|
1124
|
+
o.length > 0 ? qn : "",
|
|
1125
|
+
/ \+ \d+ more \|/.test(s) ? Jn : "",
|
|
1124
1126
|
s.includes(q) ? Yn : "",
|
|
1125
|
-
Xn
|
|
1127
|
+
s.includes(J) ? Xn : "",
|
|
1128
|
+
Zn
|
|
1126
1129
|
].filter((e) => e !== "");
|
|
1127
|
-
await e(`## Bundle Analysis\n\n${Wn}\n\n${s}\n\n${c.join("\n\n")}`,
|
|
1130
|
+
await e(`## Bundle Analysis\n\n${Wn}\n\n${s}\n\n${c.join("\n\n")}`, Rn, zn), x("Bundle sizes documented");
|
|
1128
1131
|
} catch (e) {
|
|
1129
1132
|
console.error("❌ Error documenting bundle sizes", e), process.exit(1);
|
|
1130
1133
|
}
|
|
1131
1134
|
}
|
|
1132
|
-
function
|
|
1133
|
-
let
|
|
1135
|
+
async function $n(e) {
|
|
1136
|
+
let t = [], n = await er();
|
|
1137
|
+
for (let r of n) {
|
|
1138
|
+
let n = `${r.parentPath}/${r.name}`;
|
|
1139
|
+
if (!r.isFile() || Ln.test(r.name) || e.has(n)) continue;
|
|
1140
|
+
let i = await T.readFile(n);
|
|
1141
|
+
t.push([n, {
|
|
1142
|
+
uncompressed: i.byteLength,
|
|
1143
|
+
gzip: ge(i).byteLength
|
|
1144
|
+
}]);
|
|
1145
|
+
}
|
|
1146
|
+
return t;
|
|
1147
|
+
}
|
|
1148
|
+
async function er() {
|
|
1149
|
+
try {
|
|
1150
|
+
return await T.readdir(In, {
|
|
1151
|
+
recursive: !0,
|
|
1152
|
+
withFileTypes: !0
|
|
1153
|
+
});
|
|
1154
|
+
} catch (e) {
|
|
1155
|
+
if (e.code === "ENOENT") return [];
|
|
1156
|
+
throw e;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
function tr(e, t) {
|
|
1160
|
+
let { assetContents: n, otherFiles: r, workerJson: i } = t, a = fr(e), o = [...e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, _r(e)]), ...r].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), s = Z();
|
|
1161
|
+
for (let [, e] of o) Q(s, e);
|
|
1162
|
+
let c = i === void 0 ? void 0 : nr(i, n), l = c === void 0 ? void 0 : o.find(([e]) => (a.get(e)?.get(K)?.sizes.uncompressed ?? 0) >= c.bytes)?.[0];
|
|
1134
1163
|
for (let [e, t] of a) {
|
|
1135
|
-
let r = n.get(e);
|
|
1136
|
-
|
|
1164
|
+
let r = rr(n.get(e) ?? "");
|
|
1165
|
+
c !== void 0 && e === l ? (ar(t, c), Y(t, {
|
|
1166
|
+
bytes: r.bytes - c.wasm.bytes,
|
|
1167
|
+
binaryBytes: r.binaryBytes - c.wasm.binaryBytes
|
|
1168
|
+
})) : Y(t, r);
|
|
1137
1169
|
}
|
|
1138
|
-
let
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1170
|
+
let u = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
|
|
1171
|
+
o.length > 1 && u.push(X(`**All ${String(o.length)} files**`, vr(s)));
|
|
1172
|
+
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 ? ` · ${br(t.uncompressed, s.uncompressed)} of the build` : "";
|
|
1174
|
+
u.push(X(`**${dr(e)}**`, `${vr(t)}${i}`), ...cr(n, r));
|
|
1142
1175
|
}
|
|
1143
|
-
return
|
|
1144
|
-
}
|
|
1145
|
-
function
|
|
1146
|
-
let r =
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
let n = new RegExp(String.raw`(?:var|let|const)\s+${t}\s*=\s*(["'\`])`).exec(e), r = n?.[1];
|
|
1157
|
-
if (n === null || r === void 0) return;
|
|
1158
|
-
let i = n.index + n[0].length, a = i;
|
|
1159
|
-
for (; a < e.length && e[a] !== r;) a += e[a] === "\\" ? 2 : 1;
|
|
1160
|
-
return e.slice(i, a);
|
|
1161
|
-
}
|
|
1162
|
-
function tr(e) {
|
|
1176
|
+
return u.join("\n");
|
|
1177
|
+
}
|
|
1178
|
+
function nr(e, t) {
|
|
1179
|
+
let [n, r] = fr(e).entries().next().value ?? [];
|
|
1180
|
+
if (n === void 0 || r === void 0) return;
|
|
1181
|
+
let i = r.values().reduce((e, t) => e + t.sizes.uncompressed, 0), a = rr(t.get(n) ?? "");
|
|
1182
|
+
return Y(r, a), {
|
|
1183
|
+
bytes: i,
|
|
1184
|
+
groups: r,
|
|
1185
|
+
wasm: a
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
function rr(e) {
|
|
1163
1189
|
let t = {
|
|
1164
1190
|
bytes: 0,
|
|
1165
1191
|
binaryBytes: 0
|
|
1166
1192
|
};
|
|
1167
1193
|
for (let n of e.matchAll(/data:application\/wasm;base64,([A-Za-z\d+/]*={0,2})/g)) {
|
|
1168
1194
|
let e = n[1] ?? "";
|
|
1169
|
-
t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) -
|
|
1195
|
+
t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) - ir(e);
|
|
1170
1196
|
}
|
|
1171
1197
|
return t;
|
|
1172
1198
|
}
|
|
1173
|
-
function
|
|
1199
|
+
function ir(e) {
|
|
1174
1200
|
return e.endsWith("==") ? 2 : +!!e.endsWith("=");
|
|
1175
1201
|
}
|
|
1176
|
-
function
|
|
1202
|
+
function Y(e, t) {
|
|
1177
1203
|
if (t.bytes <= 0) return;
|
|
1178
|
-
let n = [e.get("wasm"), e.get(
|
|
1204
|
+
let n = [e.get("wasm"), e.get(K)].flatMap((e) => e === void 0 ? [] : e.files.entries().map(([t, n]) => ({
|
|
1179
1205
|
group: e,
|
|
1180
1206
|
fileName: t,
|
|
1181
1207
|
sizes: n
|
|
1182
1208
|
})).toArray()).find(({ sizes: e }) => e.uncompressed >= t.bytes);
|
|
1183
1209
|
if (n === void 0) return;
|
|
1184
1210
|
or(e, n.group, n.fileName, n.sizes, t.bytes);
|
|
1185
|
-
let r = `${
|
|
1211
|
+
let r = `${J}, ${$(t.binaryBytes)} binary)`;
|
|
1186
1212
|
e.set(r, {
|
|
1187
1213
|
sizes: {
|
|
1188
1214
|
uncompressed: t.bytes,
|
|
@@ -1194,108 +1220,64 @@ function rr(e, t) {
|
|
|
1194
1220
|
}]])
|
|
1195
1221
|
});
|
|
1196
1222
|
}
|
|
1197
|
-
function
|
|
1198
|
-
let
|
|
1199
|
-
if (
|
|
1200
|
-
or(e,
|
|
1201
|
-
let
|
|
1202
|
-
uncompressed: t,
|
|
1223
|
+
function ar(e, t) {
|
|
1224
|
+
let n = e.get(K), r = n?.files.get("");
|
|
1225
|
+
if (n === void 0 || r === void 0) return;
|
|
1226
|
+
or(e, n, "", r, t.bytes);
|
|
1227
|
+
let i = {
|
|
1228
|
+
uncompressed: t.bytes,
|
|
1203
1229
|
gzip: 0
|
|
1204
|
-
}
|
|
1205
|
-
e.set(
|
|
1206
|
-
sizes:
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
},
|
|
1210
|
-
files: o
|
|
1230
|
+
};
|
|
1231
|
+
e.set(q, {
|
|
1232
|
+
sizes: i,
|
|
1233
|
+
files: /* @__PURE__ */ new Map([["", { ...i }]]),
|
|
1234
|
+
parts: t.groups
|
|
1211
1235
|
});
|
|
1212
1236
|
}
|
|
1213
|
-
function ar(e, t, n) {
|
|
1214
|
-
rr(e, n);
|
|
1215
|
-
let r = /* @__PURE__ */ new Map();
|
|
1216
|
-
for (let [t, n] of e) if (t === "src") for (let [e, t] of n.files) r.set(e, { ...t });
|
|
1217
|
-
else {
|
|
1218
|
-
let e = n.files.size === 1 ? Y(t, fr(n.files)) : t;
|
|
1219
|
-
r.set(e, { ...n.sizes });
|
|
1220
|
-
}
|
|
1221
|
-
let i = r.values().reduce((e, t) => e + t.uncompressed, 0), a = r.get(G) ?? Q();
|
|
1222
|
-
return a.uncompressed += Math.max(0, t - i), a.uncompressed > 0 && r.set(G, a), r;
|
|
1223
|
-
}
|
|
1224
1237
|
function or(e, t, n, r, i) {
|
|
1225
1238
|
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);
|
|
1226
1239
|
}
|
|
1227
1240
|
function sr(e, t) {
|
|
1228
|
-
return e[0] ===
|
|
1229
|
-
}
|
|
1230
|
-
function cr(e, t, n) {
|
|
1231
|
-
let r = [];
|
|
1232
|
-
for (let [i, { sizes: a, files: o }] of e) if (o.size === 1) {
|
|
1233
|
-
let e = fr(o);
|
|
1234
|
-
r.push(Z(`${U}${X(Y(i, e))}`, J(a.uncompressed, t)));
|
|
1235
|
-
} else r.push(Z(`${U}${dr(i, o)}`, J(a.uncompressed, t))), n || r.push(...lr(o, t));
|
|
1236
|
-
return r;
|
|
1241
|
+
return e[0] === K == (t[0] === K) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === K ? 1 : -1;
|
|
1237
1242
|
}
|
|
1238
|
-
function
|
|
1239
|
-
let
|
|
1240
|
-
|
|
1241
|
-
let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
|
|
1242
|
-
i.push(Z(`${U}${U}↳ ${String(r)} smaller files`, J(e, t, Bn)));
|
|
1243
|
-
}
|
|
1244
|
-
return i;
|
|
1245
|
-
}
|
|
1246
|
-
function ur(e, t) {
|
|
1247
|
-
if (t <= 0) return 0;
|
|
1248
|
-
let n = 0, r = 0;
|
|
1249
|
-
for (let [, i] of e.toReversed()) {
|
|
1250
|
-
let e = i.uncompressed / t * 100 < Vn, a = (r + i.uncompressed) / t * 100 <= Hn;
|
|
1251
|
-
if (!e || !a) break;
|
|
1252
|
-
n++, r += i.uncompressed;
|
|
1253
|
-
}
|
|
1254
|
-
return n >= 2 ? n : 0;
|
|
1255
|
-
}
|
|
1256
|
-
function J(e, t, n = zn) {
|
|
1257
|
-
return `${br(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
|
|
1243
|
+
function cr(e, t, n = !1) {
|
|
1244
|
+
let r = n ? `${G}${G}↳ ` : G;
|
|
1245
|
+
return [...e].toSorted(sr).flatMap(([e, i]) => [X(`${r}${ur(e, i.files)}`, lr(i.sizes.uncompressed, t, n ? Hn : Vn)), ...i.parts === void 0 ? [] : cr(i.parts, t, !0)]);
|
|
1258
1246
|
}
|
|
1259
|
-
function
|
|
1260
|
-
return t
|
|
1247
|
+
function lr(e, t, n) {
|
|
1248
|
+
return `${yr(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
|
|
1261
1249
|
}
|
|
1262
|
-
function
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
return `${X(Y(e, n))} + ${String(t.size - 1)} more`;
|
|
1250
|
+
function ur(e, t) {
|
|
1251
|
+
let [n] = [...t].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed)[0] ?? [""], r = dr(n === "" ? e : `${e} → ${n}`);
|
|
1252
|
+
return t.size > 1 ? `${r} + ${String(t.size - 1)} more` : r;
|
|
1266
1253
|
}
|
|
1267
|
-
function
|
|
1254
|
+
function dr(e) {
|
|
1268
1255
|
let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(Un - n.length, 2);
|
|
1269
1256
|
return r.length > i ? `${n}<abbr title="${r.replaceAll("&", "&").replaceAll("\"", """)}">…${r.slice(r.length - (i - 1))}</abbr>` : e;
|
|
1270
1257
|
}
|
|
1271
|
-
function
|
|
1258
|
+
function X(e, t) {
|
|
1272
1259
|
return `| ${e} | ${t.replaceAll(" ", " ")} |`;
|
|
1273
1260
|
}
|
|
1274
1261
|
function fr(e) {
|
|
1275
|
-
let
|
|
1276
|
-
if (t === void 0) throw Error("Expected exactly one file");
|
|
1277
|
-
return t;
|
|
1278
|
-
}
|
|
1279
|
-
function pr(e) {
|
|
1280
|
-
let t = mr(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1262
|
+
let t = pr(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1281
1263
|
for (let r of e.resources) {
|
|
1282
1264
|
if (r.kind !== "chunk" || !r.parent) continue;
|
|
1283
|
-
let { group: e, file: i } =
|
|
1265
|
+
let { group: e, file: i } = mr(r.name, t), a = _r(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
|
|
1284
1266
|
n.set(r.parent, o);
|
|
1285
1267
|
let s = o.get(e) ?? {
|
|
1286
|
-
sizes:
|
|
1268
|
+
sizes: Z(),
|
|
1287
1269
|
files: /* @__PURE__ */ new Map()
|
|
1288
1270
|
};
|
|
1289
|
-
o.set(e, s),
|
|
1290
|
-
let c = s.files.get(i) ??
|
|
1291
|
-
s.files.set(i, c),
|
|
1271
|
+
o.set(e, s), Q(s.sizes, a);
|
|
1272
|
+
let c = s.files.get(i) ?? Z();
|
|
1273
|
+
s.files.set(i, c), Q(c, a);
|
|
1292
1274
|
}
|
|
1293
1275
|
return n;
|
|
1294
1276
|
}
|
|
1295
|
-
function
|
|
1277
|
+
function pr(e) {
|
|
1296
1278
|
return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
|
|
1297
1279
|
}
|
|
1298
|
-
function
|
|
1280
|
+
function mr(e, t) {
|
|
1299
1281
|
let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
|
|
1300
1282
|
if (n) {
|
|
1301
1283
|
let [t, r] = n;
|
|
@@ -1305,71 +1287,71 @@ function hr(e, t) {
|
|
|
1305
1287
|
};
|
|
1306
1288
|
}
|
|
1307
1289
|
return e === "[unassigned]" ? {
|
|
1308
|
-
group:
|
|
1290
|
+
group: K,
|
|
1309
1291
|
file: ""
|
|
1310
1292
|
} : e.startsWith("\0") ? {
|
|
1311
1293
|
group: "(runtime)",
|
|
1312
1294
|
file: e.slice(1)
|
|
1313
1295
|
} : e.startsWith("rust/") ? {
|
|
1314
1296
|
group: "wasm",
|
|
1315
|
-
file:
|
|
1297
|
+
file: hr(e)
|
|
1316
1298
|
} : {
|
|
1317
1299
|
group: "src",
|
|
1318
|
-
file:
|
|
1300
|
+
file: gr(e)
|
|
1319
1301
|
};
|
|
1320
1302
|
}
|
|
1321
|
-
function
|
|
1322
|
-
let t = e.split("/", 2)[1] ?? "", n =
|
|
1303
|
+
function hr(e) {
|
|
1304
|
+
let t = e.split("/", 2)[1] ?? "", n = gr(e);
|
|
1323
1305
|
return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
|
|
1324
1306
|
}
|
|
1325
|
-
function
|
|
1307
|
+
function gr(e) {
|
|
1326
1308
|
return e.split("/").at(-1) ?? e;
|
|
1327
1309
|
}
|
|
1328
|
-
function
|
|
1310
|
+
function _r(e) {
|
|
1329
1311
|
return {
|
|
1330
1312
|
uncompressed: e.uncompressed,
|
|
1331
1313
|
gzip: e.gzip ?? 0
|
|
1332
1314
|
};
|
|
1333
1315
|
}
|
|
1334
|
-
function
|
|
1316
|
+
function vr(e) {
|
|
1335
1317
|
return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
|
|
1336
1318
|
}
|
|
1337
|
-
function
|
|
1338
|
-
let n = Math.round(e / 100 *
|
|
1339
|
-
return `\`${t.repeat(n)}${"░".repeat(
|
|
1319
|
+
function yr(e, t) {
|
|
1320
|
+
let n = Math.round(e / 100 * Bn);
|
|
1321
|
+
return `\`${t.repeat(n)}${"░".repeat(Bn - n)}\` ${e.toFixed(1)}%`;
|
|
1340
1322
|
}
|
|
1341
|
-
function
|
|
1323
|
+
function Z() {
|
|
1342
1324
|
return {
|
|
1343
1325
|
uncompressed: 0,
|
|
1344
1326
|
gzip: 0
|
|
1345
1327
|
};
|
|
1346
1328
|
}
|
|
1347
|
-
function
|
|
1329
|
+
function Q(e, t) {
|
|
1348
1330
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
1349
1331
|
}
|
|
1350
|
-
function
|
|
1332
|
+
function br(e, t) {
|
|
1351
1333
|
return `${(e / t * 100).toFixed(1)}%`;
|
|
1352
1334
|
}
|
|
1353
1335
|
function $(e) {
|
|
1354
|
-
return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
|
|
1336
|
+
return e < 1024 ? `${String(e)} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} kB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
1355
1337
|
}
|
|
1356
1338
|
// src/actions/documentProject.ts
|
|
1357
|
-
async function
|
|
1339
|
+
async function xr(e = "MIT") {
|
|
1358
1340
|
try {
|
|
1359
|
-
let
|
|
1360
|
-
await
|
|
1361
|
-
let
|
|
1362
|
-
|
|
1341
|
+
let n = await C("config.json"), i = g(n.id).typeId === "connector";
|
|
1342
|
+
await Wt(), i && await Ye(), await On(), await gt(e), await t("bundle-analysis-reports/sonda/index.json") === null ? w(`ℹ️ Bundle sizes NOT documented, as there is no '${Pn}' yet. Build the project first.`) : await Qn(), await cn(), await Xe();
|
|
1343
|
+
let a = await t(W) !== null;
|
|
1344
|
+
a ? await Nn() : w(`ℹ️ '${W}' NOT required by this project`), await r("ℹ️ Format generated files", "prettier", [
|
|
1363
1345
|
"--write",
|
|
1364
1346
|
"README.md",
|
|
1365
|
-
...
|
|
1347
|
+
...a ? [W] : []
|
|
1366
1348
|
]);
|
|
1367
1349
|
} catch (e) {
|
|
1368
1350
|
console.error("❌ Error documenting project", e), process.exit(1);
|
|
1369
1351
|
}
|
|
1370
1352
|
}
|
|
1371
1353
|
// src/actions/formatCode.ts
|
|
1372
|
-
async function
|
|
1354
|
+
async function Sr() {
|
|
1373
1355
|
try {
|
|
1374
1356
|
l("Format Code");
|
|
1375
1357
|
let e = [
|
|
@@ -1381,41 +1363,41 @@ async function wr() {
|
|
|
1381
1363
|
"app",
|
|
1382
1364
|
"src",
|
|
1383
1365
|
"tests"
|
|
1384
|
-
].filter((e) =>
|
|
1366
|
+
].filter((e) => ce(e)).map((e) => `${e}/**`)
|
|
1385
1367
|
];
|
|
1386
|
-
await r("1️⃣ Format", "prettier", e),
|
|
1368
|
+
await r("1️⃣ Format", "prettier", e), x("Code formatted");
|
|
1387
1369
|
} catch (e) {
|
|
1388
1370
|
console.error("❌ Error formatting code", e), process.exit(1);
|
|
1389
1371
|
}
|
|
1390
1372
|
}
|
|
1391
1373
|
// src/actions/lintCode.ts
|
|
1392
|
-
async function
|
|
1374
|
+
async function Cr() {
|
|
1393
1375
|
try {
|
|
1394
|
-
l("Lint Code"), await r("1️⃣ Lint", "eslint", ["."]),
|
|
1376
|
+
l("Lint Code"), await r("1️⃣ Lint", "eslint", ["."]), x("Code linted");
|
|
1395
1377
|
} catch (e) {
|
|
1396
1378
|
console.error("❌ Error linting code", e), process.exit(1);
|
|
1397
1379
|
}
|
|
1398
1380
|
}
|
|
1399
1381
|
// src/utilities/cloudflare.ts
|
|
1400
|
-
var
|
|
1382
|
+
var wr = {
|
|
1401
1383
|
".css": "text/css",
|
|
1402
1384
|
".js": "application/javascript",
|
|
1403
1385
|
".wasm": "application/wasm"
|
|
1404
|
-
},
|
|
1405
|
-
async function
|
|
1406
|
-
let e = await
|
|
1386
|
+
}, Tr = "dpuse-sample-data-eu";
|
|
1387
|
+
async function Er() {
|
|
1388
|
+
let e = await C("config.json"), t = {
|
|
1407
1389
|
body: JSON.stringify(e),
|
|
1408
1390
|
headers: { "Content-Type": "application/json" },
|
|
1409
1391
|
method: "PUT"
|
|
1410
1392
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
1411
1393
|
if (!n.ok) throw Error(await n.text());
|
|
1412
1394
|
}
|
|
1413
|
-
async function
|
|
1414
|
-
let n = await
|
|
1415
|
-
for (let [e, t] of r) await
|
|
1395
|
+
async function Dr(e, t) {
|
|
1396
|
+
let n = await Mr(`${e}/${t}`, t), r = Map.groupBy(n, ({ key: e }) => c(e));
|
|
1397
|
+
for (let [e, t] of r) await jr(t, ["--content-type", e]);
|
|
1416
1398
|
}
|
|
1417
|
-
async function
|
|
1418
|
-
await
|
|
1399
|
+
async function Or(e) {
|
|
1400
|
+
await Dr(e, "application"), await Dr(e, "fileStore"), await jr(["applicationIndex.json", "fileStoreIndex.json"].map((t) => ({
|
|
1419
1401
|
file: `${e}/${t}`,
|
|
1420
1402
|
key: t
|
|
1421
1403
|
})), [
|
|
@@ -1425,7 +1407,7 @@ async function Ar(e) {
|
|
|
1425
1407
|
"no-cache"
|
|
1426
1408
|
]);
|
|
1427
1409
|
}
|
|
1428
|
-
async function
|
|
1410
|
+
async function kr(e) {
|
|
1429
1411
|
let t = e.id, n = {
|
|
1430
1412
|
body: JSON.stringify(e),
|
|
1431
1413
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1433,14 +1415,14 @@ async function jr(e) {
|
|
|
1433
1415
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
1434
1416
|
if (!r.ok) throw Error(await r.text());
|
|
1435
1417
|
}
|
|
1436
|
-
async function
|
|
1418
|
+
async function Ar(e, t) {
|
|
1437
1419
|
let n = `v${e.version ?? "unknown"}`;
|
|
1438
1420
|
async function r(e, r = "") {
|
|
1439
|
-
let i = await
|
|
1421
|
+
let i = await ee(e, { withFileTypes: !0 });
|
|
1440
1422
|
for (let a of i) {
|
|
1441
1423
|
if (a.isDirectory() || a.name.endsWith(".map")) continue;
|
|
1442
|
-
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c =
|
|
1443
|
-
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await
|
|
1424
|
+
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = wr[E.extname(a.name)] ?? "application/octet-stream";
|
|
1425
|
+
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await b(void 0, "wrangler", [
|
|
1444
1426
|
"r2",
|
|
1445
1427
|
"object",
|
|
1446
1428
|
"put",
|
|
@@ -1455,15 +1437,15 @@ async function Mr(e, t) {
|
|
|
1455
1437
|
}
|
|
1456
1438
|
await r("dist");
|
|
1457
1439
|
}
|
|
1458
|
-
async function
|
|
1440
|
+
async function jr(e, t) {
|
|
1459
1441
|
if (e.length === 0) return;
|
|
1460
|
-
let n = await
|
|
1442
|
+
let n = await T.mkdtemp(E.join(_e.tmpdir(), "dpuse-r2-bulk-")), r = E.join(n, "files.json");
|
|
1461
1443
|
try {
|
|
1462
|
-
await
|
|
1444
|
+
await v(r, e), console.info(`⚙️ Uploading ${String(e.length)} files (${t.join(" ")})...`), await b(void 0, "wrangler", [
|
|
1463
1445
|
"r2",
|
|
1464
1446
|
"bulk",
|
|
1465
1447
|
"put",
|
|
1466
|
-
|
|
1448
|
+
Tr,
|
|
1467
1449
|
"--filename",
|
|
1468
1450
|
r,
|
|
1469
1451
|
...t,
|
|
@@ -1471,18 +1453,18 @@ async function Nr(e, t) {
|
|
|
1471
1453
|
"--remote"
|
|
1472
1454
|
]);
|
|
1473
1455
|
} finally {
|
|
1474
|
-
await
|
|
1456
|
+
await T.rm(n, {
|
|
1475
1457
|
force: !0,
|
|
1476
1458
|
recursive: !0
|
|
1477
1459
|
});
|
|
1478
1460
|
}
|
|
1479
1461
|
}
|
|
1480
|
-
async function
|
|
1481
|
-
let n = await
|
|
1462
|
+
async function Mr(e, t) {
|
|
1463
|
+
let n = await ee(e), r = [];
|
|
1482
1464
|
for (let i of n) {
|
|
1483
1465
|
if (i.startsWith(".")) continue;
|
|
1484
1466
|
let n = `${e}/${i}`, a = `${t}/${i}`;
|
|
1485
|
-
(await h(n)).isDirectory() ? r.push(...await
|
|
1467
|
+
(await h(n)).isDirectory() ? r.push(...await Mr(n, a)) : r.push({
|
|
1486
1468
|
file: n,
|
|
1487
1469
|
key: a
|
|
1488
1470
|
});
|
|
@@ -1490,56 +1472,56 @@ async function Pr(e, t) {
|
|
|
1490
1472
|
return r;
|
|
1491
1473
|
}
|
|
1492
1474
|
// src/actions/publishProject.ts
|
|
1493
|
-
async function
|
|
1475
|
+
async function Nr() {
|
|
1494
1476
|
try {
|
|
1495
1477
|
l("Publish Project");
|
|
1496
|
-
let e = await
|
|
1497
|
-
n.publishedTo === "npm" ? await r("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) :
|
|
1478
|
+
let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
|
|
1479
|
+
n.publishedTo === "npm" ? await r("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : w("1️⃣ Publishing to npm NOT required");
|
|
1498
1480
|
let i = [
|
|
1499
1481
|
"api",
|
|
1500
1482
|
"app",
|
|
1501
1483
|
"kb"
|
|
1502
1484
|
].includes(n.publishedTo);
|
|
1503
|
-
i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await
|
|
1485
|
+
i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await Pr(i ? "3️⃣ " : "2️⃣ ", e, t, n), n.publishedTo === "sampleData" && (w("3️⃣ Upload sample data"), await Or("public")), x(`Project version '${e.version ?? "unknown"}' published.`);
|
|
1504
1486
|
} catch (e) {
|
|
1505
1487
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1506
1488
|
}
|
|
1507
1489
|
}
|
|
1508
|
-
async function
|
|
1509
|
-
if (r.typeId === "app")
|
|
1510
|
-
else if (r.typeId === "engine")
|
|
1511
|
-
else if (r.uploadGroupName === void 0)
|
|
1490
|
+
async function Pr(e, t, n, r) {
|
|
1491
|
+
if (r.typeId === "app") w(`${e} Register module`), await Er();
|
|
1492
|
+
else if (r.typeId === "engine") w(`${e} Register module`), await Ar(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await kr(n);
|
|
1493
|
+
else if (r.uploadGroupName === void 0) w(`${e} Registration NOT required`);
|
|
1512
1494
|
else {
|
|
1513
|
-
|
|
1495
|
+
w(`${e} Register module`);
|
|
1514
1496
|
let i = n.id.split("-").slice(2).join("-");
|
|
1515
|
-
await
|
|
1497
|
+
await Ar(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await kr(n);
|
|
1516
1498
|
}
|
|
1517
1499
|
}
|
|
1518
1500
|
// src/actions/syncProjectWithGitHub.ts
|
|
1519
|
-
async function
|
|
1501
|
+
async function Fr() {
|
|
1520
1502
|
try {
|
|
1521
1503
|
l("Synchronise Project with GitHub");
|
|
1522
|
-
let e = await
|
|
1523
|
-
await p("1️⃣ ", e), await
|
|
1504
|
+
let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
|
|
1505
|
+
await p("1️⃣ ", e), await oe("2️⃣ ", e, n), await b("3️⃣ Stage changes", "git", ["add", "."]), await b("4️⃣ Commit changes", "git", [
|
|
1524
1506
|
"commit",
|
|
1525
1507
|
"-m",
|
|
1526
1508
|
`v${e.version ?? "unknown"}`
|
|
1527
|
-
]), await
|
|
1509
|
+
]), await b("5️⃣ Push changes", "git", [
|
|
1528
1510
|
"push",
|
|
1529
1511
|
"origin",
|
|
1530
1512
|
"main:main"
|
|
1531
|
-
]),
|
|
1513
|
+
]), x(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
|
|
1532
1514
|
} catch (e) {
|
|
1533
1515
|
console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
|
|
1534
1516
|
}
|
|
1535
1517
|
}
|
|
1536
1518
|
// src/actions/testProject.ts
|
|
1537
|
-
var
|
|
1519
|
+
var Ir = [
|
|
1538
1520
|
"1️⃣ ",
|
|
1539
1521
|
"2️⃣ ",
|
|
1540
1522
|
"3️⃣ ",
|
|
1541
1523
|
"4️⃣ "
|
|
1542
|
-
],
|
|
1524
|
+
], Lr = [{
|
|
1543
1525
|
id: "unit",
|
|
1544
1526
|
label: "Run unit tests",
|
|
1545
1527
|
command: "vitest",
|
|
@@ -1552,29 +1534,29 @@ var Rr = [
|
|
|
1552
1534
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1553
1535
|
configFileName: "playwright.config.ts"
|
|
1554
1536
|
}];
|
|
1555
|
-
async function
|
|
1537
|
+
async function Rr(e = ["unit"]) {
|
|
1556
1538
|
try {
|
|
1557
1539
|
l("Test Project");
|
|
1558
1540
|
let n = 0;
|
|
1559
|
-
for (let i of
|
|
1541
|
+
for (let i of Lr) {
|
|
1560
1542
|
if (!e.includes(i.id) || await t(i.configFileName) === null) continue;
|
|
1561
|
-
let a = `${
|
|
1543
|
+
let a = `${Ir[n] ?? ""} ${i.label}`;
|
|
1562
1544
|
await r(a, i.command, i.arguments), n += 1;
|
|
1563
1545
|
}
|
|
1564
1546
|
if (n === 0) {
|
|
1565
1547
|
console.warn("\n⚠️ No tests configured for this project.\n");
|
|
1566
1548
|
return;
|
|
1567
1549
|
}
|
|
1568
|
-
|
|
1550
|
+
x("Project tested");
|
|
1569
1551
|
} catch (e) {
|
|
1570
1552
|
console.error("❌ Error testing project", e), process.exit(1);
|
|
1571
1553
|
}
|
|
1572
1554
|
}
|
|
1573
1555
|
// src/actions/triggerGitHubRelease.ts
|
|
1574
|
-
async function
|
|
1556
|
+
async function zr() {
|
|
1575
1557
|
try {
|
|
1576
1558
|
l("Trigger GitHub Release");
|
|
1577
|
-
let e = `v${(await
|
|
1559
|
+
let e = `v${(await C("package.json")).version ?? "unknown"}`;
|
|
1578
1560
|
await r("1️⃣ Trigger GitHub release", "gh", [
|
|
1579
1561
|
"release",
|
|
1580
1562
|
"create",
|
|
@@ -1583,9 +1565,9 @@ async function Vr() {
|
|
|
1583
1565
|
"main",
|
|
1584
1566
|
"--generate-notes",
|
|
1585
1567
|
"--latest"
|
|
1586
|
-
]),
|
|
1568
|
+
]), x(`GitHub release '${e}' created.`);
|
|
1587
1569
|
} catch (e) {
|
|
1588
1570
|
console.error("❌ Error triggering GitHub release", e), process.exit(1);
|
|
1589
1571
|
}
|
|
1590
1572
|
}
|
|
1591
|
-
export { Se as auditDependencies, De as buildProject, Ue as checkProject,
|
|
1573
|
+
export { Se as auditDependencies, De as buildProject, Ue as checkProject, xr as documentProject, Sr as formatCode, Cr as lintCode, Nr as publishProject, c as resolveSampleDataContentType, Fr as syncProjectWithGitHub, Rr as testProject, zr as triggerGitHubRelease, Dr as uploadDirectoryToR2 };
|