@dpuse/dpuse-development 0.3.818 → 0.3.821
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 +21 -25
- package/dist/{apiReference-CT5_Z6VQ.js → apiReference-cMfpNKxR.js} +16 -13
- package/dist/apiReference-cMfpNKxR.js.map +1 -0
- package/dist/dpuse-development.es.js +449 -449
- package/dist/dpuse-development.es.js.map +1 -1
- package/dist/types/src/utilities/index.d.ts +3 -2
- package/dist/{utilities-6R4TbiJy.js → utilities-BLjGg0iM.js} +152 -152
- package/dist/utilities-BLjGg0iM.js.map +1 -0
- package/package.json +2 -2
- package/vite.config.default.ts +3 -1
- package/vite.config.presenter.ts +3 -1
- package/vite.config.tool.ts +3 -1
- package/vitest.config.ts +3 -1
- package/dist/apiReference-CT5_Z6VQ.js.map +0 -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-BLjGg0iM.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, repository: 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,41 +663,40 @@ 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, repository: r } = w(e, "document opening"), i = jt(e), a = Nt(t), o = m(t.id), c = Pt(n, r, i, o.uploadGroupName !== void 0, o.publishedTo === "npm" ? Mt(e) : void 0, e.description, a);
|
|
671
|
+
await _(c, 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
|
|
689
|
-
let
|
|
690
|
-
return `[}-blue.svg)](./LICENSE)
|
|
691
|
-
[](${o}/actions/workflows/ci.yml)
|
|
690
|
+
function Pt(e, t, n, r, i, a, o) {
|
|
691
|
+
let s = `https://github.com/${e}/${t}`;
|
|
692
|
+
return `[}-blue.svg)](./LICENSE)${r ? `\n[](${s}/releases/latest)` : ""}${i === void 0 ? "" : `\n[](https://www.npmjs.com/package/${i})`}
|
|
693
|
+
[](${s}/actions/workflows/ci.yml)${a == null || a === "" ? "" : `\n\n${a}`}
|
|
693
694
|
|
|
694
|
-
[
|
|
695
|
+
[Report a Vulnerability](${s}/security/advisories/new) · [Open an Issue](${s}/issues)
|
|
695
696
|
|
|
696
697
|
## About DPUse
|
|
697
698
|
|
|
698
|
-
DPUse (Data Positioning & Use) is an in-browser application that positions your data for use through three core activities: sourcing, contextualising, and publishing.
|
|
699
|
+
[DPUse](https://www.dpuse.app) (Data Positioning & Use) is an in-browser application that positions your data for use through three core activities: sourcing, contextualising, and publishing.
|
|
699
700
|
|
|
700
701
|
**Sourcing** uses a library of [Connectors](https://www.dpuse.app/connectors) to establish [Connections](https://www.dpuse.app) to applications, databases, file stores, and curated datasets; these connections are subsequently used to configure structured [Data Views](https://www.dpuse.app) from the underlying sources.
|
|
701
702
|
|
|
@@ -703,15 +704,15 @@ DPUse (Data Positioning & Use) is an in-browser application that positions your
|
|
|
703
704
|
|
|
704
705
|
**Publishing** uses a library of [Presenters](https://www.dpuse.app) to render standard [Presentations](https://www.dpuse.app) immediately using the contextualised data; additionally, [Cookbooks](https://www.dpuse.app) of [Recipes](https://www.dpuse.app) let you build Data Apps using your preferred tools.
|
|
705
706
|
|
|
706
|
-
In addition, DPUse provides [Tools](https://www.dpuse.app) used by the application, and you can use them to construct connectors and presenters.${
|
|
707
|
+
In addition, DPUse provides [Tools](https://www.dpuse.app) used by the application, and you can use them to construct connectors and presenters.${o === void 0 ? "" : `\n\n## Introduction\n\n${o}`}`;
|
|
707
708
|
}
|
|
708
709
|
//#endregion
|
|
709
710
|
//#region src/actions/documentQualitySecurity.ts
|
|
710
|
-
var
|
|
711
|
+
var Ft = {
|
|
711
712
|
"Branch-Protection": 3,
|
|
712
713
|
"Code-Review": 0,
|
|
713
714
|
Contributors: 0
|
|
714
|
-
},
|
|
715
|
+
}, 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
716
|
actions: "GitHub Actions",
|
|
716
717
|
"javascript-typescript": "JavaScript/TypeScript",
|
|
717
718
|
rust: "Rust"
|
|
@@ -721,133 +722,132 @@ var z = {
|
|
|
721
722
|
C: "yellow",
|
|
722
723
|
D: "orange",
|
|
723
724
|
F: "red"
|
|
724
|
-
},
|
|
725
|
-
async function
|
|
725
|
+
}, Wt = `${c}/health.json`, Gt = oe(se);
|
|
726
|
+
async function Kt() {
|
|
726
727
|
try {
|
|
727
|
-
|
|
728
|
-
let e = await
|
|
729
|
-
|
|
730
|
-
let
|
|
731
|
-
|
|
732
|
-
let [
|
|
733
|
-
|
|
734
|
-
let
|
|
735
|
-
coveragePercent:
|
|
736
|
-
fallowHealth:
|
|
737
|
-
securitySettings:
|
|
738
|
-
},
|
|
739
|
-
await
|
|
728
|
+
s("Document Quality & Security");
|
|
729
|
+
let e = await T("package.json"), t = await qt(e), n = await Yt(e, t === void 0 ? [] : ["--coverage", Lt]), { owner: r, repository: i } = w(e, "document quality and security");
|
|
730
|
+
E("4️⃣ Read security checks and settings");
|
|
731
|
+
let a = await Zt(r, i, e);
|
|
732
|
+
E("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
|
|
733
|
+
let [o, c] = await Promise.all([Qt(`https://github.com/${r}/${i}`), $t(`github.com/${r}/${i}`)]);
|
|
734
|
+
E("6️⃣ Insert quality and security content into 'README.md'");
|
|
735
|
+
let d = an(r, i, {
|
|
736
|
+
coveragePercent: t,
|
|
737
|
+
fallowHealth: n,
|
|
738
|
+
securitySettings: a
|
|
739
|
+
}, o, c);
|
|
740
|
+
await l(), await _(d, u, ne), C("Quality & security documented");
|
|
740
741
|
} catch (e) {
|
|
741
742
|
console.error("❌ Error documenting quality and security", e), process.exit(1);
|
|
742
743
|
}
|
|
743
744
|
}
|
|
744
|
-
async function
|
|
745
|
-
if (
|
|
746
|
-
|
|
745
|
+
async function qt(t) {
|
|
746
|
+
if (t.devDependencies?.["@vitest/coverage-v8"] == null) {
|
|
747
|
+
E("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
|
|
747
748
|
return;
|
|
748
749
|
}
|
|
749
|
-
await
|
|
750
|
+
await o("1️⃣ Measure test coverage", "vitest", [
|
|
750
751
|
"run",
|
|
751
752
|
"--passWithNoTests",
|
|
752
753
|
"--coverage"
|
|
753
754
|
]);
|
|
754
|
-
let
|
|
755
|
-
if (
|
|
756
|
-
let
|
|
757
|
-
return await
|
|
755
|
+
let n = await e(Rt);
|
|
756
|
+
if (n === null) return;
|
|
757
|
+
let r = JSON.parse(n).total.lines.pct;
|
|
758
|
+
return await Jt(r), r;
|
|
758
759
|
}
|
|
759
|
-
async function
|
|
760
|
+
async function Jt(e) {
|
|
760
761
|
let t = [
|
|
761
762
|
"red",
|
|
762
763
|
"yellow",
|
|
763
764
|
"brightgreen"
|
|
764
|
-
],
|
|
765
|
-
await
|
|
765
|
+
], n = Number(e >= Bt) + Number(e >= zt);
|
|
766
|
+
await i(Vt, {
|
|
766
767
|
schemaVersion: 1,
|
|
767
768
|
label: "coverage",
|
|
768
769
|
message: `${e.toFixed(1)}%`,
|
|
769
|
-
color: t[
|
|
770
|
+
color: t[n]
|
|
770
771
|
});
|
|
771
772
|
}
|
|
772
|
-
async function
|
|
773
|
+
async function Yt(e, n) {
|
|
773
774
|
if (e.devDependencies?.fallow == null) {
|
|
774
|
-
|
|
775
|
+
E("2️⃣ Code health NOT measured, as Fallow is not installed"), E("3️⃣ Code health report NOT required");
|
|
775
776
|
return;
|
|
776
777
|
}
|
|
777
|
-
await
|
|
778
|
+
await t("2️⃣ Measure code health", "fallow", [
|
|
778
779
|
"health",
|
|
779
780
|
"--report-only",
|
|
780
781
|
"--format",
|
|
781
782
|
"json",
|
|
782
|
-
...
|
|
783
|
-
],
|
|
784
|
-
let
|
|
785
|
-
return await
|
|
786
|
-
}
|
|
787
|
-
async function
|
|
788
|
-
let { score: t, grade:
|
|
789
|
-
await
|
|
783
|
+
...n
|
|
784
|
+
], Wt), await t("3️⃣ Write code health report", "fallow", ["--format", "markdown"], te, !0);
|
|
785
|
+
let r = await T(Wt);
|
|
786
|
+
return await Xt(r), r;
|
|
787
|
+
}
|
|
788
|
+
async function Xt(e) {
|
|
789
|
+
let { score: t, grade: n } = e.health_score;
|
|
790
|
+
await i(h, {
|
|
790
791
|
schemaVersion: 1,
|
|
791
792
|
label: "fallow",
|
|
792
|
-
message: `${
|
|
793
|
-
color: Ut[
|
|
793
|
+
message: `${n} (${String(Math.round(t))})`,
|
|
794
|
+
color: Ut[n] ?? "lightgrey"
|
|
794
795
|
});
|
|
795
796
|
}
|
|
796
|
-
async function
|
|
797
|
-
let [
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
U(`repos/${
|
|
804
|
-
U(`repos/${
|
|
805
|
-
U(`repos/${
|
|
806
|
-
|
|
807
|
-
]), p = c === void 0 ? void 0 : JSON.parse(c).security_and_analysis, m = (e) => p?.[e] === void 0 ? void 0 : p[e].status === "enabled", h = new Set((f === void 0 ? [] : JSON.parse(f).check_runs).map((e) => e.app?.slug)), g = o?.match(/package-ecosystem:/g)?.length ?? 0, _ = o?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
|
|
797
|
+
async function Zt(t, n, r) {
|
|
798
|
+
let [i, a, o] = await Promise.all([
|
|
799
|
+
e(".github/workflows/ci.yml"),
|
|
800
|
+
e(".github/dependabot.yml"),
|
|
801
|
+
e(v)
|
|
802
|
+
]), s = await e(".github/workflows/codeql.yml") ?? "", [c, l, u, d] = await Promise.all([
|
|
803
|
+
U(`repos/${t}/${n}`),
|
|
804
|
+
U(`repos/${t}/${n}/private-vulnerability-reporting`),
|
|
805
|
+
U(`repos/${t}/${n}/vulnerability-alerts`),
|
|
806
|
+
U(`repos/${t}/${n}/commits/main/check-runs?per_page=100`)
|
|
807
|
+
]), f = c === void 0 ? void 0 : JSON.parse(c).security_and_analysis, p = (e) => f?.[e] === void 0 ? void 0 : f[e].status === "enabled", m = new Set((d === void 0 ? [] : JSON.parse(d).check_runs).map((e) => e.app?.slug)), h = a?.match(/package-ecosystem:/g)?.length ?? 0, g = a?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
|
|
808
808
|
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(
|
|
809
|
+
codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => Ht[e] ?? e).toArray(),
|
|
810
|
+
codeQLQueries: /queries: ([\w-]+)/.exec(s)?.[1],
|
|
811
|
+
dependabotAlerts: u !== void 0,
|
|
812
|
+
dependabotSecurityUpdates: p("dependabot_security_updates"),
|
|
813
|
+
dependabotVersionUpdates: h > g,
|
|
814
|
+
lintInCI: (i ?? "").includes("npm run lint"),
|
|
815
|
+
npmAuditInCI: /npm (?:run )?audit/.test(i ?? ""),
|
|
816
|
+
npmAuditLevel: /npm audit --audit-level=(\w+)/.exec(i ?? "")?.[1],
|
|
817
817
|
privateVulnerabilityReporting: l === void 0 ? void 0 : JSON.parse(l).enabled,
|
|
818
|
-
propertyTests:
|
|
819
|
-
pushProtection:
|
|
820
|
-
secretScanning:
|
|
821
|
-
socket:
|
|
822
|
-
sonarCloud:
|
|
823
|
-
testsInCI:
|
|
818
|
+
propertyTests: r.devDependencies?.["fast-check"] != null,
|
|
819
|
+
pushProtection: p("secret_scanning_push_protection"),
|
|
820
|
+
secretScanning: p("secret_scanning"),
|
|
821
|
+
socket: m.has("socket-security"),
|
|
822
|
+
sonarCloud: m.has("sonarqubecloud"),
|
|
823
|
+
testsInCI: i?.includes("npm test") ?? !1
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
826
|
async function U(e) {
|
|
827
827
|
try {
|
|
828
|
-
let { stdout: t } = await
|
|
828
|
+
let { stdout: t } = await Gt("gh", ["api", e]);
|
|
829
829
|
return t;
|
|
830
830
|
} catch (e) {
|
|
831
831
|
if (String(e.stderr).includes("HTTP 404")) return;
|
|
832
832
|
throw e;
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
|
-
async function
|
|
835
|
+
async function Qt(e) {
|
|
836
836
|
let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
|
|
837
837
|
if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
|
|
838
838
|
return (await t.json()).find((t) => t.repo_url === e)?.id;
|
|
839
839
|
}
|
|
840
|
-
async function
|
|
840
|
+
async function $t(e) {
|
|
841
841
|
let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
|
|
842
842
|
if (t.status !== 404) {
|
|
843
843
|
if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
|
|
844
844
|
return await t.json();
|
|
845
845
|
}
|
|
846
846
|
}
|
|
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
847
|
function en(e) {
|
|
848
|
+
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || It.has(e) || Ft[e] !== void 0 && t >= Ft[e]);
|
|
849
|
+
}
|
|
850
|
+
function tn(e) {
|
|
851
851
|
return e === !1 ? " These are handled manually." : "";
|
|
852
852
|
}
|
|
853
853
|
function W(e) {
|
|
@@ -862,10 +862,10 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
|
|
|
862
862
|
|
|
863
863
|
`;
|
|
864
864
|
}
|
|
865
|
-
function
|
|
865
|
+
function nn(e, t, n, r) {
|
|
866
866
|
return `})`;
|
|
867
867
|
}
|
|
868
|
-
function
|
|
868
|
+
function rn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
869
869
|
let a = `https://github.com/${e}/${t}`, o = (e) => e ? ` Part of the [CI workflow](${a}/actions/workflows/ci.yml) on every push and pull request to \`main\`.` : "", s = [[
|
|
870
870
|
"Unit tests",
|
|
871
871
|
W(i.testsInCI),
|
|
@@ -878,23 +878,23 @@ function nn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
|
|
|
878
878
|
n !== void 0 && s.push([
|
|
879
879
|
"Test coverage",
|
|
880
880
|
W(!0),
|
|
881
|
-
`${
|
|
881
|
+
`${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
882
|
]);
|
|
883
|
-
let
|
|
883
|
+
let c = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, l = [[
|
|
884
884
|
"Code analysis",
|
|
885
885
|
W(i.sonarCloud),
|
|
886
|
-
`${i.sonarCloud ?
|
|
886
|
+
`${i.sonarCloud ? c : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
|
|
887
887
|
], [
|
|
888
888
|
"Linting",
|
|
889
889
|
W(i.lintInCI),
|
|
890
890
|
`[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
|
|
891
891
|
]];
|
|
892
|
-
r !== void 0 &&
|
|
892
|
+
r !== void 0 && l.unshift([
|
|
893
893
|
"Code health",
|
|
894
894
|
W(!0),
|
|
895
|
-
`[${
|
|
895
|
+
`[${nn(e, t, "Fallow code health", h)}](./${te}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
|
|
896
896
|
]);
|
|
897
|
-
let
|
|
897
|
+
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
898
|
[
|
|
899
899
|
"Push protection",
|
|
900
900
|
W(i.pushProtection),
|
|
@@ -902,8 +902,8 @@ function nn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
|
|
|
902
902
|
],
|
|
903
903
|
[
|
|
904
904
|
"Static analysis",
|
|
905
|
-
W(
|
|
906
|
-
`${
|
|
905
|
+
W(u),
|
|
906
|
+
`${u ? d : ""}[CodeQL](https://codeql.github.com) scans${p} for security vulnerabilities, ${f}, on every push and pull request to \`main\` and weekly.`
|
|
907
907
|
],
|
|
908
908
|
[
|
|
909
909
|
"Secret scanning",
|
|
@@ -929,23 +929,23 @@ function nn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
|
|
|
929
929
|
[
|
|
930
930
|
"Security updates",
|
|
931
931
|
W(i.dependabotSecurityUpdates),
|
|
932
|
-
`${g} opens pull requests that update vulnerable dependencies.${
|
|
932
|
+
`${g} opens pull requests that update vulnerable dependencies.${tn(i.dependabotSecurityUpdates)}`
|
|
933
933
|
],
|
|
934
934
|
[
|
|
935
935
|
"Version updates",
|
|
936
936
|
W(i.dependabotVersionUpdates),
|
|
937
|
-
`${g} opens pull requests for new dependency versions.${
|
|
937
|
+
`${g} opens pull requests for new dependency versions.${tn(i.dependabotVersionUpdates)}`
|
|
938
938
|
]
|
|
939
939
|
];
|
|
940
940
|
return `This section is updated each time \`npm run document\` is run. Settings come from the repository's workflow files and GitHub. Test coverage and the Fallow score are measured at the same time.
|
|
941
941
|
|
|
942
|
-
${G("Testing", s)}${G("Code Quality",
|
|
942
|
+
${G("Testing", s)}${G("Code Quality", l)}${G("Security Analysis", m)}${G("Dependencies", _)}`;
|
|
943
943
|
}
|
|
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 &&
|
|
944
|
+
function an(e, t, n, r, i) {
|
|
945
|
+
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && 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
946
|
return `## Quality & Security
|
|
947
947
|
|
|
948
|
-
${
|
|
948
|
+
${rn(e, t, n)}### OpenSSF 🚧
|
|
949
949
|
|
|
950
950
|
${l}[](https://scorecard.dev/viewer/?uri=${o})
|
|
951
951
|
|
|
@@ -957,26 +957,26 @@ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
|
|
|
957
957
|
}
|
|
958
958
|
//#endregion
|
|
959
959
|
//#region src/actions/documentUsage.ts
|
|
960
|
-
var
|
|
960
|
+
var on = "<!-- USAGE_START -->", sn = "<!-- USAGE_END -->", cn = /* @__PURE__ */ new Set([
|
|
961
961
|
"connector",
|
|
962
962
|
"cookbook",
|
|
963
963
|
"presenter"
|
|
964
|
-
]),
|
|
965
|
-
async function
|
|
964
|
+
]), 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).";
|
|
965
|
+
async function pn() {
|
|
966
966
|
try {
|
|
967
|
-
|
|
968
|
-
let [e, t] = await Promise.all([
|
|
969
|
-
await
|
|
967
|
+
s("Document Usage"), E("1️⃣ Insert usage content into 'README.md'");
|
|
968
|
+
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.`);
|
|
969
|
+
await _(u, on, sn), C("Usage documented");
|
|
970
970
|
} catch (e) {
|
|
971
971
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function mn(e) {
|
|
975
975
|
let t = e.repository, n = typeof t == "string" ? t : t?.url;
|
|
976
976
|
if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
|
|
977
977
|
return n.replace(/^git\+/, "");
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function hn(e) {
|
|
980
980
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
981
981
|
}
|
|
982
982
|
function K(e) {
|
|
@@ -985,9 +985,9 @@ function K(e) {
|
|
|
985
985
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
986
986
|
return t[0];
|
|
987
987
|
}
|
|
988
|
-
function
|
|
988
|
+
function gn(e, t) {
|
|
989
989
|
let { typeId: n } = e;
|
|
990
|
-
if (
|
|
990
|
+
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
991
|
|
|
992
992
|
You may view or clone this repository for your own purposes, such as building a new, similar ${n}, though there is currently no process to accept third-party ${n}s into DPUse at this stage.`;
|
|
993
993
|
if (e.publishedTo === "npm") {
|
|
@@ -998,11 +998,11 @@ You may view or clone this repository for your own purposes, such as building a
|
|
|
998
998
|
npm install ${t}
|
|
999
999
|
\`\`\`
|
|
1000
1000
|
|
|
1001
|
-
${
|
|
1001
|
+
${ln.has(n) ? `${un}\n\n` : ""}To work on the source instead, clone this repository.`;
|
|
1002
1002
|
}
|
|
1003
1003
|
return "You may view or clone this repository for your own purposes.";
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function _n(e, t, n, r, i, a, o) {
|
|
1006
1006
|
return `## Usage
|
|
1007
1007
|
|
|
1008
1008
|
${e}
|
|
@@ -1020,101 +1020,101 @@ ${o}`;
|
|
|
1020
1020
|
//#endregion
|
|
1021
1021
|
//#region src/actions/documentApiReference.ts
|
|
1022
1022
|
var q = "API_REFERENCE.md";
|
|
1023
|
-
async function
|
|
1023
|
+
async function vn() {
|
|
1024
1024
|
try {
|
|
1025
|
-
|
|
1026
|
-
let { writeAPIReference: e } = await import("./apiReference-
|
|
1027
|
-
await e("1️⃣ ", q),
|
|
1025
|
+
s("Document API Reference");
|
|
1026
|
+
let { writeAPIReference: e } = await import("./apiReference-cMfpNKxR.js");
|
|
1027
|
+
await e("1️⃣ ", q), C("API reference documented");
|
|
1028
1028
|
} catch (e) {
|
|
1029
1029
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
1032
|
//#endregion
|
|
1033
1033
|
//#region src/actions/documentBundleSizes.ts
|
|
1034
|
-
var
|
|
1035
|
-
async function
|
|
1034
|
+
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.`;
|
|
1035
|
+
async function An(e) {
|
|
1036
1036
|
try {
|
|
1037
|
-
|
|
1038
|
-
let t = await
|
|
1039
|
-
|
|
1040
|
-
let n =
|
|
1041
|
-
await
|
|
1037
|
+
s("Document Bundle Sizes"), E("1️⃣ Read bundle analysis report");
|
|
1038
|
+
let t = await T(yn);
|
|
1039
|
+
E("2️⃣ Insert table into 'README.md'");
|
|
1040
|
+
let n = jn(t, e?.moduleLevel ?? !1), r = n.includes("↳") ? `${Dn} ${On}` : Dn;
|
|
1041
|
+
await _(`## Bundle Analysis\n\n${En}\n\n${n}\n\n${r}\n\n${kn}`, bn, xn), C("Bundle sizes documented");
|
|
1042
1042
|
} catch (e) {
|
|
1043
1043
|
console.error("❌ Error documenting bundle sizes", e), process.exit(1);
|
|
1044
1044
|
}
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1047
|
-
let n =
|
|
1046
|
+
function jn(e, t) {
|
|
1047
|
+
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
1048
|
for (let [e, o] of i) {
|
|
1049
|
-
let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted(
|
|
1050
|
-
a.push(`| **${e}** | ${
|
|
1049
|
+
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` : "";
|
|
1050
|
+
a.push(`| **${e}** | ${Wn(o)}${c} |`, ...Nn(i, s, t));
|
|
1051
1051
|
}
|
|
1052
1052
|
return a.join("\n");
|
|
1053
1053
|
}
|
|
1054
|
-
function
|
|
1054
|
+
function Mn(e, t) {
|
|
1055
1055
|
return e[0] === X == (t[0] === X) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === X ? 1 : -1;
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function Nn(e, t, n) {
|
|
1058
1058
|
let r = [];
|
|
1059
1059
|
for (let [i, { sizes: a, files: o }] of e) {
|
|
1060
1060
|
if (o.size === 1) {
|
|
1061
|
-
let e =
|
|
1062
|
-
r.push(`| ${J}${
|
|
1061
|
+
let e = Ln(o);
|
|
1062
|
+
r.push(`| ${J}${In(i, e)} | ${Z(a.uncompressed, t)} |`);
|
|
1063
1063
|
continue;
|
|
1064
1064
|
}
|
|
1065
|
-
r.push(`| ${J}${i} | ${Z(a.uncompressed, t)} |`), n || r.push(...
|
|
1065
|
+
r.push(`| ${J}${i} | ${Z(a.uncompressed, t)} |`), n || r.push(...Pn(o, t));
|
|
1066
1066
|
}
|
|
1067
1067
|
return r;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r =
|
|
1069
|
+
function Pn(e, t) {
|
|
1070
|
+
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
1071
|
if (r > 0) {
|
|
1072
1072
|
let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
|
|
1073
|
-
i.push(`| ${J}${J}↳ ${String(r)} smaller files | ${Z(e, t,
|
|
1073
|
+
i.push(`| ${J}${J}↳ ${String(r)} smaller files | ${Z(e, t, Cn)} |`);
|
|
1074
1074
|
}
|
|
1075
1075
|
return i;
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function Fn(e, t) {
|
|
1078
1078
|
if (t <= 0) return 0;
|
|
1079
1079
|
let n = 0, r = 0;
|
|
1080
1080
|
for (let [, i] of e.toReversed()) {
|
|
1081
|
-
let e = i.uncompressed / t * 100 <
|
|
1081
|
+
let e = i.uncompressed / t * 100 < wn, a = (r + i.uncompressed) / t * 100 <= Tn;
|
|
1082
1082
|
if (!e || !a) break;
|
|
1083
1083
|
n++, r += i.uncompressed;
|
|
1084
1084
|
}
|
|
1085
1085
|
return n >= 2 ? n : 0;
|
|
1086
1086
|
}
|
|
1087
|
-
function Z(e, t, n =
|
|
1088
|
-
return `${
|
|
1087
|
+
function Z(e, t, n = Sn) {
|
|
1088
|
+
return `${Gn(t > 0 ? e / t * 100 : 0, n)} · ${Q(e)}`;
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1090
|
+
function In(e, t) {
|
|
1091
1091
|
return t === "" ? e : `${e} → ${t}`;
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function Ln(e) {
|
|
1094
1094
|
let [t] = e.keys();
|
|
1095
1095
|
if (t === void 0) throw Error("Expected exactly one file");
|
|
1096
1096
|
return t;
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1099
|
-
let t =
|
|
1098
|
+
function Rn(e) {
|
|
1099
|
+
let t = zn(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
1100
1100
|
for (let r of e.resources) {
|
|
1101
1101
|
if (r.kind !== "chunk" || !r.parent) continue;
|
|
1102
|
-
let { group: e, file: i } =
|
|
1102
|
+
let { group: e, file: i } = Bn(r.name, t), a = Un(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
|
|
1103
1103
|
n.set(r.parent, o);
|
|
1104
1104
|
let s = o.get(e) ?? {
|
|
1105
|
-
sizes:
|
|
1105
|
+
sizes: Kn(),
|
|
1106
1106
|
files: /* @__PURE__ */ new Map()
|
|
1107
1107
|
};
|
|
1108
|
-
o.set(e, s),
|
|
1109
|
-
let c = s.files.get(i) ??
|
|
1110
|
-
s.files.set(i, c),
|
|
1108
|
+
o.set(e, s), qn(s.sizes, a);
|
|
1109
|
+
let c = s.files.get(i) ?? Kn();
|
|
1110
|
+
s.files.set(i, c), qn(c, a);
|
|
1111
1111
|
}
|
|
1112
1112
|
return n;
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1114
|
+
function zn(e) {
|
|
1115
1115
|
return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1117
|
+
function Bn(e, t) {
|
|
1118
1118
|
let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
|
|
1119
1119
|
if (n) {
|
|
1120
1120
|
let [t, r] = n;
|
|
@@ -1131,42 +1131,42 @@ function zn(e, t) {
|
|
|
1131
1131
|
file: e.slice(1)
|
|
1132
1132
|
} : e.startsWith("rust/") ? {
|
|
1133
1133
|
group: "wasm",
|
|
1134
|
-
file:
|
|
1134
|
+
file: Vn(e)
|
|
1135
1135
|
} : {
|
|
1136
1136
|
group: "src",
|
|
1137
|
-
file:
|
|
1137
|
+
file: Hn(e)
|
|
1138
1138
|
};
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1141
|
-
let t = e.split("/", 2)[1] ?? "", n =
|
|
1140
|
+
function Vn(e) {
|
|
1141
|
+
let t = e.split("/", 2)[1] ?? "", n = Hn(e);
|
|
1142
1142
|
return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1144
|
+
function Hn(e) {
|
|
1145
1145
|
return e.split("/").at(-1) ?? e;
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function Un(e) {
|
|
1148
1148
|
return {
|
|
1149
1149
|
uncompressed: e.uncompressed,
|
|
1150
1150
|
gzip: e.gzip ?? 0
|
|
1151
1151
|
};
|
|
1152
1152
|
}
|
|
1153
|
-
function
|
|
1153
|
+
function Wn(e) {
|
|
1154
1154
|
return `${Q(e.uncompressed)} · gzip ${Q(e.gzip)}`;
|
|
1155
1155
|
}
|
|
1156
|
-
function
|
|
1156
|
+
function Gn(e, t = Sn) {
|
|
1157
1157
|
let n = Math.round(e / 100 * Y);
|
|
1158
1158
|
return `\`${t.repeat(n)}${"░".repeat(Y - n)}\` ${e.toFixed(1)}%`;
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1160
|
+
function Kn() {
|
|
1161
1161
|
return {
|
|
1162
1162
|
uncompressed: 0,
|
|
1163
1163
|
gzip: 0
|
|
1164
1164
|
};
|
|
1165
1165
|
}
|
|
1166
|
-
function
|
|
1166
|
+
function qn(e, t) {
|
|
1167
1167
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1169
|
+
function Jn(e, t) {
|
|
1170
1170
|
return `${(e / t * 100).toFixed(1)}%`;
|
|
1171
1171
|
}
|
|
1172
1172
|
function Q(e) {
|
|
@@ -1174,15 +1174,15 @@ function Q(e) {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
//#endregion
|
|
1176
1176
|
//#region src/actions/documentProject.ts
|
|
1177
|
-
async function
|
|
1177
|
+
async function Yn(t = "MIT", n = !1) {
|
|
1178
1178
|
try {
|
|
1179
|
-
let
|
|
1180
|
-
await
|
|
1181
|
-
let
|
|
1182
|
-
|
|
1179
|
+
let r = await T("config.json"), i = m(r.id).typeId === "connector";
|
|
1180
|
+
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();
|
|
1181
|
+
let a = await e(q) !== null;
|
|
1182
|
+
a ? await vn() : E(`ℹ️ '${q}' NOT required by this project`), await o("ℹ️ Format generated files", "prettier", [
|
|
1183
1183
|
"--write",
|
|
1184
1184
|
"README.md",
|
|
1185
|
-
...
|
|
1185
|
+
...a ? [q] : []
|
|
1186
1186
|
]);
|
|
1187
1187
|
} catch (e) {
|
|
1188
1188
|
console.error("❌ Error documenting project", e), process.exit(1);
|
|
@@ -1190,9 +1190,9 @@ async function Jn(e = "MIT", t = !1) {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
//#endregion
|
|
1192
1192
|
//#region src/actions/formatCode.ts
|
|
1193
|
-
async function
|
|
1193
|
+
async function Xn() {
|
|
1194
1194
|
try {
|
|
1195
|
-
|
|
1195
|
+
s("Format Code");
|
|
1196
1196
|
let e = [
|
|
1197
1197
|
"--write",
|
|
1198
1198
|
"*.json",
|
|
@@ -1202,37 +1202,37 @@ async function Yn() {
|
|
|
1202
1202
|
"app",
|
|
1203
1203
|
"src",
|
|
1204
1204
|
"tests"
|
|
1205
|
-
].filter((e) =>
|
|
1205
|
+
].filter((e) => ae(e)).map((e) => `${e}/**`)
|
|
1206
1206
|
];
|
|
1207
|
-
await
|
|
1207
|
+
await o("1️⃣ Format", "prettier", e), C("Code formatted");
|
|
1208
1208
|
} catch (e) {
|
|
1209
1209
|
console.error("❌ Error formatting code", e), process.exit(1);
|
|
1210
1210
|
}
|
|
1211
1211
|
}
|
|
1212
1212
|
//#endregion
|
|
1213
1213
|
//#region src/actions/lintCode.ts
|
|
1214
|
-
async function
|
|
1214
|
+
async function Zn() {
|
|
1215
1215
|
try {
|
|
1216
|
-
|
|
1216
|
+
s("Lint Code"), await o("1️⃣ Lint", "eslint", ["."]), C("Code linted");
|
|
1217
1217
|
} catch (e) {
|
|
1218
1218
|
console.error("❌ Error linting code", e), process.exit(1);
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
1221
|
//#endregion
|
|
1222
1222
|
//#region src/utilities/cloudflare.ts
|
|
1223
|
-
async function
|
|
1224
|
-
let e = await
|
|
1223
|
+
async function Qn() {
|
|
1224
|
+
let e = await T("config.json"), t = {
|
|
1225
1225
|
body: JSON.stringify(e),
|
|
1226
1226
|
headers: { "Content-Type": "application/json" },
|
|
1227
1227
|
method: "PUT"
|
|
1228
1228
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
1229
1229
|
if (!n.ok) throw Error(await n.text());
|
|
1230
1230
|
}
|
|
1231
|
-
async function
|
|
1231
|
+
async function $n(e, t) {
|
|
1232
1232
|
async function n(e, t, r) {
|
|
1233
1233
|
for (let i of r) {
|
|
1234
1234
|
let r = `${e}/${i}`, a = `${t}/${i}`;
|
|
1235
|
-
(await
|
|
1235
|
+
(await p(r)).isDirectory() ? await n(r, a, await y(r)) : (console.info(`⚙️ Uploading '${e}/${i}'...`), await b(void 0, "wrangler", [
|
|
1236
1236
|
"r2",
|
|
1237
1237
|
"object",
|
|
1238
1238
|
"put",
|
|
@@ -1246,7 +1246,7 @@ async function Qn(e, t) {
|
|
|
1246
1246
|
let r = await y(`${e}/${t}/`);
|
|
1247
1247
|
await n(`${e}/${t}`, t, r);
|
|
1248
1248
|
}
|
|
1249
|
-
async function
|
|
1249
|
+
async function er(e) {
|
|
1250
1250
|
let t = e.id, n = {
|
|
1251
1251
|
body: JSON.stringify(e),
|
|
1252
1252
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1254,14 +1254,14 @@ async function $(e) {
|
|
|
1254
1254
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
1255
1255
|
if (!r.ok) throw Error(await r.text());
|
|
1256
1256
|
}
|
|
1257
|
-
async function
|
|
1257
|
+
async function tr(e, t) {
|
|
1258
1258
|
let n = `v${e.version ?? "unknown"}`;
|
|
1259
1259
|
async function r(e, r = "") {
|
|
1260
1260
|
let i = await y(e, { withFileTypes: !0 });
|
|
1261
1261
|
for (let a of i) {
|
|
1262
1262
|
if (a.isDirectory() || a.name.endsWith(".map")) continue;
|
|
1263
1263
|
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = a.name.endsWith(".css") ? "text/css" : "application/octet-stream", l = a.name.endsWith(".js") ? "application/javascript" : c;
|
|
1264
|
-
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await
|
|
1264
|
+
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await b(void 0, "wrangler", [
|
|
1265
1265
|
"r2",
|
|
1266
1266
|
"object",
|
|
1267
1267
|
"put",
|
|
@@ -1278,44 +1278,44 @@ async function $n(e, t) {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
//#endregion
|
|
1280
1280
|
//#region src/actions/publishProject.ts
|
|
1281
|
-
async function
|
|
1281
|
+
async function nr() {
|
|
1282
1282
|
try {
|
|
1283
|
-
|
|
1284
|
-
let e = await
|
|
1285
|
-
n.publishedTo === "npm" ? await
|
|
1283
|
+
s("Publish Project");
|
|
1284
|
+
let e = await T("package.json"), t = await T("config.json"), n = m(t.id);
|
|
1285
|
+
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
1286
|
} catch (e) {
|
|
1287
1287
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1288
1288
|
}
|
|
1289
1289
|
}
|
|
1290
|
-
async function
|
|
1291
|
-
if (r.typeId === "app")
|
|
1292
|
-
else if (r.typeId === "engine")
|
|
1293
|
-
else if (r.uploadGroupName === void 0)
|
|
1290
|
+
async function $(e, t, n, r) {
|
|
1291
|
+
if (r.typeId === "app") E(`${e} Register module`), await Qn();
|
|
1292
|
+
else if (r.typeId === "engine") E(`${e} Register module`), await tr(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await er(n);
|
|
1293
|
+
else if (r.uploadGroupName === void 0) E(`${e} Registration NOT required`);
|
|
1294
1294
|
else {
|
|
1295
|
-
|
|
1295
|
+
E(`${e} Register module`);
|
|
1296
1296
|
let i = n.id.split("-").slice(2).join("-");
|
|
1297
|
-
await
|
|
1297
|
+
await tr(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await er(n);
|
|
1298
1298
|
}
|
|
1299
1299
|
}
|
|
1300
1300
|
//#endregion
|
|
1301
1301
|
//#region src/actions/releaseProject.ts
|
|
1302
|
-
async function
|
|
1302
|
+
async function rr(e = "MIT", t = !1) {
|
|
1303
1303
|
try {
|
|
1304
|
-
|
|
1305
|
-
let n = await
|
|
1306
|
-
await
|
|
1307
|
-
let a = await
|
|
1308
|
-
if (await
|
|
1304
|
+
s("Release Project");
|
|
1305
|
+
let n = await T("package.json"), r = await T("config.json"), i = m(r.id);
|
|
1306
|
+
await d("1️⃣ ", n);
|
|
1307
|
+
let a = await S("2️⃣ ", n, i);
|
|
1308
|
+
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
1309
|
"commit",
|
|
1310
1310
|
"-m",
|
|
1311
1311
|
`v${n.version ?? "unknown"}`
|
|
1312
|
-
]), await
|
|
1312
|
+
]), await b("7️⃣ Push changes", "git", [
|
|
1313
1313
|
"push",
|
|
1314
1314
|
"origin",
|
|
1315
1315
|
"main:main"
|
|
1316
|
-
]), await
|
|
1316
|
+
]), await $("8️⃣ ", n, a, i), i.publishedTo === "npm") {
|
|
1317
1317
|
let e = `v${n.version ?? "unknown"}`;
|
|
1318
|
-
await
|
|
1318
|
+
await o("9️⃣ Trigger GitHub release", "gh", [
|
|
1319
1319
|
"release",
|
|
1320
1320
|
"create",
|
|
1321
1321
|
e,
|
|
@@ -1324,39 +1324,39 @@ async function nr(e = "MIT", t = !1) {
|
|
|
1324
1324
|
"--generate-notes",
|
|
1325
1325
|
"--latest"
|
|
1326
1326
|
]);
|
|
1327
|
-
} else
|
|
1328
|
-
|
|
1327
|
+
} else E(`9️⃣ Publishing NOT required for package with type identifier of '${i.typeId}'.`);
|
|
1328
|
+
C(`Project version '${n.version ?? "unknown"}' released.`);
|
|
1329
1329
|
} catch (e) {
|
|
1330
1330
|
console.error("❌ Error releasing project", e), process.exit(1);
|
|
1331
1331
|
}
|
|
1332
1332
|
}
|
|
1333
1333
|
//#endregion
|
|
1334
1334
|
//#region src/actions/syncProjectWithGitHub.ts
|
|
1335
|
-
async function
|
|
1335
|
+
async function ir() {
|
|
1336
1336
|
try {
|
|
1337
|
-
|
|
1338
|
-
let e = await
|
|
1339
|
-
await
|
|
1337
|
+
s("Synchronise Project with GitHub");
|
|
1338
|
+
let e = await T("package.json"), t = await T("config.json"), n = m(t.id);
|
|
1339
|
+
await d("1️⃣ ", e), await S("2️⃣ ", e, n), await b("3️⃣ Stage changes", "git", ["add", "."]), await b("4️⃣ Commit changes", "git", [
|
|
1340
1340
|
"commit",
|
|
1341
1341
|
"-m",
|
|
1342
1342
|
`v${e.version ?? "unknown"}`
|
|
1343
|
-
]), await
|
|
1343
|
+
]), await b("5️⃣ Push changes", "git", [
|
|
1344
1344
|
"push",
|
|
1345
1345
|
"origin",
|
|
1346
1346
|
"main:main"
|
|
1347
|
-
]),
|
|
1347
|
+
]), C(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
|
|
1348
1348
|
} catch (e) {
|
|
1349
1349
|
console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
|
|
1350
1350
|
}
|
|
1351
1351
|
}
|
|
1352
1352
|
//#endregion
|
|
1353
1353
|
//#region src/actions/testProject.ts
|
|
1354
|
-
var
|
|
1354
|
+
var ar = [
|
|
1355
1355
|
"1️⃣ ",
|
|
1356
1356
|
"2️⃣ ",
|
|
1357
1357
|
"3️⃣ ",
|
|
1358
1358
|
"4️⃣ "
|
|
1359
|
-
],
|
|
1359
|
+
], or = [{
|
|
1360
1360
|
id: "unit",
|
|
1361
1361
|
label: "Run unit tests",
|
|
1362
1362
|
command: "vitest",
|
|
@@ -1369,31 +1369,31 @@ var ir = [
|
|
|
1369
1369
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1370
1370
|
configFileName: "playwright.config.ts"
|
|
1371
1371
|
}];
|
|
1372
|
-
async function
|
|
1372
|
+
async function sr(t = ["unit"]) {
|
|
1373
1373
|
try {
|
|
1374
|
-
|
|
1375
|
-
let
|
|
1376
|
-
for (let
|
|
1377
|
-
if (!
|
|
1378
|
-
let
|
|
1379
|
-
await
|
|
1374
|
+
s("Test Project");
|
|
1375
|
+
let n = 0;
|
|
1376
|
+
for (let r of or) {
|
|
1377
|
+
if (!t.includes(r.id) || await e(r.configFileName) === null) continue;
|
|
1378
|
+
let i = `${ar[n] ?? ""} ${r.label}`;
|
|
1379
|
+
await o(i, r.command, r.arguments), n += 1;
|
|
1380
1380
|
}
|
|
1381
|
-
if (
|
|
1381
|
+
if (n === 0) {
|
|
1382
1382
|
console.warn("\n⚠️ No tests configured for this project.\n");
|
|
1383
1383
|
return;
|
|
1384
1384
|
}
|
|
1385
|
-
|
|
1385
|
+
C("Project tested");
|
|
1386
1386
|
} catch (e) {
|
|
1387
1387
|
console.error("❌ Error testing project", e), process.exit(1);
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
1390
|
//#endregion
|
|
1391
1391
|
//#region src/actions/triggerGitHubRelease.ts
|
|
1392
|
-
async function
|
|
1392
|
+
async function cr() {
|
|
1393
1393
|
try {
|
|
1394
|
-
|
|
1395
|
-
let e = `v${(await
|
|
1396
|
-
await
|
|
1394
|
+
s("Trigger GitHub Release");
|
|
1395
|
+
let e = `v${(await T("package.json")).version ?? "unknown"}`;
|
|
1396
|
+
await o("1️⃣ Trigger GitHub release", "gh", [
|
|
1397
1397
|
"release",
|
|
1398
1398
|
"create",
|
|
1399
1399
|
e,
|
|
@@ -1401,10 +1401,10 @@ async function sr() {
|
|
|
1401
1401
|
"main",
|
|
1402
1402
|
"--generate-notes",
|
|
1403
1403
|
"--latest"
|
|
1404
|
-
]),
|
|
1404
|
+
]), C(`GitHub release '${e}' created.`);
|
|
1405
1405
|
} catch (e) {
|
|
1406
1406
|
console.error("❌ Error triggering GitHub release", e), process.exit(1);
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
1409
|
//#endregion
|
|
1410
|
-
export {
|
|
1410
|
+
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 };
|