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