@dpuse/dpuse-development 1.0.155 → 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 +474 -478
- 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 +7 -7
- 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 = [
|
|
@@ -47,90 +48,104 @@ var ve = [
|
|
|
47
48
|
reason: "'undici', pinned to 7.29.1 by miniflare, Wrangler's local Workers simulator, which runs only during development and is never deployed; remove once miniflare takes 7.30.1",
|
|
48
49
|
reviewBy: "2026-11-30"
|
|
49
50
|
}
|
|
50
|
-
], ye =
|
|
51
|
-
|
|
51
|
+
], ye = [{
|
|
52
|
+
id: "GHSA-fc5q-39xc-vjpf",
|
|
53
|
+
reason: "'picomatch', used by the build-time route plugin in 'vue-router' 5, which runs only while building and is not in the app bundle; remove once 'picomatch' releases a fix",
|
|
54
|
+
reviewBy: "2026-12-31"
|
|
55
|
+
}], be = /* @__PURE__ */ new Set(["critical", "high"]), xe = [...ve, ...ye];
|
|
56
|
+
async function Se() {
|
|
52
57
|
try {
|
|
53
58
|
l("Audit Dependencies");
|
|
54
|
-
let e = await
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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`);
|
|
61
|
+
else {
|
|
62
|
+
let e = await n("1️⃣ Check shipped dependencies for any vulnerability", "npm", [
|
|
63
|
+
"audit",
|
|
64
|
+
"--omit=dev",
|
|
65
|
+
"--json"
|
|
66
|
+
]), t = JSON.parse(e);
|
|
67
|
+
if (t.error !== void 0) throw Error(t.error.summary);
|
|
68
|
+
let r = we(D(t), ye, !0);
|
|
69
|
+
if (r.length > 0) throw Error(`${String(r.length)} vulnerabilities found in shipped dependencies`);
|
|
70
|
+
}
|
|
71
|
+
let t = await n("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--json"]), r = JSON.parse(t);
|
|
72
|
+
if (r.error !== void 0) throw Error(r.error.summary);
|
|
73
|
+
let i = we(D(r), xe, !1);
|
|
74
|
+
if (i.length > 0) throw Error(`${String(i.length)} high or critical vulnerabilities found`);
|
|
75
|
+
x("Dependencies audited");
|
|
61
76
|
} catch (e) {
|
|
62
77
|
console.error("❌ Error auditing dependencies", e), process.exit(1);
|
|
63
78
|
}
|
|
64
79
|
}
|
|
65
|
-
async function
|
|
80
|
+
async function Ce(e) {
|
|
66
81
|
let t = JSON.parse(await n(e, "npm", ["audit", "--json"]));
|
|
67
82
|
if (t.error !== void 0) {
|
|
68
83
|
console.warn(`⚠️ Could not check the allow list: ${t.error.summary}`);
|
|
69
84
|
return;
|
|
70
85
|
}
|
|
71
86
|
let r = 0;
|
|
72
|
-
for (let e of
|
|
73
|
-
let t =
|
|
87
|
+
for (let e of D(t)) {
|
|
88
|
+
let t = be.has(e.severity) ? Te(e, xe) : void 0;
|
|
74
89
|
t !== void 0 && (console.warn(`⚠️ ${t.id} ('${e.name}') is on the allow list, so the CI audit ignores it: ${t.reason}`), r++);
|
|
75
90
|
}
|
|
76
91
|
r === 0 && console.info("ℹ️ None of the reported advisories are on the allow list");
|
|
77
92
|
}
|
|
78
|
-
function
|
|
79
|
-
let
|
|
80
|
-
for (let
|
|
81
|
-
if (!
|
|
82
|
-
let e =
|
|
83
|
-
e === void 0 ? (console.error(`❌ ${
|
|
93
|
+
function we(e, t, n) {
|
|
94
|
+
let r = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), i = [];
|
|
95
|
+
for (let a of e) {
|
|
96
|
+
if (!n && !be.has(a.severity)) continue;
|
|
97
|
+
let e = Te(a, t);
|
|
98
|
+
e === void 0 ? (console.error(`❌ ${a.severity} '${a.name}': ${a.title} (${a.url})`), i.push(a)) : e.reviewBy < r ? console.warn(`⚠️ Ignored ${e.id}, but its review date ${e.reviewBy} has passed: ${e.reason}`) : console.info(`ℹ️ Ignored ${e.id}: ${e.reason}`);
|
|
84
99
|
}
|
|
85
|
-
return
|
|
100
|
+
return i;
|
|
86
101
|
}
|
|
87
|
-
function
|
|
88
|
-
let
|
|
89
|
-
return
|
|
102
|
+
function Te(e, t) {
|
|
103
|
+
let n = e.url.slice(e.url.lastIndexOf("/") + 1);
|
|
104
|
+
return t.find((e) => e.id === n);
|
|
90
105
|
}
|
|
91
|
-
function
|
|
106
|
+
function D(e) {
|
|
92
107
|
let t = /* @__PURE__ */ new Map(), n = Object.values(e.vulnerabilities ?? {});
|
|
93
108
|
for (let e of n) for (let n of e.via) typeof n != "string" && t.set(n.url, n);
|
|
94
109
|
return t.values().toArray();
|
|
95
110
|
}
|
|
96
111
|
// src/actions/buildProject.ts
|
|
97
|
-
var
|
|
98
|
-
async function
|
|
112
|
+
var Ee = "build:wasm";
|
|
113
|
+
async function De() {
|
|
99
114
|
try {
|
|
100
|
-
l("Build Project"), await
|
|
115
|
+
l("Build Project"), await Oe("1️⃣ ", await C("package.json")), x("Project built");
|
|
101
116
|
} catch (e) {
|
|
102
117
|
console.error("❌ Error building project", e), process.exit(1);
|
|
103
118
|
}
|
|
104
119
|
}
|
|
105
|
-
async function
|
|
106
|
-
t.scripts?.[
|
|
120
|
+
async function Oe(e, t) {
|
|
121
|
+
t.scripts?.[Ee] != null && await r(`${e} Build WebAssembly`, "npm", ["run", Ee]), await r(`${e} Bundle project`, "vite", ["build"]);
|
|
107
122
|
}
|
|
108
123
|
// src/actions/checkConfigFiles.ts
|
|
109
|
-
var
|
|
110
|
-
async function
|
|
124
|
+
var O = "@dpuse/dpuse-development/prettierrc", ke = "dpuse-development";
|
|
125
|
+
async function Ae() {
|
|
111
126
|
try {
|
|
112
|
-
l("Check configuration files"),
|
|
113
|
-
let e = await
|
|
114
|
-
await
|
|
115
|
-
let o = await t(
|
|
116
|
-
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");
|
|
117
132
|
} catch (e) {
|
|
118
133
|
console.error("❌ Error checking configuration files", e), process.exit(1);
|
|
119
134
|
}
|
|
120
135
|
}
|
|
121
|
-
async function
|
|
136
|
+
async function je(e, t) {
|
|
122
137
|
["github"].includes(e.typeId) ? console.info("ℹ️ File 'eslint.config.js' is NOT required by this project") : [
|
|
123
138
|
"app",
|
|
124
139
|
"api",
|
|
125
140
|
"development",
|
|
126
141
|
"eslint",
|
|
127
142
|
"kb"
|
|
128
|
-
].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"]);
|
|
129
144
|
}
|
|
130
|
-
function
|
|
131
|
-
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 ===
|
|
145
|
+
function Me(e, t) {
|
|
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}'`);
|
|
132
147
|
}
|
|
133
|
-
async function
|
|
148
|
+
async function Ne(e, t) {
|
|
134
149
|
["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
|
|
135
150
|
"connector",
|
|
136
151
|
"cookbook",
|
|
@@ -139,12 +154,12 @@ async function Me(e, t) {
|
|
|
139
154
|
"presenter",
|
|
140
155
|
"shared",
|
|
141
156
|
"tool"
|
|
142
|
-
].includes(e.typeId) ? await
|
|
143
|
-
}
|
|
144
|
-
async function Ne(e, t) {
|
|
145
|
-
["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await D(t, "scripts/tsconfig.json");
|
|
157
|
+
].includes(e.typeId) ? await k(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
|
|
146
158
|
}
|
|
147
159
|
async function Pe(e, t) {
|
|
160
|
+
["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await k(t, "scripts/tsconfig.json");
|
|
161
|
+
}
|
|
162
|
+
async function Fe(e, t) {
|
|
148
163
|
if ([
|
|
149
164
|
"eslint",
|
|
150
165
|
"github",
|
|
@@ -168,26 +183,26 @@ async function Pe(e, t) {
|
|
|
168
183
|
break;
|
|
169
184
|
default: n = ["vite.config.default.ts"];
|
|
170
185
|
}
|
|
171
|
-
await
|
|
186
|
+
await k(t, "vite.config.ts", n);
|
|
172
187
|
}
|
|
173
188
|
}
|
|
174
|
-
async function
|
|
175
|
-
for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await t(n) !== null && await
|
|
189
|
+
async function Ie(e) {
|
|
190
|
+
for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await t(n) !== null && await k(e, n);
|
|
176
191
|
console.info("ℹ️ CodeQL and Scorecard workflows and file 'SECURITY.md' are NOT required by this project");
|
|
177
192
|
}
|
|
178
|
-
async function
|
|
179
|
-
await
|
|
193
|
+
async function Le(e) {
|
|
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");
|
|
180
195
|
}
|
|
181
|
-
async function
|
|
196
|
+
async function Re(e, t) {
|
|
182
197
|
[
|
|
183
198
|
"app",
|
|
184
199
|
"api",
|
|
185
200
|
"github",
|
|
186
201
|
"kb"
|
|
187
|
-
].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");
|
|
188
203
|
}
|
|
189
|
-
async function
|
|
190
|
-
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;
|
|
191
206
|
try {
|
|
192
207
|
o = await s(i);
|
|
193
208
|
} catch (e) {
|
|
@@ -196,7 +211,7 @@ async function D(e, t, n = [], r = (e) => e) {
|
|
|
196
211
|
if (o === void 0) console.info(`❌ File '${t}' is MISSING`);
|
|
197
212
|
else {
|
|
198
213
|
for (let n of a) {
|
|
199
|
-
let i =
|
|
214
|
+
let i = E.resolve(e, `../${n}`), a = r(await s(i));
|
|
200
215
|
if (o === a) {
|
|
201
216
|
console.info(`ℹ️ File '${t}' is the same as '${n}'`);
|
|
202
217
|
return;
|
|
@@ -206,16 +221,16 @@ async function D(e, t, n = [], r = (e) => e) {
|
|
|
206
221
|
}
|
|
207
222
|
}
|
|
208
223
|
// src/actions/checkDependencies.ts
|
|
209
|
-
async function
|
|
224
|
+
async function ze() {
|
|
210
225
|
try {
|
|
211
|
-
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'");
|
|
212
227
|
let e = {};
|
|
213
228
|
try {
|
|
214
|
-
e = await
|
|
229
|
+
e = await C(E.resolve(process.cwd(), ".ncurc.json"));
|
|
215
230
|
} catch (e) {
|
|
216
231
|
if (e.code !== "ENOENT") throw e;
|
|
217
232
|
}
|
|
218
|
-
await
|
|
233
|
+
await fe({
|
|
219
234
|
interactive: !0,
|
|
220
235
|
upgrade: !0,
|
|
221
236
|
dep: "dev,prod,peer,optional",
|
|
@@ -232,16 +247,16 @@ async function Re() {
|
|
|
232
247
|
"fix",
|
|
233
248
|
"--no-strict-allow-scripts",
|
|
234
249
|
"--no-fund"
|
|
235
|
-
], !0), await
|
|
236
|
-
let t = await
|
|
250
|
+
], !0), await Ce("4️⃣ Name the advisories above that the CI audit ignores");
|
|
251
|
+
let t = await Be();
|
|
237
252
|
if (t.length > 0 ? await r("5️⃣ Move install-script pins to installed versions", "npm", [
|
|
238
253
|
"install-scripts",
|
|
239
254
|
"approve",
|
|
240
255
|
...t
|
|
241
|
-
]) :
|
|
242
|
-
let e = await
|
|
243
|
-
await r("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]), await
|
|
244
|
-
} else
|
|
256
|
+
]) : w("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin") {
|
|
257
|
+
let e = await Ve();
|
|
258
|
+
await r("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]), await He(e);
|
|
259
|
+
} else w("6️⃣ Skipped removing unused install-script entries (macOS only)");
|
|
245
260
|
t.length > 0 && await r("7️⃣ Run install scripts skipped in steps 3 and 4", "npm", [
|
|
246
261
|
"rebuild",
|
|
247
262
|
...t,
|
|
@@ -251,71 +266,71 @@ async function Re() {
|
|
|
251
266
|
"--strict-allow-scripts",
|
|
252
267
|
"--no-audit",
|
|
253
268
|
"--no-fund"
|
|
254
|
-
]),
|
|
269
|
+
]), x("Dependencies checked");
|
|
255
270
|
} catch (e) {
|
|
256
271
|
console.error("❌ Error checking dependencies", e), process.exit(1);
|
|
257
272
|
}
|
|
258
273
|
}
|
|
259
|
-
async function
|
|
260
|
-
let e = await
|
|
274
|
+
async function Be() {
|
|
275
|
+
let e = await Ve(), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
|
|
261
276
|
return [...new Set(t)];
|
|
262
277
|
}
|
|
263
|
-
async function
|
|
264
|
-
let { allowScripts: e = {} } = await
|
|
278
|
+
async function Ve() {
|
|
279
|
+
let { allowScripts: e = {} } = await C(E.resolve(process.cwd(), "package.json"));
|
|
265
280
|
return e;
|
|
266
281
|
}
|
|
267
|
-
async function
|
|
268
|
-
let t =
|
|
282
|
+
async function He(e) {
|
|
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));
|
|
269
284
|
if (i.length === 0) return;
|
|
270
|
-
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) => {
|
|
271
286
|
let t = e.lastIndexOf("@"), n = t > 0 ? e.slice(0, t) : e, r = t > 0 ? e.slice(t + 1) : void 0;
|
|
272
287
|
return o.some(([e, t]) => e.endsWith(`node_modules/${n}`) && t.hasInstallScript === !0 && (r === void 0 || t.version === r));
|
|
273
288
|
});
|
|
274
|
-
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(", ")}`));
|
|
275
290
|
}
|
|
276
291
|
// src/actions/checkProject.ts
|
|
277
|
-
async function
|
|
278
|
-
await
|
|
292
|
+
async function Ue() {
|
|
293
|
+
await Ae(), await ze();
|
|
279
294
|
}
|
|
280
295
|
// src/actions/documentActions.ts
|
|
281
|
-
var
|
|
296
|
+
var We = "<!-- SUPPORTED_ACTIONS_START -->", Ge = "<!-- SUPPORTED_ACTIONS_END -->", Ke = "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.", qe = {
|
|
282
297
|
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.",
|
|
283
298
|
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.",
|
|
284
299
|
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.",
|
|
285
300
|
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."
|
|
286
|
-
},
|
|
287
|
-
async function
|
|
301
|
+
}, Je = "The table below lists all connector actions and highlights those supported by this connector.";
|
|
302
|
+
async function Ye() {
|
|
288
303
|
try {
|
|
289
|
-
l("Document Actions"),
|
|
290
|
-
let t = (await
|
|
291
|
-
await e(o,
|
|
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");
|
|
292
307
|
} catch (e) {
|
|
293
308
|
console.error("❌ Error documenting actions", e), process.exit(1);
|
|
294
309
|
}
|
|
295
310
|
}
|
|
296
311
|
// src/actions/documentContributingLicense.ts
|
|
297
|
-
async function
|
|
312
|
+
async function Xe() {
|
|
298
313
|
try {
|
|
299
314
|
l("Document Contributing & License");
|
|
300
|
-
let [t, n] = await Promise.all([
|
|
301
|
-
|
|
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");
|
|
302
317
|
} catch (e) {
|
|
303
318
|
console.error("❌ Error documenting contributing and license", e), process.exit(1);
|
|
304
319
|
}
|
|
305
320
|
}
|
|
306
|
-
function
|
|
321
|
+
function Ze(e) {
|
|
307
322
|
let t = e.author, n = typeof t == "string" ? t : t?.name;
|
|
308
323
|
if (n == null || n === "") throw Error("package.json 'author' field is required to document contributing and license.");
|
|
309
324
|
let r = n.indexOf("<"), i = r === -1 ? -1 : n.indexOf(">", r);
|
|
310
325
|
return i === -1 ? n.trim() : [n.slice(0, r).trim(), n.slice(i + 1).trim()].filter((e) => e !== "").join(" ");
|
|
311
326
|
}
|
|
312
|
-
function
|
|
327
|
+
function Qe(e) {
|
|
313
328
|
let t = (/* @__PURE__ */ new Date()).getFullYear();
|
|
314
329
|
if (e == null) return String(t);
|
|
315
330
|
let n = new Date(e).getFullYear();
|
|
316
331
|
return n === t ? String(t) : `${String(n)}-present`;
|
|
317
332
|
}
|
|
318
|
-
function
|
|
333
|
+
function $e(e, t, n, r) {
|
|
319
334
|
return `## Contributing
|
|
320
335
|
|
|
321
336
|
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.
|
|
@@ -329,12 +344,12 @@ This project is licensed under the MIT License, permitting free use, modificatio
|
|
|
329
344
|
[MIT](./LICENSE) © ${r} ${n}`;
|
|
330
345
|
}
|
|
331
346
|
// src/utilities/rustCrates.ts
|
|
332
|
-
var
|
|
333
|
-
async function
|
|
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";
|
|
348
|
+
async function at(e, n) {
|
|
334
349
|
if (await t("rust/Cargo.toml") === null) return null;
|
|
335
350
|
let r = [
|
|
336
351
|
"--manifest-path",
|
|
337
|
-
|
|
352
|
+
y,
|
|
338
353
|
"--locked"
|
|
339
354
|
], i = [
|
|
340
355
|
"tree",
|
|
@@ -343,22 +358,22 @@ async function it(e, n) {
|
|
|
343
358
|
"--edges",
|
|
344
359
|
"normal,no-proc-macro",
|
|
345
360
|
"--target",
|
|
346
|
-
|
|
361
|
+
it,
|
|
347
362
|
"--prefix",
|
|
348
363
|
"depth",
|
|
349
364
|
"--format",
|
|
350
365
|
"{p}|{l}|{r}"
|
|
351
366
|
];
|
|
352
|
-
await o(e, "cargo", i,
|
|
367
|
+
await o(e, "cargo", i, j), await o(e, "cargo", [
|
|
353
368
|
"metadata",
|
|
354
369
|
...r,
|
|
355
370
|
"--format-version",
|
|
356
371
|
"1",
|
|
357
372
|
"--filter-platform",
|
|
358
|
-
|
|
359
|
-
],
|
|
360
|
-
let a =
|
|
361
|
-
await
|
|
373
|
+
it
|
|
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 });
|
|
362
377
|
let l = /* @__PURE__ */ new Map();
|
|
363
378
|
for (let e of a) e.isOwn || l.has(`${e.name}@${e.version}`) || l.set(`${e.name}@${e.version}`, {
|
|
364
379
|
name: e.name,
|
|
@@ -371,9 +386,9 @@ async function it(e, n) {
|
|
|
371
386
|
latestPublishedDate: ""
|
|
372
387
|
});
|
|
373
388
|
let u = l.values().toArray();
|
|
374
|
-
|
|
375
|
-
for (let e of u) e.licenseFiles = await
|
|
376
|
-
return await
|
|
389
|
+
st(u, n);
|
|
390
|
+
for (let e of u) e.licenseFiles = await ut(e, c);
|
|
391
|
+
return await dt(e, u), {
|
|
377
392
|
crates: u,
|
|
378
393
|
treeItems: a.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
|
|
379
394
|
name: e,
|
|
@@ -383,7 +398,7 @@ async function it(e, n) {
|
|
|
383
398
|
}))
|
|
384
399
|
};
|
|
385
400
|
}
|
|
386
|
-
function
|
|
401
|
+
function ot(e) {
|
|
387
402
|
let t = [];
|
|
388
403
|
for (let n of e.split("\n")) {
|
|
389
404
|
let [e = "", r = "", i = ""] = n.trim().split("|", 3), a = /^\d+/.exec(e)?.[0];
|
|
@@ -400,49 +415,49 @@ function at(e) {
|
|
|
400
415
|
}
|
|
401
416
|
return t;
|
|
402
417
|
}
|
|
403
|
-
function
|
|
404
|
-
let n = t.split(";").filter((e) =>
|
|
418
|
+
function st(e, t) {
|
|
419
|
+
let n = t.split(";").filter((e) => ct(e)), r = e.filter((e) => !lt(e.licenseExpression, n));
|
|
405
420
|
if (r.length === 0) return;
|
|
406
421
|
let i = r.map((e) => `${e.name}@${e.version} (${e.licenseExpression === "" ? "no licence" : e.licenseExpression})`).join(", ");
|
|
407
422
|
throw Error(`Rust crates with licences not allowed: ${i}.`);
|
|
408
423
|
}
|
|
409
|
-
function
|
|
424
|
+
function ct(e) {
|
|
410
425
|
try {
|
|
411
|
-
return
|
|
426
|
+
return he(e, [e]);
|
|
412
427
|
} catch {
|
|
413
428
|
return !1;
|
|
414
429
|
}
|
|
415
430
|
}
|
|
416
|
-
function
|
|
431
|
+
function lt(e, t) {
|
|
417
432
|
try {
|
|
418
|
-
return
|
|
433
|
+
return he(e.replaceAll("/", " OR "), t);
|
|
419
434
|
} catch {
|
|
420
435
|
return !1;
|
|
421
436
|
}
|
|
422
437
|
}
|
|
423
|
-
async function
|
|
438
|
+
async function ut(e, t) {
|
|
424
439
|
let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
|
|
425
440
|
if (n == null) return [];
|
|
426
|
-
let r =
|
|
427
|
-
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 });
|
|
428
443
|
let a = [];
|
|
429
444
|
for (let t of i) {
|
|
430
445
|
let n = `downloads/${e.name}@${e.version}-${t}`;
|
|
431
|
-
await
|
|
446
|
+
await T.copyFile(E.join(r, t), E.join("licenses", n)), a.push({
|
|
432
447
|
label: t,
|
|
433
448
|
path: n
|
|
434
449
|
});
|
|
435
450
|
}
|
|
436
451
|
return a;
|
|
437
452
|
}
|
|
438
|
-
async function
|
|
439
|
-
|
|
453
|
+
async function dt(e, t) {
|
|
454
|
+
w(`${e} - fetch release dates from crates.io`);
|
|
440
455
|
for (let [e, n] of t.entries()) {
|
|
441
|
-
e > 0 && await
|
|
456
|
+
e > 0 && await me(et), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
|
|
442
457
|
try {
|
|
443
458
|
let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, {
|
|
444
|
-
headers: { "User-Agent":
|
|
445
|
-
signal: AbortSignal.timeout(
|
|
459
|
+
headers: { "User-Agent": nt },
|
|
460
|
+
signal: AbortSignal.timeout(tt)
|
|
446
461
|
});
|
|
447
462
|
if (!e.ok) continue;
|
|
448
463
|
let t = await e.json(), r = new Map((t.versions ?? []).map((e) => [e.num, e.created_at]));
|
|
@@ -451,77 +466,77 @@ async function ut(e, t) {
|
|
|
451
466
|
}
|
|
452
467
|
}
|
|
453
468
|
// src/actions/documentDependencies.ts
|
|
454
|
-
var
|
|
455
|
-
async function
|
|
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}`;
|
|
470
|
+
async function gt(e = "MIT") {
|
|
456
471
|
try {
|
|
457
472
|
l("Document Dependencies");
|
|
458
|
-
let t = await
|
|
459
|
-
if (
|
|
460
|
-
await
|
|
473
|
+
let t = await C("package.json"), n = t.name ?? "";
|
|
474
|
+
if (re.has(n)) {
|
|
475
|
+
await _t(n), x("Dependencies documented");
|
|
461
476
|
return;
|
|
462
477
|
}
|
|
463
478
|
await m("1️⃣ Clear downloaded licenses", "licenses/downloads");
|
|
464
|
-
let r = await
|
|
479
|
+
let r = await Et(), i = await Dt();
|
|
465
480
|
if (i === null) {
|
|
466
|
-
let n =
|
|
467
|
-
await
|
|
481
|
+
let n = jt(r);
|
|
482
|
+
await Tt("2️⃣ Identify production licenses", e, [t.name ?? "", ...n], !0), await o("3️⃣ Identify transitive dependencies", "npm", [
|
|
468
483
|
"ls",
|
|
469
484
|
"--all",
|
|
470
485
|
"--json",
|
|
471
486
|
"--omit=dev"
|
|
472
|
-
],
|
|
487
|
+
], F), await vt("4️⃣ ", e, new Set(n));
|
|
473
488
|
} else {
|
|
474
|
-
let n =
|
|
475
|
-
await
|
|
489
|
+
let n = Ot(i, r), a = kt(r), s = a.filter((e) => !n.has(e));
|
|
490
|
+
await Tt("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), At(n, new Set(a)), await o("3️⃣ Identify transitive dependencies", "npm", [
|
|
476
491
|
"ls",
|
|
477
492
|
"--all",
|
|
478
493
|
"--json"
|
|
479
|
-
],
|
|
480
|
-
let c = await
|
|
494
|
+
], F, !0);
|
|
495
|
+
let c = await at("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
|
|
481
496
|
allowedLicenses: e,
|
|
482
|
-
productionNames:
|
|
497
|
+
productionNames: Ct(t),
|
|
483
498
|
rustCrates: c,
|
|
484
499
|
shippedKeys: n
|
|
485
500
|
};
|
|
486
|
-
await
|
|
501
|
+
await yt(c === null ? "4️⃣ " : "5️⃣ ", l);
|
|
487
502
|
}
|
|
488
|
-
|
|
503
|
+
x("Dependencies documented");
|
|
489
504
|
} catch (e) {
|
|
490
505
|
console.error("❌ Error documenting dependencies", e), process.exit(1);
|
|
491
506
|
}
|
|
492
507
|
}
|
|
493
|
-
async function
|
|
494
|
-
|
|
508
|
+
async function _t(t) {
|
|
509
|
+
w(`1️⃣ Skip: ${t} is a development-only tool and is never part of a production release.`);
|
|
495
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.`;
|
|
496
|
-
await e(`${
|
|
511
|
+
await e(`${P}\n\n${n}`, M, N);
|
|
497
512
|
}
|
|
498
|
-
async function
|
|
499
|
-
|
|
500
|
-
let i = await
|
|
501
|
-
for (let e of a.values()) o +=
|
|
513
|
+
async function vt(t, n, r) {
|
|
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);
|
|
502
517
|
let s = [];
|
|
503
|
-
i.dependencies != null &&
|
|
504
|
-
let c = `${
|
|
505
|
-
await e(`${
|
|
506
|
-
}
|
|
507
|
-
async function
|
|
508
|
-
|
|
509
|
-
let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = n, s = await
|
|
510
|
-
for (let e of s.values().toArray().toSorted(
|
|
511
|
-
for (let e of c.values().toArray().toSorted(
|
|
512
|
-
let f = await
|
|
513
|
-
|
|
518
|
+
i.dependencies != null && zt(i.dependencies, a, r, s, 0);
|
|
519
|
+
let c = `${mt}\n\n${s.join("\n")}`;
|
|
520
|
+
await e(`${P}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${c}`, M, N);
|
|
521
|
+
}
|
|
522
|
+
async function yt(t, n) {
|
|
523
|
+
w(`${t} Insert licenses into 'README.md'`);
|
|
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`;
|
|
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, {
|
|
514
529
|
licensesByKey: s,
|
|
515
530
|
shippedKeys: o,
|
|
516
531
|
shownKeys: /* @__PURE__ */ new Set()
|
|
517
532
|
}, m, 0, !1);
|
|
518
|
-
let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) =>
|
|
519
|
-
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);
|
|
520
535
|
}
|
|
521
|
-
function
|
|
536
|
+
function bt(e, t) {
|
|
522
537
|
return e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en");
|
|
523
538
|
}
|
|
524
|
-
function
|
|
539
|
+
function xt(e) {
|
|
525
540
|
return {
|
|
526
541
|
name: e.name,
|
|
527
542
|
repository: e.repository,
|
|
@@ -534,27 +549,27 @@ function bt(e) {
|
|
|
534
549
|
licenseFiles: e.licenseFiles
|
|
535
550
|
};
|
|
536
551
|
}
|
|
537
|
-
function
|
|
552
|
+
function St(e, t) {
|
|
538
553
|
let n = " ".repeat(e.depth);
|
|
539
|
-
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);
|
|
540
555
|
}
|
|
541
|
-
function
|
|
556
|
+
function Ct(e) {
|
|
542
557
|
return /* @__PURE__ */ new Set([
|
|
543
558
|
...Object.keys(e.dependencies ?? {}),
|
|
544
559
|
...Object.keys(e.optionalDependencies ?? {}),
|
|
545
560
|
...Object.keys(e.peerDependencies ?? {})
|
|
546
561
|
]);
|
|
547
562
|
}
|
|
548
|
-
async function
|
|
549
|
-
let e = await
|
|
550
|
-
for (let [n, r] of Object.entries(e)) t.set(n,
|
|
563
|
+
async function wt() {
|
|
564
|
+
let e = await C("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
|
|
565
|
+
for (let [n, r] of Object.entries(e)) t.set(n, Lt(n, r));
|
|
551
566
|
return await Promise.all(t.values().map(async (e) => {
|
|
552
|
-
let t = await
|
|
567
|
+
let t = await Rt(e.name, e.installedVersion);
|
|
553
568
|
e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
|
|
554
569
|
})), t;
|
|
555
570
|
}
|
|
556
|
-
async function
|
|
557
|
-
|
|
571
|
+
async function Tt(e, t, n, r) {
|
|
572
|
+
w(e), await new Promise((e, i) => {
|
|
558
573
|
let a = {
|
|
559
574
|
start: process.cwd(),
|
|
560
575
|
production: r,
|
|
@@ -566,63 +581,63 @@ async function wt(e, t, n, r) {
|
|
|
566
581
|
excludePackages: n.join(";"),
|
|
567
582
|
out: "licenses/licenses.json"
|
|
568
583
|
};
|
|
569
|
-
|
|
584
|
+
pe(a, (t) => {
|
|
570
585
|
t == null ? e() : i(t);
|
|
571
586
|
});
|
|
572
587
|
});
|
|
573
588
|
}
|
|
574
|
-
async function
|
|
589
|
+
async function Et() {
|
|
575
590
|
let e = await t("package-lock.json");
|
|
576
591
|
return e === null ? {} : JSON.parse(e).packages ?? {};
|
|
577
592
|
}
|
|
578
|
-
async function
|
|
579
|
-
let e = await t(
|
|
593
|
+
async function Dt() {
|
|
594
|
+
let e = await t(ft);
|
|
580
595
|
return e === null ? null : JSON.parse(e);
|
|
581
596
|
}
|
|
582
|
-
function
|
|
597
|
+
function Ot(e, t) {
|
|
583
598
|
let n = new Set(e.packages);
|
|
584
599
|
for (let r of e.external) {
|
|
585
|
-
let e =
|
|
586
|
-
if (e !== void 0) for (let r of [e, ...
|
|
600
|
+
let e = Pt(t, "", r);
|
|
601
|
+
if (e !== void 0) for (let r of [e, ...Mt(t, e)]) {
|
|
587
602
|
let e = t[r];
|
|
588
|
-
e?.version !== void 0 && n.add(
|
|
603
|
+
e?.version !== void 0 && n.add(I(r, e));
|
|
589
604
|
}
|
|
590
605
|
}
|
|
591
606
|
return n;
|
|
592
607
|
}
|
|
593
|
-
function
|
|
608
|
+
function kt(e) {
|
|
594
609
|
let t = /* @__PURE__ */ new Set();
|
|
595
|
-
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));
|
|
596
611
|
return [...t];
|
|
597
612
|
}
|
|
598
|
-
function
|
|
613
|
+
function At(e, t) {
|
|
599
614
|
let n = [...e.difference(t)];
|
|
600
615
|
n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
|
|
601
616
|
}
|
|
602
|
-
function
|
|
617
|
+
function I(e, t) {
|
|
603
618
|
return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
|
|
604
619
|
}
|
|
605
|
-
function
|
|
606
|
-
let t =
|
|
620
|
+
function jt(e) {
|
|
621
|
+
let t = Mt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
607
622
|
for (let [i, a] of Object.entries(e)) {
|
|
608
623
|
if (i === "" || a.version === void 0) continue;
|
|
609
|
-
let e =
|
|
624
|
+
let e = I(i, a);
|
|
610
625
|
t.has(i) ? n.add(e) : r.add(e);
|
|
611
626
|
}
|
|
612
627
|
return r.values().filter((e) => !n.has(e)).toArray();
|
|
613
628
|
}
|
|
614
|
-
function
|
|
629
|
+
function Mt(e, t) {
|
|
615
630
|
let n = /* @__PURE__ */ new Set(), r = [t];
|
|
616
631
|
for (; r.length > 0;) {
|
|
617
632
|
let t = r.pop() ?? "", i = e[t];
|
|
618
|
-
if (i !== void 0) for (let a of
|
|
619
|
-
let i =
|
|
633
|
+
if (i !== void 0) for (let a of Nt(i)) {
|
|
634
|
+
let i = Pt(e, t, a);
|
|
620
635
|
i === void 0 || n.has(i) || (n.add(i), r.push(i));
|
|
621
636
|
}
|
|
622
637
|
}
|
|
623
638
|
return n;
|
|
624
639
|
}
|
|
625
|
-
function
|
|
640
|
+
function Nt(e) {
|
|
626
641
|
let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
|
|
627
642
|
return [
|
|
628
643
|
...Object.keys(e.dependencies ?? {}),
|
|
@@ -630,7 +645,7 @@ function Mt(e) {
|
|
|
630
645
|
...t
|
|
631
646
|
];
|
|
632
647
|
}
|
|
633
|
-
function
|
|
648
|
+
function Pt(e, t, n) {
|
|
634
649
|
let r = t;
|
|
635
650
|
for (;;) {
|
|
636
651
|
let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
|
|
@@ -640,14 +655,14 @@ function Nt(e, t, n) {
|
|
|
640
655
|
r = a === -1 ? "" : r.slice(0, a);
|
|
641
656
|
}
|
|
642
657
|
}
|
|
643
|
-
function
|
|
644
|
-
let r =
|
|
658
|
+
function Ft(e, t, n = !1) {
|
|
659
|
+
let r = It(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.";
|
|
645
660
|
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.`;
|
|
646
661
|
}
|
|
647
|
-
function
|
|
662
|
+
function It(e) {
|
|
648
663
|
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))}`;
|
|
649
664
|
}
|
|
650
|
-
function
|
|
665
|
+
function Lt(e, t) {
|
|
651
666
|
let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
|
|
652
667
|
return {
|
|
653
668
|
name: r,
|
|
@@ -664,7 +679,7 @@ function It(e, t) {
|
|
|
664
679
|
}]
|
|
665
680
|
};
|
|
666
681
|
}
|
|
667
|
-
async function
|
|
682
|
+
async function Rt(e, t) {
|
|
668
683
|
try {
|
|
669
684
|
let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
|
|
670
685
|
if (n.ok) {
|
|
@@ -682,36 +697,36 @@ async function Lt(e, t) {
|
|
|
682
697
|
publishedDate: ""
|
|
683
698
|
};
|
|
684
699
|
}
|
|
685
|
-
function
|
|
700
|
+
function L(e, t) {
|
|
686
701
|
let n = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
|
|
687
702
|
return `${t === void 0 ? "" : `|${t}`}|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${n}|\n`;
|
|
688
703
|
}
|
|
689
|
-
function
|
|
704
|
+
function zt(e, t, n, r, i) {
|
|
690
705
|
let a = " ".repeat(i);
|
|
691
706
|
for (let [o, s] of Object.entries(e)) {
|
|
692
707
|
if (s.version === void 0) continue;
|
|
693
708
|
let e = s.version;
|
|
694
|
-
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));
|
|
695
710
|
}
|
|
696
711
|
}
|
|
697
|
-
function
|
|
712
|
+
function R(e, t, n, r, i) {
|
|
698
713
|
for (let [a, o] of e) {
|
|
699
714
|
if (o.version === void 0) continue;
|
|
700
715
|
let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
|
|
701
|
-
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);
|
|
702
717
|
}
|
|
703
718
|
}
|
|
704
|
-
function
|
|
705
|
-
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)}`;
|
|
706
721
|
}
|
|
707
|
-
function
|
|
722
|
+
function Bt(e) {
|
|
708
723
|
if (e == null) return "";
|
|
709
|
-
let t = e.publishedDate ?
|
|
724
|
+
let t = e.publishedDate ? Vt(e.publishedDate.split("T", 1)[0]) : "";
|
|
710
725
|
if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
|
|
711
|
-
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} ❗`;
|
|
712
727
|
return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
|
|
713
728
|
}
|
|
714
|
-
function
|
|
729
|
+
function Vt(e) {
|
|
715
730
|
if (e == null || e === "") return "n/a";
|
|
716
731
|
let t = e.split("T", 1)[0];
|
|
717
732
|
if (t == null || t === "") return "n/a";
|
|
@@ -719,42 +734,42 @@ function Bt(e) {
|
|
|
719
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} ⚠️`;
|
|
720
735
|
}
|
|
721
736
|
// src/actions/documentOpening.ts
|
|
722
|
-
var
|
|
723
|
-
async function
|
|
737
|
+
var Ht = "<!-- OPENING_START -->", Ut = "<!-- OPENING_END -->";
|
|
738
|
+
async function Wt() {
|
|
724
739
|
try {
|
|
725
|
-
l("Document Opening"),
|
|
726
|
-
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, {
|
|
727
742
|
description: t.description,
|
|
728
743
|
dpuseModuleId: c,
|
|
729
744
|
introduction: o,
|
|
730
745
|
npmPackageName: u,
|
|
731
746
|
version: t.version
|
|
732
747
|
});
|
|
733
|
-
await e(d,
|
|
748
|
+
await e(d, Ht, Ut), x("Opening documented");
|
|
734
749
|
} catch (e) {
|
|
735
750
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
736
751
|
}
|
|
737
752
|
}
|
|
738
|
-
function
|
|
753
|
+
function Gt(e) {
|
|
739
754
|
return e === void 0 ? "blue" : /^v?0/.test(e) || /alpha|beta|snapshot|dev|pre|rc/i.test(e) ? "orange" : "blue";
|
|
740
755
|
}
|
|
741
|
-
function
|
|
756
|
+
function Kt(e) {
|
|
742
757
|
let t = e.license;
|
|
743
758
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
744
759
|
return t;
|
|
745
760
|
}
|
|
746
|
-
function
|
|
761
|
+
function qt(e) {
|
|
747
762
|
let t = e.name;
|
|
748
763
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
|
|
749
764
|
return t;
|
|
750
765
|
}
|
|
751
|
-
function
|
|
766
|
+
function Jt(e) {
|
|
752
767
|
let t = e.description.en?.trim();
|
|
753
768
|
return t === void 0 || t === "" ? void 0 : t;
|
|
754
769
|
}
|
|
755
|
-
function
|
|
770
|
+
function Yt(e, t, n, r) {
|
|
756
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 ?? ""}`);
|
|
757
|
-
return `[](./LICENSE)${a === void 0 ? "" : `\n[](./LICENSE)${a === void 0 ? "" : `\n[})](${l}/releases/latest)`}${s === void 0 ? "" : `\n[](https://www.npmjs.com/package/${s})`}
|
|
758
773
|
[](${l}/actions/workflows/ci.yml)${i == null || i === "" ? "" : `\n\n${i}`}
|
|
759
774
|
|
|
760
775
|
[Report a Vulnerability](${l}/security/advisories/new) · [Open an Issue](${l}/issues)
|
|
@@ -772,43 +787,43 @@ function Jt(e, t, n, r) {
|
|
|
772
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}`}`;
|
|
773
788
|
}
|
|
774
789
|
// src/actions/documentQualitySecurity.ts
|
|
775
|
-
var
|
|
790
|
+
var Xt = {
|
|
776
791
|
"Branch-Protection": 3,
|
|
777
792
|
"Code-Review": 0,
|
|
778
793
|
Contributors: 0
|
|
779
|
-
},
|
|
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 = {
|
|
780
795
|
actions: "GitHub Actions",
|
|
781
796
|
"javascript-typescript": "JavaScript/TypeScript",
|
|
782
797
|
rust: "Rust"
|
|
783
|
-
},
|
|
798
|
+
}, an = {
|
|
784
799
|
A: "brightgreen",
|
|
785
800
|
B: "green",
|
|
786
801
|
C: "yellow",
|
|
787
802
|
D: "orange",
|
|
788
803
|
F: "red"
|
|
789
|
-
},
|
|
790
|
-
async function
|
|
804
|
+
}, on = `${u}/health.json`, sn = le(ue);
|
|
805
|
+
async function cn() {
|
|
791
806
|
try {
|
|
792
807
|
l("Document Quality & Security");
|
|
793
|
-
let t = await
|
|
794
|
-
|
|
795
|
-
let o = await
|
|
796
|
-
|
|
797
|
-
let [s, c] = await Promise.all([
|
|
798
|
-
|
|
799
|
-
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, {
|
|
800
815
|
coveragePercent: n,
|
|
801
816
|
fallowHealth: r,
|
|
802
817
|
securitySettings: o
|
|
803
818
|
}, s, c);
|
|
804
|
-
await d(), await e(u, f,
|
|
819
|
+
await d(), await e(u, f, ie), x("Quality & security documented");
|
|
805
820
|
} catch (e) {
|
|
806
821
|
console.error("❌ Error documenting quality and security", e), process.exit(1);
|
|
807
822
|
}
|
|
808
823
|
}
|
|
809
|
-
async function
|
|
824
|
+
async function ln(e) {
|
|
810
825
|
if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
|
|
811
|
-
|
|
826
|
+
w("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
|
|
812
827
|
return;
|
|
813
828
|
}
|
|
814
829
|
await r("1️⃣ Measure test coverage", "vitest", [
|
|
@@ -816,27 +831,27 @@ async function cn(e) {
|
|
|
816
831
|
"--passWithNoTests",
|
|
817
832
|
"--coverage"
|
|
818
833
|
]);
|
|
819
|
-
let n = await t(
|
|
834
|
+
let n = await t($t);
|
|
820
835
|
if (n === null) return;
|
|
821
836
|
let i = JSON.parse(n).total.lines.pct;
|
|
822
|
-
if (i !== "Unknown") return await
|
|
837
|
+
if (i !== "Unknown") return await un(i), i;
|
|
823
838
|
}
|
|
824
|
-
async function
|
|
839
|
+
async function un(e) {
|
|
825
840
|
let t = [
|
|
826
841
|
"red",
|
|
827
842
|
"yellow",
|
|
828
843
|
"brightgreen"
|
|
829
|
-
], n = Number(e >=
|
|
830
|
-
await
|
|
844
|
+
], n = Number(e >= tn) + Number(e >= en);
|
|
845
|
+
await v(nn, {
|
|
831
846
|
schemaVersion: 1,
|
|
832
847
|
label: "coverage",
|
|
833
848
|
message: `${e.toFixed(1)}%`,
|
|
834
849
|
color: t[n]
|
|
835
850
|
});
|
|
836
851
|
}
|
|
837
|
-
async function
|
|
852
|
+
async function dn(e, t) {
|
|
838
853
|
if (e.devDependencies?.fallow == null) {
|
|
839
|
-
|
|
854
|
+
w("2️⃣ Code health NOT measured, as Fallow is not installed"), w("3️⃣ Code health report NOT required");
|
|
840
855
|
return;
|
|
841
856
|
}
|
|
842
857
|
await o("2️⃣ Measure code health", "fallow", [
|
|
@@ -845,32 +860,32 @@ async function un(e, t) {
|
|
|
845
860
|
"--format",
|
|
846
861
|
"json",
|
|
847
862
|
...t
|
|
848
|
-
],
|
|
849
|
-
let n = await
|
|
850
|
-
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;
|
|
851
866
|
}
|
|
852
|
-
async function
|
|
867
|
+
async function fn(e) {
|
|
853
868
|
let { score: t, grade: n } = e.health_score;
|
|
854
|
-
await _
|
|
869
|
+
await v(_, {
|
|
855
870
|
schemaVersion: 1,
|
|
856
871
|
label: "fallow",
|
|
857
872
|
message: `${n} (${String(Math.round(t))})`,
|
|
858
|
-
color:
|
|
873
|
+
color: an[n] ?? "lightgrey"
|
|
859
874
|
});
|
|
860
875
|
}
|
|
861
|
-
async function
|
|
876
|
+
async function pn(e, n, r) {
|
|
862
877
|
let [i, a, o] = await Promise.all([
|
|
863
878
|
t(".github/workflows/ci.yml"),
|
|
864
879
|
t(".github/dependabot.yml"),
|
|
865
|
-
t(
|
|
880
|
+
t(y)
|
|
866
881
|
]), s = await t(".github/workflows/codeql.yml") ?? "", [c, l, u, d] = await Promise.all([
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
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`)
|
|
871
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;
|
|
872
887
|
return {
|
|
873
|
-
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(),
|
|
874
889
|
codeQLQueries: /queries: ([\w-]+)/.exec(s)?.[1],
|
|
875
890
|
dependabotAlerts: u !== void 0,
|
|
876
891
|
dependabotSecurityUpdates: p("dependabot_security_updates"),
|
|
@@ -887,37 +902,37 @@ async function fn(e, n, r) {
|
|
|
887
902
|
testsInCI: i?.includes("npm test") ?? !1
|
|
888
903
|
};
|
|
889
904
|
}
|
|
890
|
-
async function
|
|
905
|
+
async function B(e) {
|
|
891
906
|
try {
|
|
892
|
-
let { stdout: t } = await
|
|
907
|
+
let { stdout: t } = await sn("gh", ["api", e]);
|
|
893
908
|
return t;
|
|
894
909
|
} catch (e) {
|
|
895
910
|
if (String(e.stderr).includes("HTTP 404")) return;
|
|
896
911
|
throw e;
|
|
897
912
|
}
|
|
898
913
|
}
|
|
899
|
-
async function
|
|
914
|
+
async function mn(e) {
|
|
900
915
|
let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
|
|
901
916
|
if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
|
|
902
917
|
return (await t.json()).find((t) => t.repo_url === e)?.id;
|
|
903
918
|
}
|
|
904
|
-
async function
|
|
919
|
+
async function hn(e) {
|
|
905
920
|
let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
|
|
906
921
|
if (t.status !== 404) {
|
|
907
922
|
if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
|
|
908
923
|
return await t.json();
|
|
909
924
|
}
|
|
910
925
|
}
|
|
911
|
-
function hn(e) {
|
|
912
|
-
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Xt.has(e) || Yt[e] !== void 0 && t >= Yt[e]);
|
|
913
|
-
}
|
|
914
926
|
function gn(e) {
|
|
927
|
+
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Zt.has(e) || Xt[e] !== void 0 && t >= Xt[e]);
|
|
928
|
+
}
|
|
929
|
+
function _n(e) {
|
|
915
930
|
return e === !1 ? " These are handled manually." : "";
|
|
916
931
|
}
|
|
917
|
-
function
|
|
932
|
+
function V(e) {
|
|
918
933
|
return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
|
|
919
934
|
}
|
|
920
|
-
function
|
|
935
|
+
function H(e, t) {
|
|
921
936
|
return t.length === 0 ? "" : `### ${e}
|
|
922
937
|
|
|
923
938
|
|Check|Status|What it does|
|
|
@@ -926,90 +941,90 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
|
|
|
926
941
|
|
|
927
942
|
`;
|
|
928
943
|
}
|
|
929
|
-
function
|
|
944
|
+
function vn(e, t, n, r) {
|
|
930
945
|
return `})`;
|
|
931
946
|
}
|
|
932
|
-
function
|
|
947
|
+
function yn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
933
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 = [[
|
|
934
949
|
"Unit tests",
|
|
935
|
-
|
|
950
|
+
V(i.testsInCI),
|
|
936
951
|
`[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
|
|
937
952
|
], [
|
|
938
953
|
"Property-based tests",
|
|
939
|
-
|
|
954
|
+
V(i.propertyTests),
|
|
940
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)}`
|
|
941
956
|
]];
|
|
942
957
|
n !== void 0 && s.push([
|
|
943
958
|
"Test coverage",
|
|
944
|
-
|
|
945
|
-
`${
|
|
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)}%.`
|
|
946
961
|
]);
|
|
947
962
|
let c = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, l = [[
|
|
948
963
|
"Code analysis",
|
|
949
|
-
|
|
964
|
+
V(i.sonarCloud),
|
|
950
965
|
`${i.sonarCloud ? c : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
|
|
951
966
|
], [
|
|
952
967
|
"Linting",
|
|
953
|
-
|
|
968
|
+
V(i.lintInCI),
|
|
954
969
|
`[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
|
|
955
970
|
]];
|
|
956
971
|
r !== void 0 && l.unshift([
|
|
957
972
|
"Code health",
|
|
958
|
-
|
|
959
|
-
`[${
|
|
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.`
|
|
960
975
|
]);
|
|
961
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 = [
|
|
962
977
|
[
|
|
963
978
|
"Push protection",
|
|
964
|
-
|
|
979
|
+
V(i.pushProtection),
|
|
965
980
|
"[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
|
|
966
981
|
],
|
|
967
982
|
[
|
|
968
983
|
"Static analysis",
|
|
969
|
-
|
|
984
|
+
V(u),
|
|
970
985
|
`${u ? d : ""}[CodeQL](https://codeql.github.com) scans${p} for security vulnerabilities, ${f}, on every push and pull request to \`main\` and weekly.`
|
|
971
986
|
],
|
|
972
987
|
[
|
|
973
988
|
"Secret scanning",
|
|
974
|
-
|
|
989
|
+
V(i.secretScanning),
|
|
975
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."
|
|
976
991
|
]
|
|
977
992
|
], h = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", g = [
|
|
978
993
|
[
|
|
979
994
|
"Vulnerability audit",
|
|
980
|
-
|
|
995
|
+
V(i.npmAuditInCI),
|
|
981
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)}`
|
|
982
997
|
],
|
|
983
998
|
[
|
|
984
999
|
"Supply chain risk",
|
|
985
|
-
|
|
1000
|
+
V(i.socket),
|
|
986
1001
|
"[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
|
|
987
1002
|
],
|
|
988
1003
|
[
|
|
989
1004
|
"Security alerts",
|
|
990
|
-
|
|
1005
|
+
V(i.dependabotAlerts),
|
|
991
1006
|
`${h} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
|
|
992
1007
|
],
|
|
993
1008
|
[
|
|
994
1009
|
"Security updates",
|
|
995
|
-
|
|
996
|
-
`${h} opens pull requests that update vulnerable dependencies.${
|
|
1010
|
+
V(i.dependabotSecurityUpdates),
|
|
1011
|
+
`${h} opens pull requests that update vulnerable dependencies.${_n(i.dependabotSecurityUpdates)}`
|
|
997
1012
|
],
|
|
998
1013
|
[
|
|
999
1014
|
"Version updates",
|
|
1000
|
-
|
|
1001
|
-
`${h} opens pull requests for new dependency versions.${
|
|
1015
|
+
V(i.dependabotVersionUpdates),
|
|
1016
|
+
`${h} opens pull requests for new dependency versions.${_n(i.dependabotVersionUpdates)}`
|
|
1002
1017
|
]
|
|
1003
1018
|
];
|
|
1004
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.
|
|
1005
1020
|
|
|
1006
|
-
${
|
|
1021
|
+
${H("Testing", s)}${H("Code Quality", l)}${H("Security Analysis", m)}${H("Dependencies", g)}`;
|
|
1007
1022
|
}
|
|
1008
|
-
function
|
|
1009
|
-
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.";
|
|
1010
1025
|
return `## Quality & Security
|
|
1011
1026
|
|
|
1012
|
-
${
|
|
1027
|
+
${yn(e, t, n)}### OpenSSF 🚧
|
|
1013
1028
|
|
|
1014
1029
|
${l}[](https://scorecard.dev/viewer/?uri=${o})
|
|
1015
1030
|
|
|
@@ -1020,37 +1035,37 @@ This project is working towards the [OpenSSF Best Practices](https://www.bestpra
|
|
|
1020
1035
|
Please do not open public GitHub issues for security vulnerabilities. ${u}`;
|
|
1021
1036
|
}
|
|
1022
1037
|
// src/actions/documentUsage.ts
|
|
1023
|
-
var
|
|
1038
|
+
var xn = "<!-- USAGE_START -->", Sn = "<!-- USAGE_END -->", Cn = /* @__PURE__ */ new Set([
|
|
1024
1039
|
"connector",
|
|
1025
1040
|
"cookbook",
|
|
1026
1041
|
"presenter"
|
|
1027
|
-
]),
|
|
1028
|
-
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() {
|
|
1029
1044
|
try {
|
|
1030
|
-
l("Document Usage"),
|
|
1031
|
-
let [t, n] = await Promise.all([
|
|
1032
|
-
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");
|
|
1033
1048
|
} catch (e) {
|
|
1034
1049
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
1035
1050
|
}
|
|
1036
1051
|
}
|
|
1037
|
-
function
|
|
1052
|
+
function kn(e) {
|
|
1038
1053
|
let t = e.repository, n = typeof t == "string" ? t : t?.url;
|
|
1039
1054
|
if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
|
|
1040
1055
|
return n.replace(/^git\+/, "");
|
|
1041
1056
|
}
|
|
1042
|
-
function
|
|
1057
|
+
function An(e) {
|
|
1043
1058
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
1044
1059
|
}
|
|
1045
|
-
function
|
|
1060
|
+
function U(e) {
|
|
1046
1061
|
if (e == null) throw Error("package.json version range is required to document usage.");
|
|
1047
1062
|
let t = /\d+(?:\.\d+)*/.exec(e);
|
|
1048
1063
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
1049
1064
|
return t[0];
|
|
1050
1065
|
}
|
|
1051
|
-
function
|
|
1066
|
+
function jn(e, t) {
|
|
1052
1067
|
let { typeId: n } = e;
|
|
1053
|
-
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.
|
|
1054
1069
|
|
|
1055
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.`;
|
|
1056
1071
|
if (e.publishedTo === "npm") {
|
|
@@ -1061,11 +1076,11 @@ You may view or clone this repository for your own purposes, such as building a
|
|
|
1061
1076
|
npm install ${t}
|
|
1062
1077
|
\`\`\`
|
|
1063
1078
|
|
|
1064
|
-
${
|
|
1079
|
+
${wn.has(n) ? `${Tn}\n\n` : ""}To work on the source instead, clone this repository.`;
|
|
1065
1080
|
}
|
|
1066
1081
|
return "You may view or clone this repository for your own purposes.";
|
|
1067
1082
|
}
|
|
1068
|
-
function
|
|
1083
|
+
function Mn(e, t, n, r, i, a, o) {
|
|
1069
1084
|
return `## Usage
|
|
1070
1085
|
|
|
1071
1086
|
${e}
|
|
@@ -1081,94 +1096,119 @@ _Requires [Node.js](https://nodejs.org/) ${r} or later, [npm](https://www.npmjs.
|
|
|
1081
1096
|
${o}`;
|
|
1082
1097
|
}
|
|
1083
1098
|
// src/actions/documentApiReference.ts
|
|
1084
|
-
var
|
|
1085
|
-
async function
|
|
1099
|
+
var W = "API_REFERENCE.md";
|
|
1100
|
+
async function Nn() {
|
|
1086
1101
|
try {
|
|
1087
1102
|
l("Document API Reference");
|
|
1088
|
-
let { writeAPIReference: e } = await import("./apiReference-
|
|
1089
|
-
await e("1️⃣ ",
|
|
1103
|
+
let { writeAPIReference: e } = await import("./apiReference-BdQJPhGc.js");
|
|
1104
|
+
await e("1️⃣ ", W), x("API reference documented");
|
|
1090
1105
|
} catch (e) {
|
|
1091
1106
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
1092
1107
|
}
|
|
1093
1108
|
}
|
|
1094
1109
|
// src/actions/documentBundleSizes.ts
|
|
1095
|
-
var
|
|
1096
|
-
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() {
|
|
1097
1112
|
try {
|
|
1098
|
-
l("Document Bundle Sizes"),
|
|
1099
|
-
let
|
|
1100
|
-
for (let e of
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
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
|
|
1106
1122
|
}), c = [
|
|
1107
|
-
s.includes("↳") ? `${
|
|
1108
|
-
|
|
1109
|
-
s
|
|
1110
|
-
s.includes(q) ?
|
|
1111
|
-
|
|
1123
|
+
s.includes("↳") ? `${Gn} ${Kn}` : Gn,
|
|
1124
|
+
o.length > 0 ? qn : "",
|
|
1125
|
+
/ \+ \d+ more \|/.test(s) ? Jn : "",
|
|
1126
|
+
s.includes(q) ? Yn : "",
|
|
1127
|
+
s.includes(J) ? Xn : "",
|
|
1128
|
+
Zn
|
|
1112
1129
|
].filter((e) => e !== "");
|
|
1113
|
-
await e(`## Bundle Analysis\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");
|
|
1114
1131
|
} catch (e) {
|
|
1115
1132
|
console.error("❌ Error documenting bundle sizes", e), process.exit(1);
|
|
1116
1133
|
}
|
|
1117
1134
|
}
|
|
1118
|
-
function
|
|
1119
|
-
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];
|
|
1120
1163
|
for (let [e, t] of a) {
|
|
1121
|
-
let r = n.get(e);
|
|
1122
|
-
|
|
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);
|
|
1123
1169
|
}
|
|
1124
|
-
let
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
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));
|
|
1128
1175
|
}
|
|
1129
|
-
return
|
|
1130
|
-
}
|
|
1131
|
-
function
|
|
1132
|
-
let r =
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
let n = new RegExp(String.raw`(?:var|let|const)\s+${t}\s*=\s*(["'\`])`).exec(e), r = n?.[1];
|
|
1143
|
-
if (n === null || r === void 0) return;
|
|
1144
|
-
let i = n.index + n[0].length, a = i;
|
|
1145
|
-
for (; a < e.length && e[a] !== r;) a += e[a] === "\\" ? 2 : 1;
|
|
1146
|
-
return e.slice(i, a);
|
|
1147
|
-
}
|
|
1148
|
-
function $n(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) {
|
|
1149
1189
|
let t = {
|
|
1150
1190
|
bytes: 0,
|
|
1151
1191
|
binaryBytes: 0
|
|
1152
1192
|
};
|
|
1153
1193
|
for (let n of e.matchAll(/data:application\/wasm;base64,([A-Za-z\d+/]*={0,2})/g)) {
|
|
1154
1194
|
let e = n[1] ?? "";
|
|
1155
|
-
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);
|
|
1156
1196
|
}
|
|
1157
1197
|
return t;
|
|
1158
1198
|
}
|
|
1159
|
-
function
|
|
1199
|
+
function ir(e) {
|
|
1160
1200
|
return e.endsWith("==") ? 2 : +!!e.endsWith("=");
|
|
1161
1201
|
}
|
|
1162
|
-
function
|
|
1202
|
+
function Y(e, t) {
|
|
1163
1203
|
if (t.bytes <= 0) return;
|
|
1164
|
-
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]) => ({
|
|
1165
1205
|
group: e,
|
|
1166
1206
|
fileName: t,
|
|
1167
1207
|
sizes: n
|
|
1168
1208
|
})).toArray()).find(({ sizes: e }) => e.uncompressed >= t.bytes);
|
|
1169
1209
|
if (n === void 0) return;
|
|
1170
|
-
|
|
1171
|
-
let r = `${
|
|
1210
|
+
or(e, n.group, n.fileName, n.sizes, t.bytes);
|
|
1211
|
+
let r = `${J}, ${$(t.binaryBytes)} binary)`;
|
|
1172
1212
|
e.set(r, {
|
|
1173
1213
|
sizes: {
|
|
1174
1214
|
uncompressed: t.bytes,
|
|
@@ -1180,108 +1220,64 @@ function tr(e, t) {
|
|
|
1180
1220
|
}]])
|
|
1181
1221
|
});
|
|
1182
1222
|
}
|
|
1183
|
-
function
|
|
1184
|
-
let
|
|
1185
|
-
if (
|
|
1186
|
-
|
|
1187
|
-
let
|
|
1188
|
-
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,
|
|
1189
1229
|
gzip: 0
|
|
1190
|
-
}
|
|
1191
|
-
e.set(
|
|
1192
|
-
sizes:
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
},
|
|
1196
|
-
files: o
|
|
1230
|
+
};
|
|
1231
|
+
e.set(q, {
|
|
1232
|
+
sizes: i,
|
|
1233
|
+
files: /* @__PURE__ */ new Map([["", { ...i }]]),
|
|
1234
|
+
parts: t.groups
|
|
1197
1235
|
});
|
|
1198
1236
|
}
|
|
1199
|
-
function
|
|
1200
|
-
tr(e, n);
|
|
1201
|
-
let r = /* @__PURE__ */ new Map();
|
|
1202
|
-
for (let [t, n] of e) if (t === "src") for (let [e, t] of n.files) r.set(e, { ...t });
|
|
1203
|
-
else {
|
|
1204
|
-
let e = n.files.size === 1 ? Y(t, ur(n.files)) : t;
|
|
1205
|
-
r.set(e, { ...n.sizes });
|
|
1206
|
-
}
|
|
1207
|
-
let i = r.values().reduce((e, t) => e + t.uncompressed, 0), a = r.get(G) ?? Q();
|
|
1208
|
-
return a.uncompressed += Math.max(0, t - i), a.uncompressed > 0 && r.set(G, a), r;
|
|
1209
|
-
}
|
|
1210
|
-
function ir(e, t, n, r, i) {
|
|
1237
|
+
function or(e, t, n, r, i) {
|
|
1211
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);
|
|
1212
1239
|
}
|
|
1213
|
-
function ar(e, t) {
|
|
1214
|
-
return e[0] === G == (t[0] === G) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === G ? 1 : -1;
|
|
1215
|
-
}
|
|
1216
|
-
function or(e, t, n) {
|
|
1217
|
-
let r = [];
|
|
1218
|
-
for (let [i, { sizes: a, files: o }] of e) if (o.size === 1) {
|
|
1219
|
-
let e = ur(o);
|
|
1220
|
-
r.push(Z(`${U}${X(Y(i, e))}`, J(a.uncompressed, t)));
|
|
1221
|
-
} else r.push(Z(`${U}${lr(i, o)}`, J(a.uncompressed, t))), n || r.push(...sr(o, t));
|
|
1222
|
-
return r;
|
|
1223
|
-
}
|
|
1224
1240
|
function sr(e, t) {
|
|
1225
|
-
|
|
1226
|
-
if (r > 0) {
|
|
1227
|
-
let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
|
|
1228
|
-
i.push(Z(`${U}${U}↳ ${String(r)} smaller files`, J(e, t, Rn)));
|
|
1229
|
-
}
|
|
1230
|
-
return i;
|
|
1231
|
-
}
|
|
1232
|
-
function cr(e, t) {
|
|
1233
|
-
if (t <= 0) return 0;
|
|
1234
|
-
let n = 0, r = 0;
|
|
1235
|
-
for (let [, i] of e.toReversed()) {
|
|
1236
|
-
let e = i.uncompressed / t * 100 < zn, a = (r + i.uncompressed) / t * 100 <= Bn;
|
|
1237
|
-
if (!e || !a) break;
|
|
1238
|
-
n++, r += i.uncompressed;
|
|
1239
|
-
}
|
|
1240
|
-
return n >= 2 ? n : 0;
|
|
1241
|
+
return e[0] === K == (t[0] === K) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === K ? 1 : -1;
|
|
1241
1242
|
}
|
|
1242
|
-
function
|
|
1243
|
-
|
|
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)]);
|
|
1244
1246
|
}
|
|
1245
|
-
function
|
|
1246
|
-
return t
|
|
1247
|
+
function lr(e, t, n) {
|
|
1248
|
+
return `${yr(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
|
|
1247
1249
|
}
|
|
1248
|
-
function
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
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;
|
|
1252
1253
|
}
|
|
1253
|
-
function
|
|
1254
|
-
let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(
|
|
1254
|
+
function dr(e) {
|
|
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);
|
|
1255
1256
|
return r.length > i ? `${n}<abbr title="${r.replaceAll("&", "&").replaceAll("\"", """)}">…${r.slice(r.length - (i - 1))}</abbr>` : e;
|
|
1256
1257
|
}
|
|
1257
|
-
function
|
|
1258
|
+
function X(e, t) {
|
|
1258
1259
|
return `| ${e} | ${t.replaceAll(" ", " ")} |`;
|
|
1259
1260
|
}
|
|
1260
|
-
function
|
|
1261
|
-
let
|
|
1262
|
-
if (t === void 0) throw Error("Expected exactly one file");
|
|
1263
|
-
return t;
|
|
1264
|
-
}
|
|
1265
|
-
function dr(e) {
|
|
1266
|
-
let t = fr(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1261
|
+
function fr(e) {
|
|
1262
|
+
let t = pr(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1267
1263
|
for (let r of e.resources) {
|
|
1268
1264
|
if (r.kind !== "chunk" || !r.parent) continue;
|
|
1269
|
-
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();
|
|
1270
1266
|
n.set(r.parent, o);
|
|
1271
1267
|
let s = o.get(e) ?? {
|
|
1272
|
-
sizes:
|
|
1268
|
+
sizes: Z(),
|
|
1273
1269
|
files: /* @__PURE__ */ new Map()
|
|
1274
1270
|
};
|
|
1275
|
-
o.set(e, s),
|
|
1276
|
-
let c = s.files.get(i) ??
|
|
1277
|
-
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);
|
|
1278
1274
|
}
|
|
1279
1275
|
return n;
|
|
1280
1276
|
}
|
|
1281
|
-
function
|
|
1277
|
+
function pr(e) {
|
|
1282
1278
|
return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
|
|
1283
1279
|
}
|
|
1284
|
-
function
|
|
1280
|
+
function mr(e, t) {
|
|
1285
1281
|
let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
|
|
1286
1282
|
if (n) {
|
|
1287
1283
|
let [t, r] = n;
|
|
@@ -1291,64 +1287,64 @@ function pr(e, t) {
|
|
|
1291
1287
|
};
|
|
1292
1288
|
}
|
|
1293
1289
|
return e === "[unassigned]" ? {
|
|
1294
|
-
group:
|
|
1290
|
+
group: K,
|
|
1295
1291
|
file: ""
|
|
1296
1292
|
} : e.startsWith("\0") ? {
|
|
1297
1293
|
group: "(runtime)",
|
|
1298
1294
|
file: e.slice(1)
|
|
1299
1295
|
} : e.startsWith("rust/") ? {
|
|
1300
1296
|
group: "wasm",
|
|
1301
|
-
file:
|
|
1297
|
+
file: hr(e)
|
|
1302
1298
|
} : {
|
|
1303
1299
|
group: "src",
|
|
1304
|
-
file:
|
|
1300
|
+
file: gr(e)
|
|
1305
1301
|
};
|
|
1306
1302
|
}
|
|
1307
|
-
function
|
|
1308
|
-
let t = e.split("/", 2)[1] ?? "", n =
|
|
1303
|
+
function hr(e) {
|
|
1304
|
+
let t = e.split("/", 2)[1] ?? "", n = gr(e);
|
|
1309
1305
|
return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
|
|
1310
1306
|
}
|
|
1311
|
-
function
|
|
1307
|
+
function gr(e) {
|
|
1312
1308
|
return e.split("/").at(-1) ?? e;
|
|
1313
1309
|
}
|
|
1314
|
-
function
|
|
1310
|
+
function _r(e) {
|
|
1315
1311
|
return {
|
|
1316
1312
|
uncompressed: e.uncompressed,
|
|
1317
1313
|
gzip: e.gzip ?? 0
|
|
1318
1314
|
};
|
|
1319
1315
|
}
|
|
1320
|
-
function
|
|
1316
|
+
function vr(e) {
|
|
1321
1317
|
return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
|
|
1322
1318
|
}
|
|
1323
|
-
function
|
|
1324
|
-
let n = Math.round(e / 100 *
|
|
1325
|
-
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)}%`;
|
|
1326
1322
|
}
|
|
1327
|
-
function
|
|
1323
|
+
function Z() {
|
|
1328
1324
|
return {
|
|
1329
1325
|
uncompressed: 0,
|
|
1330
1326
|
gzip: 0
|
|
1331
1327
|
};
|
|
1332
1328
|
}
|
|
1333
|
-
function
|
|
1329
|
+
function Q(e, t) {
|
|
1334
1330
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
1335
1331
|
}
|
|
1336
1332
|
function br(e, t) {
|
|
1337
1333
|
return `${(e / t * 100).toFixed(1)}%`;
|
|
1338
1334
|
}
|
|
1339
1335
|
function $(e) {
|
|
1340
|
-
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`;
|
|
1341
1337
|
}
|
|
1342
1338
|
// src/actions/documentProject.ts
|
|
1343
|
-
async function xr(e = "MIT"
|
|
1339
|
+
async function xr(e = "MIT") {
|
|
1344
1340
|
try {
|
|
1345
|
-
let
|
|
1346
|
-
await
|
|
1347
|
-
let
|
|
1348
|
-
|
|
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", [
|
|
1349
1345
|
"--write",
|
|
1350
1346
|
"README.md",
|
|
1351
|
-
...
|
|
1347
|
+
...a ? [W] : []
|
|
1352
1348
|
]);
|
|
1353
1349
|
} catch (e) {
|
|
1354
1350
|
console.error("❌ Error documenting project", e), process.exit(1);
|
|
@@ -1367,9 +1363,9 @@ async function Sr() {
|
|
|
1367
1363
|
"app",
|
|
1368
1364
|
"src",
|
|
1369
1365
|
"tests"
|
|
1370
|
-
].filter((e) =>
|
|
1366
|
+
].filter((e) => ce(e)).map((e) => `${e}/**`)
|
|
1371
1367
|
];
|
|
1372
|
-
await r("1️⃣ Format", "prettier", e),
|
|
1368
|
+
await r("1️⃣ Format", "prettier", e), x("Code formatted");
|
|
1373
1369
|
} catch (e) {
|
|
1374
1370
|
console.error("❌ Error formatting code", e), process.exit(1);
|
|
1375
1371
|
}
|
|
@@ -1377,7 +1373,7 @@ async function Sr() {
|
|
|
1377
1373
|
// src/actions/lintCode.ts
|
|
1378
1374
|
async function Cr() {
|
|
1379
1375
|
try {
|
|
1380
|
-
l("Lint Code"), await r("1️⃣ Lint", "eslint", ["."]),
|
|
1376
|
+
l("Lint Code"), await r("1️⃣ Lint", "eslint", ["."]), x("Code linted");
|
|
1381
1377
|
} catch (e) {
|
|
1382
1378
|
console.error("❌ Error linting code", e), process.exit(1);
|
|
1383
1379
|
}
|
|
@@ -1389,7 +1385,7 @@ var wr = {
|
|
|
1389
1385
|
".wasm": "application/wasm"
|
|
1390
1386
|
}, Tr = "dpuse-sample-data-eu";
|
|
1391
1387
|
async function Er() {
|
|
1392
|
-
let e = await
|
|
1388
|
+
let e = await C("config.json"), t = {
|
|
1393
1389
|
body: JSON.stringify(e),
|
|
1394
1390
|
headers: { "Content-Type": "application/json" },
|
|
1395
1391
|
method: "PUT"
|
|
@@ -1422,11 +1418,11 @@ async function kr(e) {
|
|
|
1422
1418
|
async function Ar(e, t) {
|
|
1423
1419
|
let n = `v${e.version ?? "unknown"}`;
|
|
1424
1420
|
async function r(e, r = "") {
|
|
1425
|
-
let i = await
|
|
1421
|
+
let i = await ee(e, { withFileTypes: !0 });
|
|
1426
1422
|
for (let a of i) {
|
|
1427
1423
|
if (a.isDirectory() || a.name.endsWith(".map")) continue;
|
|
1428
|
-
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = wr[
|
|
1429
|
-
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", [
|
|
1430
1426
|
"r2",
|
|
1431
1427
|
"object",
|
|
1432
1428
|
"put",
|
|
@@ -1443,9 +1439,9 @@ async function Ar(e, t) {
|
|
|
1443
1439
|
}
|
|
1444
1440
|
async function jr(e, t) {
|
|
1445
1441
|
if (e.length === 0) return;
|
|
1446
|
-
let n = await
|
|
1442
|
+
let n = await T.mkdtemp(E.join(_e.tmpdir(), "dpuse-r2-bulk-")), r = E.join(n, "files.json");
|
|
1447
1443
|
try {
|
|
1448
|
-
await
|
|
1444
|
+
await v(r, e), console.info(`⚙️ Uploading ${String(e.length)} files (${t.join(" ")})...`), await b(void 0, "wrangler", [
|
|
1449
1445
|
"r2",
|
|
1450
1446
|
"bulk",
|
|
1451
1447
|
"put",
|
|
@@ -1457,14 +1453,14 @@ async function jr(e, t) {
|
|
|
1457
1453
|
"--remote"
|
|
1458
1454
|
]);
|
|
1459
1455
|
} finally {
|
|
1460
|
-
await
|
|
1456
|
+
await T.rm(n, {
|
|
1461
1457
|
force: !0,
|
|
1462
1458
|
recursive: !0
|
|
1463
1459
|
});
|
|
1464
1460
|
}
|
|
1465
1461
|
}
|
|
1466
1462
|
async function Mr(e, t) {
|
|
1467
|
-
let n = await
|
|
1463
|
+
let n = await ee(e), r = [];
|
|
1468
1464
|
for (let i of n) {
|
|
1469
1465
|
if (i.startsWith(".")) continue;
|
|
1470
1466
|
let n = `${e}/${i}`, a = `${t}/${i}`;
|
|
@@ -1479,24 +1475,24 @@ async function Mr(e, t) {
|
|
|
1479
1475
|
async function Nr() {
|
|
1480
1476
|
try {
|
|
1481
1477
|
l("Publish Project");
|
|
1482
|
-
let e = await
|
|
1483
|
-
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");
|
|
1484
1480
|
let i = [
|
|
1485
1481
|
"api",
|
|
1486
1482
|
"app",
|
|
1487
1483
|
"kb"
|
|
1488
1484
|
].includes(n.publishedTo);
|
|
1489
|
-
i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await Pr(i ? "3️⃣ " : "2️⃣ ", e, t, n), n.publishedTo === "sampleData" && (
|
|
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.`);
|
|
1490
1486
|
} catch (e) {
|
|
1491
1487
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1492
1488
|
}
|
|
1493
1489
|
}
|
|
1494
1490
|
async function Pr(e, t, n, r) {
|
|
1495
|
-
if (r.typeId === "app")
|
|
1496
|
-
else if (r.typeId === "engine")
|
|
1497
|
-
else if (r.uploadGroupName === void 0)
|
|
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`);
|
|
1498
1494
|
else {
|
|
1499
|
-
|
|
1495
|
+
w(`${e} Register module`);
|
|
1500
1496
|
let i = n.id.split("-").slice(2).join("-");
|
|
1501
1497
|
await Ar(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await kr(n);
|
|
1502
1498
|
}
|
|
@@ -1505,16 +1501,16 @@ async function Pr(e, t, n, r) {
|
|
|
1505
1501
|
async function Fr() {
|
|
1506
1502
|
try {
|
|
1507
1503
|
l("Synchronise Project with GitHub");
|
|
1508
|
-
let e = await
|
|
1509
|
-
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", [
|
|
1510
1506
|
"commit",
|
|
1511
1507
|
"-m",
|
|
1512
1508
|
`v${e.version ?? "unknown"}`
|
|
1513
|
-
]), await
|
|
1509
|
+
]), await b("5️⃣ Push changes", "git", [
|
|
1514
1510
|
"push",
|
|
1515
1511
|
"origin",
|
|
1516
1512
|
"main:main"
|
|
1517
|
-
]),
|
|
1513
|
+
]), x(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
|
|
1518
1514
|
} catch (e) {
|
|
1519
1515
|
console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
|
|
1520
1516
|
}
|
|
@@ -1551,7 +1547,7 @@ async function Rr(e = ["unit"]) {
|
|
|
1551
1547
|
console.warn("\n⚠️ No tests configured for this project.\n");
|
|
1552
1548
|
return;
|
|
1553
1549
|
}
|
|
1554
|
-
|
|
1550
|
+
x("Project tested");
|
|
1555
1551
|
} catch (e) {
|
|
1556
1552
|
console.error("❌ Error testing project", e), process.exit(1);
|
|
1557
1553
|
}
|
|
@@ -1560,7 +1556,7 @@ async function Rr(e = ["unit"]) {
|
|
|
1560
1556
|
async function zr() {
|
|
1561
1557
|
try {
|
|
1562
1558
|
l("Trigger GitHub Release");
|
|
1563
|
-
let e = `v${(await
|
|
1559
|
+
let e = `v${(await C("package.json")).version ?? "unknown"}`;
|
|
1564
1560
|
await r("1️⃣ Trigger GitHub release", "gh", [
|
|
1565
1561
|
"release",
|
|
1566
1562
|
"create",
|
|
@@ -1569,9 +1565,9 @@ async function zr() {
|
|
|
1569
1565
|
"main",
|
|
1570
1566
|
"--generate-notes",
|
|
1571
1567
|
"--latest"
|
|
1572
|
-
]),
|
|
1568
|
+
]), x(`GitHub release '${e}' created.`);
|
|
1573
1569
|
} catch (e) {
|
|
1574
1570
|
console.error("❌ Error triggering GitHub release", e), process.exit(1);
|
|
1575
1571
|
}
|
|
1576
1572
|
}
|
|
1577
|
-
export {
|
|
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 };
|