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