@dpuse/dpuse-development 1.0.108 → 1.0.110
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, D as t, E as n, M as r, O as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as p, h as m, i as h, j as g, k as _, l as v, m as y, n as ee, o as te, p as b, r as
|
|
1
|
+
import { C as e, D as t, E as n, M as r, O as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as p, h as m, i as h, j as g, k as _, l as v, m as y, n as ee, o as te, p as b, r as x, s as ne, t as re, u as ie, v as S, w as C, x as w, y as T } from "./utilities-BLjGg0iM.js";
|
|
2
2
|
import { SHIPPED_PACKAGES_FILE_NAME as ae } from "./vite.es.js";
|
|
3
3
|
import { existsSync as oe, promises as E } from "node:fs";
|
|
4
4
|
import D from "node:path";
|
|
@@ -31,58 +31,75 @@ async function ge() {
|
|
|
31
31
|
try {
|
|
32
32
|
s("Audit Dependencies");
|
|
33
33
|
let e = await w("package.json");
|
|
34
|
-
|
|
34
|
+
x.has(e.name ?? "") ? T(`1️⃣ Shipped dependencies NOT checked: ${e.name ?? ""} is a development-only tool`) : await o("1️⃣ Check shipped dependencies for any vulnerability", "npm", ["audit", "--omit=dev"]);
|
|
35
35
|
let t = await n("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--json"]), r = JSON.parse(t);
|
|
36
36
|
if (r.error !== void 0) throw Error(r.error.summary);
|
|
37
|
-
let i =
|
|
37
|
+
let i = ve(be(r));
|
|
38
38
|
if (i.length > 0) throw Error(`${String(i.length)} high or critical vulnerabilities found`);
|
|
39
39
|
S("Dependencies audited");
|
|
40
40
|
} catch (e) {
|
|
41
41
|
console.error("❌ Error auditing dependencies", e), process.exit(1);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
function _e(e) {
|
|
44
|
+
async function _e(e) {
|
|
45
|
+
let t = JSON.parse(await n(e, "npm", ["audit", "--json"]));
|
|
46
|
+
if (t.error !== void 0) {
|
|
47
|
+
console.warn(`⚠️ Could not check the allow list: ${t.error.summary}`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let r = 0;
|
|
51
|
+
for (let e of be(t)) {
|
|
52
|
+
let t = he.has(e.severity) ? ye(e) : void 0;
|
|
53
|
+
t !== void 0 && (console.warn(`⚠️ ${t.id} ('${e.name}') is on the allow list, so the CI audit ignores it: ${t.reason}`), r++);
|
|
54
|
+
}
|
|
55
|
+
r === 0 && console.info("ℹ️ None of the reported advisories are on the allow list");
|
|
56
|
+
}
|
|
57
|
+
function ve(e) {
|
|
45
58
|
let t = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), n = [];
|
|
46
59
|
for (let r of e) {
|
|
47
60
|
if (!he.has(r.severity)) continue;
|
|
48
|
-
let e =
|
|
49
|
-
|
|
61
|
+
let e = ye(r);
|
|
62
|
+
e === void 0 ? (console.error(`❌ ${r.severity} '${r.name}': ${r.title} (${r.url})`), n.push(r)) : e.reviewBy < t ? console.warn(`⚠️ Ignored ${e.id}, but its review date ${e.reviewBy} has passed: ${e.reason}`) : console.info(`ℹ️ Ignored ${e.id}: ${e.reason}`);
|
|
50
63
|
}
|
|
51
64
|
return n;
|
|
52
65
|
}
|
|
53
|
-
function
|
|
66
|
+
function ye(e) {
|
|
67
|
+
let t = e.url.slice(e.url.lastIndexOf("/") + 1);
|
|
68
|
+
return me.find((e) => e.id === t);
|
|
69
|
+
}
|
|
70
|
+
function be(e) {
|
|
54
71
|
let t = /* @__PURE__ */ new Map(), n = Object.values(e.vulnerabilities ?? {});
|
|
55
72
|
for (let e of n) for (let n of e.via) typeof n != "string" && t.set(n.url, n);
|
|
56
73
|
return t.values().toArray();
|
|
57
74
|
}
|
|
58
75
|
//#endregion
|
|
59
76
|
//#region src/actions/buildProject.ts
|
|
60
|
-
var
|
|
61
|
-
async function
|
|
77
|
+
var xe = "build:wasm";
|
|
78
|
+
async function Se() {
|
|
62
79
|
try {
|
|
63
|
-
s("Build Project"), await
|
|
80
|
+
s("Build Project"), await Ce("1️⃣ ", await w("package.json")), S("Project built");
|
|
64
81
|
} catch (e) {
|
|
65
82
|
console.error("❌ Error building project", e), process.exit(1);
|
|
66
83
|
}
|
|
67
84
|
}
|
|
68
|
-
async function
|
|
69
|
-
t.scripts?.[
|
|
85
|
+
async function Ce(e, t) {
|
|
86
|
+
t.scripts?.[xe] != null && await o(`${e} Build WebAssembly`, "npm", ["run", xe]), await o(`${e} Bundle project`, "vite", ["build"]);
|
|
70
87
|
}
|
|
71
88
|
//#endregion
|
|
72
89
|
//#region src/actions/checkConfigFiles.ts
|
|
73
|
-
var O = "@dpuse/dpuse-development/prettierrc",
|
|
74
|
-
async function
|
|
90
|
+
var O = "@dpuse/dpuse-development/prettierrc", we = "dpuse-development";
|
|
91
|
+
async function Te() {
|
|
75
92
|
try {
|
|
76
93
|
s("Check configuration files"), T("1️⃣ Check individual files");
|
|
77
94
|
let t = await w("config.json"), n = await w("package.json"), r = n.private === !0, i = m(t.id), a = D.dirname(le(import.meta.url));
|
|
78
|
-
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
|
|
95
|
+
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 Ee(i, a), await k(a, "LICENSE"), await Oe(i, a), await ke(i, a), await Ae(i, a), await Ne(i, a), De(i, n);
|
|
79
96
|
let o = await e(v) !== null;
|
|
80
|
-
o && await k(a, "rust-toolchain.toml"), await k(a, ".github/dependabot.yml", [`.github/dependabot${r ? ".private" : ""}${o ? ".rust" : ""}.yml`]), r ? await
|
|
97
|
+
o && await k(a, "rust-toolchain.toml"), await k(a, ".github/dependabot.yml", [`.github/dependabot${r ? ".private" : ""}${o ? ".rust" : ""}.yml`]), r ? await je(a) : (await Me(a), await k(a, "SECURITY.md", [], (e) => e.replaceAll(we, () => t.id))), S("Configuration files checked");
|
|
81
98
|
} catch (e) {
|
|
82
99
|
console.error("❌ Error checking configuration files", e), process.exit(1);
|
|
83
100
|
}
|
|
84
101
|
}
|
|
85
|
-
async function
|
|
102
|
+
async function Ee(e, t) {
|
|
86
103
|
["github"].includes(e.typeId) ? console.info("ℹ️ File 'eslint.config.js' is NOT required by this project") : [
|
|
87
104
|
"app",
|
|
88
105
|
"api",
|
|
@@ -91,10 +108,10 @@ async function we(e, t) {
|
|
|
91
108
|
"kb"
|
|
92
109
|
].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await k(t, "eslint.config.js", ["eslint.config.default.js"]);
|
|
93
110
|
}
|
|
94
|
-
function
|
|
111
|
+
function De(e, t) {
|
|
95
112
|
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}'`);
|
|
96
113
|
}
|
|
97
|
-
async function
|
|
114
|
+
async function Oe(e, t) {
|
|
98
115
|
["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
|
|
99
116
|
"connector",
|
|
100
117
|
"cookbook",
|
|
@@ -105,10 +122,10 @@ async function Ee(e, t) {
|
|
|
105
122
|
"tool"
|
|
106
123
|
].includes(e.typeId) ? await k(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
|
|
107
124
|
}
|
|
108
|
-
async function
|
|
125
|
+
async function ke(e, t) {
|
|
109
126
|
["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await k(t, "scripts/tsconfig.json");
|
|
110
127
|
}
|
|
111
|
-
async function
|
|
128
|
+
async function Ae(e, t) {
|
|
112
129
|
if ([
|
|
113
130
|
"eslint",
|
|
114
131
|
"github",
|
|
@@ -134,14 +151,14 @@ async function Oe(e, t) {
|
|
|
134
151
|
await k(t, "vite.config.ts", n);
|
|
135
152
|
}
|
|
136
153
|
}
|
|
137
|
-
async function
|
|
154
|
+
async function je(t) {
|
|
138
155
|
for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await e(n) !== null && await k(t, n);
|
|
139
156
|
console.info("ℹ️ CodeQL and Scorecard workflows and file 'SECURITY.md' are NOT required by this project");
|
|
140
157
|
}
|
|
141
|
-
async function
|
|
158
|
+
async function Me(e) {
|
|
142
159
|
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");
|
|
143
160
|
}
|
|
144
|
-
async function
|
|
161
|
+
async function Ne(e, t) {
|
|
145
162
|
[
|
|
146
163
|
"app",
|
|
147
164
|
"api",
|
|
@@ -171,7 +188,7 @@ async function k(e, t, n = [], r = (e) => e) {
|
|
|
171
188
|
}
|
|
172
189
|
//#endregion
|
|
173
190
|
//#region src/actions/checkDependencies.ts
|
|
174
|
-
async function
|
|
191
|
+
async function Pe() {
|
|
175
192
|
try {
|
|
176
193
|
s("Check Dependencies"), await o("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), T("2️⃣ Check using 'npm-check-updates'");
|
|
177
194
|
let e = {};
|
|
@@ -197,8 +214,8 @@ async function Me() {
|
|
|
197
214
|
"fix",
|
|
198
215
|
"--no-strict-allow-scripts",
|
|
199
216
|
"--no-fund"
|
|
200
|
-
], !0);
|
|
201
|
-
let t = await
|
|
217
|
+
], !0), await _e("4️⃣ Name the advisories above that the CI audit ignores");
|
|
218
|
+
let t = await Fe();
|
|
202
219
|
t.length > 0 ? await o("5️⃣ Move install-script pins to installed versions", "npm", [
|
|
203
220
|
"install-scripts",
|
|
204
221
|
"approve",
|
|
@@ -217,56 +234,56 @@ async function Me() {
|
|
|
217
234
|
console.error("❌ Error checking dependencies", e), process.exit(1);
|
|
218
235
|
}
|
|
219
236
|
}
|
|
220
|
-
async function
|
|
237
|
+
async function Fe() {
|
|
221
238
|
let { allowScripts: e = {} } = await w(D.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
|
|
222
239
|
return [...new Set(t)];
|
|
223
240
|
}
|
|
224
241
|
//#endregion
|
|
225
242
|
//#region src/actions/checkProject.ts
|
|
226
|
-
async function
|
|
227
|
-
await
|
|
243
|
+
async function Ie() {
|
|
244
|
+
await Te(), await Pe();
|
|
228
245
|
}
|
|
229
246
|
//#endregion
|
|
230
247
|
//#region src/actions/documentActions.ts
|
|
231
|
-
var
|
|
248
|
+
var Le = "<!-- SUPPORTED_ACTIONS_START -->", Re = "<!-- SUPPORTED_ACTIONS_END -->", ze = "Connectors conform to a unified interface contract by implementing a specific subset of standard actions. These standardised actions allow the DPUse application to interact with any underlying data source in the same way, enabling Connectors to be built independently and loaded dynamically at runtime.", Be = {
|
|
232
249
|
source: "This connector is a Source connector that supports only read actions. Connectors can also function as a Destination (write-only) or Bidirectional (read/write), depending on the actions they support.",
|
|
233
250
|
destination: "This connector is a Destination connector that supports only write actions. Connectors can also function as a Source (read-only) or Bidirectional (read/write), depending on the actions they support.",
|
|
234
251
|
bidirectional: "This connector is a Bidirectional connector that supports both read and write actions. Connectors can also function as a Source (read-only) or Destination (write-only), depending on the actions they support.",
|
|
235
252
|
unknown: "This connector does not yet implement any read or write actions, so its type cannot be determined. Connectors function as a Source (read-only), a Destination (write-only), or Bidirectional (read/write), depending on the actions they support."
|
|
236
|
-
},
|
|
237
|
-
async function
|
|
253
|
+
}, Ve = "The table below lists all connector actions and highlights those supported by this connector.";
|
|
254
|
+
async function He() {
|
|
238
255
|
try {
|
|
239
256
|
s("Document Actions"), T("1️⃣ Insert actions description and table into 'README.md'");
|
|
240
|
-
let e = (await w("config.json")).actionNames ?? [], t = g(e), n = r(e), i = `## Supported Actions\n\n${
|
|
241
|
-
await _(i,
|
|
257
|
+
let e = (await w("config.json")).actionNames ?? [], t = g(e), n = r(e), i = `## Supported Actions\n\n${ze}\n\n${Be[t]} ${Ve}\n\n${n}`;
|
|
258
|
+
await _(i, Le, Re), S("Actions documented");
|
|
242
259
|
} catch (e) {
|
|
243
260
|
console.error("❌ Error documenting actions", e), process.exit(1);
|
|
244
261
|
}
|
|
245
262
|
}
|
|
246
263
|
//#endregion
|
|
247
264
|
//#region src/actions/documentContributingLicense.ts
|
|
248
|
-
async function
|
|
265
|
+
async function Ue() {
|
|
249
266
|
try {
|
|
250
267
|
s("Document Contributing & License");
|
|
251
|
-
let [e, t] = await Promise.all([w("package.json"), w("config.json")]), { owner: n, repository: r } = C(e, "document contributing and license"), i =
|
|
252
|
-
T("1️⃣ Insert contributing and license content into 'README.md'"), await l(), await _(
|
|
268
|
+
let [e, t] = await Promise.all([w("package.json"), w("config.json")]), { owner: n, repository: r } = C(e, "document contributing and license"), i = We(e), a = Ge(t.firstCreatedAt);
|
|
269
|
+
T("1️⃣ Insert contributing and license content into 'README.md'"), await l(), await _(Ke(n, r, i, a), ee, re), S("Contributing & license documented");
|
|
253
270
|
} catch (e) {
|
|
254
271
|
console.error("❌ Error documenting contributing and license", e), process.exit(1);
|
|
255
272
|
}
|
|
256
273
|
}
|
|
257
|
-
function
|
|
274
|
+
function We(e) {
|
|
258
275
|
let t = e.author, n = typeof t == "string" ? t : t?.name;
|
|
259
276
|
if (n == null || n === "") throw Error("package.json 'author' field is required to document contributing and license.");
|
|
260
277
|
let r = n.indexOf("<"), i = r === -1 ? -1 : n.indexOf(">", r);
|
|
261
278
|
return i === -1 ? n.trim() : [n.slice(0, r).trim(), n.slice(i + 1).trim()].filter((e) => e !== "").join(" ");
|
|
262
279
|
}
|
|
263
|
-
function
|
|
280
|
+
function Ge(e) {
|
|
264
281
|
let t = (/* @__PURE__ */ new Date()).getFullYear();
|
|
265
282
|
if (e == null) return String(t);
|
|
266
283
|
let n = new Date(e).getFullYear();
|
|
267
284
|
return n === t ? String(t) : `${String(n)}-present`;
|
|
268
285
|
}
|
|
269
|
-
function
|
|
286
|
+
function Ke(e, t, n, r) {
|
|
270
287
|
return `## Contributing
|
|
271
288
|
|
|
272
289
|
This repository is maintained solely by its owner and does not, at present, accept external contributions into the canonical repo. Its source is published openly under the MIT License — every DPUse project is fully open source except DPUse Engine, which remains closed and proprietary.
|
|
@@ -281,8 +298,8 @@ This project is licensed under the MIT License, permitting free use, modificatio
|
|
|
281
298
|
}
|
|
282
299
|
//#endregion
|
|
283
300
|
//#region src/utilities/rustCrates.ts
|
|
284
|
-
var A = "licenses/cargoMetadata.json", j = "licenses/cargoTree.txt",
|
|
285
|
-
async function
|
|
301
|
+
var A = "licenses/cargoMetadata.json", j = "licenses/cargoTree.txt", qe = 1e3, Je = 1e4, Ye = "dpuse-development (https://github.com/dpuse/dpuse-development)", Xe = /^(?:copying|licen[cs]e|unlicense)/i, Ze = "wasm32-unknown-unknown";
|
|
302
|
+
async function Qe(n, r) {
|
|
286
303
|
if (await e("rust/Cargo.toml") === null) return null;
|
|
287
304
|
let i = [
|
|
288
305
|
"--manifest-path",
|
|
@@ -295,7 +312,7 @@ async function Xe(n, r) {
|
|
|
295
312
|
"--edges",
|
|
296
313
|
"normal,no-proc-macro",
|
|
297
314
|
"--target",
|
|
298
|
-
|
|
315
|
+
Ze,
|
|
299
316
|
"--prefix",
|
|
300
317
|
"depth",
|
|
301
318
|
"--format",
|
|
@@ -307,9 +324,9 @@ async function Xe(n, r) {
|
|
|
307
324
|
"--format-version",
|
|
308
325
|
"1",
|
|
309
326
|
"--filter-platform",
|
|
310
|
-
|
|
327
|
+
Ze
|
|
311
328
|
], A);
|
|
312
|
-
let s =
|
|
329
|
+
let s = $e(await a(j)), c = await w(A);
|
|
313
330
|
await E.rm(j, { force: !0 }), await E.rm(A, { force: !0 });
|
|
314
331
|
let l = /* @__PURE__ */ new Map();
|
|
315
332
|
for (let e of s) e.isOwn || l.has(`${e.name}@${e.version}`) || l.set(`${e.name}@${e.version}`, {
|
|
@@ -323,9 +340,9 @@ async function Xe(n, r) {
|
|
|
323
340
|
latestPublishedDate: ""
|
|
324
341
|
});
|
|
325
342
|
let u = l.values().toArray();
|
|
326
|
-
|
|
327
|
-
for (let e of u) e.licenseFiles = await
|
|
328
|
-
return await
|
|
343
|
+
et(u, r);
|
|
344
|
+
for (let e of u) e.licenseFiles = await rt(e, c);
|
|
345
|
+
return await it(n, u), {
|
|
329
346
|
crates: u,
|
|
330
347
|
treeItems: s.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
|
|
331
348
|
name: e,
|
|
@@ -335,7 +352,7 @@ async function Xe(n, r) {
|
|
|
335
352
|
}))
|
|
336
353
|
};
|
|
337
354
|
}
|
|
338
|
-
function
|
|
355
|
+
function $e(e) {
|
|
339
356
|
let t = [];
|
|
340
357
|
for (let n of e.split("\n")) {
|
|
341
358
|
let [e = "", r = "", i = ""] = n.trim().split("|", 3), a = /^\d+/.exec(e)?.[0];
|
|
@@ -352,30 +369,30 @@ function Ze(e) {
|
|
|
352
369
|
}
|
|
353
370
|
return t;
|
|
354
371
|
}
|
|
355
|
-
function
|
|
356
|
-
let n = t.split(";").filter((e) =>
|
|
372
|
+
function et(e, t) {
|
|
373
|
+
let n = t.split(";").filter((e) => tt(e)), r = e.filter((e) => !nt(e.licenseExpression, n));
|
|
357
374
|
if (r.length === 0) return;
|
|
358
375
|
let i = r.map((e) => `${e.name}@${e.version} (${e.licenseExpression === "" ? "no licence" : e.licenseExpression})`).join(", ");
|
|
359
376
|
throw Error(`Rust crates with licences not allowed: ${i}.`);
|
|
360
377
|
}
|
|
361
|
-
function
|
|
378
|
+
function tt(e) {
|
|
362
379
|
try {
|
|
363
380
|
return pe(e, [e]);
|
|
364
381
|
} catch {
|
|
365
382
|
return !1;
|
|
366
383
|
}
|
|
367
384
|
}
|
|
368
|
-
function
|
|
385
|
+
function nt(e, t) {
|
|
369
386
|
try {
|
|
370
387
|
return pe(e.replaceAll("/", " OR "), t);
|
|
371
388
|
} catch {
|
|
372
389
|
return !1;
|
|
373
390
|
}
|
|
374
391
|
}
|
|
375
|
-
async function
|
|
392
|
+
async function rt(e, t) {
|
|
376
393
|
let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
|
|
377
394
|
if (n == null) return [];
|
|
378
|
-
let r = D.dirname(n.manifest_path), i = (await E.readdir(r)).filter((e) =>
|
|
395
|
+
let r = D.dirname(n.manifest_path), i = (await E.readdir(r)).filter((e) => Xe.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
|
|
379
396
|
await E.mkdir("licenses/downloads", { recursive: !0 });
|
|
380
397
|
let a = [];
|
|
381
398
|
for (let t of i) {
|
|
@@ -387,14 +404,14 @@ async function tt(e, t) {
|
|
|
387
404
|
}
|
|
388
405
|
return a;
|
|
389
406
|
}
|
|
390
|
-
async function
|
|
407
|
+
async function it(e, t) {
|
|
391
408
|
T(`${e} - fetch release dates from crates.io`);
|
|
392
409
|
for (let [e, n] of t.entries()) {
|
|
393
|
-
e > 0 && await fe(
|
|
410
|
+
e > 0 && await fe(qe), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
|
|
394
411
|
try {
|
|
395
412
|
let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, {
|
|
396
|
-
headers: { "User-Agent":
|
|
397
|
-
signal: AbortSignal.timeout(
|
|
413
|
+
headers: { "User-Agent": Ye },
|
|
414
|
+
signal: AbortSignal.timeout(Je)
|
|
398
415
|
});
|
|
399
416
|
if (!e.ok) continue;
|
|
400
417
|
let t = await e.json(), r = new Map((t.versions ?? []).map((e) => [e.num, e.created_at]));
|
|
@@ -404,77 +421,77 @@ async function nt(e, t) {
|
|
|
404
421
|
}
|
|
405
422
|
//#endregion
|
|
406
423
|
//#region src/actions/documentDependencies.ts
|
|
407
|
-
var M = "<!-- DEPENDENCY_LICENSES_START -->", N = "<!-- DEPENDENCY_LICENSES_END -->", P = "## Dependency Licenses",
|
|
408
|
-
async function
|
|
424
|
+
var M = "<!-- DEPENDENCY_LICENSES_START -->", N = "<!-- DEPENDENCY_LICENSES_END -->", P = "## Dependency Licenses", at = `bundle-analysis-reports/${ae}`, F = "licenses/licenseTree.json", ot = "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.", st = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${ot}`, ct = `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. ${ot}`;
|
|
425
|
+
async function lt(e = "MIT") {
|
|
409
426
|
try {
|
|
410
427
|
s("Document Dependencies");
|
|
411
428
|
let n = await w("package.json"), r = n.name ?? "";
|
|
412
|
-
if (
|
|
413
|
-
await
|
|
429
|
+
if (x.has(r)) {
|
|
430
|
+
await ut(r), S("Dependencies documented");
|
|
414
431
|
return;
|
|
415
432
|
}
|
|
416
433
|
await f("1️⃣ Clear downloaded licenses", "licenses/downloads");
|
|
417
|
-
let i = await
|
|
434
|
+
let i = await yt(), a = await bt();
|
|
418
435
|
if (a === null) {
|
|
419
|
-
let r =
|
|
420
|
-
await
|
|
436
|
+
let r = wt(i);
|
|
437
|
+
await vt("2️⃣ Identify production licenses", e, [n.name ?? "", ...r], !0), await t("3️⃣ Identify transitive dependencies", "npm", [
|
|
421
438
|
"ls",
|
|
422
439
|
"--all",
|
|
423
440
|
"--json",
|
|
424
441
|
"--omit=dev"
|
|
425
|
-
], F), await
|
|
442
|
+
], F), await dt("4️⃣ ", e, new Set(r));
|
|
426
443
|
} else {
|
|
427
|
-
let r =
|
|
428
|
-
await
|
|
444
|
+
let r = xt(a, i), o = St(i), s = o.filter((e) => !r.has(e));
|
|
445
|
+
await vt("2️⃣ Identify shipped licenses", e, [n.name ?? "", ...s], !1), Ct(r, new Set(o)), await t("3️⃣ Identify transitive dependencies", "npm", [
|
|
429
446
|
"ls",
|
|
430
447
|
"--all",
|
|
431
448
|
"--json"
|
|
432
449
|
], F, !0);
|
|
433
|
-
let c = await
|
|
450
|
+
let c = await Qe("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
|
|
434
451
|
allowedLicenses: e,
|
|
435
|
-
productionNames:
|
|
452
|
+
productionNames: gt(n),
|
|
436
453
|
rustCrates: c,
|
|
437
454
|
shippedKeys: r
|
|
438
455
|
};
|
|
439
|
-
await
|
|
456
|
+
await ft(c === null ? "4️⃣ " : "5️⃣ ", l);
|
|
440
457
|
}
|
|
441
458
|
S("Dependencies documented");
|
|
442
459
|
} catch (e) {
|
|
443
460
|
console.error("❌ Error documenting dependencies", e), process.exit(1);
|
|
444
461
|
}
|
|
445
462
|
}
|
|
446
|
-
async function
|
|
463
|
+
async function ut(e) {
|
|
447
464
|
T(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`);
|
|
448
465
|
let t = `> [!WARNING]\n> Dependency licenses are not documented here: ${e} is a development-only tool and is never part of a production release.`;
|
|
449
466
|
await _(`${P}\n\n${t}`, M, N);
|
|
450
467
|
}
|
|
451
|
-
async function
|
|
468
|
+
async function dt(e, t, n) {
|
|
452
469
|
T(`${e} Insert licenses into 'README.md'`);
|
|
453
|
-
let r = await w(F), i = await
|
|
454
|
-
for (let e of i.values()) a +=
|
|
470
|
+
let r = await w(F), i = await _t(), a = `${Ot(t, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
471
|
+
for (let e of i.values()) a += L(e);
|
|
455
472
|
let o = [];
|
|
456
|
-
r.dependencies != null &&
|
|
457
|
-
let s = `${
|
|
473
|
+
r.dependencies != null && Mt(r.dependencies, i, n, o, 0);
|
|
474
|
+
let s = `${st}\n\n${o.join("\n")}`;
|
|
458
475
|
await _(`${P}\n\n${a.trimEnd()}\n\n### Dependency Tree\n\n${s}`, M, N);
|
|
459
476
|
}
|
|
460
|
-
async function
|
|
477
|
+
async function ft(e, t) {
|
|
461
478
|
T(`${e} Insert licenses into 'README.md'`);
|
|
462
|
-
let { allowedLicenses: n, productionNames: r, rustCrates: i, shippedKeys: a } = t, o = await
|
|
463
|
-
for (let e of o.values().toArray().toSorted(
|
|
464
|
-
for (let e of s.values().toArray().toSorted(
|
|
479
|
+
let { allowedLicenses: n, productionNames: r, rustCrates: i, shippedKeys: a } = t, o = await _t(), s = new Map((i?.crates ?? []).map((e) => [`${e.name}@${e.version}`, mt(e)])), c = i !== null, l = c ? "|Type|Dependency|Version|License(s)|Document|\n|:-|:-|:-:|:-|:-|" : "|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|", u = `${Ot(n, !0, c)}\n\n${l}\n`;
|
|
480
|
+
for (let e of o.values().toArray().toSorted(pt)) u += L(e, c ? "JavaScript" : void 0);
|
|
481
|
+
for (let e of s.values().toArray().toSorted(pt)) u += L(e, "Rust");
|
|
465
482
|
let d = await w(F), f = Object.entries(d.dependencies ?? {}).toSorted(([e], [t]) => Number(!r.has(e)) - Number(!r.has(t))), p = [];
|
|
466
|
-
|
|
483
|
+
R(f, {
|
|
467
484
|
licensesByKey: o,
|
|
468
485
|
shippedKeys: a,
|
|
469
486
|
shownKeys: /* @__PURE__ */ new Set()
|
|
470
487
|
}, p, 0, !1);
|
|
471
|
-
let m = p.length === 0 ? "None." : p.join("\n"), h = (i?.treeItems ?? []).map((e) =>
|
|
488
|
+
let m = p.length === 0 ? "None." : p.join("\n"), h = (i?.treeItems ?? []).map((e) => ht(e, s)).join("\n"), g = c ? `${ct}\n\n#### JavaScript\n\n${m}\n\n#### Rust\n\n${h}` : `${ct}\n\n${m}`;
|
|
472
489
|
await _(`${P}\n\n${u.trimEnd()}\n\n### Dependency Tree\n\n${g}`, M, N);
|
|
473
490
|
}
|
|
474
|
-
function
|
|
491
|
+
function pt(e, t) {
|
|
475
492
|
return e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en");
|
|
476
493
|
}
|
|
477
|
-
function
|
|
494
|
+
function mt(e) {
|
|
478
495
|
return {
|
|
479
496
|
name: e.name,
|
|
480
497
|
repository: e.repository,
|
|
@@ -487,26 +504,26 @@ function ft(e) {
|
|
|
487
504
|
licenseFiles: e.licenseFiles
|
|
488
505
|
};
|
|
489
506
|
}
|
|
490
|
-
function
|
|
507
|
+
function ht(e, t) {
|
|
491
508
|
let n = " ".repeat(e.depth);
|
|
492
|
-
return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` :
|
|
509
|
+
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);
|
|
493
510
|
}
|
|
494
|
-
function
|
|
511
|
+
function gt(e) {
|
|
495
512
|
return /* @__PURE__ */ new Set([
|
|
496
513
|
...Object.keys(e.dependencies ?? {}),
|
|
497
514
|
...Object.keys(e.optionalDependencies ?? {}),
|
|
498
515
|
...Object.keys(e.peerDependencies ?? {})
|
|
499
516
|
]);
|
|
500
517
|
}
|
|
501
|
-
async function
|
|
518
|
+
async function _t() {
|
|
502
519
|
let e = await w("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
|
|
503
|
-
for (let [n, r] of Object.entries(e)) t.set(n,
|
|
520
|
+
for (let [n, r] of Object.entries(e)) t.set(n, At(n, r));
|
|
504
521
|
return await Promise.all(t.values().map(async (e) => {
|
|
505
|
-
let t = await
|
|
522
|
+
let t = await jt(e.name, e.installedVersion);
|
|
506
523
|
e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
|
|
507
524
|
})), t;
|
|
508
525
|
}
|
|
509
|
-
async function
|
|
526
|
+
async function vt(e, t, n, r) {
|
|
510
527
|
T(e), await new Promise((e, i) => {
|
|
511
528
|
let a = {
|
|
512
529
|
start: process.cwd(),
|
|
@@ -524,39 +541,39 @@ async function gt(e, t, n, r) {
|
|
|
524
541
|
});
|
|
525
542
|
});
|
|
526
543
|
}
|
|
527
|
-
async function
|
|
544
|
+
async function yt() {
|
|
528
545
|
let t = await e("package-lock.json");
|
|
529
546
|
return t === null ? {} : JSON.parse(t).packages ?? {};
|
|
530
547
|
}
|
|
531
|
-
async function
|
|
532
|
-
let t = await e(
|
|
548
|
+
async function bt() {
|
|
549
|
+
let t = await e(at);
|
|
533
550
|
return t === null ? null : JSON.parse(t);
|
|
534
551
|
}
|
|
535
|
-
function
|
|
552
|
+
function xt(e, t) {
|
|
536
553
|
let n = new Set(e.packages);
|
|
537
554
|
for (let r of e.external) {
|
|
538
|
-
let e =
|
|
539
|
-
if (e !== void 0) for (let r of [e, ...
|
|
555
|
+
let e = Dt(t, "", r);
|
|
556
|
+
if (e !== void 0) for (let r of [e, ...Tt(t, e)]) {
|
|
540
557
|
let e = t[r];
|
|
541
558
|
e?.version !== void 0 && n.add(I(r, e));
|
|
542
559
|
}
|
|
543
560
|
}
|
|
544
561
|
return n;
|
|
545
562
|
}
|
|
546
|
-
function
|
|
563
|
+
function St(e) {
|
|
547
564
|
let t = /* @__PURE__ */ new Set();
|
|
548
565
|
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(I(n, r));
|
|
549
566
|
return [...t];
|
|
550
567
|
}
|
|
551
|
-
function
|
|
568
|
+
function Ct(e, t) {
|
|
552
569
|
let n = [...e.difference(t)];
|
|
553
570
|
n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
|
|
554
571
|
}
|
|
555
572
|
function I(e, t) {
|
|
556
573
|
return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
|
|
557
574
|
}
|
|
558
|
-
function
|
|
559
|
-
let t =
|
|
575
|
+
function wt(e) {
|
|
576
|
+
let t = Tt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
560
577
|
for (let [i, a] of Object.entries(e)) {
|
|
561
578
|
if (i === "" || a.version === void 0) continue;
|
|
562
579
|
let e = I(i, a);
|
|
@@ -564,18 +581,18 @@ function St(e) {
|
|
|
564
581
|
}
|
|
565
582
|
return r.values().filter((e) => !n.has(e)).toArray();
|
|
566
583
|
}
|
|
567
|
-
function
|
|
584
|
+
function Tt(e, t) {
|
|
568
585
|
let n = /* @__PURE__ */ new Set(), r = [t];
|
|
569
586
|
for (; r.length > 0;) {
|
|
570
587
|
let t = r.pop() ?? "", i = e[t];
|
|
571
|
-
if (i !== void 0) for (let a of
|
|
572
|
-
let i =
|
|
588
|
+
if (i !== void 0) for (let a of Et(i)) {
|
|
589
|
+
let i = Dt(e, t, a);
|
|
573
590
|
i === void 0 || n.has(i) || (n.add(i), r.push(i));
|
|
574
591
|
}
|
|
575
592
|
}
|
|
576
593
|
return n;
|
|
577
594
|
}
|
|
578
|
-
function
|
|
595
|
+
function Et(e) {
|
|
579
596
|
let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
|
|
580
597
|
return [
|
|
581
598
|
...Object.keys(e.dependencies ?? {}),
|
|
@@ -583,7 +600,7 @@ function Ct(e) {
|
|
|
583
600
|
...t
|
|
584
601
|
];
|
|
585
602
|
}
|
|
586
|
-
function
|
|
603
|
+
function Dt(e, t, n) {
|
|
587
604
|
let r = t;
|
|
588
605
|
for (;;) {
|
|
589
606
|
let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
|
|
@@ -593,14 +610,14 @@ function R(e, t, n) {
|
|
|
593
610
|
r = a === -1 ? "" : r.slice(0, a);
|
|
594
611
|
}
|
|
595
612
|
}
|
|
596
|
-
function
|
|
597
|
-
let r =
|
|
613
|
+
function Ot(e, t, n = !1) {
|
|
614
|
+
let r = kt(e.split(";")), i = n ? "[license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn) and [cargo tree](https://doc.rust-lang.org/cargo/commands/cargo-tree.html)" : "[license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn)", a = "The following table lists every package whose code, styles or assets are included in this project's build, as recorded by the build itself. Modules loaded at run time are not included; each documents its own.";
|
|
598
615
|
return `License data is updated each time \`npm run document\` is run, using ${i}. ${t ? n ? `${a} It also lists every Rust crate compiled into its WebAssembly, as resolved by Cargo; macros and other crates used only while compiling put none of their code in it, so are left out.` : a : "The following table lists all production dependencies. This project has no build record, so the list is taken from its declared dependencies."} These dependencies have been checked and confirmed to use ${r}, all of which allow commercial use. All are used unmodified, so any licence conditions that apply only to modified versions are not triggered. Developers cloning this repository should independently verify development dependencies.`;
|
|
599
616
|
}
|
|
600
|
-
function
|
|
617
|
+
function kt(e) {
|
|
601
618
|
return e.length === 1 ? e[0] ?? "" : e.length === 2 ? `${String(e[0])} or ${String(e[1])}` : `${e.slice(0, -1).join(", ")}, or ${String(e.at(-1))}`;
|
|
602
619
|
}
|
|
603
|
-
function
|
|
620
|
+
function At(e, t) {
|
|
604
621
|
let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
|
|
605
622
|
return {
|
|
606
623
|
name: r,
|
|
@@ -617,7 +634,7 @@ function Tt(e, t) {
|
|
|
617
634
|
}]
|
|
618
635
|
};
|
|
619
636
|
}
|
|
620
|
-
async function
|
|
637
|
+
async function jt(e, t) {
|
|
621
638
|
try {
|
|
622
639
|
let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
|
|
623
640
|
if (n.ok) {
|
|
@@ -635,40 +652,40 @@ async function Et(e, t) {
|
|
|
635
652
|
publishedDate: ""
|
|
636
653
|
};
|
|
637
654
|
}
|
|
638
|
-
function
|
|
655
|
+
function L(e, t) {
|
|
639
656
|
let n = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
|
|
640
657
|
return `${t === void 0 ? "" : `|${t}`}|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${n}|\n`;
|
|
641
658
|
}
|
|
642
|
-
function
|
|
659
|
+
function Mt(e, t, n, r, i) {
|
|
643
660
|
let a = " ".repeat(i);
|
|
644
661
|
for (let [o, s] of Object.entries(e)) {
|
|
645
662
|
if (s.version === void 0) continue;
|
|
646
663
|
let e = s.version;
|
|
647
|
-
n.has(`${o}@${e}`) || (r.push(
|
|
664
|
+
n.has(`${o}@${e}`) || (r.push(z(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && Mt(s.dependencies, t, n, r, i + 1));
|
|
648
665
|
}
|
|
649
666
|
}
|
|
650
|
-
function
|
|
667
|
+
function R(e, t, n, r, i) {
|
|
651
668
|
for (let [a, o] of e) {
|
|
652
669
|
if (o.version === void 0) continue;
|
|
653
670
|
let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
|
|
654
671
|
if (!t.shippedKeys.has(e)) {
|
|
655
|
-
|
|
672
|
+
R(s, t, n, r, !0);
|
|
656
673
|
continue;
|
|
657
674
|
}
|
|
658
|
-
i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(
|
|
675
|
+
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));
|
|
659
676
|
}
|
|
660
677
|
}
|
|
661
|
-
function
|
|
662
|
-
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${
|
|
678
|
+
function z(e, t, n, r) {
|
|
679
|
+
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${Nt(n)}`;
|
|
663
680
|
}
|
|
664
|
-
function
|
|
681
|
+
function Nt(e) {
|
|
665
682
|
if (e == null) return "";
|
|
666
|
-
let t = e.publishedDate ?
|
|
683
|
+
let t = e.publishedDate ? Pt(e.publishedDate.split("T", 1)[0]) : "";
|
|
667
684
|
if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
|
|
668
|
-
let n = e.latestPublishedDate ?
|
|
685
|
+
let n = e.latestPublishedDate ? Pt(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `latest: ${e.latestVersion} ❗` : `latest: ${e.latestVersion} — ${n} ❗`;
|
|
669
686
|
return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
|
|
670
687
|
}
|
|
671
|
-
function
|
|
688
|
+
function Pt(e) {
|
|
672
689
|
if (e == null || e === "") return "n/a";
|
|
673
690
|
let t = e.split("T", 1)[0];
|
|
674
691
|
if (t == null || t === "") return "n/a";
|
|
@@ -677,31 +694,31 @@ function U(e) {
|
|
|
677
694
|
}
|
|
678
695
|
//#endregion
|
|
679
696
|
//#region src/actions/documentOpening.ts
|
|
680
|
-
var
|
|
681
|
-
async function
|
|
697
|
+
var Ft = "<!-- OPENING_START -->", It = "<!-- OPENING_END -->";
|
|
698
|
+
async function Lt() {
|
|
682
699
|
try {
|
|
683
700
|
s("Document Opening"), T("1️⃣ Insert opening content into 'README.md'");
|
|
684
|
-
let e = await w("package.json"), t = await w("config.json"), { owner: n, repository: r } = C(e, "document opening"), i =
|
|
685
|
-
await _(c,
|
|
701
|
+
let e = await w("package.json"), t = await w("config.json"), { owner: n, repository: r } = C(e, "document opening"), i = Rt(e), a = Bt(t), o = m(t.id), c = Vt(n, r, i, o.uploadGroupName === void 0 ? void 0 : t.id, o.publishedTo === "npm" ? zt(e) : void 0, e.description, a);
|
|
702
|
+
await _(c, Ft, It), S("Opening documented");
|
|
686
703
|
} catch (e) {
|
|
687
704
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
688
705
|
}
|
|
689
706
|
}
|
|
690
|
-
function
|
|
707
|
+
function Rt(e) {
|
|
691
708
|
let t = e.license;
|
|
692
709
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
693
710
|
return t;
|
|
694
711
|
}
|
|
695
|
-
function
|
|
712
|
+
function zt(e) {
|
|
696
713
|
let t = e.name;
|
|
697
714
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
|
|
698
715
|
return t;
|
|
699
716
|
}
|
|
700
|
-
function
|
|
717
|
+
function Bt(e) {
|
|
701
718
|
let t = e.description.en?.trim();
|
|
702
719
|
return t === void 0 || t === "" ? void 0 : t;
|
|
703
720
|
}
|
|
704
|
-
function
|
|
721
|
+
function Vt(e, t, n, r, i, a, o) {
|
|
705
722
|
let s = `https://github.com/${e}/${t}`, c = n.replaceAll("-", "--"), l = encodeURIComponent(`https://api.dpuse.app/configs/${r ?? ""}`);
|
|
706
723
|
return `[](./LICENSE)${r === void 0 ? "" : `\n[](${s}/releases/latest)`}${i === void 0 ? "" : `\n[](https://www.npmjs.com/package/${i})`}
|
|
707
724
|
[](${s}/actions/workflows/ci.yml)${a == null || a === "" ? "" : `\n\n${a}`}
|
|
@@ -722,41 +739,41 @@ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the applicati
|
|
|
722
739
|
}
|
|
723
740
|
//#endregion
|
|
724
741
|
//#region src/actions/documentQualitySecurity.ts
|
|
725
|
-
var
|
|
742
|
+
var Ht = {
|
|
726
743
|
"Branch-Protection": 3,
|
|
727
744
|
"Code-Review": 0,
|
|
728
745
|
Contributors: 0
|
|
729
|
-
},
|
|
746
|
+
}, Ut = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Wt = "coverage/coverage-final.json", Gt = "coverage/coverage-summary.json", Kt = 80, qt = 60, Jt = "code-health-reports/vitest/badge.json", Yt = {
|
|
730
747
|
actions: "GitHub Actions",
|
|
731
748
|
"javascript-typescript": "JavaScript/TypeScript",
|
|
732
749
|
rust: "Rust"
|
|
733
|
-
},
|
|
750
|
+
}, Xt = {
|
|
734
751
|
A: "brightgreen",
|
|
735
752
|
B: "green",
|
|
736
753
|
C: "yellow",
|
|
737
754
|
D: "orange",
|
|
738
755
|
F: "red"
|
|
739
|
-
},
|
|
740
|
-
async function
|
|
756
|
+
}, Zt = `${c}/health.json`, Qt = se(ce);
|
|
757
|
+
async function $t() {
|
|
741
758
|
try {
|
|
742
759
|
s("Document Quality & Security");
|
|
743
|
-
let e = await w("package.json"), t = await
|
|
760
|
+
let e = await w("package.json"), t = await en(e), n = await nn(e, t === void 0 ? [] : ["--coverage", Wt]), { owner: r, repository: i } = C(e, "document quality and security");
|
|
744
761
|
T("4️⃣ Read security checks and settings");
|
|
745
|
-
let a = await
|
|
762
|
+
let a = await an(r, i, e);
|
|
746
763
|
T("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
|
|
747
|
-
let [o, c] = await Promise.all([
|
|
764
|
+
let [o, c] = await Promise.all([on(`https://github.com/${r}/${i}`), sn(`github.com/${r}/${i}`)]);
|
|
748
765
|
T("6️⃣ Insert quality and security content into 'README.md'");
|
|
749
|
-
let d =
|
|
766
|
+
let d = fn(r, i, {
|
|
750
767
|
coveragePercent: t,
|
|
751
768
|
fallowHealth: n,
|
|
752
769
|
securitySettings: a
|
|
753
770
|
}, o, c);
|
|
754
|
-
await l(), await _(d, u,
|
|
771
|
+
await l(), await _(d, u, ne), S("Quality & security documented");
|
|
755
772
|
} catch (e) {
|
|
756
773
|
console.error("❌ Error documenting quality and security", e), process.exit(1);
|
|
757
774
|
}
|
|
758
775
|
}
|
|
759
|
-
async function
|
|
776
|
+
async function en(t) {
|
|
760
777
|
if (t.devDependencies?.["@vitest/coverage-v8"] == null) {
|
|
761
778
|
T("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
|
|
762
779
|
return;
|
|
@@ -766,25 +783,25 @@ async function Jt(t) {
|
|
|
766
783
|
"--passWithNoTests",
|
|
767
784
|
"--coverage"
|
|
768
785
|
]);
|
|
769
|
-
let n = await e(
|
|
786
|
+
let n = await e(Gt);
|
|
770
787
|
if (n === null) return;
|
|
771
788
|
let r = JSON.parse(n).total.lines.pct;
|
|
772
|
-
return await
|
|
789
|
+
return await tn(r), r;
|
|
773
790
|
}
|
|
774
|
-
async function
|
|
791
|
+
async function tn(e) {
|
|
775
792
|
let t = [
|
|
776
793
|
"red",
|
|
777
794
|
"yellow",
|
|
778
795
|
"brightgreen"
|
|
779
|
-
], n = Number(e >=
|
|
780
|
-
await i(
|
|
796
|
+
], n = Number(e >= qt) + Number(e >= Kt);
|
|
797
|
+
await i(Jt, {
|
|
781
798
|
schemaVersion: 1,
|
|
782
799
|
label: "coverage",
|
|
783
800
|
message: `${e.toFixed(1)}%`,
|
|
784
801
|
color: t[n]
|
|
785
802
|
});
|
|
786
803
|
}
|
|
787
|
-
async function
|
|
804
|
+
async function nn(e, n) {
|
|
788
805
|
if (e.devDependencies?.fallow == null) {
|
|
789
806
|
T("2️⃣ Code health NOT measured, as Fallow is not installed"), T("3️⃣ Code health report NOT required");
|
|
790
807
|
return;
|
|
@@ -795,32 +812,32 @@ async function Xt(e, n) {
|
|
|
795
812
|
"--format",
|
|
796
813
|
"json",
|
|
797
814
|
...n
|
|
798
|
-
],
|
|
799
|
-
let r = await w(
|
|
800
|
-
return await
|
|
815
|
+
], Zt), await t("3️⃣ Write code health report", "fallow", ["--format", "markdown"], te, !0);
|
|
816
|
+
let r = await w(Zt);
|
|
817
|
+
return await rn(r), r;
|
|
801
818
|
}
|
|
802
|
-
async function
|
|
819
|
+
async function rn(e) {
|
|
803
820
|
let { score: t, grade: n } = e.health_score;
|
|
804
821
|
await i(h, {
|
|
805
822
|
schemaVersion: 1,
|
|
806
823
|
label: "fallow",
|
|
807
824
|
message: `${n} (${String(Math.round(t))})`,
|
|
808
|
-
color:
|
|
825
|
+
color: Xt[n] ?? "lightgrey"
|
|
809
826
|
});
|
|
810
827
|
}
|
|
811
|
-
async function
|
|
828
|
+
async function an(t, n, r) {
|
|
812
829
|
let [i, a, o] = await Promise.all([
|
|
813
830
|
e(".github/workflows/ci.yml"),
|
|
814
831
|
e(".github/dependabot.yml"),
|
|
815
832
|
e(v)
|
|
816
833
|
]), s = await e(".github/workflows/codeql.yml") ?? "", [c, l, u, d] = await Promise.all([
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
834
|
+
B(`repos/${t}/${n}`),
|
|
835
|
+
B(`repos/${t}/${n}/private-vulnerability-reporting`),
|
|
836
|
+
B(`repos/${t}/${n}/vulnerability-alerts`),
|
|
837
|
+
B(`repos/${t}/${n}/commits/main/check-runs?per_page=100`)
|
|
821
838
|
]), 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;
|
|
822
839
|
return {
|
|
823
|
-
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) =>
|
|
840
|
+
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => Yt[e] ?? e).toArray(),
|
|
824
841
|
codeQLQueries: /queries: ([\w-]+)/.exec(s)?.[1],
|
|
825
842
|
dependabotAlerts: u !== void 0,
|
|
826
843
|
dependabotSecurityUpdates: p("dependabot_security_updates"),
|
|
@@ -837,37 +854,37 @@ async function Qt(t, n, r) {
|
|
|
837
854
|
testsInCI: i?.includes("npm test") ?? !1
|
|
838
855
|
};
|
|
839
856
|
}
|
|
840
|
-
async function
|
|
857
|
+
async function B(e) {
|
|
841
858
|
try {
|
|
842
|
-
let { stdout: t } = await
|
|
859
|
+
let { stdout: t } = await Qt("gh", ["api", e]);
|
|
843
860
|
return t;
|
|
844
861
|
} catch (e) {
|
|
845
862
|
if (String(e.stderr).includes("HTTP 404")) return;
|
|
846
863
|
throw e;
|
|
847
864
|
}
|
|
848
865
|
}
|
|
849
|
-
async function
|
|
866
|
+
async function on(e) {
|
|
850
867
|
let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
|
|
851
868
|
if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
|
|
852
869
|
return (await t.json()).find((t) => t.repo_url === e)?.id;
|
|
853
870
|
}
|
|
854
|
-
async function
|
|
871
|
+
async function sn(e) {
|
|
855
872
|
let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
|
|
856
873
|
if (t.status !== 404) {
|
|
857
874
|
if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
|
|
858
875
|
return await t.json();
|
|
859
876
|
}
|
|
860
877
|
}
|
|
861
|
-
function
|
|
862
|
-
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 ||
|
|
878
|
+
function cn(e) {
|
|
879
|
+
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Ut.has(e) || Ht[e] !== void 0 && t >= Ht[e]);
|
|
863
880
|
}
|
|
864
|
-
function
|
|
881
|
+
function ln(e) {
|
|
865
882
|
return e === !1 ? " These are handled manually." : "";
|
|
866
883
|
}
|
|
867
|
-
function
|
|
884
|
+
function V(e) {
|
|
868
885
|
return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
|
|
869
886
|
}
|
|
870
|
-
function
|
|
887
|
+
function H(e, t) {
|
|
871
888
|
return t.length === 0 ? "" : `### ${e}
|
|
872
889
|
|
|
873
890
|
|Check|Status|What it does|
|
|
@@ -876,90 +893,90 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
|
|
|
876
893
|
|
|
877
894
|
`;
|
|
878
895
|
}
|
|
879
|
-
function
|
|
896
|
+
function un(e, t, n, r) {
|
|
880
897
|
return `})`;
|
|
881
898
|
}
|
|
882
|
-
function
|
|
899
|
+
function dn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
883
900
|
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 = [[
|
|
884
901
|
"Unit tests",
|
|
885
|
-
|
|
902
|
+
V(i.testsInCI),
|
|
886
903
|
`[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
|
|
887
904
|
], [
|
|
888
905
|
"Property-based tests",
|
|
889
|
-
|
|
906
|
+
V(i.propertyTests),
|
|
890
907
|
`[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)}`
|
|
891
908
|
]];
|
|
892
909
|
n !== void 0 && s.push([
|
|
893
910
|
"Test coverage",
|
|
894
|
-
|
|
895
|
-
`${
|
|
911
|
+
V(!0),
|
|
912
|
+
`${un(e, t, "Coverage", Jt)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(Kt)}%.`
|
|
896
913
|
]);
|
|
897
914
|
let c = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, l = [[
|
|
898
915
|
"Code analysis",
|
|
899
|
-
|
|
916
|
+
V(i.sonarCloud),
|
|
900
917
|
`${i.sonarCloud ? c : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
|
|
901
918
|
], [
|
|
902
919
|
"Linting",
|
|
903
|
-
|
|
920
|
+
V(i.lintInCI),
|
|
904
921
|
`[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
|
|
905
922
|
]];
|
|
906
923
|
r !== void 0 && l.unshift([
|
|
907
924
|
"Code health",
|
|
908
|
-
|
|
909
|
-
`[${
|
|
925
|
+
V(!0),
|
|
926
|
+
`[${un(e, t, "Fallow code health", h)}](./${te}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
|
|
910
927
|
]);
|
|
911
928
|
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 = [
|
|
912
929
|
[
|
|
913
930
|
"Push protection",
|
|
914
|
-
|
|
931
|
+
V(i.pushProtection),
|
|
915
932
|
"[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
|
|
916
933
|
],
|
|
917
934
|
[
|
|
918
935
|
"Static analysis",
|
|
919
|
-
|
|
936
|
+
V(u),
|
|
920
937
|
`${u ? d : ""}[CodeQL](https://codeql.github.com) scans${p} for security vulnerabilities, ${f}, on every push and pull request to \`main\` and weekly.`
|
|
921
938
|
],
|
|
922
939
|
[
|
|
923
940
|
"Secret scanning",
|
|
924
|
-
|
|
941
|
+
V(i.secretScanning),
|
|
925
942
|
"[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
|
|
926
943
|
]
|
|
927
944
|
], g = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", _ = [
|
|
928
945
|
[
|
|
929
946
|
"Vulnerability audit",
|
|
930
|
-
|
|
947
|
+
V(i.npmAuditInCI),
|
|
931
948
|
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)}`
|
|
932
949
|
],
|
|
933
950
|
[
|
|
934
951
|
"Supply chain risk",
|
|
935
|
-
|
|
952
|
+
V(i.socket),
|
|
936
953
|
"[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
|
|
937
954
|
],
|
|
938
955
|
[
|
|
939
956
|
"Security alerts",
|
|
940
|
-
|
|
957
|
+
V(i.dependabotAlerts),
|
|
941
958
|
`${g} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
|
|
942
959
|
],
|
|
943
960
|
[
|
|
944
961
|
"Security updates",
|
|
945
|
-
|
|
946
|
-
`${g} opens pull requests that update vulnerable dependencies.${
|
|
962
|
+
V(i.dependabotSecurityUpdates),
|
|
963
|
+
`${g} opens pull requests that update vulnerable dependencies.${ln(i.dependabotSecurityUpdates)}`
|
|
947
964
|
],
|
|
948
965
|
[
|
|
949
966
|
"Version updates",
|
|
950
|
-
|
|
951
|
-
`${g} opens pull requests for new dependency versions.${
|
|
967
|
+
V(i.dependabotVersionUpdates),
|
|
968
|
+
`${g} opens pull requests for new dependency versions.${ln(i.dependabotVersionUpdates)}`
|
|
952
969
|
]
|
|
953
970
|
];
|
|
954
971
|
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.
|
|
955
972
|
|
|
956
|
-
${
|
|
973
|
+
${H("Testing", s)}${H("Code Quality", l)}${H("Security Analysis", m)}${H("Dependencies", _)}`;
|
|
957
974
|
}
|
|
958
|
-
function
|
|
959
|
-
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 &&
|
|
975
|
+
function fn(e, t, n, r, i) {
|
|
976
|
+
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && cn(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.";
|
|
960
977
|
return `## Quality & Security
|
|
961
978
|
|
|
962
|
-
${
|
|
979
|
+
${dn(e, t, n)}### OpenSSF 🚧
|
|
963
980
|
|
|
964
981
|
${l}[](https://scorecard.dev/viewer/?uri=${o})
|
|
965
982
|
|
|
@@ -971,37 +988,37 @@ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
|
|
|
971
988
|
}
|
|
972
989
|
//#endregion
|
|
973
990
|
//#region src/actions/documentUsage.ts
|
|
974
|
-
var
|
|
991
|
+
var pn = "<!-- USAGE_START -->", mn = "<!-- USAGE_END -->", hn = /* @__PURE__ */ new Set([
|
|
975
992
|
"connector",
|
|
976
993
|
"cookbook",
|
|
977
994
|
"presenter"
|
|
978
|
-
]),
|
|
979
|
-
async function
|
|
995
|
+
]), gn = /* @__PURE__ */ new Set(["development", "eslint"]), _n = "> [!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.", vn = "This repository manages itself using the actions it implements.", yn = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
|
|
996
|
+
async function bn() {
|
|
980
997
|
try {
|
|
981
998
|
s("Document Usage"), T("1️⃣ Insert usage content into 'README.md'");
|
|
982
|
-
let [e, t] = await Promise.all([w("package.json"), w("config.json")]), n =
|
|
983
|
-
await _(u,
|
|
999
|
+
let [e, t] = await Promise.all([w("package.json"), w("config.json")]), n = xn(e), r = Sn(n), i = U(e.engines?.node), a = U(e.engines?.npm), o = U(e.devDependencies?.typescript), c = Cn(m(t.id), e.name), l = `${n.replace(/\.git$/, "")}/blob/main/package.json`, u = wn(c, n, r, i, a, o, `${e.name === "@dpuse/dpuse-development" ? vn : yn} See the \`scripts\` block in [package.json](${l}) for details.`);
|
|
1000
|
+
await _(u, pn, mn), S("Usage documented");
|
|
984
1001
|
} catch (e) {
|
|
985
1002
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
986
1003
|
}
|
|
987
1004
|
}
|
|
988
|
-
function
|
|
1005
|
+
function xn(e) {
|
|
989
1006
|
let t = e.repository, n = typeof t == "string" ? t : t?.url;
|
|
990
1007
|
if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
|
|
991
1008
|
return n.replace(/^git\+/, "");
|
|
992
1009
|
}
|
|
993
|
-
function
|
|
1010
|
+
function Sn(e) {
|
|
994
1011
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
995
1012
|
}
|
|
996
|
-
function
|
|
1013
|
+
function U(e) {
|
|
997
1014
|
if (e == null) throw Error("package.json version range is required to document usage.");
|
|
998
1015
|
let t = /\d+(?:\.\d+)*/.exec(e);
|
|
999
1016
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
1000
1017
|
return t[0];
|
|
1001
1018
|
}
|
|
1002
|
-
function
|
|
1019
|
+
function Cn(e, t) {
|
|
1003
1020
|
let { typeId: n } = e;
|
|
1004
|
-
if (
|
|
1021
|
+
if (hn.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.
|
|
1005
1022
|
|
|
1006
1023
|
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.`;
|
|
1007
1024
|
if (e.publishedTo === "npm") {
|
|
@@ -1012,11 +1029,11 @@ You may view or clone this repository for your own purposes, such as building a
|
|
|
1012
1029
|
npm install ${t}
|
|
1013
1030
|
\`\`\`
|
|
1014
1031
|
|
|
1015
|
-
${
|
|
1032
|
+
${gn.has(n) ? `${_n}\n\n` : ""}To work on the source instead, clone this repository.`;
|
|
1016
1033
|
}
|
|
1017
1034
|
return "You may view or clone this repository for your own purposes.";
|
|
1018
1035
|
}
|
|
1019
|
-
function
|
|
1036
|
+
function wn(e, t, n, r, i, a, o) {
|
|
1020
1037
|
return `## Usage
|
|
1021
1038
|
|
|
1022
1039
|
${e}
|
|
@@ -1033,102 +1050,199 @@ ${o}`;
|
|
|
1033
1050
|
}
|
|
1034
1051
|
//#endregion
|
|
1035
1052
|
//#region src/actions/documentApiReference.ts
|
|
1036
|
-
var
|
|
1037
|
-
async function
|
|
1053
|
+
var W = "API_REFERENCE.md";
|
|
1054
|
+
async function Tn() {
|
|
1038
1055
|
try {
|
|
1039
1056
|
s("Document API Reference");
|
|
1040
1057
|
let { writeAPIReference: e } = await import("./apiReference-cMfpNKxR.js");
|
|
1041
|
-
await e("1️⃣ ",
|
|
1058
|
+
await e("1️⃣ ", W), S("API reference documented");
|
|
1042
1059
|
} catch (e) {
|
|
1043
1060
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
1044
1061
|
}
|
|
1045
1062
|
}
|
|
1046
1063
|
//#endregion
|
|
1047
1064
|
//#region src/actions/documentBundleSizes.ts
|
|
1048
|
-
var
|
|
1049
|
-
async function
|
|
1065
|
+
var En = "bundle-analysis-reports/sonda/index.json", Dn = "bundle-analysis-reports/sonda/worker.json", On = "<!-- BUNDLE_START -->", kn = "<!-- BUNDLE_END -->", G = " ", K = 20, An = "█", jn = "▒", Mn = 100 / K / 2, Nn = 100 / K, Pn = "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._", Fn = "Bars show each row's share of its output file.", In = "↳ rows are part of the row above.", q = "(bundler output, whitespace & JSON)", J = "(inlined worker)", Ln = `${J} = a Web Worker built separately and embedded in its output file as text. Where the build records what it contains, its rows list that; any few bytes over are the escaping needed to embed it.`, Y = "(Rust WebAssembly as base64", Rn = `${Y}…) = the compiled Rust code, embedded as base64 text, about a third larger than the binary it decodes to, which is the size given.`, zn = `${q} = bytes Sonda can't trace to a source file: whitespace (indentation and line breaks), code the bundler generates (region comments, the combined import/export lines, its small runtime helper and wrappers), and imported JSON such as \`config.json\`, which the bundler doesn't map. The JSON and the generated code are real bytes that ship; the whitespace mostly disappears once compressed.`;
|
|
1066
|
+
async function Bn(t) {
|
|
1050
1067
|
try {
|
|
1051
1068
|
s("Document Bundle Sizes"), T("1️⃣ Read bundle analysis report");
|
|
1052
|
-
let
|
|
1069
|
+
let n = await w(En), r = await e(Dn), i = r === null ? void 0 : JSON.parse(r), a = /* @__PURE__ */ new Map();
|
|
1070
|
+
for (let t of n.resources) t.kind === "asset" && a.set(t.name, await e(t.name));
|
|
1053
1071
|
T("2️⃣ Insert table into 'README.md'");
|
|
1054
|
-
let
|
|
1055
|
-
|
|
1072
|
+
let o = Vn(n, {
|
|
1073
|
+
assetContents: a,
|
|
1074
|
+
isModuleLevel: t?.moduleLevel ?? !1,
|
|
1075
|
+
workerJson: i
|
|
1076
|
+
}), c = [
|
|
1077
|
+
o.includes("↳") ? `${Fn} ${In}` : Fn,
|
|
1078
|
+
o.includes(J) ? Ln : "",
|
|
1079
|
+
o.includes(Y) ? Rn : "",
|
|
1080
|
+
zn
|
|
1081
|
+
].filter((e) => e !== "");
|
|
1082
|
+
await _(`## Bundle Analysis\n\n${Pn}\n\n${o}\n\n${c.join("\n\n")}`, On, kn), S("Bundle sizes documented");
|
|
1056
1083
|
} catch (e) {
|
|
1057
1084
|
console.error("❌ Error documenting bundle sizes", e), process.exit(1);
|
|
1058
1085
|
}
|
|
1059
1086
|
}
|
|
1060
|
-
function
|
|
1061
|
-
let
|
|
1062
|
-
for (let [e,
|
|
1063
|
-
let
|
|
1064
|
-
|
|
1087
|
+
function Vn(e, t) {
|
|
1088
|
+
let { assetContents: n, isModuleLevel: r, workerJson: i } = t, a = nr(e), o = i === void 0 ? void 0 : nr(i).values().next().value;
|
|
1089
|
+
for (let [e, t] of a) {
|
|
1090
|
+
let r = n.get(e);
|
|
1091
|
+
r != null && Hn(t, r, o);
|
|
1065
1092
|
}
|
|
1066
|
-
|
|
1093
|
+
let s = a.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), c = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, sr(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), l = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
|
|
1094
|
+
for (let [e, t] of c) {
|
|
1095
|
+
let n = [...a.get(e) ?? /* @__PURE__ */ new Map()].toSorted(Xn), i = n.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), o = i > 0 && s > 0 ? ` · ${dr(i, s)} of the build` : "";
|
|
1096
|
+
l.push(`| **${e}** | ${cr(t)}${o} |`, ...Zn(n, i, r));
|
|
1097
|
+
}
|
|
1098
|
+
return l.join("\n");
|
|
1099
|
+
}
|
|
1100
|
+
function Hn(e, t, n) {
|
|
1101
|
+
let r = Un(t), i = Wn(r ?? ""), a = Wn(t);
|
|
1102
|
+
Kn(e, {
|
|
1103
|
+
bytes: a.bytes - i.bytes,
|
|
1104
|
+
binaryBytes: a.binaryBytes - i.binaryBytes
|
|
1105
|
+
}), r !== void 0 && qn(e, Buffer.byteLength(r), i, n);
|
|
1106
|
+
}
|
|
1107
|
+
function Un(e) {
|
|
1108
|
+
if (!e.includes("new Worker(")) return;
|
|
1109
|
+
let t = /encodeURIComponent\((\w+)\)/.exec(e)?.[1];
|
|
1110
|
+
if (t === void 0) return;
|
|
1111
|
+
let n = new RegExp(String.raw`(?:var|let|const)\s+${t}\s*=\s*(["'\`])`).exec(e), r = n?.[1];
|
|
1112
|
+
if (n === null || r === void 0) return;
|
|
1113
|
+
let i = n.index + n[0].length, a = i;
|
|
1114
|
+
for (; a < e.length && e[a] !== r;) a += e[a] === "\\" ? 2 : 1;
|
|
1115
|
+
return e.slice(i, a);
|
|
1067
1116
|
}
|
|
1068
|
-
function
|
|
1069
|
-
|
|
1117
|
+
function Wn(e) {
|
|
1118
|
+
let t = {
|
|
1119
|
+
bytes: 0,
|
|
1120
|
+
binaryBytes: 0
|
|
1121
|
+
};
|
|
1122
|
+
for (let n of e.matchAll(/data:application\/wasm;base64,([A-Za-z\d+/]*={0,2})/g)) {
|
|
1123
|
+
let e = n[1] ?? "";
|
|
1124
|
+
t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) - Gn(e);
|
|
1125
|
+
}
|
|
1126
|
+
return t;
|
|
1070
1127
|
}
|
|
1071
|
-
function
|
|
1128
|
+
function Gn(e) {
|
|
1129
|
+
return e.endsWith("==") ? 2 : +!!e.endsWith("=");
|
|
1130
|
+
}
|
|
1131
|
+
function Kn(e, t) {
|
|
1132
|
+
if (t.bytes <= 0) return;
|
|
1133
|
+
let n = [e.get("wasm"), e.get(q)].flatMap((e) => e === void 0 ? [] : e.files.entries().map(([t, n]) => ({
|
|
1134
|
+
group: e,
|
|
1135
|
+
fileName: t,
|
|
1136
|
+
sizes: n
|
|
1137
|
+
})).toArray()).find(({ sizes: e }) => e.uncompressed >= t.bytes);
|
|
1138
|
+
if (n === void 0) return;
|
|
1139
|
+
Yn(e, n.group, n.fileName, n.sizes, t.bytes);
|
|
1140
|
+
let r = `${Y}, ${Q(t.binaryBytes)} binary)`;
|
|
1141
|
+
e.set(r, {
|
|
1142
|
+
sizes: {
|
|
1143
|
+
uncompressed: t.bytes,
|
|
1144
|
+
gzip: 0
|
|
1145
|
+
},
|
|
1146
|
+
files: /* @__PURE__ */ new Map([["", {
|
|
1147
|
+
uncompressed: t.bytes,
|
|
1148
|
+
gzip: 0
|
|
1149
|
+
}]])
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
function qn(e, t, n, r) {
|
|
1153
|
+
let i = e.get(q), a = i?.files.get("");
|
|
1154
|
+
if (i === void 0 || a === void 0 || a.uncompressed < t) return;
|
|
1155
|
+
Yn(e, i, "", a, t);
|
|
1156
|
+
let o = r === void 0 ? /* @__PURE__ */ new Map([["", {
|
|
1157
|
+
uncompressed: t,
|
|
1158
|
+
gzip: 0
|
|
1159
|
+
}]]) : Jn(r, t, n);
|
|
1160
|
+
e.set(J, {
|
|
1161
|
+
sizes: {
|
|
1162
|
+
uncompressed: t,
|
|
1163
|
+
gzip: 0
|
|
1164
|
+
},
|
|
1165
|
+
files: o
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
function Jn(e, t, n) {
|
|
1169
|
+
Kn(e, n);
|
|
1170
|
+
let r = /* @__PURE__ */ new Map();
|
|
1171
|
+
for (let [t, n] of e) if (t === "src") for (let [e, t] of n.files) r.set(e, { ...t });
|
|
1172
|
+
else {
|
|
1173
|
+
let e = n.files.size === 1 ? er(t, tr(n.files)) : t;
|
|
1174
|
+
r.set(e, { ...n.sizes });
|
|
1175
|
+
}
|
|
1176
|
+
let i = r.values().reduce((e, t) => e + t.uncompressed, 0), a = r.get(q) ?? Z();
|
|
1177
|
+
return a.uncompressed += Math.max(0, t - i), a.uncompressed > 0 && r.set(q, a), r;
|
|
1178
|
+
}
|
|
1179
|
+
function Yn(e, t, n, r, i) {
|
|
1180
|
+
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);
|
|
1181
|
+
}
|
|
1182
|
+
function Xn(e, t) {
|
|
1183
|
+
return e[0] === q == (t[0] === q) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === q ? 1 : -1;
|
|
1184
|
+
}
|
|
1185
|
+
function Zn(e, t, n) {
|
|
1072
1186
|
let r = [];
|
|
1073
1187
|
for (let [i, { sizes: a, files: o }] of e) {
|
|
1074
1188
|
if (o.size === 1) {
|
|
1075
|
-
let e =
|
|
1076
|
-
r.push(`| ${
|
|
1189
|
+
let e = tr(o);
|
|
1190
|
+
r.push(`| ${G}${er(i, e)} | ${X(a.uncompressed, t)} |`);
|
|
1077
1191
|
continue;
|
|
1078
1192
|
}
|
|
1079
|
-
r.push(`| ${
|
|
1193
|
+
r.push(`| ${G}${i} | ${X(a.uncompressed, t)} |`), n || r.push(...Qn(o, t));
|
|
1080
1194
|
}
|
|
1081
1195
|
return r;
|
|
1082
1196
|
}
|
|
1083
|
-
function
|
|
1084
|
-
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r =
|
|
1197
|
+
function Qn(e, t) {
|
|
1198
|
+
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = $n(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${G}${G}↳ ${e} | ${X(n.uncompressed, t, jn)} |`);
|
|
1085
1199
|
if (r > 0) {
|
|
1086
1200
|
let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
|
|
1087
|
-
i.push(`| ${
|
|
1201
|
+
i.push(`| ${G}${G}↳ ${String(r)} smaller files | ${X(e, t, jn)} |`);
|
|
1088
1202
|
}
|
|
1089
1203
|
return i;
|
|
1090
1204
|
}
|
|
1091
|
-
function
|
|
1205
|
+
function $n(e, t) {
|
|
1092
1206
|
if (t <= 0) return 0;
|
|
1093
1207
|
let n = 0, r = 0;
|
|
1094
1208
|
for (let [, i] of e.toReversed()) {
|
|
1095
|
-
let e = i.uncompressed / t * 100 <
|
|
1209
|
+
let e = i.uncompressed / t * 100 < Mn, a = (r + i.uncompressed) / t * 100 <= Nn;
|
|
1096
1210
|
if (!e || !a) break;
|
|
1097
1211
|
n++, r += i.uncompressed;
|
|
1098
1212
|
}
|
|
1099
1213
|
return n >= 2 ? n : 0;
|
|
1100
1214
|
}
|
|
1101
|
-
function
|
|
1102
|
-
return `${
|
|
1215
|
+
function X(e, t, n = An) {
|
|
1216
|
+
return `${lr(t > 0 ? e / t * 100 : 0, n)} · ${Q(e)}`;
|
|
1103
1217
|
}
|
|
1104
|
-
function
|
|
1218
|
+
function er(e, t) {
|
|
1105
1219
|
return t === "" ? e : `${e} → ${t}`;
|
|
1106
1220
|
}
|
|
1107
|
-
function
|
|
1221
|
+
function tr(e) {
|
|
1108
1222
|
let [t] = e.keys();
|
|
1109
1223
|
if (t === void 0) throw Error("Expected exactly one file");
|
|
1110
1224
|
return t;
|
|
1111
1225
|
}
|
|
1112
|
-
function
|
|
1113
|
-
let t =
|
|
1226
|
+
function nr(e) {
|
|
1227
|
+
let t = rr(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1114
1228
|
for (let r of e.resources) {
|
|
1115
1229
|
if (r.kind !== "chunk" || !r.parent) continue;
|
|
1116
|
-
let { group: e, file: i } =
|
|
1230
|
+
let { group: e, file: i } = ir(r.name, t), a = sr(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
|
|
1117
1231
|
n.set(r.parent, o);
|
|
1118
1232
|
let s = o.get(e) ?? {
|
|
1119
|
-
sizes:
|
|
1233
|
+
sizes: Z(),
|
|
1120
1234
|
files: /* @__PURE__ */ new Map()
|
|
1121
1235
|
};
|
|
1122
|
-
o.set(e, s),
|
|
1123
|
-
let c = s.files.get(i) ??
|
|
1124
|
-
s.files.set(i, c),
|
|
1236
|
+
o.set(e, s), ur(s.sizes, a);
|
|
1237
|
+
let c = s.files.get(i) ?? Z();
|
|
1238
|
+
s.files.set(i, c), ur(c, a);
|
|
1125
1239
|
}
|
|
1126
1240
|
return n;
|
|
1127
1241
|
}
|
|
1128
|
-
function
|
|
1242
|
+
function rr(e) {
|
|
1129
1243
|
return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
|
|
1130
1244
|
}
|
|
1131
|
-
function
|
|
1245
|
+
function ir(e, t) {
|
|
1132
1246
|
let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
|
|
1133
1247
|
if (n) {
|
|
1134
1248
|
let [t, r] = n;
|
|
@@ -1138,65 +1252,65 @@ function Vn(e, t) {
|
|
|
1138
1252
|
};
|
|
1139
1253
|
}
|
|
1140
1254
|
return e === "[unassigned]" ? {
|
|
1141
|
-
group:
|
|
1255
|
+
group: q,
|
|
1142
1256
|
file: ""
|
|
1143
1257
|
} : e.startsWith("\0") ? {
|
|
1144
1258
|
group: "(runtime)",
|
|
1145
1259
|
file: e.slice(1)
|
|
1146
1260
|
} : e.startsWith("rust/") ? {
|
|
1147
1261
|
group: "wasm",
|
|
1148
|
-
file:
|
|
1262
|
+
file: ar(e)
|
|
1149
1263
|
} : {
|
|
1150
1264
|
group: "src",
|
|
1151
|
-
file:
|
|
1265
|
+
file: or(e)
|
|
1152
1266
|
};
|
|
1153
1267
|
}
|
|
1154
|
-
function
|
|
1155
|
-
let t = e.split("/", 2)[1] ?? "", n =
|
|
1268
|
+
function ar(e) {
|
|
1269
|
+
let t = e.split("/", 2)[1] ?? "", n = or(e);
|
|
1156
1270
|
return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
|
|
1157
1271
|
}
|
|
1158
|
-
function
|
|
1272
|
+
function or(e) {
|
|
1159
1273
|
return e.split("/").at(-1) ?? e;
|
|
1160
1274
|
}
|
|
1161
|
-
function
|
|
1275
|
+
function sr(e) {
|
|
1162
1276
|
return {
|
|
1163
1277
|
uncompressed: e.uncompressed,
|
|
1164
1278
|
gzip: e.gzip ?? 0
|
|
1165
1279
|
};
|
|
1166
1280
|
}
|
|
1167
|
-
function
|
|
1168
|
-
return `${
|
|
1281
|
+
function cr(e) {
|
|
1282
|
+
return `${Q(e.uncompressed)} · gzip ${Q(e.gzip)}`;
|
|
1169
1283
|
}
|
|
1170
|
-
function
|
|
1171
|
-
let n = Math.round(e / 100 *
|
|
1172
|
-
return `\`${t.repeat(n)}${"░".repeat(
|
|
1284
|
+
function lr(e, t = An) {
|
|
1285
|
+
let n = Math.round(e / 100 * K);
|
|
1286
|
+
return `\`${t.repeat(n)}${"░".repeat(K - n)}\` ${e.toFixed(1)}%`;
|
|
1173
1287
|
}
|
|
1174
|
-
function
|
|
1288
|
+
function Z() {
|
|
1175
1289
|
return {
|
|
1176
1290
|
uncompressed: 0,
|
|
1177
1291
|
gzip: 0
|
|
1178
1292
|
};
|
|
1179
1293
|
}
|
|
1180
|
-
function
|
|
1294
|
+
function ur(e, t) {
|
|
1181
1295
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
1182
1296
|
}
|
|
1183
|
-
function
|
|
1297
|
+
function dr(e, t) {
|
|
1184
1298
|
return `${(e / t * 100).toFixed(1)}%`;
|
|
1185
1299
|
}
|
|
1186
|
-
function
|
|
1300
|
+
function Q(e) {
|
|
1187
1301
|
return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
|
|
1188
1302
|
}
|
|
1189
1303
|
//#endregion
|
|
1190
1304
|
//#region src/actions/documentProject.ts
|
|
1191
|
-
async function
|
|
1305
|
+
async function fr(t = "MIT", n = !1) {
|
|
1192
1306
|
try {
|
|
1193
1307
|
let r = await w("config.json"), i = m(r.id).typeId === "connector";
|
|
1194
|
-
await
|
|
1195
|
-
let a = await e(
|
|
1196
|
-
a ? await
|
|
1308
|
+
await Lt(), i && await He(), await bn(), await lt(t), await e("bundle-analysis-reports/sonda/index.json") === null ? T(`ℹ️ Bundle sizes NOT documented, as there is no '${En}' yet. Build the project first.`) : await Bn({ moduleLevel: n }), await $t(), await Ue();
|
|
1309
|
+
let a = await e(W) !== null;
|
|
1310
|
+
a ? await Tn() : T(`ℹ️ '${W}' NOT required by this project`), await o("ℹ️ Format generated files", "prettier", [
|
|
1197
1311
|
"--write",
|
|
1198
1312
|
"README.md",
|
|
1199
|
-
...a ? [
|
|
1313
|
+
...a ? [W] : []
|
|
1200
1314
|
]);
|
|
1201
1315
|
} catch (e) {
|
|
1202
1316
|
console.error("❌ Error documenting project", e), process.exit(1);
|
|
@@ -1204,7 +1318,7 @@ async function Xn(t = "MIT", n = !1) {
|
|
|
1204
1318
|
}
|
|
1205
1319
|
//#endregion
|
|
1206
1320
|
//#region src/actions/formatCode.ts
|
|
1207
|
-
async function
|
|
1321
|
+
async function pr() {
|
|
1208
1322
|
try {
|
|
1209
1323
|
s("Format Code");
|
|
1210
1324
|
let e = [
|
|
@@ -1225,7 +1339,7 @@ async function Zn() {
|
|
|
1225
1339
|
}
|
|
1226
1340
|
//#endregion
|
|
1227
1341
|
//#region src/actions/lintCode.ts
|
|
1228
|
-
async function
|
|
1342
|
+
async function mr() {
|
|
1229
1343
|
try {
|
|
1230
1344
|
s("Lint Code"), await o("1️⃣ Lint", "eslint", ["."]), S("Code linted");
|
|
1231
1345
|
} catch (e) {
|
|
@@ -1234,7 +1348,7 @@ async function Qn() {
|
|
|
1234
1348
|
}
|
|
1235
1349
|
//#endregion
|
|
1236
1350
|
//#region src/utilities/cloudflare.ts
|
|
1237
|
-
async function
|
|
1351
|
+
async function hr() {
|
|
1238
1352
|
let e = await w("config.json"), t = {
|
|
1239
1353
|
body: JSON.stringify(e),
|
|
1240
1354
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1242,7 +1356,7 @@ async function $n() {
|
|
|
1242
1356
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
1243
1357
|
if (!n.ok) throw Error(await n.text());
|
|
1244
1358
|
}
|
|
1245
|
-
async function
|
|
1359
|
+
async function gr(e, t) {
|
|
1246
1360
|
async function n(e, t, r) {
|
|
1247
1361
|
for (let i of r) {
|
|
1248
1362
|
let r = `${e}/${i}`, a = `${t}/${i}`;
|
|
@@ -1260,7 +1374,7 @@ async function er(e, t) {
|
|
|
1260
1374
|
let r = await y(`${e}/${t}/`);
|
|
1261
1375
|
await n(`${e}/${t}`, t, r);
|
|
1262
1376
|
}
|
|
1263
|
-
async function
|
|
1377
|
+
async function $(e) {
|
|
1264
1378
|
let t = e.id, n = {
|
|
1265
1379
|
body: JSON.stringify(e),
|
|
1266
1380
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1268,7 +1382,7 @@ async function tr(e) {
|
|
|
1268
1382
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
1269
1383
|
if (!r.ok) throw Error(await r.text());
|
|
1270
1384
|
}
|
|
1271
|
-
async function
|
|
1385
|
+
async function _r(e, t) {
|
|
1272
1386
|
let n = `v${e.version ?? "unknown"}`;
|
|
1273
1387
|
async function r(e, r = "") {
|
|
1274
1388
|
let i = await y(e, { withFileTypes: !0 });
|
|
@@ -1292,34 +1406,34 @@ async function nr(e, t) {
|
|
|
1292
1406
|
}
|
|
1293
1407
|
//#endregion
|
|
1294
1408
|
//#region src/actions/publishProject.ts
|
|
1295
|
-
async function
|
|
1409
|
+
async function vr() {
|
|
1296
1410
|
try {
|
|
1297
1411
|
s("Publish Project");
|
|
1298
1412
|
let e = await w("package.json"), t = await w("config.json"), n = m(t.id);
|
|
1299
|
-
n.publishedTo === "npm" ? await o("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : T("1️⃣ Publishing to npm NOT required"), await
|
|
1413
|
+
n.publishedTo === "npm" ? await o("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : T("1️⃣ Publishing to npm NOT required"), await yr("2️⃣ ", e, t, n), n.publishedTo === "kb" && await o("3️⃣ Deploy", "npm", ["run", "deploy"]), S(`Project version '${e.version ?? "unknown"}' published.`);
|
|
1300
1414
|
} catch (e) {
|
|
1301
1415
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1302
1416
|
}
|
|
1303
1417
|
}
|
|
1304
|
-
async function
|
|
1305
|
-
if (r.typeId === "app") T(`${e} Register module`), await
|
|
1306
|
-
else if (r.typeId === "engine") T(`${e} Register module`), await
|
|
1418
|
+
async function yr(e, t, n, r) {
|
|
1419
|
+
if (r.typeId === "app") T(`${e} Register module`), await hr();
|
|
1420
|
+
else if (r.typeId === "engine") T(`${e} Register module`), await _r(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await $(n);
|
|
1307
1421
|
else if (r.uploadGroupName === void 0) T(`${e} Registration NOT required`);
|
|
1308
1422
|
else {
|
|
1309
1423
|
T(`${e} Register module`);
|
|
1310
1424
|
let i = n.id.split("-").slice(2).join("-");
|
|
1311
|
-
await
|
|
1425
|
+
await _r(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await $(n);
|
|
1312
1426
|
}
|
|
1313
1427
|
}
|
|
1314
1428
|
//#endregion
|
|
1315
1429
|
//#region src/actions/releaseProject.ts
|
|
1316
|
-
async function
|
|
1430
|
+
async function br(e = "MIT", t = !1) {
|
|
1317
1431
|
try {
|
|
1318
1432
|
s("Release Project");
|
|
1319
1433
|
let n = await w("package.json"), r = await w("config.json"), i = m(r.id);
|
|
1320
1434
|
await d("1️⃣ ", n);
|
|
1321
|
-
let a = await
|
|
1322
|
-
if (await
|
|
1435
|
+
let a = await ie("2️⃣ ", n, i);
|
|
1436
|
+
if (await Ce("3️⃣ ", n), T("4️⃣ Regenerate README"), await fr(e, t), await b("5️⃣ Stage changes", "git", ["add", "."]), await b("6️⃣ Commit changes", "git", [
|
|
1323
1437
|
"commit",
|
|
1324
1438
|
"-m",
|
|
1325
1439
|
`v${n.version ?? "unknown"}`
|
|
@@ -1327,7 +1441,7 @@ async function ar(e = "MIT", t = !1) {
|
|
|
1327
1441
|
"push",
|
|
1328
1442
|
"origin",
|
|
1329
1443
|
"main:main"
|
|
1330
|
-
]), await
|
|
1444
|
+
]), await yr("8️⃣ ", n, a, i), i.publishedTo === "npm") {
|
|
1331
1445
|
let e = `v${n.version ?? "unknown"}`;
|
|
1332
1446
|
await o("9️⃣ Trigger GitHub release", "gh", [
|
|
1333
1447
|
"release",
|
|
@@ -1346,11 +1460,11 @@ async function ar(e = "MIT", t = !1) {
|
|
|
1346
1460
|
}
|
|
1347
1461
|
//#endregion
|
|
1348
1462
|
//#region src/actions/syncProjectWithGitHub.ts
|
|
1349
|
-
async function
|
|
1463
|
+
async function xr() {
|
|
1350
1464
|
try {
|
|
1351
1465
|
s("Synchronise Project with GitHub");
|
|
1352
1466
|
let e = await w("package.json"), t = await w("config.json"), n = m(t.id);
|
|
1353
|
-
await d("1️⃣ ", e), await
|
|
1467
|
+
await d("1️⃣ ", e), await ie("2️⃣ ", e, n), await b("3️⃣ Stage changes", "git", ["add", "."]), await b("4️⃣ Commit changes", "git", [
|
|
1354
1468
|
"commit",
|
|
1355
1469
|
"-m",
|
|
1356
1470
|
`v${e.version ?? "unknown"}`
|
|
@@ -1365,12 +1479,12 @@ async function or() {
|
|
|
1365
1479
|
}
|
|
1366
1480
|
//#endregion
|
|
1367
1481
|
//#region src/actions/testProject.ts
|
|
1368
|
-
var
|
|
1482
|
+
var Sr = [
|
|
1369
1483
|
"1️⃣ ",
|
|
1370
1484
|
"2️⃣ ",
|
|
1371
1485
|
"3️⃣ ",
|
|
1372
1486
|
"4️⃣ "
|
|
1373
|
-
],
|
|
1487
|
+
], Cr = [{
|
|
1374
1488
|
id: "unit",
|
|
1375
1489
|
label: "Run unit tests",
|
|
1376
1490
|
command: "vitest",
|
|
@@ -1383,13 +1497,13 @@ var sr = [
|
|
|
1383
1497
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1384
1498
|
configFileName: "playwright.config.ts"
|
|
1385
1499
|
}];
|
|
1386
|
-
async function
|
|
1500
|
+
async function wr(t = ["unit"]) {
|
|
1387
1501
|
try {
|
|
1388
1502
|
s("Test Project");
|
|
1389
1503
|
let n = 0;
|
|
1390
|
-
for (let r of
|
|
1504
|
+
for (let r of Cr) {
|
|
1391
1505
|
if (!t.includes(r.id) || await e(r.configFileName) === null) continue;
|
|
1392
|
-
let i = `${
|
|
1506
|
+
let i = `${Sr[n] ?? ""} ${r.label}`;
|
|
1393
1507
|
await o(i, r.command, r.arguments), n += 1;
|
|
1394
1508
|
}
|
|
1395
1509
|
if (n === 0) {
|
|
@@ -1403,7 +1517,7 @@ async function lr(t = ["unit"]) {
|
|
|
1403
1517
|
}
|
|
1404
1518
|
//#endregion
|
|
1405
1519
|
//#region src/actions/triggerGitHubRelease.ts
|
|
1406
|
-
async function
|
|
1520
|
+
async function Tr() {
|
|
1407
1521
|
try {
|
|
1408
1522
|
s("Trigger GitHub Release");
|
|
1409
1523
|
let e = `v${(await w("package.json")).version ?? "unknown"}`;
|
|
@@ -1421,4 +1535,4 @@ async function ur() {
|
|
|
1421
1535
|
}
|
|
1422
1536
|
}
|
|
1423
1537
|
//#endregion
|
|
1424
|
-
export { ge as auditDependencies,
|
|
1538
|
+
export { ge as auditDependencies, Se as buildProject, Ie as checkProject, fr as documentProject, pr as formatCode, mr as lintCode, vr as publishProject, br as releaseProject, xr as syncProjectWithGitHub, wr as testProject, Tr as triggerGitHubRelease, gr as uploadDirectoryToR2 };
|