@dpuse/dpuse-development 0.3.816 → 0.3.818
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 +20 -20
- package/dist/{apiReference-Fj5_02JP.js → apiReference-CT5_Z6VQ.js} +3 -3
- package/dist/{apiReference-Fj5_02JP.js.map → apiReference-CT5_Z6VQ.js.map} +1 -1
- package/dist/dpuse-development.es.js +388 -356
- package/dist/dpuse-development.es.js.map +1 -1
- package/dist/types/src/utilities/index.d.ts +1 -0
- package/dist/{utilities-CQ2h3IWL.js → utilities-6R4TbiJy.js} +36 -19
- package/dist/utilities-6R4TbiJy.js.map +1 -0
- package/package.json +6 -6
- package/dist/utilities-CQ2h3IWL.js.map +0 -1
|
@@ -1,61 +1,90 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r,
|
|
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
|
-
//#region src/actions/
|
|
13
|
-
|
|
1
|
+
import { A as e, C as t, D as n, E as r, O as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as p, h as m, i as h, j as g, l as _, m as v, n as ee, o as te, p as y, r as ne, s as re, t as ie, u as ae, v as b, w as x, x as S, y as oe } from "./utilities-6R4TbiJy.js";
|
|
2
|
+
import { SHIPPED_PACKAGES_FILE_NAME as se } from "./vite.es.js";
|
|
3
|
+
import { existsSync as ce, promises as C } from "node:fs";
|
|
4
|
+
import w 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 T from "spdx-satisfies";
|
|
12
|
+
//#region src/actions/auditDependencies_.json
|
|
13
|
+
var he = [{
|
|
14
|
+
id: "GHSA-ch52-4w7c-c8xp",
|
|
15
|
+
reason: "'http-cache-semantics', used by the licence checker, which only reads the npm registry locally, with no shared cache to leak from",
|
|
16
|
+
reviewBy: "2026-12-31"
|
|
17
|
+
}, {
|
|
18
|
+
id: "GHSA-fx2h-pf6j-xcff",
|
|
19
|
+
reason: "'vite', used by VitePress 1.x in dpuse-kb, which affects only the local dev server on Windows",
|
|
20
|
+
reviewBy: "2026-12-31"
|
|
21
|
+
}], ge = /* @__PURE__ */ new Set(["critical", "high"]);
|
|
22
|
+
async function _e() {
|
|
14
23
|
try {
|
|
15
|
-
|
|
24
|
+
p("Audit Dependencies"), await x("1️⃣ Check shipped dependencies for any vulnerability", "npm", ["audit", "--omit=dev"]);
|
|
25
|
+
let e = await o("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--json"]), t = JSON.parse(e);
|
|
26
|
+
if (t.error !== void 0) throw Error(t.error.summary);
|
|
27
|
+
let n = ve(ye(t));
|
|
28
|
+
if (n.length > 0) throw Error(`${String(n.length)} high or critical vulnerabilities found`);
|
|
29
|
+
s("Dependencies audited");
|
|
16
30
|
} catch (e) {
|
|
17
31
|
console.error("❌ Error auditing dependencies", e), process.exit(1);
|
|
18
32
|
}
|
|
19
33
|
}
|
|
34
|
+
function ve(e) {
|
|
35
|
+
let t = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), n = [];
|
|
36
|
+
for (let r of e) {
|
|
37
|
+
if (!ge.has(r.severity)) continue;
|
|
38
|
+
let e = r.url.slice(r.url.lastIndexOf("/") + 1), i = he.find((t) => t.id === e);
|
|
39
|
+
i === void 0 ? (console.error(`❌ ${r.severity} '${r.name}': ${r.title} (${r.url})`), n.push(r)) : i.reviewBy < t ? console.warn(`⚠️ Ignored ${e}, but its review date ${i.reviewBy} has passed: ${i.reason}`) : console.info(`ℹ️ Ignored ${e}: ${i.reason}`);
|
|
40
|
+
}
|
|
41
|
+
return n;
|
|
42
|
+
}
|
|
43
|
+
function ye(e) {
|
|
44
|
+
let t = /* @__PURE__ */ new Map(), n = Object.values(e.vulnerabilities ?? {});
|
|
45
|
+
for (let e of n) for (let n of e.via) typeof n != "string" && t.set(n.url, n);
|
|
46
|
+
return t.values().toArray();
|
|
47
|
+
}
|
|
20
48
|
//#endregion
|
|
21
49
|
//#region src/actions/buildProject.ts
|
|
22
|
-
var
|
|
23
|
-
async function
|
|
50
|
+
var be = "build:wasm";
|
|
51
|
+
async function xe() {
|
|
24
52
|
try {
|
|
25
|
-
|
|
53
|
+
p("Build Project"), await Se("1️⃣ ", await l("package.json")), s("Project built");
|
|
26
54
|
} catch (e) {
|
|
27
55
|
console.error("❌ Error building project", e), process.exit(1);
|
|
28
56
|
}
|
|
29
57
|
}
|
|
30
|
-
async function
|
|
31
|
-
t.scripts?.[
|
|
58
|
+
async function Se(e, t) {
|
|
59
|
+
t.scripts?.[be] != null && await x(`${e} Build WebAssembly`, "npm", ["run", be]), await x(`${e} Bundle project`, "vite", ["build"]);
|
|
32
60
|
}
|
|
33
61
|
//#endregion
|
|
34
62
|
//#region src/actions/checkConfigFiles.ts
|
|
35
|
-
var E = "@dpuse/dpuse-development/prettierrc",
|
|
36
|
-
async function
|
|
63
|
+
var E = "@dpuse/dpuse-development/prettierrc", Ce = "dpuse-development";
|
|
64
|
+
async function we() {
|
|
37
65
|
try {
|
|
38
|
-
|
|
39
|
-
let e = await
|
|
40
|
-
await D(
|
|
41
|
-
let
|
|
42
|
-
|
|
66
|
+
p("Check configuration files"), b("1️⃣ Check individual files");
|
|
67
|
+
let e = await l("config.json"), t = await l("package.json"), n = t.private === !0, r = v(e.id), i = w.dirname(de(import.meta.url));
|
|
68
|
+
await D(i, ".editorconfig"), await D(i, ".gitattributes"), await D(i, ".gitignore", [".gitignore_default"]), await D(i, ".markdownlint.json"), await D(i, ".ncurc.json"), await Te(r, i), await D(i, "LICENSE"), await De(r, i), await Oe(r, i), await ke(r, i), await je(r, i), Ee(r, t);
|
|
69
|
+
let o = await a(u) !== null;
|
|
70
|
+
o && await D(i, "rust-toolchain.toml"), await D(i, ".github/dependabot.yml", [`.github/dependabot${n ? ".private" : ""}${o ? ".rust" : ""}.yml`]), n ? console.info("ℹ️ GitHub workflows and file 'SECURITY.md' are NOT required by this project") : (await Ae(i), await D(i, "SECURITY.md", [], (t) => t.replaceAll(Ce, () => e.id))), s("Configuration files checked");
|
|
43
71
|
} catch (e) {
|
|
44
72
|
console.error("❌ Error checking configuration files", e), process.exit(1);
|
|
45
73
|
}
|
|
46
74
|
}
|
|
47
|
-
async function
|
|
48
|
-
["github"
|
|
75
|
+
async function Te(e, t) {
|
|
76
|
+
["github"].includes(e.typeId) ? console.info("ℹ️ File 'eslint.config.js' is NOT required by this project") : [
|
|
49
77
|
"app",
|
|
50
78
|
"api",
|
|
51
79
|
"development",
|
|
52
|
-
"eslint"
|
|
80
|
+
"eslint",
|
|
81
|
+
"kb"
|
|
53
82
|
].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await D(t, "eslint.config.js", ["eslint.config.default.js"]);
|
|
54
83
|
}
|
|
55
|
-
function
|
|
84
|
+
function Ee(e, t) {
|
|
56
85
|
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}'`);
|
|
57
86
|
}
|
|
58
|
-
async function
|
|
87
|
+
async function De(e, t) {
|
|
59
88
|
["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
|
|
60
89
|
"connector",
|
|
61
90
|
"cookbook",
|
|
@@ -66,10 +95,10 @@ async function Se(e, t) {
|
|
|
66
95
|
"tool"
|
|
67
96
|
].includes(e.typeId) ? await D(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
|
|
68
97
|
}
|
|
69
|
-
async function
|
|
98
|
+
async function Oe(e, t) {
|
|
70
99
|
["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await D(t, "scripts/tsconfig.json");
|
|
71
100
|
}
|
|
72
|
-
async function
|
|
101
|
+
async function ke(e, t) {
|
|
73
102
|
if ([
|
|
74
103
|
"eslint",
|
|
75
104
|
"github",
|
|
@@ -95,20 +124,19 @@ async function we(e, t) {
|
|
|
95
124
|
await D(t, "vite.config.ts", n);
|
|
96
125
|
}
|
|
97
126
|
}
|
|
98
|
-
async function
|
|
127
|
+
async function Ae(e) {
|
|
99
128
|
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");
|
|
100
129
|
}
|
|
101
|
-
async function
|
|
130
|
+
async function je(e, t) {
|
|
102
131
|
[
|
|
103
132
|
"app",
|
|
104
133
|
"api",
|
|
105
|
-
"eslint",
|
|
106
134
|
"github",
|
|
107
135
|
"kb"
|
|
108
136
|
].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await D(t, "vitest.config.ts");
|
|
109
137
|
}
|
|
110
138
|
async function D(e, t, n = [], r = (e) => e) {
|
|
111
|
-
let i =
|
|
139
|
+
let i = w.resolve(process.cwd(), t), a = n.length > 0 ? n : [t], o;
|
|
112
140
|
try {
|
|
113
141
|
o = await S(i);
|
|
114
142
|
} catch (e) {
|
|
@@ -119,7 +147,7 @@ async function D(e, t, n = [], r = (e) => e) {
|
|
|
119
147
|
return;
|
|
120
148
|
}
|
|
121
149
|
for (let n of a) {
|
|
122
|
-
let i =
|
|
150
|
+
let i = w.resolve(e, `../${n}`), a = r(await S(i));
|
|
123
151
|
if (o === a) {
|
|
124
152
|
console.info(`ℹ️ File '${t}' is the same as '${n}'`);
|
|
125
153
|
return;
|
|
@@ -129,16 +157,16 @@ async function D(e, t, n = [], r = (e) => e) {
|
|
|
129
157
|
}
|
|
130
158
|
//#endregion
|
|
131
159
|
//#region src/actions/checkDependencies.ts
|
|
132
|
-
async function
|
|
160
|
+
async function Me() {
|
|
133
161
|
try {
|
|
134
|
-
|
|
162
|
+
p("Check Dependencies"), await x("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), b("2️⃣ Check using 'npm-check-updates'");
|
|
135
163
|
let e = {};
|
|
136
164
|
try {
|
|
137
|
-
e = await
|
|
165
|
+
e = await l(w.resolve(process.cwd(), ".ncurc.json"));
|
|
138
166
|
} catch (e) {
|
|
139
167
|
if (e.code !== "ENOENT") throw e;
|
|
140
168
|
}
|
|
141
|
-
await
|
|
169
|
+
await fe({
|
|
142
170
|
interactive: !0,
|
|
143
171
|
upgrade: !0,
|
|
144
172
|
dep: "dev,prod,peer,optional",
|
|
@@ -156,7 +184,7 @@ async function De() {
|
|
|
156
184
|
"--no-strict-allow-scripts",
|
|
157
185
|
"--no-fund"
|
|
158
186
|
], !0);
|
|
159
|
-
let t = await
|
|
187
|
+
let t = await Ne();
|
|
160
188
|
t.length > 0 ? await x("5️⃣ Move install-script pins to installed versions", "npm", [
|
|
161
189
|
"install-scripts",
|
|
162
190
|
"approve",
|
|
@@ -170,61 +198,61 @@ async function De() {
|
|
|
170
198
|
"--strict-allow-scripts",
|
|
171
199
|
"--no-audit",
|
|
172
200
|
"--no-fund"
|
|
173
|
-
]),
|
|
201
|
+
]), s("Dependencies checked");
|
|
174
202
|
} catch (e) {
|
|
175
203
|
console.error("❌ Error checking dependencies", e), process.exit(1);
|
|
176
204
|
}
|
|
177
205
|
}
|
|
178
|
-
async function
|
|
179
|
-
let { allowScripts: e = {} } = await
|
|
206
|
+
async function Ne() {
|
|
207
|
+
let { allowScripts: e = {} } = await l(w.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
|
|
180
208
|
return [...new Set(t)];
|
|
181
209
|
}
|
|
182
210
|
//#endregion
|
|
183
211
|
//#region src/actions/checkProject.ts
|
|
184
|
-
async function
|
|
185
|
-
await
|
|
212
|
+
async function Pe() {
|
|
213
|
+
await we(), await Me();
|
|
186
214
|
}
|
|
187
215
|
//#endregion
|
|
188
216
|
//#region src/actions/documentActions.ts
|
|
189
|
-
var
|
|
217
|
+
var Fe = "<!-- SUPPORTED_ACTIONS_START -->", Ie = "<!-- SUPPORTED_ACTIONS_END -->", Le = "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.", Re = {
|
|
190
218
|
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.",
|
|
191
219
|
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.",
|
|
192
220
|
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.",
|
|
193
221
|
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."
|
|
194
|
-
},
|
|
195
|
-
async function
|
|
222
|
+
}, ze = "The table below lists all connector actions and highlights those supported by this connector.";
|
|
223
|
+
async function Be() {
|
|
196
224
|
try {
|
|
197
|
-
|
|
198
|
-
let t = (await
|
|
199
|
-
await
|
|
225
|
+
p("Document Actions"), b("1️⃣ Insert actions description and table into 'README.md'");
|
|
226
|
+
let t = (await l("config.json")).actionNames ?? [], n = e(t), r = g(t), a = `## Supported Actions\n\n${Le}\n\n${Re[n]} ${ze}\n\n${r}`;
|
|
227
|
+
await i(a, Fe, Ie), s("Actions documented");
|
|
200
228
|
} catch (e) {
|
|
201
229
|
console.error("❌ Error documenting actions", e), process.exit(1);
|
|
202
230
|
}
|
|
203
231
|
}
|
|
204
232
|
//#endregion
|
|
205
233
|
//#region src/actions/documentContributingLicense.ts
|
|
206
|
-
async function
|
|
234
|
+
async function Ve() {
|
|
207
235
|
try {
|
|
208
|
-
|
|
209
|
-
let [e,
|
|
210
|
-
b("1️⃣ Insert contributing and license content into 'README.md'"), await
|
|
236
|
+
p("Document Contributing & License");
|
|
237
|
+
let [e, n] = await Promise.all([l("package.json"), l("config.json")]), { owner: r, repo: a } = t(e, "document contributing and license"), o = He(e), c = Ue(n.firstCreatedAt);
|
|
238
|
+
b("1️⃣ Insert contributing and license content into 'README.md'"), await oe(), await i(We(r, a, o, c), ee, ie), s("Contributing & license documented");
|
|
211
239
|
} catch (e) {
|
|
212
240
|
console.error("❌ Error documenting contributing and license", e), process.exit(1);
|
|
213
241
|
}
|
|
214
242
|
}
|
|
215
|
-
function
|
|
243
|
+
function He(e) {
|
|
216
244
|
let t = e.author, n = typeof t == "string" ? t : t?.name;
|
|
217
245
|
if (n == null || n === "") throw Error("package.json 'author' field is required to document contributing and license.");
|
|
218
246
|
let r = n.indexOf("<"), i = r === -1 ? -1 : n.indexOf(">", r);
|
|
219
247
|
return i === -1 ? n.trim() : [n.slice(0, r).trim(), n.slice(i + 1).trim()].filter((e) => e !== "").join(" ");
|
|
220
248
|
}
|
|
221
|
-
function
|
|
249
|
+
function Ue(e) {
|
|
222
250
|
let t = (/* @__PURE__ */ new Date()).getFullYear();
|
|
223
251
|
if (e == null) return String(t);
|
|
224
252
|
let n = new Date(e).getFullYear();
|
|
225
253
|
return n === t ? String(t) : `${String(n)}-present`;
|
|
226
254
|
}
|
|
227
|
-
function
|
|
255
|
+
function We(e, t, n, r) {
|
|
228
256
|
return `## Contributing
|
|
229
257
|
|
|
230
258
|
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.
|
|
@@ -239,14 +267,14 @@ This project is licensed under the MIT License, permitting free use, modificatio
|
|
|
239
267
|
}
|
|
240
268
|
//#endregion
|
|
241
269
|
//#region src/utilities/rustCrates.ts
|
|
242
|
-
var O = "licenses/cargoMetadata.json", k = "licenses/cargoTree.txt",
|
|
243
|
-
async function
|
|
244
|
-
if (await
|
|
270
|
+
var O = "licenses/cargoMetadata.json", k = "licenses/cargoTree.txt", Ge = 1e3, Ke = 1e4, qe = "dpuse-development (https://github.com/dpuse/dpuse-development)", Je = /^(?:copying|licen[cs]e|unlicense)/i, A = "wasm32-unknown-unknown";
|
|
271
|
+
async function Ye(e, t) {
|
|
272
|
+
if (await a("rust/Cargo.toml") === null) return null;
|
|
245
273
|
let n = [
|
|
246
274
|
"--manifest-path",
|
|
247
|
-
|
|
275
|
+
u,
|
|
248
276
|
"--locked"
|
|
249
|
-
],
|
|
277
|
+
], i = [
|
|
250
278
|
"tree",
|
|
251
279
|
...n,
|
|
252
280
|
"--workspace",
|
|
@@ -259,7 +287,7 @@ async function Ue(e, t) {
|
|
|
259
287
|
"--format",
|
|
260
288
|
"{p}|{l}|{r}"
|
|
261
289
|
];
|
|
262
|
-
await
|
|
290
|
+
await r(e, "cargo", i, k), await r(e, "cargo", [
|
|
263
291
|
"metadata",
|
|
264
292
|
...n,
|
|
265
293
|
"--format-version",
|
|
@@ -267,10 +295,10 @@ async function Ue(e, t) {
|
|
|
267
295
|
"--filter-platform",
|
|
268
296
|
A
|
|
269
297
|
], O);
|
|
270
|
-
let o =
|
|
271
|
-
await
|
|
272
|
-
let
|
|
273
|
-
for (let e of o) e.isOwn ||
|
|
298
|
+
let o = Xe(await S(k)), s = await l(O);
|
|
299
|
+
await C.rm(k, { force: !0 }), await C.rm(O, { force: !0 });
|
|
300
|
+
let c = /* @__PURE__ */ new Map();
|
|
301
|
+
for (let e of o) e.isOwn || c.has(`${e.name}@${e.version}`) || c.set(`${e.name}@${e.version}`, {
|
|
274
302
|
name: e.name,
|
|
275
303
|
version: e.version,
|
|
276
304
|
licenseExpression: e.licenseExpression,
|
|
@@ -280,10 +308,10 @@ async function Ue(e, t) {
|
|
|
280
308
|
latestVersion: "",
|
|
281
309
|
latestPublishedDate: ""
|
|
282
310
|
});
|
|
283
|
-
let d =
|
|
284
|
-
|
|
285
|
-
for (let e of d) e.licenseFiles = await
|
|
286
|
-
return await
|
|
311
|
+
let d = c.values().toArray();
|
|
312
|
+
Ze(d, t);
|
|
313
|
+
for (let e of d) e.licenseFiles = await et(e, s);
|
|
314
|
+
return await tt(e, d), {
|
|
287
315
|
crates: d,
|
|
288
316
|
treeItems: o.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
|
|
289
317
|
name: e,
|
|
@@ -293,7 +321,7 @@ async function Ue(e, t) {
|
|
|
293
321
|
}))
|
|
294
322
|
};
|
|
295
323
|
}
|
|
296
|
-
function
|
|
324
|
+
function Xe(e) {
|
|
297
325
|
let t = [];
|
|
298
326
|
for (let n of e.split("\n")) {
|
|
299
327
|
let [e = "", r = "", i = ""] = n.trim().split("|", 3), a = /^\d+/.exec(e)?.[0];
|
|
@@ -310,46 +338,50 @@ function We(e) {
|
|
|
310
338
|
}
|
|
311
339
|
return t;
|
|
312
340
|
}
|
|
313
|
-
function
|
|
314
|
-
let n = t.split(";").filter((e) =>
|
|
341
|
+
function Ze(e, t) {
|
|
342
|
+
let n = t.split(";").filter((e) => Qe(e)), r = e.filter((e) => !$e(e.licenseExpression, n));
|
|
315
343
|
if (r.length === 0) return;
|
|
316
344
|
let i = r.map((e) => `${e.name}@${e.version} (${e.licenseExpression === "" ? "no licence" : e.licenseExpression})`).join(", ");
|
|
317
345
|
throw Error(`Rust crates with licences not allowed: ${i}.`);
|
|
318
346
|
}
|
|
319
|
-
function
|
|
347
|
+
function Qe(e) {
|
|
320
348
|
try {
|
|
321
|
-
return
|
|
349
|
+
return T(e, [e]);
|
|
322
350
|
} catch {
|
|
323
351
|
return !1;
|
|
324
352
|
}
|
|
325
353
|
}
|
|
326
|
-
function
|
|
354
|
+
function $e(e, t) {
|
|
327
355
|
try {
|
|
328
|
-
return
|
|
356
|
+
return T(e.replaceAll("/", " OR "), t);
|
|
329
357
|
} catch {
|
|
330
358
|
return !1;
|
|
331
359
|
}
|
|
332
360
|
}
|
|
333
|
-
async function
|
|
361
|
+
async function et(e, t) {
|
|
334
362
|
let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
|
|
335
363
|
if (n == null) return [];
|
|
336
|
-
let r =
|
|
337
|
-
await
|
|
364
|
+
let r = w.dirname(n.manifest_path), i = (await C.readdir(r)).filter((e) => Je.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
|
|
365
|
+
await C.mkdir("licenses/downloads", { recursive: !0 });
|
|
338
366
|
let a = [];
|
|
339
367
|
for (let t of i) {
|
|
340
368
|
let n = `downloads/${e.name}@${e.version}-${t}`;
|
|
341
|
-
await
|
|
369
|
+
await C.copyFile(w.join(r, t), w.join("licenses", n)), a.push({
|
|
342
370
|
label: t,
|
|
343
371
|
path: n
|
|
344
372
|
});
|
|
345
373
|
}
|
|
346
374
|
return a;
|
|
347
375
|
}
|
|
348
|
-
async function
|
|
349
|
-
|
|
350
|
-
|
|
376
|
+
async function tt(e, t) {
|
|
377
|
+
b(`${e} - fetch release dates from crates.io`);
|
|
378
|
+
for (let [e, n] of t.entries()) {
|
|
379
|
+
e > 0 && await me(Ge), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
|
|
351
380
|
try {
|
|
352
|
-
let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, {
|
|
381
|
+
let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, {
|
|
382
|
+
headers: { "User-Agent": qe },
|
|
383
|
+
signal: AbortSignal.timeout(Ke)
|
|
384
|
+
});
|
|
353
385
|
if (!e.ok) continue;
|
|
354
386
|
let t = await e.json(), r = new Map((t.versions ?? []).map((e) => [e.num, e.created_at]));
|
|
355
387
|
n.latestVersion = t.crate?.max_stable_version ?? t.crate?.max_version ?? "", n.publishedDate = r.get(n.version) ?? "", n.latestPublishedDate = n.latestVersion === n.version ? "" : r.get(n.latestVersion) ?? "";
|
|
@@ -358,75 +390,75 @@ async function Ye(e) {
|
|
|
358
390
|
}
|
|
359
391
|
//#endregion
|
|
360
392
|
//#region src/actions/documentDependencies.ts
|
|
361
|
-
var j = "<!-- DEPENDENCY_LICENSES_START -->", M = "<!-- DEPENDENCY_LICENSES_END -->", N = "## Dependency Licenses",
|
|
362
|
-
async function
|
|
393
|
+
var j = "<!-- DEPENDENCY_LICENSES_START -->", M = "<!-- DEPENDENCY_LICENSES_END -->", N = "## Dependency Licenses", nt = `bundle-analysis-reports/${se}`, P = "licenses/licenseTree.json", rt = "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.", it = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${rt}`, at = `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. ${rt}`;
|
|
394
|
+
async function ot(e = "MIT") {
|
|
363
395
|
try {
|
|
364
|
-
|
|
365
|
-
let t = await
|
|
396
|
+
p("Document Dependencies");
|
|
397
|
+
let t = await l("package.json");
|
|
366
398
|
if (t.name === "@dpuse/dpuse-development" || t.name === "@dpuse/eslint-config-dpuse") {
|
|
367
|
-
await
|
|
399
|
+
await st(t.name), s("Dependencies documented");
|
|
368
400
|
return;
|
|
369
401
|
}
|
|
370
|
-
await
|
|
371
|
-
let n = await
|
|
372
|
-
if (
|
|
373
|
-
let
|
|
374
|
-
await
|
|
402
|
+
await d("1️⃣ Clear downloaded licenses", "licenses/downloads");
|
|
403
|
+
let n = await ht(), i = await gt();
|
|
404
|
+
if (i === null) {
|
|
405
|
+
let i = bt(n);
|
|
406
|
+
await mt("2️⃣ Identify production licenses", e, [t.name ?? "", ...i], !0), await r("3️⃣ Identify transitive dependencies", "npm", [
|
|
375
407
|
"ls",
|
|
376
408
|
"--all",
|
|
377
409
|
"--json",
|
|
378
410
|
"--omit=dev"
|
|
379
|
-
], P), await
|
|
411
|
+
], P), await ct("4️⃣ ", e, new Set(i));
|
|
380
412
|
} else {
|
|
381
|
-
let
|
|
382
|
-
await
|
|
413
|
+
let a = _t(i, n), o = vt(n), s = o.filter((e) => !a.has(e));
|
|
414
|
+
await mt("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), yt(a, new Set(o)), await r("3️⃣ Identify transitive dependencies", "npm", [
|
|
383
415
|
"ls",
|
|
384
416
|
"--all",
|
|
385
417
|
"--json"
|
|
386
418
|
], P, !0);
|
|
387
|
-
let c = await
|
|
419
|
+
let c = await Ye("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
|
|
388
420
|
allowedLicenses: e,
|
|
389
|
-
productionNames:
|
|
421
|
+
productionNames: ft(t),
|
|
390
422
|
rustCrates: c,
|
|
391
|
-
shippedKeys:
|
|
423
|
+
shippedKeys: a
|
|
392
424
|
};
|
|
393
|
-
await
|
|
425
|
+
await lt(c === null ? "4️⃣ " : "5️⃣ ", l);
|
|
394
426
|
}
|
|
395
|
-
|
|
427
|
+
s("Dependencies documented");
|
|
396
428
|
} catch (e) {
|
|
397
429
|
console.error("❌ Error documenting dependencies", e), process.exit(1);
|
|
398
430
|
}
|
|
399
431
|
}
|
|
400
|
-
async function
|
|
432
|
+
async function st(e) {
|
|
401
433
|
b(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`);
|
|
402
434
|
let t = `> [!WARNING]\n> Dependency licenses are not documented here: ${e} is a development-only tool and is never part of a production release.`;
|
|
403
|
-
await
|
|
435
|
+
await i(`${N}\n\n${t}`, j, M);
|
|
404
436
|
}
|
|
405
|
-
async function
|
|
437
|
+
async function ct(e, t, n) {
|
|
406
438
|
b(`${e} Insert licenses into 'README.md'`);
|
|
407
|
-
let
|
|
408
|
-
for (let e of a.values()) o +=
|
|
439
|
+
let r = await l(P), a = await pt(), o = `${wt(t, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
440
|
+
for (let e of a.values()) o += Ot(e);
|
|
409
441
|
let s = [];
|
|
410
|
-
|
|
411
|
-
let
|
|
412
|
-
await
|
|
442
|
+
r.dependencies != null && kt(r.dependencies, a, n, s, 0);
|
|
443
|
+
let c = `${it}\n\n${s.join("\n")}`;
|
|
444
|
+
await i(`${N}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${c}`, j, M);
|
|
413
445
|
}
|
|
414
|
-
async function
|
|
446
|
+
async function lt(e, t) {
|
|
415
447
|
b(`${e} Insert licenses into 'README.md'`);
|
|
416
|
-
let { allowedLicenses:
|
|
417
|
-
for (let e of u) d +=
|
|
418
|
-
let f = await
|
|
419
|
-
|
|
448
|
+
let { allowedLicenses: n, productionNames: r, rustCrates: a, shippedKeys: o } = t, s = await pt(), c = new Map((a?.crates ?? []).map((e) => [`${e.name}@${e.version}`, ut(e)])), u = [...s.values(), ...c.values()].toSorted((e, t) => e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en")), d = `${wt(n, !0, a !== null)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
449
|
+
for (let e of u) d += Ot(e);
|
|
450
|
+
let f = await l(P), p = Object.entries(f.dependencies ?? {}).toSorted(([e], [t]) => Number(!r.has(e)) - Number(!r.has(t))), m = [];
|
|
451
|
+
I(p, {
|
|
420
452
|
licensesByKey: s,
|
|
421
453
|
shippedKeys: o,
|
|
422
454
|
shownKeys: /* @__PURE__ */ new Set()
|
|
423
455
|
}, m, 0, !1);
|
|
424
456
|
let h = a?.treeItems ?? [];
|
|
425
|
-
for (let e of h) m.push(
|
|
426
|
-
let g = `${
|
|
427
|
-
await
|
|
457
|
+
for (let e of h) m.push(dt(e, c));
|
|
458
|
+
let g = `${at}\n\n${m.join("\n")}`;
|
|
459
|
+
await i(`${N}\n\n${d.trimEnd()}\n\n### Dependency Tree\n\n${g}`, j, M);
|
|
428
460
|
}
|
|
429
|
-
function
|
|
461
|
+
function ut(e) {
|
|
430
462
|
return {
|
|
431
463
|
name: e.name,
|
|
432
464
|
repository: e.repository,
|
|
@@ -439,26 +471,26 @@ function rt(e) {
|
|
|
439
471
|
licenseFiles: e.licenseFiles
|
|
440
472
|
};
|
|
441
473
|
}
|
|
442
|
-
function
|
|
474
|
+
function dt(e, t) {
|
|
443
475
|
let n = " ".repeat(e.depth);
|
|
444
|
-
return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` :
|
|
476
|
+
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);
|
|
445
477
|
}
|
|
446
|
-
function
|
|
478
|
+
function ft(e) {
|
|
447
479
|
return /* @__PURE__ */ new Set([
|
|
448
480
|
...Object.keys(e.dependencies ?? {}),
|
|
449
481
|
...Object.keys(e.optionalDependencies ?? {}),
|
|
450
482
|
...Object.keys(e.peerDependencies ?? {})
|
|
451
483
|
]);
|
|
452
484
|
}
|
|
453
|
-
async function
|
|
454
|
-
let e = await
|
|
455
|
-
for (let [n, r] of Object.entries(e)) t.set(n,
|
|
485
|
+
async function pt() {
|
|
486
|
+
let e = await l("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
|
|
487
|
+
for (let [n, r] of Object.entries(e)) t.set(n, Et(n, r));
|
|
456
488
|
return await Promise.all(t.values().map(async (e) => {
|
|
457
|
-
let t = await
|
|
489
|
+
let t = await Dt(e.name, e.installedVersion);
|
|
458
490
|
e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
|
|
459
491
|
})), t;
|
|
460
492
|
}
|
|
461
|
-
async function
|
|
493
|
+
async function mt(e, t, n, r) {
|
|
462
494
|
b(e), await new Promise((e, i) => {
|
|
463
495
|
let a = {
|
|
464
496
|
start: process.cwd(),
|
|
@@ -471,63 +503,63 @@ async function L(e, t, n, r) {
|
|
|
471
503
|
excludePackages: n.join(";"),
|
|
472
504
|
out: "licenses/licenses.json"
|
|
473
505
|
};
|
|
474
|
-
|
|
506
|
+
pe(a, (t) => {
|
|
475
507
|
t == null ? e() : i(t);
|
|
476
508
|
});
|
|
477
509
|
});
|
|
478
510
|
}
|
|
479
|
-
async function
|
|
480
|
-
let e = await
|
|
511
|
+
async function ht() {
|
|
512
|
+
let e = await a("package-lock.json");
|
|
481
513
|
return e === null ? {} : JSON.parse(e).packages ?? {};
|
|
482
514
|
}
|
|
483
|
-
async function
|
|
484
|
-
let e = await
|
|
515
|
+
async function gt() {
|
|
516
|
+
let e = await a(nt);
|
|
485
517
|
return e === null ? null : JSON.parse(e);
|
|
486
518
|
}
|
|
487
|
-
function
|
|
519
|
+
function _t(e, t) {
|
|
488
520
|
let n = new Set(e.packages);
|
|
489
521
|
for (let r of e.external) {
|
|
490
|
-
let e =
|
|
491
|
-
if (e !== void 0) for (let r of [e, ...
|
|
522
|
+
let e = Ct(t, "", r);
|
|
523
|
+
if (e !== void 0) for (let r of [e, ...xt(t, e)]) {
|
|
492
524
|
let e = t[r];
|
|
493
|
-
e?.version !== void 0 && n.add(
|
|
525
|
+
e?.version !== void 0 && n.add(F(r, e));
|
|
494
526
|
}
|
|
495
527
|
}
|
|
496
528
|
return n;
|
|
497
529
|
}
|
|
498
|
-
function
|
|
530
|
+
function vt(e) {
|
|
499
531
|
let t = /* @__PURE__ */ new Set();
|
|
500
|
-
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(
|
|
532
|
+
for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(F(n, r));
|
|
501
533
|
return [...t];
|
|
502
534
|
}
|
|
503
|
-
function
|
|
535
|
+
function yt(e, t) {
|
|
504
536
|
let n = [...e.difference(t)];
|
|
505
537
|
n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
|
|
506
538
|
}
|
|
507
|
-
function
|
|
539
|
+
function F(e, t) {
|
|
508
540
|
return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
|
|
509
541
|
}
|
|
510
|
-
function
|
|
511
|
-
let t =
|
|
542
|
+
function bt(e) {
|
|
543
|
+
let t = xt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
512
544
|
for (let [i, a] of Object.entries(e)) {
|
|
513
545
|
if (i === "" || a.version === void 0) continue;
|
|
514
|
-
let e =
|
|
546
|
+
let e = F(i, a);
|
|
515
547
|
t.has(i) ? n.add(e) : r.add(e);
|
|
516
548
|
}
|
|
517
549
|
return r.values().filter((e) => !n.has(e)).toArray();
|
|
518
550
|
}
|
|
519
|
-
function
|
|
551
|
+
function xt(e, t) {
|
|
520
552
|
let n = /* @__PURE__ */ new Set(), r = [t];
|
|
521
553
|
for (; r.length > 0;) {
|
|
522
554
|
let t = r.pop() ?? "", i = e[t];
|
|
523
|
-
if (i !== void 0) for (let a of
|
|
524
|
-
let i =
|
|
555
|
+
if (i !== void 0) for (let a of St(i)) {
|
|
556
|
+
let i = Ct(e, t, a);
|
|
525
557
|
i === void 0 || n.has(i) || (n.add(i), r.push(i));
|
|
526
558
|
}
|
|
527
559
|
}
|
|
528
560
|
return n;
|
|
529
561
|
}
|
|
530
|
-
function
|
|
562
|
+
function St(e) {
|
|
531
563
|
let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
|
|
532
564
|
return [
|
|
533
565
|
...Object.keys(e.dependencies ?? {}),
|
|
@@ -535,7 +567,7 @@ function ft(e) {
|
|
|
535
567
|
...t
|
|
536
568
|
];
|
|
537
569
|
}
|
|
538
|
-
function
|
|
570
|
+
function Ct(e, t, n) {
|
|
539
571
|
let r = t;
|
|
540
572
|
for (;;) {
|
|
541
573
|
let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
|
|
@@ -545,14 +577,14 @@ function B(e, t, n) {
|
|
|
545
577
|
r = a === -1 ? "" : r.slice(0, a);
|
|
546
578
|
}
|
|
547
579
|
}
|
|
548
|
-
function
|
|
549
|
-
let r =
|
|
580
|
+
function wt(e, t, n = !1) {
|
|
581
|
+
let r = Tt(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.";
|
|
550
582
|
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.`;
|
|
551
583
|
}
|
|
552
|
-
function
|
|
584
|
+
function Tt(e) {
|
|
553
585
|
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))}`;
|
|
554
586
|
}
|
|
555
|
-
function
|
|
587
|
+
function Et(e, t) {
|
|
556
588
|
let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
|
|
557
589
|
return {
|
|
558
590
|
name: r,
|
|
@@ -569,7 +601,7 @@ function ht(e, t) {
|
|
|
569
601
|
}]
|
|
570
602
|
};
|
|
571
603
|
}
|
|
572
|
-
async function
|
|
604
|
+
async function Dt(e, t) {
|
|
573
605
|
try {
|
|
574
606
|
let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
|
|
575
607
|
if (n.ok) {
|
|
@@ -587,40 +619,40 @@ async function gt(e, t) {
|
|
|
587
619
|
publishedDate: ""
|
|
588
620
|
};
|
|
589
621
|
}
|
|
590
|
-
function
|
|
622
|
+
function Ot(e) {
|
|
591
623
|
let t = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
|
|
592
624
|
return `|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${t}|\n`;
|
|
593
625
|
}
|
|
594
|
-
function
|
|
626
|
+
function kt(e, t, n, r, i) {
|
|
595
627
|
let a = " ".repeat(i);
|
|
596
628
|
for (let [o, s] of Object.entries(e)) {
|
|
597
629
|
if (s.version === void 0) continue;
|
|
598
630
|
let e = s.version;
|
|
599
|
-
n.has(`${o}@${e}`) || (r.push(
|
|
631
|
+
n.has(`${o}@${e}`) || (r.push(L(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && kt(s.dependencies, t, n, r, i + 1));
|
|
600
632
|
}
|
|
601
633
|
}
|
|
602
|
-
function
|
|
634
|
+
function I(e, t, n, r, i) {
|
|
603
635
|
for (let [a, o] of e) {
|
|
604
636
|
if (o.version === void 0) continue;
|
|
605
637
|
let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
|
|
606
638
|
if (!t.shippedKeys.has(e)) {
|
|
607
|
-
|
|
639
|
+
I(s, t, n, r, !0);
|
|
608
640
|
continue;
|
|
609
641
|
}
|
|
610
|
-
i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(
|
|
642
|
+
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));
|
|
611
643
|
}
|
|
612
644
|
}
|
|
613
|
-
function
|
|
614
|
-
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${
|
|
645
|
+
function L(e, t, n, r) {
|
|
646
|
+
return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${At(n)}`;
|
|
615
647
|
}
|
|
616
|
-
function
|
|
648
|
+
function At(e) {
|
|
617
649
|
if (e == null) return "";
|
|
618
|
-
let t = e.publishedDate ?
|
|
650
|
+
let t = e.publishedDate ? R(e.publishedDate.split("T", 1)[0]) : "";
|
|
619
651
|
if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
|
|
620
|
-
let n = e.latestPublishedDate ?
|
|
652
|
+
let n = e.latestPublishedDate ? R(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `**latest**: ${e.latestVersion} ❗` : `**latest**: ${e.latestVersion} — ${n} ❗`;
|
|
621
653
|
return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
|
|
622
654
|
}
|
|
623
|
-
function
|
|
655
|
+
function R(e) {
|
|
624
656
|
if (e == null || e === "") return "n/a";
|
|
625
657
|
let t = e.split("T", 1)[0];
|
|
626
658
|
if (t == null || t === "") return "n/a";
|
|
@@ -629,31 +661,31 @@ function bt(e) {
|
|
|
629
661
|
}
|
|
630
662
|
//#endregion
|
|
631
663
|
//#region src/actions/documentOpening.ts
|
|
632
|
-
var
|
|
633
|
-
async function
|
|
664
|
+
var jt = "<!-- OPENING_START -->", Mt = "<!-- OPENING_END -->";
|
|
665
|
+
async function Nt() {
|
|
634
666
|
try {
|
|
635
|
-
|
|
636
|
-
let e = await
|
|
637
|
-
await
|
|
667
|
+
p("Document Opening"), b("1️⃣ Insert opening content into 'README.md'");
|
|
668
|
+
let e = await l("package.json"), n = await l("config.json"), { owner: r, repo: a } = t(e, "document opening"), o = Pt(e), c = It(n), u = Lt(r, a, o, v(n.id).publishedTo === "npm" ? Ft(e) : void 0, e.description, c);
|
|
669
|
+
await i(u, jt, Mt), s("Opening documented");
|
|
638
670
|
} catch (e) {
|
|
639
671
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
640
672
|
}
|
|
641
673
|
}
|
|
642
|
-
function
|
|
674
|
+
function Pt(e) {
|
|
643
675
|
let t = e.license;
|
|
644
676
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
645
677
|
return t;
|
|
646
678
|
}
|
|
647
|
-
function
|
|
679
|
+
function Ft(e) {
|
|
648
680
|
let t = e.name;
|
|
649
681
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
|
|
650
682
|
return t;
|
|
651
683
|
}
|
|
652
|
-
function
|
|
684
|
+
function It(e) {
|
|
653
685
|
let t = e.description.en?.trim();
|
|
654
686
|
return t === void 0 || t === "" ? void 0 : t;
|
|
655
687
|
}
|
|
656
|
-
function
|
|
688
|
+
function Lt(e, t, n, r, i, a) {
|
|
657
689
|
let o = `https://github.com/${e}/${t}`;
|
|
658
690
|
return `[}-blue.svg)](./LICENSE)
|
|
659
691
|
[](${o}/releases/latest)${r === void 0 ? "" : `\n[](https://www.npmjs.com/package/${r})`}
|
|
@@ -675,41 +707,41 @@ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the applicati
|
|
|
675
707
|
}
|
|
676
708
|
//#endregion
|
|
677
709
|
//#region src/actions/documentQualitySecurity.ts
|
|
678
|
-
var
|
|
710
|
+
var z = {
|
|
679
711
|
"Branch-Protection": 3,
|
|
680
712
|
"Code-Review": 0,
|
|
681
713
|
Contributors: 0
|
|
682
|
-
},
|
|
714
|
+
}, Rt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), zt = "coverage/coverage-final.json", Bt = "coverage/coverage-summary.json", B = 80, Vt = 60, V = "code-health-reports/vitest/badge.json", Ht = {
|
|
683
715
|
actions: "GitHub Actions",
|
|
684
716
|
"javascript-typescript": "JavaScript/TypeScript",
|
|
685
717
|
rust: "Rust"
|
|
686
|
-
},
|
|
718
|
+
}, Ut = {
|
|
687
719
|
A: "brightgreen",
|
|
688
720
|
B: "green",
|
|
689
721
|
C: "yellow",
|
|
690
722
|
D: "orange",
|
|
691
723
|
F: "red"
|
|
692
|
-
},
|
|
693
|
-
async function
|
|
724
|
+
}, H = `${h}/health.json`, Wt = le(ue);
|
|
725
|
+
async function Gt() {
|
|
694
726
|
try {
|
|
695
|
-
|
|
696
|
-
let e = await
|
|
727
|
+
p("Document Quality & Security");
|
|
728
|
+
let e = await l("package.json"), n = await Kt(e), r = await Jt(e, n === void 0 ? [] : ["--coverage", zt]), { owner: a, repo: o } = t(e, "document quality and security");
|
|
697
729
|
b("4️⃣ Read security checks and settings");
|
|
698
|
-
let
|
|
730
|
+
let c = await Xt(a, o, e);
|
|
699
731
|
b("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
|
|
700
|
-
let [u, d] = await Promise.all([
|
|
732
|
+
let [u, d] = await Promise.all([Zt(`https://github.com/${a}/${o}`), Qt(`github.com/${a}/${o}`)]);
|
|
701
733
|
b("6️⃣ Insert quality and security content into 'README.md'");
|
|
702
|
-
let
|
|
703
|
-
coveragePercent:
|
|
704
|
-
fallowHealth:
|
|
705
|
-
securitySettings:
|
|
734
|
+
let f = rn(a, o, {
|
|
735
|
+
coveragePercent: n,
|
|
736
|
+
fallowHealth: r,
|
|
737
|
+
securitySettings: c
|
|
706
738
|
}, u, d);
|
|
707
|
-
await
|
|
739
|
+
await oe(), await i(f, re, te), s("Quality & security documented");
|
|
708
740
|
} catch (e) {
|
|
709
741
|
console.error("❌ Error documenting quality and security", e), process.exit(1);
|
|
710
742
|
}
|
|
711
743
|
}
|
|
712
|
-
async function
|
|
744
|
+
async function Kt(e) {
|
|
713
745
|
if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
|
|
714
746
|
b("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
|
|
715
747
|
return;
|
|
@@ -719,70 +751,70 @@ async function Bt(e) {
|
|
|
719
751
|
"--passWithNoTests",
|
|
720
752
|
"--coverage"
|
|
721
753
|
]);
|
|
722
|
-
let t = await
|
|
754
|
+
let t = await a(Bt);
|
|
723
755
|
if (t === null) return;
|
|
724
756
|
let n = JSON.parse(t).total.lines.pct;
|
|
725
|
-
return await
|
|
757
|
+
return await qt(n), n;
|
|
726
758
|
}
|
|
727
|
-
async function
|
|
759
|
+
async function qt(e) {
|
|
728
760
|
let t = [
|
|
729
761
|
"red",
|
|
730
762
|
"yellow",
|
|
731
763
|
"brightgreen"
|
|
732
|
-
],
|
|
733
|
-
await
|
|
764
|
+
], r = Number(e >= Vt) + Number(e >= B);
|
|
765
|
+
await n(V, {
|
|
734
766
|
schemaVersion: 1,
|
|
735
767
|
label: "coverage",
|
|
736
768
|
message: `${e.toFixed(1)}%`,
|
|
737
|
-
color: t[
|
|
769
|
+
color: t[r]
|
|
738
770
|
});
|
|
739
771
|
}
|
|
740
|
-
async function
|
|
772
|
+
async function Jt(e, t) {
|
|
741
773
|
if (e.devDependencies?.fallow == null) {
|
|
742
774
|
b("2️⃣ Code health NOT measured, as Fallow is not installed"), b("3️⃣ Code health report NOT required");
|
|
743
775
|
return;
|
|
744
776
|
}
|
|
745
|
-
await
|
|
777
|
+
await r("2️⃣ Measure code health", "fallow", [
|
|
746
778
|
"health",
|
|
747
779
|
"--report-only",
|
|
748
780
|
"--format",
|
|
749
781
|
"json",
|
|
750
782
|
...t
|
|
751
|
-
],
|
|
752
|
-
let n = await
|
|
753
|
-
return await
|
|
783
|
+
], H), await r("3️⃣ Write code health report", "fallow", ["--format", "markdown"], c, !0);
|
|
784
|
+
let n = await l(H);
|
|
785
|
+
return await Yt(n), n;
|
|
754
786
|
}
|
|
755
|
-
async function
|
|
756
|
-
let { score: t, grade:
|
|
757
|
-
await
|
|
787
|
+
async function Yt(e) {
|
|
788
|
+
let { score: t, grade: r } = e.health_score;
|
|
789
|
+
await n(ne, {
|
|
758
790
|
schemaVersion: 1,
|
|
759
791
|
label: "fallow",
|
|
760
|
-
message: `${
|
|
761
|
-
color:
|
|
792
|
+
message: `${r} (${String(Math.round(t))})`,
|
|
793
|
+
color: Ut[r] ?? "lightgrey"
|
|
762
794
|
});
|
|
763
795
|
}
|
|
764
|
-
async function
|
|
765
|
-
let [r,
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
]), [c,
|
|
796
|
+
async function Xt(e, t, n) {
|
|
797
|
+
let [r, i, o, s] = await Promise.all([
|
|
798
|
+
a(".github/workflows/ci.yml"),
|
|
799
|
+
a(".github/workflows/codeql.yml"),
|
|
800
|
+
a(".github/dependabot.yml"),
|
|
801
|
+
a(u)
|
|
802
|
+
]), [c, l, d, f] = await Promise.all([
|
|
771
803
|
U(`repos/${e}/${t}`),
|
|
772
804
|
U(`repos/${e}/${t}/private-vulnerability-reporting`),
|
|
773
805
|
U(`repos/${e}/${t}/vulnerability-alerts`),
|
|
774
806
|
U(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
|
|
775
807
|
]), p = c === void 0 ? void 0 : JSON.parse(c).security_and_analysis, m = (e) => p?.[e] === void 0 ? void 0 : p[e].status === "enabled", h = new Set((f === void 0 ? [] : JSON.parse(f).check_runs).map((e) => e.app?.slug)), g = o?.match(/package-ecosystem:/g)?.length ?? 0, _ = o?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
|
|
776
808
|
return {
|
|
777
|
-
codeQLLanguages: (
|
|
778
|
-
codeQLQueries: /queries: ([\w-]+)/.exec(
|
|
809
|
+
codeQLLanguages: (i ?? "").matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || s !== null).map(([, e = ""]) => Ht[e] ?? e).toArray(),
|
|
810
|
+
codeQLQueries: /queries: ([\w-]+)/.exec(i ?? "")?.[1],
|
|
779
811
|
dependabotAlerts: d !== void 0,
|
|
780
812
|
dependabotSecurityUpdates: m("dependabot_security_updates"),
|
|
781
813
|
dependabotVersionUpdates: g > _,
|
|
782
814
|
lintInCI: (r ?? "").includes("npm run lint"),
|
|
783
815
|
npmAuditInCI: /npm (?:run )?audit/.test(r ?? ""),
|
|
784
816
|
npmAuditLevel: /npm audit --audit-level=(\w+)/.exec(r ?? "")?.[1],
|
|
785
|
-
privateVulnerabilityReporting:
|
|
817
|
+
privateVulnerabilityReporting: l === void 0 ? void 0 : JSON.parse(l).enabled,
|
|
786
818
|
propertyTests: n.devDependencies?.["fast-check"] != null,
|
|
787
819
|
pushProtection: m("secret_scanning_push_protection"),
|
|
788
820
|
secretScanning: m("secret_scanning"),
|
|
@@ -793,29 +825,29 @@ async function Wt(e, t, n) {
|
|
|
793
825
|
}
|
|
794
826
|
async function U(e) {
|
|
795
827
|
try {
|
|
796
|
-
let { stdout: t } = await
|
|
828
|
+
let { stdout: t } = await Wt("gh", ["api", e]);
|
|
797
829
|
return t;
|
|
798
830
|
} catch (e) {
|
|
799
831
|
if (String(e.stderr).includes("HTTP 404")) return;
|
|
800
832
|
throw e;
|
|
801
833
|
}
|
|
802
834
|
}
|
|
803
|
-
async function
|
|
835
|
+
async function Zt(e) {
|
|
804
836
|
let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
|
|
805
837
|
if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
|
|
806
838
|
return (await t.json()).find((t) => t.repo_url === e)?.id;
|
|
807
839
|
}
|
|
808
|
-
async function
|
|
840
|
+
async function Qt(e) {
|
|
809
841
|
let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
|
|
810
842
|
if (t.status !== 404) {
|
|
811
843
|
if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
|
|
812
844
|
return await t.json();
|
|
813
845
|
}
|
|
814
846
|
}
|
|
815
|
-
function
|
|
816
|
-
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 ||
|
|
847
|
+
function $t(e) {
|
|
848
|
+
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Rt.has(e) || z[e] !== void 0 && t >= z[e]);
|
|
817
849
|
}
|
|
818
|
-
function
|
|
850
|
+
function en(e) {
|
|
819
851
|
return e === !1 ? " These are handled manually." : "";
|
|
820
852
|
}
|
|
821
853
|
function W(e) {
|
|
@@ -830,11 +862,11 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
|
|
|
830
862
|
|
|
831
863
|
`;
|
|
832
864
|
}
|
|
833
|
-
function
|
|
865
|
+
function tn(e, t, n, r) {
|
|
834
866
|
return `})`;
|
|
835
867
|
}
|
|
836
|
-
function
|
|
837
|
-
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\`.` : "",
|
|
868
|
+
function nn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
869
|
+
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 = [[
|
|
838
870
|
"Unit tests",
|
|
839
871
|
W(i.testsInCI),
|
|
840
872
|
`[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
|
|
@@ -843,10 +875,10 @@ function Xt(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
|
|
|
843
875
|
W(i.propertyTests),
|
|
844
876
|
`[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)}`
|
|
845
877
|
]];
|
|
846
|
-
n !== void 0 &&
|
|
878
|
+
n !== void 0 && s.push([
|
|
847
879
|
"Test coverage",
|
|
848
880
|
W(!0),
|
|
849
|
-
`${
|
|
881
|
+
`${tn(e, t, "Coverage", V)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(B)}%.`
|
|
850
882
|
]);
|
|
851
883
|
let l = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, u = [[
|
|
852
884
|
"Code analysis",
|
|
@@ -860,7 +892,7 @@ function Xt(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
|
|
|
860
892
|
r !== void 0 && u.unshift([
|
|
861
893
|
"Code health",
|
|
862
894
|
W(!0),
|
|
863
|
-
`[${
|
|
895
|
+
`[${tn(e, t, "Fallow code health", ne)}](./${c}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
|
|
864
896
|
]);
|
|
865
897
|
let d = i.codeQLLanguages.length > 0, f = `[](${a}/security/code-scanning) `, p = i.codeQLQueries === "security-extended" ? "using the extended security queries" : "using the default queries", m = d ? ` ${i.codeQLLanguages.join(" and ")}` : "", h = [
|
|
866
898
|
[
|
|
@@ -897,23 +929,23 @@ function Xt(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
|
|
|
897
929
|
[
|
|
898
930
|
"Security updates",
|
|
899
931
|
W(i.dependabotSecurityUpdates),
|
|
900
|
-
`${g} opens pull requests that update vulnerable dependencies.${
|
|
932
|
+
`${g} opens pull requests that update vulnerable dependencies.${en(i.dependabotSecurityUpdates)}`
|
|
901
933
|
],
|
|
902
934
|
[
|
|
903
935
|
"Version updates",
|
|
904
936
|
W(i.dependabotVersionUpdates),
|
|
905
|
-
`${g} opens pull requests for new dependency versions.${
|
|
937
|
+
`${g} opens pull requests for new dependency versions.${en(i.dependabotVersionUpdates)}`
|
|
906
938
|
]
|
|
907
939
|
];
|
|
908
940
|
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.
|
|
909
941
|
|
|
910
|
-
${G("Testing",
|
|
942
|
+
${G("Testing", s)}${G("Code Quality", u)}${G("Security Analysis", h)}${G("Dependencies", _)}`;
|
|
911
943
|
}
|
|
912
|
-
function
|
|
913
|
-
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 &&
|
|
944
|
+
function rn(e, t, n, r, i) {
|
|
945
|
+
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && $t(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.";
|
|
914
946
|
return `## Quality & Security
|
|
915
947
|
|
|
916
|
-
${
|
|
948
|
+
${nn(e, t, n)}### OpenSSF 🚧
|
|
917
949
|
|
|
918
950
|
${l}[](https://scorecard.dev/viewer/?uri=${o})
|
|
919
951
|
|
|
@@ -925,26 +957,26 @@ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
|
|
|
925
957
|
}
|
|
926
958
|
//#endregion
|
|
927
959
|
//#region src/actions/documentUsage.ts
|
|
928
|
-
var
|
|
960
|
+
var an = "<!-- USAGE_START -->", on = "<!-- USAGE_END -->", sn = /* @__PURE__ */ new Set([
|
|
929
961
|
"connector",
|
|
930
962
|
"cookbook",
|
|
931
963
|
"presenter"
|
|
932
|
-
]),
|
|
933
|
-
async function
|
|
964
|
+
]), cn = /* @__PURE__ */ new Set(["development", "eslint"]), ln = "> [!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.", un = "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).";
|
|
965
|
+
async function fn() {
|
|
934
966
|
try {
|
|
935
|
-
|
|
936
|
-
let [e, t] = await Promise.all([
|
|
937
|
-
await
|
|
967
|
+
p("Document Usage"), b("1️⃣ Insert usage content into 'README.md'");
|
|
968
|
+
let [e, t] = await Promise.all([l("package.json"), l("config.json")]), n = pn(e), r = mn(n), a = K(e.engines?.node), o = K(e.engines?.npm), c = K(e.devDependencies?.typescript), u = hn(v(t.id), e.name), d = `${n.replace(/\.git$/, "")}/blob/main/package.json`, f = gn(u, n, r, a, o, c, `${e.name === "@dpuse/dpuse-development" ? un : dn} See the \`scripts\` block in [package.json](${d}) for details.`);
|
|
969
|
+
await i(f, an, on), s("Usage documented");
|
|
938
970
|
} catch (e) {
|
|
939
971
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
940
972
|
}
|
|
941
973
|
}
|
|
942
|
-
function
|
|
974
|
+
function pn(e) {
|
|
943
975
|
let t = e.repository, n = typeof t == "string" ? t : t?.url;
|
|
944
976
|
if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
|
|
945
977
|
return n.replace(/^git\+/, "");
|
|
946
978
|
}
|
|
947
|
-
function
|
|
979
|
+
function mn(e) {
|
|
948
980
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
949
981
|
}
|
|
950
982
|
function K(e) {
|
|
@@ -953,9 +985,9 @@ function K(e) {
|
|
|
953
985
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
954
986
|
return t[0];
|
|
955
987
|
}
|
|
956
|
-
function
|
|
988
|
+
function hn(e, t) {
|
|
957
989
|
let { typeId: n } = e;
|
|
958
|
-
if (
|
|
990
|
+
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.
|
|
959
991
|
|
|
960
992
|
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.`;
|
|
961
993
|
if (e.publishedTo === "npm") {
|
|
@@ -966,11 +998,11 @@ You may view or clone this repository for your own purposes, such as building a
|
|
|
966
998
|
npm install ${t}
|
|
967
999
|
\`\`\`
|
|
968
1000
|
|
|
969
|
-
${
|
|
1001
|
+
${cn.has(n) ? `${ln}\n\n` : ""}To work on the source instead, clone this repository.`;
|
|
970
1002
|
}
|
|
971
1003
|
return "You may view or clone this repository for your own purposes.";
|
|
972
1004
|
}
|
|
973
|
-
function
|
|
1005
|
+
function gn(e, t, n, r, i, a, o) {
|
|
974
1006
|
return `## Usage
|
|
975
1007
|
|
|
976
1008
|
${e}
|
|
@@ -988,101 +1020,101 @@ ${o}`;
|
|
|
988
1020
|
//#endregion
|
|
989
1021
|
//#region src/actions/documentApiReference.ts
|
|
990
1022
|
var q = "API_REFERENCE.md";
|
|
991
|
-
async function
|
|
1023
|
+
async function _n() {
|
|
992
1024
|
try {
|
|
993
|
-
|
|
994
|
-
let { writeAPIReference: e } = await import("./apiReference-
|
|
995
|
-
await e("1️⃣ ", q),
|
|
1025
|
+
p("Document API Reference");
|
|
1026
|
+
let { writeAPIReference: e } = await import("./apiReference-CT5_Z6VQ.js");
|
|
1027
|
+
await e("1️⃣ ", q), s("API reference documented");
|
|
996
1028
|
} catch (e) {
|
|
997
1029
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
998
1030
|
}
|
|
999
1031
|
}
|
|
1000
1032
|
//#endregion
|
|
1001
1033
|
//#region src/actions/documentBundleSizes.ts
|
|
1002
|
-
var
|
|
1003
|
-
async function
|
|
1034
|
+
var vn = "bundle-analysis-reports/sonda/index.json", yn = "<!-- BUNDLE_START -->", bn = "<!-- BUNDLE_END -->", J = " ", Y = 20, xn = "█", Sn = "▒", Cn = 100 / Y / 2, wn = 100 / Y, Tn = "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._", En = "Bars show each row's share of its output file.", Dn = "↳ rows are part of the row above.", X = "(bundler output, whitespace & JSON)", On = `${X} = 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.`;
|
|
1035
|
+
async function kn(e) {
|
|
1004
1036
|
try {
|
|
1005
|
-
|
|
1006
|
-
let t = await
|
|
1037
|
+
p("Document Bundle Sizes"), b("1️⃣ Read bundle analysis report");
|
|
1038
|
+
let t = await l(vn);
|
|
1007
1039
|
b("2️⃣ Insert table into 'README.md'");
|
|
1008
|
-
let
|
|
1009
|
-
await
|
|
1040
|
+
let n = An(t, e?.moduleLevel ?? !1), r = n.includes("↳") ? `${En} ${Dn}` : En;
|
|
1041
|
+
await i(`## Bundle Analysis\n\n${Tn}\n\n${n}\n\n${r}\n\n${On}`, yn, bn), s("Bundle sizes documented");
|
|
1010
1042
|
} catch (e) {
|
|
1011
1043
|
console.error("❌ Error documenting bundle sizes", e), process.exit(1);
|
|
1012
1044
|
}
|
|
1013
1045
|
}
|
|
1014
|
-
function
|
|
1015
|
-
let n =
|
|
1046
|
+
function An(e, t) {
|
|
1047
|
+
let n = Ln(e), r = n.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), i = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, Hn(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
|
|
1016
1048
|
for (let [e, o] of i) {
|
|
1017
|
-
let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted(
|
|
1018
|
-
a.push(`| **${e}** | ${
|
|
1049
|
+
let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted(jn), s = i.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), c = s > 0 && r > 0 ? ` · ${qn(s, r)} of the build` : "";
|
|
1050
|
+
a.push(`| **${e}** | ${Un(o)}${c} |`, ...Mn(i, s, t));
|
|
1019
1051
|
}
|
|
1020
1052
|
return a.join("\n");
|
|
1021
1053
|
}
|
|
1022
|
-
function
|
|
1054
|
+
function jn(e, t) {
|
|
1023
1055
|
return e[0] === X == (t[0] === X) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === X ? 1 : -1;
|
|
1024
1056
|
}
|
|
1025
|
-
function
|
|
1057
|
+
function Mn(e, t, n) {
|
|
1026
1058
|
let r = [];
|
|
1027
1059
|
for (let [i, { sizes: a, files: o }] of e) {
|
|
1028
1060
|
if (o.size === 1) {
|
|
1029
|
-
let e =
|
|
1030
|
-
r.push(`| ${J}${
|
|
1061
|
+
let e = In(o);
|
|
1062
|
+
r.push(`| ${J}${Fn(i, e)} | ${Z(a.uncompressed, t)} |`);
|
|
1031
1063
|
continue;
|
|
1032
1064
|
}
|
|
1033
|
-
r.push(`| ${J}${i} | ${Z(a.uncompressed, t)} |`), n || r.push(...
|
|
1065
|
+
r.push(`| ${J}${i} | ${Z(a.uncompressed, t)} |`), n || r.push(...Nn(o, t));
|
|
1034
1066
|
}
|
|
1035
1067
|
return r;
|
|
1036
1068
|
}
|
|
1037
|
-
function
|
|
1038
|
-
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r =
|
|
1069
|
+
function Nn(e, t) {
|
|
1070
|
+
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = Pn(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${J}${J}↳ ${e} | ${Z(n.uncompressed, t, Sn)} |`);
|
|
1039
1071
|
if (r > 0) {
|
|
1040
1072
|
let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
|
|
1041
|
-
i.push(`| ${J}${J}↳ ${String(r)} smaller files | ${Z(e, t,
|
|
1073
|
+
i.push(`| ${J}${J}↳ ${String(r)} smaller files | ${Z(e, t, Sn)} |`);
|
|
1042
1074
|
}
|
|
1043
1075
|
return i;
|
|
1044
1076
|
}
|
|
1045
|
-
function
|
|
1077
|
+
function Pn(e, t) {
|
|
1046
1078
|
if (t <= 0) return 0;
|
|
1047
1079
|
let n = 0, r = 0;
|
|
1048
1080
|
for (let [, i] of e.toReversed()) {
|
|
1049
|
-
let e = i.uncompressed / t * 100 <
|
|
1081
|
+
let e = i.uncompressed / t * 100 < Cn, a = (r + i.uncompressed) / t * 100 <= wn;
|
|
1050
1082
|
if (!e || !a) break;
|
|
1051
1083
|
n++, r += i.uncompressed;
|
|
1052
1084
|
}
|
|
1053
1085
|
return n >= 2 ? n : 0;
|
|
1054
1086
|
}
|
|
1055
|
-
function Z(e, t, n =
|
|
1056
|
-
return `${
|
|
1087
|
+
function Z(e, t, n = xn) {
|
|
1088
|
+
return `${Wn(t > 0 ? e / t * 100 : 0, n)} · ${Q(e)}`;
|
|
1057
1089
|
}
|
|
1058
|
-
function
|
|
1090
|
+
function Fn(e, t) {
|
|
1059
1091
|
return t === "" ? e : `${e} → ${t}`;
|
|
1060
1092
|
}
|
|
1061
|
-
function
|
|
1093
|
+
function In(e) {
|
|
1062
1094
|
let [t] = e.keys();
|
|
1063
1095
|
if (t === void 0) throw Error("Expected exactly one file");
|
|
1064
1096
|
return t;
|
|
1065
1097
|
}
|
|
1066
|
-
function
|
|
1067
|
-
let t =
|
|
1098
|
+
function Ln(e) {
|
|
1099
|
+
let t = Rn(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1068
1100
|
for (let r of e.resources) {
|
|
1069
1101
|
if (r.kind !== "chunk" || !r.parent) continue;
|
|
1070
|
-
let { group: e, file: i } =
|
|
1102
|
+
let { group: e, file: i } = zn(r.name, t), a = Hn(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
|
|
1071
1103
|
n.set(r.parent, o);
|
|
1072
1104
|
let s = o.get(e) ?? {
|
|
1073
|
-
sizes:
|
|
1105
|
+
sizes: Gn(),
|
|
1074
1106
|
files: /* @__PURE__ */ new Map()
|
|
1075
1107
|
};
|
|
1076
|
-
o.set(e, s),
|
|
1077
|
-
let c = s.files.get(i) ??
|
|
1078
|
-
s.files.set(i, c),
|
|
1108
|
+
o.set(e, s), Kn(s.sizes, a);
|
|
1109
|
+
let c = s.files.get(i) ?? Gn();
|
|
1110
|
+
s.files.set(i, c), Kn(c, a);
|
|
1079
1111
|
}
|
|
1080
1112
|
return n;
|
|
1081
1113
|
}
|
|
1082
|
-
function
|
|
1114
|
+
function Rn(e) {
|
|
1083
1115
|
return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
|
|
1084
1116
|
}
|
|
1085
|
-
function
|
|
1117
|
+
function zn(e, t) {
|
|
1086
1118
|
let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
|
|
1087
1119
|
if (n) {
|
|
1088
1120
|
let [t, r] = n;
|
|
@@ -1099,42 +1131,42 @@ function Nn(e, t) {
|
|
|
1099
1131
|
file: e.slice(1)
|
|
1100
1132
|
} : e.startsWith("rust/") ? {
|
|
1101
1133
|
group: "wasm",
|
|
1102
|
-
file:
|
|
1134
|
+
file: Bn(e)
|
|
1103
1135
|
} : {
|
|
1104
1136
|
group: "src",
|
|
1105
|
-
file:
|
|
1137
|
+
file: Vn(e)
|
|
1106
1138
|
};
|
|
1107
1139
|
}
|
|
1108
|
-
function
|
|
1109
|
-
let t = e.split("/", 2)[1] ?? "", n =
|
|
1140
|
+
function Bn(e) {
|
|
1141
|
+
let t = e.split("/", 2)[1] ?? "", n = Vn(e);
|
|
1110
1142
|
return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
|
|
1111
1143
|
}
|
|
1112
|
-
function
|
|
1144
|
+
function Vn(e) {
|
|
1113
1145
|
return e.split("/").at(-1) ?? e;
|
|
1114
1146
|
}
|
|
1115
|
-
function
|
|
1147
|
+
function Hn(e) {
|
|
1116
1148
|
return {
|
|
1117
1149
|
uncompressed: e.uncompressed,
|
|
1118
1150
|
gzip: e.gzip ?? 0
|
|
1119
1151
|
};
|
|
1120
1152
|
}
|
|
1121
|
-
function
|
|
1153
|
+
function Un(e) {
|
|
1122
1154
|
return `${Q(e.uncompressed)} · gzip ${Q(e.gzip)}`;
|
|
1123
1155
|
}
|
|
1124
|
-
function
|
|
1156
|
+
function Wn(e, t = xn) {
|
|
1125
1157
|
let n = Math.round(e / 100 * Y);
|
|
1126
1158
|
return `\`${t.repeat(n)}${"░".repeat(Y - n)}\` ${e.toFixed(1)}%`;
|
|
1127
1159
|
}
|
|
1128
|
-
function
|
|
1160
|
+
function Gn() {
|
|
1129
1161
|
return {
|
|
1130
1162
|
uncompressed: 0,
|
|
1131
1163
|
gzip: 0
|
|
1132
1164
|
};
|
|
1133
1165
|
}
|
|
1134
|
-
function
|
|
1166
|
+
function Kn(e, t) {
|
|
1135
1167
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
1136
1168
|
}
|
|
1137
|
-
function
|
|
1169
|
+
function qn(e, t) {
|
|
1138
1170
|
return `${(e / t * 100).toFixed(1)}%`;
|
|
1139
1171
|
}
|
|
1140
1172
|
function Q(e) {
|
|
@@ -1142,15 +1174,15 @@ function Q(e) {
|
|
|
1142
1174
|
}
|
|
1143
1175
|
//#endregion
|
|
1144
1176
|
//#region src/actions/documentProject.ts
|
|
1145
|
-
async function
|
|
1177
|
+
async function Jn(e = "MIT", t = !1) {
|
|
1146
1178
|
try {
|
|
1147
|
-
let n = await
|
|
1148
|
-
await
|
|
1149
|
-
let
|
|
1150
|
-
|
|
1179
|
+
let n = await l("config.json"), r = v(n.id).typeId === "connector";
|
|
1180
|
+
await Nt(), r && await Be(), await fn(), await ot(e), await a("bundle-analysis-reports/sonda/index.json") === null ? b(`ℹ️ Bundle sizes NOT documented, as there is no '${vn}' yet. Build the project first.`) : await kn({ moduleLevel: t }), await Gt(), await Ve();
|
|
1181
|
+
let i = await a(q) !== null;
|
|
1182
|
+
i ? await _n() : b(`ℹ️ '${q}' NOT required by this project`), await x("ℹ️ Format generated files", "prettier", [
|
|
1151
1183
|
"--write",
|
|
1152
1184
|
"README.md",
|
|
1153
|
-
...
|
|
1185
|
+
...i ? [q] : []
|
|
1154
1186
|
]);
|
|
1155
1187
|
} catch (e) {
|
|
1156
1188
|
console.error("❌ Error documenting project", e), process.exit(1);
|
|
@@ -1158,9 +1190,9 @@ async function Hn(e = "MIT", t = !1) {
|
|
|
1158
1190
|
}
|
|
1159
1191
|
//#endregion
|
|
1160
1192
|
//#region src/actions/formatCode.ts
|
|
1161
|
-
async function
|
|
1193
|
+
async function Yn() {
|
|
1162
1194
|
try {
|
|
1163
|
-
|
|
1195
|
+
p("Format Code");
|
|
1164
1196
|
let e = [
|
|
1165
1197
|
"--write",
|
|
1166
1198
|
"*.json",
|
|
@@ -1170,37 +1202,37 @@ async function Un() {
|
|
|
1170
1202
|
"app",
|
|
1171
1203
|
"src",
|
|
1172
1204
|
"tests"
|
|
1173
|
-
].filter((e) =>
|
|
1205
|
+
].filter((e) => ce(e)).map((e) => `${e}/**`)
|
|
1174
1206
|
];
|
|
1175
|
-
await x("1️⃣ Format", "prettier", e),
|
|
1207
|
+
await x("1️⃣ Format", "prettier", e), s("Code formatted");
|
|
1176
1208
|
} catch (e) {
|
|
1177
1209
|
console.error("❌ Error formatting code", e), process.exit(1);
|
|
1178
1210
|
}
|
|
1179
1211
|
}
|
|
1180
1212
|
//#endregion
|
|
1181
1213
|
//#region src/actions/lintCode.ts
|
|
1182
|
-
async function
|
|
1214
|
+
async function Xn() {
|
|
1183
1215
|
try {
|
|
1184
|
-
|
|
1216
|
+
p("Lint Code"), await x("1️⃣ Lint", "eslint", ["."]), s("Code linted");
|
|
1185
1217
|
} catch (e) {
|
|
1186
1218
|
console.error("❌ Error linting code", e), process.exit(1);
|
|
1187
1219
|
}
|
|
1188
1220
|
}
|
|
1189
1221
|
//#endregion
|
|
1190
1222
|
//#region src/utilities/cloudflare.ts
|
|
1191
|
-
async function
|
|
1192
|
-
let e = await
|
|
1223
|
+
async function Zn() {
|
|
1224
|
+
let e = await l("config.json"), t = {
|
|
1193
1225
|
body: JSON.stringify(e),
|
|
1194
1226
|
headers: { "Content-Type": "application/json" },
|
|
1195
1227
|
method: "PUT"
|
|
1196
1228
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
1197
1229
|
if (!n.ok) throw Error(await n.text());
|
|
1198
1230
|
}
|
|
1199
|
-
async function
|
|
1231
|
+
async function Qn(e, t) {
|
|
1200
1232
|
async function n(e, t, r) {
|
|
1201
1233
|
for (let i of r) {
|
|
1202
1234
|
let r = `${e}/${i}`, a = `${t}/${i}`;
|
|
1203
|
-
(await
|
|
1235
|
+
(await m(r)).isDirectory() ? await n(r, a, await y(r)) : (console.info(`⚙️ Uploading '${e}/${i}'...`), await f(void 0, "wrangler", [
|
|
1204
1236
|
"r2",
|
|
1205
1237
|
"object",
|
|
1206
1238
|
"put",
|
|
@@ -1211,10 +1243,10 @@ async function Kn(e, t) {
|
|
|
1211
1243
|
]));
|
|
1212
1244
|
}
|
|
1213
1245
|
}
|
|
1214
|
-
let r = await
|
|
1246
|
+
let r = await y(`${e}/${t}/`);
|
|
1215
1247
|
await n(`${e}/${t}`, t, r);
|
|
1216
1248
|
}
|
|
1217
|
-
async function
|
|
1249
|
+
async function $(e) {
|
|
1218
1250
|
let t = e.id, n = {
|
|
1219
1251
|
body: JSON.stringify(e),
|
|
1220
1252
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1222,14 +1254,14 @@ async function qn(e) {
|
|
|
1222
1254
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
1223
1255
|
if (!r.ok) throw Error(await r.text());
|
|
1224
1256
|
}
|
|
1225
|
-
async function
|
|
1257
|
+
async function $n(e, t) {
|
|
1226
1258
|
let n = `v${e.version ?? "unknown"}`;
|
|
1227
1259
|
async function r(e, r = "") {
|
|
1228
|
-
let i = await
|
|
1260
|
+
let i = await y(e, { withFileTypes: !0 });
|
|
1229
1261
|
for (let a of i) {
|
|
1230
1262
|
if (a.isDirectory() || a.name.endsWith(".map")) continue;
|
|
1231
1263
|
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = a.name.endsWith(".css") ? "text/css" : "application/octet-stream", l = a.name.endsWith(".js") ? "application/javascript" : c;
|
|
1232
|
-
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await
|
|
1264
|
+
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await f(void 0, "wrangler", [
|
|
1233
1265
|
"r2",
|
|
1234
1266
|
"object",
|
|
1235
1267
|
"put",
|
|
@@ -1246,42 +1278,42 @@ async function Jn(e, t) {
|
|
|
1246
1278
|
}
|
|
1247
1279
|
//#endregion
|
|
1248
1280
|
//#region src/actions/publishProject.ts
|
|
1249
|
-
async function
|
|
1281
|
+
async function er() {
|
|
1250
1282
|
try {
|
|
1251
|
-
|
|
1252
|
-
let e = await
|
|
1253
|
-
n.publishedTo === "npm" ? await x("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : b("1️⃣ Publishing to npm NOT required"), await
|
|
1283
|
+
p("Publish Project");
|
|
1284
|
+
let e = await l("package.json"), t = await l("config.json"), n = v(t.id);
|
|
1285
|
+
n.publishedTo === "npm" ? await x("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : b("1️⃣ Publishing to npm NOT required"), await tr("2️⃣ ", e, t, n), n.publishedTo === "kb" && await x("3️⃣ Deploy", "npm", ["run", "deploy"]), s(`Project version '${e.version ?? "unknown"}' published.`);
|
|
1254
1286
|
} catch (e) {
|
|
1255
1287
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1256
1288
|
}
|
|
1257
1289
|
}
|
|
1258
|
-
async function
|
|
1259
|
-
if (r.typeId === "app") b(`${e} Register module`), await
|
|
1260
|
-
else if (r.typeId === "engine") b(`${e} Register module`), await
|
|
1290
|
+
async function tr(e, t, n, r) {
|
|
1291
|
+
if (r.typeId === "app") b(`${e} Register module`), await Zn();
|
|
1292
|
+
else if (r.typeId === "engine") b(`${e} Register module`), await $n(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await $(n);
|
|
1261
1293
|
else if (r.uploadGroupName === void 0) b(`${e} Registration NOT required`);
|
|
1262
1294
|
else {
|
|
1263
1295
|
b(`${e} Register module`);
|
|
1264
1296
|
let i = n.id.split("-").slice(2).join("-");
|
|
1265
|
-
await
|
|
1297
|
+
await $n(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await $(n);
|
|
1266
1298
|
}
|
|
1267
1299
|
}
|
|
1268
1300
|
//#endregion
|
|
1269
1301
|
//#region src/actions/releaseProject.ts
|
|
1270
|
-
async function
|
|
1302
|
+
async function nr(e = "MIT", t = !1) {
|
|
1271
1303
|
try {
|
|
1272
|
-
|
|
1273
|
-
let n = await
|
|
1274
|
-
await
|
|
1275
|
-
let a = await
|
|
1276
|
-
if (await
|
|
1304
|
+
p("Release Project");
|
|
1305
|
+
let n = await l("package.json"), r = await l("config.json"), i = v(r.id);
|
|
1306
|
+
await ae("1️⃣ ", n);
|
|
1307
|
+
let a = await _("2️⃣ ", n, i);
|
|
1308
|
+
if (await Se("3️⃣ ", n), b("4️⃣ Regenerate README"), await Jn(e, t), await f("5️⃣ Stage changes", "git", ["add", "."]), await f("6️⃣ Commit changes", "git", [
|
|
1277
1309
|
"commit",
|
|
1278
1310
|
"-m",
|
|
1279
1311
|
`v${n.version ?? "unknown"}`
|
|
1280
|
-
]), await
|
|
1312
|
+
]), await f("7️⃣ Push changes", "git", [
|
|
1281
1313
|
"push",
|
|
1282
1314
|
"origin",
|
|
1283
1315
|
"main:main"
|
|
1284
|
-
]), await
|
|
1316
|
+
]), await tr("8️⃣ ", n, a, i), i.publishedTo === "npm") {
|
|
1285
1317
|
let e = `v${n.version ?? "unknown"}`;
|
|
1286
1318
|
await x("9️⃣ Create GitHub release", "gh", [
|
|
1287
1319
|
"release",
|
|
@@ -1293,38 +1325,38 @@ async function Xn(e = "MIT", t = !1) {
|
|
|
1293
1325
|
"--latest"
|
|
1294
1326
|
]);
|
|
1295
1327
|
} else b(`9️⃣ Publishing NOT required for package with type identifier of '${i.typeId}'.`);
|
|
1296
|
-
|
|
1328
|
+
s(`Project version '${n.version ?? "unknown"}' released.`);
|
|
1297
1329
|
} catch (e) {
|
|
1298
1330
|
console.error("❌ Error releasing project", e), process.exit(1);
|
|
1299
1331
|
}
|
|
1300
1332
|
}
|
|
1301
1333
|
//#endregion
|
|
1302
1334
|
//#region src/actions/syncProjectWithGitHub.ts
|
|
1303
|
-
async function
|
|
1335
|
+
async function rr() {
|
|
1304
1336
|
try {
|
|
1305
|
-
|
|
1306
|
-
let e = await
|
|
1307
|
-
await
|
|
1337
|
+
p("Synchronise Project with GitHub");
|
|
1338
|
+
let e = await l("package.json"), t = await l("config.json"), n = v(t.id);
|
|
1339
|
+
await ae("1️⃣ ", e), await _("2️⃣ ", e, n), await f("3️⃣ Stage changes", "git", ["add", "."]), await f("4️⃣ Commit changes", "git", [
|
|
1308
1340
|
"commit",
|
|
1309
1341
|
"-m",
|
|
1310
1342
|
`v${e.version ?? "unknown"}`
|
|
1311
|
-
]), await
|
|
1343
|
+
]), await f("5️⃣ Push changes", "git", [
|
|
1312
1344
|
"push",
|
|
1313
1345
|
"origin",
|
|
1314
1346
|
"main:main"
|
|
1315
|
-
]),
|
|
1347
|
+
]), s(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
|
|
1316
1348
|
} catch (e) {
|
|
1317
1349
|
console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
|
|
1318
1350
|
}
|
|
1319
1351
|
}
|
|
1320
1352
|
//#endregion
|
|
1321
1353
|
//#region src/actions/testProject.ts
|
|
1322
|
-
var
|
|
1354
|
+
var ir = [
|
|
1323
1355
|
"1️⃣ ",
|
|
1324
1356
|
"2️⃣ ",
|
|
1325
1357
|
"3️⃣ ",
|
|
1326
1358
|
"4️⃣ "
|
|
1327
|
-
],
|
|
1359
|
+
], ar = [{
|
|
1328
1360
|
id: "unit",
|
|
1329
1361
|
label: "Run unit tests",
|
|
1330
1362
|
command: "vitest",
|
|
@@ -1337,30 +1369,30 @@ var Qn = [
|
|
|
1337
1369
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1338
1370
|
configFileName: "playwright.config.ts"
|
|
1339
1371
|
}];
|
|
1340
|
-
async function
|
|
1372
|
+
async function or(e = ["unit"]) {
|
|
1341
1373
|
try {
|
|
1342
|
-
|
|
1374
|
+
p("Test Project");
|
|
1343
1375
|
let t = 0;
|
|
1344
|
-
for (let n of
|
|
1345
|
-
if (!e.includes(n.id) || await
|
|
1346
|
-
let r = `${
|
|
1376
|
+
for (let n of ar) {
|
|
1377
|
+
if (!e.includes(n.id) || await a(n.configFileName) === null) continue;
|
|
1378
|
+
let r = `${ir[t] ?? ""} ${n.label}`;
|
|
1347
1379
|
await x(r, n.command, n.arguments), t += 1;
|
|
1348
1380
|
}
|
|
1349
1381
|
if (t === 0) {
|
|
1350
1382
|
console.warn("\n⚠️ No tests configured for this project.\n");
|
|
1351
1383
|
return;
|
|
1352
1384
|
}
|
|
1353
|
-
|
|
1385
|
+
s("Project tested");
|
|
1354
1386
|
} catch (e) {
|
|
1355
1387
|
console.error("❌ Error testing project", e), process.exit(1);
|
|
1356
1388
|
}
|
|
1357
1389
|
}
|
|
1358
1390
|
//#endregion
|
|
1359
1391
|
//#region src/actions/triggerGitHubRelease.ts
|
|
1360
|
-
async function
|
|
1392
|
+
async function sr() {
|
|
1361
1393
|
try {
|
|
1362
|
-
|
|
1363
|
-
let e = `v${(await
|
|
1394
|
+
p("Trigger GitHub Release");
|
|
1395
|
+
let e = `v${(await l("package.json")).version ?? "unknown"}`;
|
|
1364
1396
|
await x("1️⃣ Create GitHub release", "gh", [
|
|
1365
1397
|
"release",
|
|
1366
1398
|
"create",
|
|
@@ -1369,10 +1401,10 @@ async function tr() {
|
|
|
1369
1401
|
"main",
|
|
1370
1402
|
"--generate-notes",
|
|
1371
1403
|
"--latest"
|
|
1372
|
-
]),
|
|
1404
|
+
]), s(`GitHub release '${e}' created.`);
|
|
1373
1405
|
} catch (e) {
|
|
1374
1406
|
console.error("❌ Error triggering GitHub release", e), process.exit(1);
|
|
1375
1407
|
}
|
|
1376
1408
|
}
|
|
1377
1409
|
//#endregion
|
|
1378
|
-
export {
|
|
1410
|
+
export { _e as auditDependencies, xe as buildProject, Pe as checkProject, Jn as documentProject, Yn as formatCode, Xn as lintCode, er as publishProject, nr as releaseProject, rr as syncProjectWithGitHub, or as testProject, sr as triggerGitHubRelease, Qn as uploadDirectoryToR2 };
|