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