@dpuse/dpuse-development 0.3.799 → 0.3.800
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.private.rust.yml +16 -0
- package/.github/dependabot.rust.yml +22 -0
- package/.github/workflows/ci.yml +12 -0
- package/.github/workflows/codeql.yml +6 -0
- package/.github/workflows/publish.yml +20 -2
- package/README.md +11 -11
- package/dist/{apiReference-DCzx5xFp.js → apiReference-BazeHifT.js} +3 -3
- package/dist/{apiReference-DCzx5xFp.js.map → apiReference-BazeHifT.js.map} +1 -1
- package/dist/dpuse-development.es.js +304 -297
- package/dist/dpuse-development.es.js.map +1 -1
- package/dist/types/src/actions/buildProject.d.ts +3 -0
- package/dist/types/src/actions/publishProject.d.ts +1 -0
- package/dist/types/src/utilities/index.d.ts +1 -0
- package/dist/{utilities-DxgaXApN.js → utilities-Bo8LfncX.js} +27 -27
- package/dist/{utilities-DxgaXApN.js.map → utilities-Bo8LfncX.js.map} +1 -1
- package/package.json +4 -2
- package/rust-toolchain.toml +5 -0
- package/.github/publish.cloudflare.yml +0 -67
|
@@ -1,52 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { existsSync as
|
|
1
|
+
import { A as e, C as t, D as n, E as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, k as h, l as g, m as _, n as ee, o as te, p as v, r as ne, s as re, t as ie, u as y, v as b, w as x, x as S, y as C } from "./utilities-Bo8LfncX.js";
|
|
2
|
+
import { existsSync as ae } from "node:fs";
|
|
3
3
|
import w from "node:path";
|
|
4
|
-
import { promisify as
|
|
5
|
-
import { execFile as
|
|
6
|
-
import { fileURLToPath as
|
|
7
|
-
import { run as
|
|
8
|
-
import { init as
|
|
4
|
+
import { promisify as oe } from "node:util";
|
|
5
|
+
import { execFile as se } from "node:child_process";
|
|
6
|
+
import { fileURLToPath as ce } from "node:url";
|
|
7
|
+
import { run as le } from "npm-check-updates";
|
|
8
|
+
import { init as ue } from "license-checker-rseidelsohn";
|
|
9
9
|
//#region src/actions/auditDependencies.ts
|
|
10
|
-
async function
|
|
10
|
+
async function de() {
|
|
11
11
|
try {
|
|
12
|
-
f("Audit Dependencies"), await
|
|
12
|
+
f("Audit Dependencies"), await x("1️⃣ Check shipped dependencies for any vulnerability", "npm", ["audit", "--omit=dev"]), await x("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--audit-level=high"]), o("Dependencies audited");
|
|
13
13
|
} catch (e) {
|
|
14
14
|
console.error("❌ Error auditing dependencies", e), process.exit(1);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/actions/buildProject.ts
|
|
19
|
-
|
|
19
|
+
var T = "build:wasm";
|
|
20
|
+
async function fe() {
|
|
20
21
|
try {
|
|
21
|
-
f("Build Project"), await
|
|
22
|
+
f("Build Project"), await E("1️⃣ ", await c("package.json")), o("Project built");
|
|
22
23
|
} catch (e) {
|
|
23
24
|
console.error("❌ Error building project", e), process.exit(1);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
27
|
+
async function E(e, t) {
|
|
28
|
+
t.scripts?.[T] != null && await x(`${e} Build WebAssembly`, "npm", ["run", T]), await x(`${e} Bundle project`, "vite", ["build"]);
|
|
29
|
+
}
|
|
26
30
|
//#endregion
|
|
27
31
|
//#region src/actions/checkConfigFiles.ts
|
|
28
|
-
var
|
|
29
|
-
async function
|
|
32
|
+
var D = "@dpuse/dpuse-development/prettierrc", pe = "dpuse-development";
|
|
33
|
+
async function me() {
|
|
30
34
|
try {
|
|
31
|
-
f("Check configuration files"),
|
|
32
|
-
let e = await
|
|
33
|
-
await
|
|
35
|
+
f("Check configuration files"), b("1️⃣ Check individual files");
|
|
36
|
+
let e = await c("config.json"), t = await c("package.json"), n = t.private === !0, r = _(e.id), a = w.dirname(ce(import.meta.url));
|
|
37
|
+
await O(a, ".editorconfig"), await O(a, ".gitattributes"), await O(a, ".gitignore", [".gitignore_default"]), await O(a, ".markdownlint.json"), await O(a, ".ncurc.json"), await he(r, a), await O(a, "LICENSE"), await _e(r, a), await ve(r, a), await ye(r, a), await xe(r, a), ge(r, t);
|
|
38
|
+
let s = await i(l) !== null;
|
|
39
|
+
s && await O(a, "rust-toolchain.toml"), await O(a, ".github/dependabot.yml", [`.github/dependabot${n ? ".private" : ""}${s ? ".rust" : ""}.yml`]), n ? console.info("ℹ️ GitHub workflows and file 'SECURITY.md' are NOT required by this project") : (await be(a), await O(a, "SECURITY.md", [], (t) => t.replaceAll(pe, () => e.id))), o("Configuration files checked");
|
|
34
40
|
} catch (e) {
|
|
35
41
|
console.error("❌ Error checking configuration files", e), process.exit(1);
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
|
-
async function
|
|
44
|
+
async function he(e, t) {
|
|
39
45
|
["github", "kb"].includes(e.typeId) ? console.info("ℹ️ File 'eslint.config.js' is NOT required by this project") : [
|
|
40
46
|
"app",
|
|
41
47
|
"api",
|
|
42
48
|
"development",
|
|
43
49
|
"eslint"
|
|
44
|
-
].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await
|
|
50
|
+
].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await O(t, "eslint.config.js", ["eslint.config.default.js"]);
|
|
45
51
|
}
|
|
46
|
-
function
|
|
47
|
-
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 ===
|
|
52
|
+
function ge(e, t) {
|
|
53
|
+
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 === D ? console.info(`ℹ️ Prettier configuration is '${D}'`) : console.info(`❌ Prettier configuration is NOT '${D}'`);
|
|
48
54
|
}
|
|
49
|
-
async function
|
|
55
|
+
async function _e(e, t) {
|
|
50
56
|
["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
|
|
51
57
|
"connector",
|
|
52
58
|
"development",
|
|
@@ -54,12 +60,12 @@ async function ge(e, t) {
|
|
|
54
60
|
"presenter",
|
|
55
61
|
"shared",
|
|
56
62
|
"tool"
|
|
57
|
-
].includes(e.typeId) ? await
|
|
58
|
-
}
|
|
59
|
-
async function _e(e, t) {
|
|
60
|
-
["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await E(t, "scripts/tsconfig.json");
|
|
63
|
+
].includes(e.typeId) ? await O(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
|
|
61
64
|
}
|
|
62
65
|
async function ve(e, t) {
|
|
66
|
+
["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await O(t, "scripts/tsconfig.json");
|
|
67
|
+
}
|
|
68
|
+
async function ye(e, t) {
|
|
63
69
|
if ([
|
|
64
70
|
"eslint",
|
|
65
71
|
"github",
|
|
@@ -85,25 +91,25 @@ async function ve(e, t) {
|
|
|
85
91
|
break;
|
|
86
92
|
default: n = ["vite.config.default.ts"];
|
|
87
93
|
}
|
|
88
|
-
await
|
|
94
|
+
await O(t, "vite.config.ts", n);
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
|
-
async function
|
|
92
|
-
await
|
|
97
|
+
async function be(e) {
|
|
98
|
+
await O(e, ".github/workflows/ci.yml"), await O(e, ".github/workflows/codeql.yml"), await O(e, ".github/workflows/publish.yml"), await O(e, ".github/workflows/scorecard.yml");
|
|
93
99
|
}
|
|
94
|
-
async function
|
|
100
|
+
async function xe(e, t) {
|
|
95
101
|
[
|
|
96
102
|
"app",
|
|
97
103
|
"api",
|
|
98
104
|
"eslint",
|
|
99
105
|
"github",
|
|
100
106
|
"kb"
|
|
101
|
-
].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await
|
|
107
|
+
].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await O(t, "vitest.config.ts");
|
|
102
108
|
}
|
|
103
|
-
async function
|
|
109
|
+
async function O(e, t, n = [], r = (e) => e) {
|
|
104
110
|
let i = w.resolve(process.cwd(), t), a = n.length > 0 ? n : [t], o;
|
|
105
111
|
try {
|
|
106
|
-
o = await
|
|
112
|
+
o = await S(i);
|
|
107
113
|
} catch (e) {
|
|
108
114
|
if (e.code !== "ENOENT") throw e;
|
|
109
115
|
}
|
|
@@ -112,7 +118,7 @@ async function E(e, t, n = [], r = (e) => e) {
|
|
|
112
118
|
return;
|
|
113
119
|
}
|
|
114
120
|
for (let n of a) {
|
|
115
|
-
let i = w.resolve(e, `../${n}`), a = r(await
|
|
121
|
+
let i = w.resolve(e, `../${n}`), a = r(await S(i));
|
|
116
122
|
if (o === a) {
|
|
117
123
|
console.info(`ℹ️ File '${t}' is the same as '${n}'`);
|
|
118
124
|
return;
|
|
@@ -122,102 +128,102 @@ async function E(e, t, n = [], r = (e) => e) {
|
|
|
122
128
|
}
|
|
123
129
|
//#endregion
|
|
124
130
|
//#region src/actions/checkDependencies.ts
|
|
125
|
-
async function
|
|
131
|
+
async function Se() {
|
|
126
132
|
try {
|
|
127
|
-
f("Check Dependencies"), await
|
|
128
|
-
let
|
|
133
|
+
f("Check Dependencies"), await x("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), b("2️⃣ Check using 'npm-check-updates'");
|
|
134
|
+
let e = {};
|
|
129
135
|
try {
|
|
130
|
-
|
|
136
|
+
e = await c(w.resolve(process.cwd(), ".ncurc.json"));
|
|
131
137
|
} catch (e) {
|
|
132
138
|
if (e.code !== "ENOENT") throw e;
|
|
133
139
|
}
|
|
134
|
-
await
|
|
140
|
+
await le({
|
|
135
141
|
interactive: !0,
|
|
136
142
|
upgrade: !0,
|
|
137
143
|
dep: "dev,prod,peer,optional",
|
|
138
144
|
install: "never",
|
|
139
|
-
...
|
|
140
|
-
}), await
|
|
145
|
+
...e
|
|
146
|
+
}), await x("3️⃣ Install updated dependencies", "npm", [
|
|
141
147
|
"install",
|
|
142
148
|
"--prefer-online",
|
|
143
149
|
"--no-strict-allow-scripts",
|
|
144
150
|
"--no-audit",
|
|
145
151
|
"--no-fund"
|
|
146
|
-
]), await
|
|
152
|
+
]), await x("4️⃣ Fix vulnerabilities where a compatible upgrade exists", "npm", [
|
|
147
153
|
"audit",
|
|
148
154
|
"fix",
|
|
149
155
|
"--no-strict-allow-scripts",
|
|
150
156
|
"--no-fund"
|
|
151
157
|
], !0);
|
|
152
|
-
let
|
|
153
|
-
|
|
158
|
+
let t = await Ce();
|
|
159
|
+
t.length > 0 ? await x("5️⃣ Move install-script pins to installed versions", "npm", [
|
|
154
160
|
"install-scripts",
|
|
155
161
|
"approve",
|
|
156
|
-
...
|
|
157
|
-
]) :
|
|
162
|
+
...t
|
|
163
|
+
]) : b("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin" ? await x("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]) : b("6️⃣ Skipped removing unused install-script entries (macOS only)"), t.length > 0 && await x("7️⃣ Run install scripts skipped in steps 3 and 4", "npm", [
|
|
158
164
|
"rebuild",
|
|
159
|
-
...
|
|
165
|
+
...t,
|
|
160
166
|
"--no-strict-allow-scripts"
|
|
161
|
-
]), await
|
|
167
|
+
]), await x("8️⃣ Confirm every install script is reviewed", "npm", [
|
|
162
168
|
"install",
|
|
163
169
|
"--strict-allow-scripts",
|
|
164
170
|
"--no-audit",
|
|
165
171
|
"--no-fund"
|
|
166
|
-
]),
|
|
172
|
+
]), o("Dependencies checked");
|
|
167
173
|
} catch (e) {
|
|
168
174
|
console.error("❌ Error checking dependencies", e), process.exit(1);
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
|
-
async function
|
|
172
|
-
let { allowScripts: e = {} } = await
|
|
177
|
+
async function Ce() {
|
|
178
|
+
let { allowScripts: e = {} } = await c(w.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
|
|
173
179
|
return [...new Set(t)];
|
|
174
180
|
}
|
|
175
181
|
//#endregion
|
|
176
182
|
//#region src/actions/checkProject.ts
|
|
177
|
-
async function
|
|
178
|
-
await
|
|
183
|
+
async function we() {
|
|
184
|
+
await me(), await Se();
|
|
179
185
|
}
|
|
180
186
|
//#endregion
|
|
181
187
|
//#region src/actions/documentActions.ts
|
|
182
|
-
var
|
|
188
|
+
var Te = "<!-- CONNECTOR_ACTIONS_START -->", Ee = "<!-- CONNECTOR_ACTIONS_END -->", De = "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.", Oe = {
|
|
183
189
|
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.",
|
|
184
190
|
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.",
|
|
185
191
|
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.",
|
|
186
192
|
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."
|
|
187
|
-
},
|
|
188
|
-
async function
|
|
193
|
+
}, ke = "The table below lists all connector actions and highlights those supported by this connector.";
|
|
194
|
+
async function Ae() {
|
|
189
195
|
try {
|
|
190
|
-
f("Document Actions"),
|
|
191
|
-
let
|
|
192
|
-
await
|
|
196
|
+
f("Document Actions"), b("1️⃣ Insert actions description and table into 'README.md'");
|
|
197
|
+
let t = (await c("config.json")).actionNames ?? [], r = h(t), i = e(t), a = `${De}\n\n${Oe[r]} ${ke}\n\n${i}`;
|
|
198
|
+
await n(a, Te, Ee), o("Actions documented");
|
|
193
199
|
} catch (e) {
|
|
194
200
|
console.error("❌ Error documenting actions", e), process.exit(1);
|
|
195
201
|
}
|
|
196
202
|
}
|
|
197
203
|
//#endregion
|
|
198
204
|
//#region src/actions/documentContributingLicense.ts
|
|
199
|
-
async function
|
|
205
|
+
async function je() {
|
|
200
206
|
try {
|
|
201
207
|
f("Document Contributing & License");
|
|
202
|
-
let [e,
|
|
203
|
-
|
|
208
|
+
let [e, r] = await Promise.all([c("package.json"), c("config.json")]), { owner: i, repo: a } = t(e, "document contributing and license"), s = Me(e), l = Ne(r.firstCreatedAt);
|
|
209
|
+
b("1️⃣ Insert contributing and license content into 'README.md'"), await C(), await n(Pe(i, a, s, l), ee, ie), o("Contributing & license documented");
|
|
204
210
|
} catch (e) {
|
|
205
211
|
console.error("❌ Error documenting contributing and license", e), process.exit(1);
|
|
206
212
|
}
|
|
207
213
|
}
|
|
208
|
-
function
|
|
214
|
+
function Me(e) {
|
|
209
215
|
let t = e.author, n = typeof t == "string" ? t : t?.name;
|
|
210
216
|
if (n == null || n === "") throw Error("package.json 'author' field is required to document contributing and license.");
|
|
211
217
|
let r = n.indexOf("<"), i = r === -1 ? -1 : n.indexOf(">", r);
|
|
212
218
|
return i === -1 ? n.trim() : [n.slice(0, r).trim(), n.slice(i + 1).trim()].filter((e) => e !== "").join(" ");
|
|
213
219
|
}
|
|
214
|
-
function
|
|
220
|
+
function Ne(e) {
|
|
215
221
|
let t = (/* @__PURE__ */ new Date()).getFullYear();
|
|
216
222
|
if (e == null) return String(t);
|
|
217
223
|
let n = new Date(e).getFullYear();
|
|
218
224
|
return n === t ? String(t) : `${String(n)}-present`;
|
|
219
225
|
}
|
|
220
|
-
function
|
|
226
|
+
function Pe(e, t, n, r) {
|
|
221
227
|
return `## Contributing
|
|
222
228
|
|
|
223
229
|
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.
|
|
@@ -232,18 +238,18 @@ This project is licensed under the MIT License, permitting free use, modificatio
|
|
|
232
238
|
}
|
|
233
239
|
//#endregion
|
|
234
240
|
//#region src/actions/documentDependencies.ts
|
|
235
|
-
var
|
|
236
|
-
async function
|
|
241
|
+
var k = "<!-- DEPENDENCY_LICENSES_START -->", A = "<!-- DEPENDENCY_LICENSES_END -->", j = "## Dependency Licenses", Fe = "The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. 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.";
|
|
242
|
+
async function Ie(e = "MIT") {
|
|
237
243
|
try {
|
|
238
244
|
f("Document Dependencies");
|
|
239
|
-
let t = await
|
|
245
|
+
let t = await c("package.json");
|
|
240
246
|
if (t.name === "@dpuse/dpuse-development" || t.name === "@dpuse/eslint-config-dpuse") {
|
|
241
|
-
await
|
|
247
|
+
await Le(t.name), o("Dependencies documented");
|
|
242
248
|
return;
|
|
243
249
|
}
|
|
244
|
-
await
|
|
245
|
-
let n = await
|
|
246
|
-
|
|
250
|
+
await u("1️⃣ Clear downloaded licenses", "licenses/downloads");
|
|
251
|
+
let n = await ze();
|
|
252
|
+
b("2️⃣ Identify production licenses"), await new Promise((r, i) => {
|
|
247
253
|
let a = {
|
|
248
254
|
start: process.cwd(),
|
|
249
255
|
production: !0,
|
|
@@ -255,41 +261,41 @@ async function Fe(e = "MIT") {
|
|
|
255
261
|
excludePackages: [t.name ?? "", ...n].join(";"),
|
|
256
262
|
out: "licenses/licenses.json"
|
|
257
263
|
};
|
|
258
|
-
|
|
264
|
+
ue(a, (e) => {
|
|
259
265
|
e == null ? r() : i(e);
|
|
260
266
|
});
|
|
261
|
-
}), await
|
|
267
|
+
}), await a("3️⃣ Identify transitive dependencies", "npm", [
|
|
262
268
|
"ls",
|
|
263
269
|
"--all",
|
|
264
270
|
"--json",
|
|
265
271
|
"--omit=dev"
|
|
266
|
-
], "licenses/licenseTree.json"), await
|
|
272
|
+
], "licenses/licenseTree.json"), await Re("4️⃣ ", e, new Set(n)), o("Dependencies documented");
|
|
267
273
|
} catch (e) {
|
|
268
274
|
console.error("❌ Error documenting dependencies", e), process.exit(1);
|
|
269
275
|
}
|
|
270
276
|
}
|
|
271
|
-
async function
|
|
272
|
-
|
|
273
|
-
let
|
|
274
|
-
await
|
|
275
|
-
}
|
|
276
|
-
async function
|
|
277
|
-
|
|
278
|
-
let [i,
|
|
279
|
-
for (let [e, t] of Object.entries(i))
|
|
280
|
-
await Promise.all(
|
|
281
|
-
let t = await
|
|
277
|
+
async function Le(e) {
|
|
278
|
+
b(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`);
|
|
279
|
+
let t = `> [!WARNING]\n> Dependency licenses are not documented here: ${e} is a development-only tool and is never part of a production release.`;
|
|
280
|
+
await n(`${j}\n\n${t}`, k, A);
|
|
281
|
+
}
|
|
282
|
+
async function Re(e, t, r) {
|
|
283
|
+
b(`${e} Insert licenses into 'README.md'`);
|
|
284
|
+
let [i, a] = await Promise.all([c("licenses/licenses.json"), c("licenses/licenseTree.json")]), o = /* @__PURE__ */ new Map();
|
|
285
|
+
for (let [e, t] of Object.entries(i)) o.set(e, He(e, t));
|
|
286
|
+
await Promise.all(o.values().map(async (e) => {
|
|
287
|
+
let t = await Ue(e.name, e.installedVersion);
|
|
282
288
|
e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
|
|
283
289
|
}));
|
|
284
|
-
let
|
|
285
|
-
for (let e of
|
|
290
|
+
let s = `${Be(t)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
|
|
291
|
+
for (let e of o.values()) s += We(e);
|
|
286
292
|
let l = [];
|
|
287
|
-
|
|
288
|
-
let u = `${
|
|
289
|
-
await
|
|
293
|
+
a.dependencies != null && M(a.dependencies, o, r, l, 0);
|
|
294
|
+
let u = `${Fe}\n\n${l.join("\n")}`;
|
|
295
|
+
await n(`${j}\n\n${s.trimEnd()}\n\n### Dependency Tree\n\n${u}`, k, A);
|
|
290
296
|
}
|
|
291
|
-
async function
|
|
292
|
-
let e = await
|
|
297
|
+
async function ze() {
|
|
298
|
+
let e = await i("package-lock.json"), t = e === null ? {} : JSON.parse(e).packages ?? {}, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
293
299
|
for (let [e, i] of Object.entries(t)) {
|
|
294
300
|
if (e === "" || i.version === void 0) continue;
|
|
295
301
|
let t = `${i.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${i.version}`;
|
|
@@ -297,13 +303,13 @@ async function Re() {
|
|
|
297
303
|
}
|
|
298
304
|
return r.values().filter((e) => !n.has(e)).toArray();
|
|
299
305
|
}
|
|
300
|
-
function ze(e) {
|
|
301
|
-
return `License data is updated each time \`npm run document\` is run, using [license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn). The following table lists all production dependencies. These dependencies (including transitive ones) have been checked and confirmed to use ${Be(e.split(";"))} — all permissive, commercially-friendly licenses. Users of the uploaded library are covered by these checks; developers cloning this repository should independently verify development dependencies.`;
|
|
302
|
-
}
|
|
303
306
|
function Be(e) {
|
|
307
|
+
return `License data is updated each time \`npm run document\` is run, using [license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn). The following table lists all production dependencies. These dependencies (including transitive ones) have been checked and confirmed to use ${Ve(e.split(";"))} — all permissive, commercially-friendly licenses. Users of the uploaded library are covered by these checks; developers cloning this repository should independently verify development dependencies.`;
|
|
308
|
+
}
|
|
309
|
+
function Ve(e) {
|
|
304
310
|
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))}`;
|
|
305
311
|
}
|
|
306
|
-
function
|
|
312
|
+
function He(e, t) {
|
|
307
313
|
let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
|
|
308
314
|
return {
|
|
309
315
|
name: r,
|
|
@@ -317,7 +323,7 @@ function Ve(e, t) {
|
|
|
317
323
|
...t.licenseFile != null && { licenseFileLink: t.licenseFile }
|
|
318
324
|
};
|
|
319
325
|
}
|
|
320
|
-
async function
|
|
326
|
+
async function Ue(e, t) {
|
|
321
327
|
try {
|
|
322
328
|
let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
|
|
323
329
|
if (n.ok) {
|
|
@@ -335,27 +341,27 @@ async function He(e, t) {
|
|
|
335
341
|
publishedDate: ""
|
|
336
342
|
};
|
|
337
343
|
}
|
|
338
|
-
function
|
|
344
|
+
function We(e) {
|
|
339
345
|
let t = e.licenseFileLink == null || e.licenseFileLink === "" ? "⚠️ No license file" : `[LICENSE](licenses/${e.licenseFileLink})`;
|
|
340
346
|
return `|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${t}|\n`;
|
|
341
347
|
}
|
|
342
|
-
function
|
|
348
|
+
function M(e, t, n, r, i) {
|
|
343
349
|
let a = " ".repeat(i);
|
|
344
350
|
for (let [o, s] of Object.entries(e)) {
|
|
345
351
|
let e = s.version ?? "";
|
|
346
352
|
if (n.has(`${o}@${e}`)) continue;
|
|
347
|
-
let c = t.get(`${o}@${e}`), l = c == null ? o : `[${o}](${c.repository})`, u =
|
|
348
|
-
r.push(`${a}- **${l}** ${e}${u}`), s.dependencies != null &&
|
|
353
|
+
let c = t.get(`${o}@${e}`), l = c == null ? o : `[${o}](${c.repository})`, u = Ge(c);
|
|
354
|
+
r.push(`${a}- **${l}** ${e}${u}`), s.dependencies != null && M(s.dependencies, t, n, r, i + 1);
|
|
349
355
|
}
|
|
350
356
|
}
|
|
351
|
-
function
|
|
357
|
+
function Ge(e) {
|
|
352
358
|
if (e == null) return "";
|
|
353
|
-
let t = e.publishedDate ?
|
|
359
|
+
let t = e.publishedDate ? N(e.publishedDate.split("T", 1)[0]) : "";
|
|
354
360
|
if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
|
|
355
|
-
let n = e.latestPublishedDate ?
|
|
361
|
+
let n = e.latestPublishedDate ? N(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `**latest**: ${e.latestVersion} ❗` : `**latest**: ${e.latestVersion} — ${n} ❗`;
|
|
356
362
|
return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
|
|
357
363
|
}
|
|
358
|
-
function
|
|
364
|
+
function N(e) {
|
|
359
365
|
if (e == null || e === "") return "n/a";
|
|
360
366
|
let t = e.split("T", 1)[0];
|
|
361
367
|
if (t == null || t === "") return "n/a";
|
|
@@ -364,31 +370,31 @@ function j(e) {
|
|
|
364
370
|
}
|
|
365
371
|
//#endregion
|
|
366
372
|
//#region src/actions/documentOpening.ts
|
|
367
|
-
var
|
|
368
|
-
async function
|
|
373
|
+
var Ke = "<!-- OPENING_START -->", qe = "<!-- OPENING_END -->";
|
|
374
|
+
async function Je() {
|
|
369
375
|
try {
|
|
370
|
-
f("Document Opening"),
|
|
371
|
-
let e = await
|
|
372
|
-
await
|
|
376
|
+
f("Document Opening"), b("1️⃣ Insert opening content into 'README.md'");
|
|
377
|
+
let e = await c("package.json"), r = await c("config.json"), { owner: i, repo: a } = t(e, "document opening"), s = Ye(e), l = Ze(r), u = Qe(i, a, s, _(r.id).publishedTo === "npm" ? Xe(e) : void 0, e.description, l);
|
|
378
|
+
await n(u, Ke, qe), o("Opening documented");
|
|
373
379
|
} catch (e) {
|
|
374
380
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
375
381
|
}
|
|
376
382
|
}
|
|
377
|
-
function
|
|
383
|
+
function Ye(e) {
|
|
378
384
|
let t = e.license;
|
|
379
385
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
380
386
|
return t;
|
|
381
387
|
}
|
|
382
|
-
function
|
|
388
|
+
function Xe(e) {
|
|
383
389
|
let t = e.name;
|
|
384
390
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
|
|
385
391
|
return t;
|
|
386
392
|
}
|
|
387
|
-
function
|
|
393
|
+
function Ze(e) {
|
|
388
394
|
let t = e.description.en, n = (Array.isArray(t) ? t : [t]).filter((e) => typeof e == "string" && e !== "");
|
|
389
395
|
return n.length === 0 ? void 0 : n.join("\n\n");
|
|
390
396
|
}
|
|
391
|
-
function
|
|
397
|
+
function Qe(e, t, n, r, i, a) {
|
|
392
398
|
let o = `https://github.com/${e}/${t}`;
|
|
393
399
|
return `[}-blue.svg)](./LICENSE)
|
|
394
400
|
[](${o}/releases/latest)${r === void 0 ? "" : `\n[](https://www.npmjs.com/package/${r})`}
|
|
@@ -410,11 +416,11 @@ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the applicati
|
|
|
410
416
|
}
|
|
411
417
|
//#endregion
|
|
412
418
|
//#region src/actions/documentQualitySecurity.ts
|
|
413
|
-
var
|
|
419
|
+
var P = {
|
|
414
420
|
"Branch-Protection": 3,
|
|
415
421
|
"Code-Review": 0,
|
|
416
422
|
Contributors: 0
|
|
417
|
-
},
|
|
423
|
+
}, $e = /* @__PURE__ */ new Set(["CII-Best-Practices"]), et = "coverage/coverage-final.json", tt = "coverage/coverage-summary.json", F = 80, nt = 60, I = "code-health-reports/vitest/badge.json", rt = {
|
|
418
424
|
actions: "GitHub Actions",
|
|
419
425
|
"javascript-typescript": "JavaScript/TypeScript",
|
|
420
426
|
rust: "Rust"
|
|
@@ -424,48 +430,48 @@ var M = {
|
|
|
424
430
|
C: "yellow",
|
|
425
431
|
D: "orange",
|
|
426
432
|
F: "red"
|
|
427
|
-
},
|
|
433
|
+
}, L = `${m}/health.json`, at = oe(se);
|
|
428
434
|
async function ot() {
|
|
429
435
|
try {
|
|
430
436
|
f("Document Quality & Security");
|
|
431
|
-
let e = await
|
|
432
|
-
|
|
433
|
-
let
|
|
434
|
-
|
|
435
|
-
let [
|
|
436
|
-
|
|
437
|
-
let p = gt(
|
|
438
|
-
coveragePercent:
|
|
437
|
+
let e = await c("package.json"), r = await st(e), i = await lt(e, r === void 0 ? [] : ["--coverage", et]), { owner: a, repo: s } = t(e, "document quality and security");
|
|
438
|
+
b("4️⃣ Read security checks and settings");
|
|
439
|
+
let l = await dt(a, s, e);
|
|
440
|
+
b("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
|
|
441
|
+
let [u, d] = await Promise.all([ft(`https://github.com/${a}/${s}`), pt(`github.com/${a}/${s}`)]);
|
|
442
|
+
b("6️⃣ Insert quality and security content into 'README.md'");
|
|
443
|
+
let p = gt(a, s, {
|
|
444
|
+
coveragePercent: r,
|
|
439
445
|
fallowHealth: i,
|
|
440
|
-
securitySettings:
|
|
441
|
-
},
|
|
442
|
-
await
|
|
446
|
+
securitySettings: l
|
|
447
|
+
}, u, d);
|
|
448
|
+
await C(), await n(p, re, te), o("Quality & security documented");
|
|
443
449
|
} catch (e) {
|
|
444
450
|
console.error("❌ Error documenting quality and security", e), process.exit(1);
|
|
445
451
|
}
|
|
446
452
|
}
|
|
447
|
-
async function st(
|
|
448
|
-
if (
|
|
449
|
-
|
|
453
|
+
async function st(e) {
|
|
454
|
+
if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
|
|
455
|
+
b("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
|
|
450
456
|
return;
|
|
451
457
|
}
|
|
452
|
-
await
|
|
458
|
+
await x("1️⃣ Measure test coverage", "vitest", [
|
|
453
459
|
"run",
|
|
454
460
|
"--passWithNoTests",
|
|
455
461
|
"--coverage"
|
|
456
462
|
]);
|
|
457
|
-
let
|
|
458
|
-
if (
|
|
459
|
-
let
|
|
460
|
-
return await ct(
|
|
463
|
+
let t = await i(tt);
|
|
464
|
+
if (t === null) return;
|
|
465
|
+
let n = JSON.parse(t).total.lines.pct;
|
|
466
|
+
return await ct(n), n;
|
|
461
467
|
}
|
|
462
468
|
async function ct(e) {
|
|
463
469
|
let t = [
|
|
464
470
|
"red",
|
|
465
471
|
"yellow",
|
|
466
472
|
"brightgreen"
|
|
467
|
-
], n = Number(e >= nt) + Number(e >=
|
|
468
|
-
await
|
|
473
|
+
], n = Number(e >= nt) + Number(e >= F);
|
|
474
|
+
await r(I, {
|
|
469
475
|
schemaVersion: 1,
|
|
470
476
|
label: "coverage",
|
|
471
477
|
message: `${e.toFixed(1)}%`,
|
|
@@ -474,22 +480,22 @@ async function ct(e) {
|
|
|
474
480
|
}
|
|
475
481
|
async function lt(e, t) {
|
|
476
482
|
if (e.devDependencies?.fallow == null) {
|
|
477
|
-
|
|
483
|
+
b("2️⃣ Code health NOT measured, as Fallow is not installed"), b("3️⃣ Code health report NOT required");
|
|
478
484
|
return;
|
|
479
485
|
}
|
|
480
|
-
await
|
|
486
|
+
await a("2️⃣ Measure code health", "fallow", [
|
|
481
487
|
"health",
|
|
482
488
|
"--report-only",
|
|
483
489
|
"--format",
|
|
484
490
|
"json",
|
|
485
491
|
...t
|
|
486
|
-
],
|
|
487
|
-
let n = await
|
|
492
|
+
], L), await a("3️⃣ Write code health report", "fallow", ["--format", "markdown"], s, !0);
|
|
493
|
+
let n = await c(L);
|
|
488
494
|
return await ut(n), n;
|
|
489
495
|
}
|
|
490
496
|
async function ut(e) {
|
|
491
497
|
let { score: t, grade: n } = e.health_score;
|
|
492
|
-
await
|
|
498
|
+
await r(ne, {
|
|
493
499
|
schemaVersion: 1,
|
|
494
500
|
label: "fallow",
|
|
495
501
|
message: `${n} (${String(Math.round(t))})`,
|
|
@@ -497,35 +503,36 @@ async function ut(e) {
|
|
|
497
503
|
});
|
|
498
504
|
}
|
|
499
505
|
async function dt(e, t, n) {
|
|
500
|
-
let [r,
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
506
|
+
let [r, a, o, s] = await Promise.all([
|
|
507
|
+
i(".github/workflows/ci.yml"),
|
|
508
|
+
i(".github/workflows/codeql.yml"),
|
|
509
|
+
i(".github/dependabot.yml"),
|
|
510
|
+
i(l)
|
|
511
|
+
]), [c, u, d, f] = await Promise.all([
|
|
512
|
+
R(`repos/${e}/${t}`),
|
|
513
|
+
R(`repos/${e}/${t}/private-vulnerability-reporting`),
|
|
514
|
+
R(`repos/${e}/${t}/vulnerability-alerts`),
|
|
515
|
+
R(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
|
|
516
|
+
]), 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;
|
|
510
517
|
return {
|
|
511
|
-
codeQLLanguages: (
|
|
512
|
-
codeQLQueries: /queries: ([\w-]+)/.exec(
|
|
513
|
-
dependabotAlerts:
|
|
514
|
-
dependabotSecurityUpdates:
|
|
515
|
-
dependabotVersionUpdates:
|
|
518
|
+
codeQLLanguages: (a ?? "").matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || s !== null).map(([, e = ""]) => rt[e] ?? e).toArray(),
|
|
519
|
+
codeQLQueries: /queries: ([\w-]+)/.exec(a ?? "")?.[1],
|
|
520
|
+
dependabotAlerts: d !== void 0,
|
|
521
|
+
dependabotSecurityUpdates: m("dependabot_security_updates"),
|
|
522
|
+
dependabotVersionUpdates: g > _,
|
|
516
523
|
lintInCI: (r ?? "").includes("npm run lint"),
|
|
517
524
|
npmAuditInCI: /npm (?:run )?audit/.test(r ?? ""),
|
|
518
525
|
npmAuditLevel: /npm audit --audit-level=(\w+)/.exec(r ?? "")?.[1],
|
|
519
|
-
privateVulnerabilityReporting:
|
|
526
|
+
privateVulnerabilityReporting: u === void 0 ? void 0 : JSON.parse(u).enabled,
|
|
520
527
|
propertyTests: n.devDependencies?.["fast-check"] != null,
|
|
521
|
-
pushProtection:
|
|
522
|
-
secretScanning:
|
|
523
|
-
socket:
|
|
524
|
-
sonarCloud:
|
|
528
|
+
pushProtection: m("secret_scanning_push_protection"),
|
|
529
|
+
secretScanning: m("secret_scanning"),
|
|
530
|
+
socket: h.has("socket-security"),
|
|
531
|
+
sonarCloud: h.has("sonarqubecloud"),
|
|
525
532
|
testsInCI: r?.includes("npm test") ?? !1
|
|
526
533
|
};
|
|
527
534
|
}
|
|
528
|
-
async function
|
|
535
|
+
async function R(e) {
|
|
529
536
|
try {
|
|
530
537
|
let { stdout: t } = await at("gh", ["api", e]);
|
|
531
538
|
return t;
|
|
@@ -547,15 +554,15 @@ async function pt(e) {
|
|
|
547
554
|
}
|
|
548
555
|
}
|
|
549
556
|
function mt(e) {
|
|
550
|
-
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 ||
|
|
557
|
+
return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || $e.has(e) || P[e] !== void 0 && t >= P[e]);
|
|
551
558
|
}
|
|
552
|
-
function
|
|
559
|
+
function z(e) {
|
|
553
560
|
return e === !1 ? " These are handled manually." : "";
|
|
554
561
|
}
|
|
555
|
-
function
|
|
562
|
+
function B(e) {
|
|
556
563
|
return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
|
|
557
564
|
}
|
|
558
|
-
function
|
|
565
|
+
function V(e, t) {
|
|
559
566
|
return t.length === 0 ? "" : `### ${e}
|
|
560
567
|
|
|
561
568
|
|Check|Status|What it does|
|
|
@@ -564,84 +571,84 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
|
|
|
564
571
|
|
|
565
572
|
`;
|
|
566
573
|
}
|
|
567
|
-
function
|
|
574
|
+
function H(e, t, n, r) {
|
|
568
575
|
return `})`;
|
|
569
576
|
}
|
|
570
577
|
function ht(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
|
|
571
|
-
let a = `https://github.com/${e}/${t}`,
|
|
578
|
+
let a = `https://github.com/${e}/${t}`, o = (e) => e ? ` Part of the [CI workflow](${a}/actions/workflows/ci.yml) on every push and pull request to \`main\`.` : "", c = [[
|
|
572
579
|
"Unit tests",
|
|
573
|
-
|
|
574
|
-
`[Vitest](https://vitest.dev) runs the unit tests.${
|
|
580
|
+
B(i.testsInCI),
|
|
581
|
+
`[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
|
|
575
582
|
], [
|
|
576
583
|
"Property-based tests",
|
|
577
|
-
|
|
578
|
-
`[fast-check](https://fast-check.dev) runs many random inputs per test to find edge cases, alongside the unit tests.${
|
|
584
|
+
B(i.propertyTests),
|
|
585
|
+
`[fast-check](https://fast-check.dev) runs many random inputs per test to find edge cases, alongside the unit tests.${o(i.propertyTests && i.testsInCI)}`
|
|
579
586
|
]];
|
|
580
587
|
n !== void 0 && c.push([
|
|
581
588
|
"Test coverage",
|
|
582
|
-
|
|
583
|
-
`${
|
|
589
|
+
B(!0),
|
|
590
|
+
`${H(e, t, "Coverage", I)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(F)}%.`
|
|
584
591
|
]);
|
|
585
592
|
let l = `[](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, u = [[
|
|
586
593
|
"Code analysis",
|
|
587
|
-
|
|
594
|
+
B(i.sonarCloud),
|
|
588
595
|
`${i.sonarCloud ? l : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
|
|
589
596
|
], [
|
|
590
597
|
"Linting",
|
|
591
|
-
|
|
592
|
-
`[ESLint](https://eslint.org) checks the code for errors and style problems.${
|
|
598
|
+
B(i.lintInCI),
|
|
599
|
+
`[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
|
|
593
600
|
]];
|
|
594
601
|
r !== void 0 && u.unshift([
|
|
595
602
|
"Code health",
|
|
596
|
-
|
|
597
|
-
`[${
|
|
603
|
+
B(!0),
|
|
604
|
+
`[${H(e, t, "Fallow code health", ne)}](./${s}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
|
|
598
605
|
]);
|
|
599
606
|
let d = i.codeQLLanguages.length > 0, f = `[](${a}/security/code-scanning) `, p = i.codeQLQueries === "security-extended" ? "using the extended security queries" : "using the default queries", m = d ? ` ${i.codeQLLanguages.join(" and ")}` : "", h = [
|
|
600
607
|
[
|
|
601
608
|
"Push protection",
|
|
602
|
-
|
|
609
|
+
B(i.pushProtection),
|
|
603
610
|
"[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
|
|
604
611
|
],
|
|
605
612
|
[
|
|
606
613
|
"Static analysis",
|
|
607
|
-
|
|
614
|
+
B(d),
|
|
608
615
|
`${d ? f : ""}[CodeQL](https://codeql.github.com) scans${m} for security vulnerabilities, ${p}, on every push and pull request to \`main\` and weekly.`
|
|
609
616
|
],
|
|
610
617
|
[
|
|
611
618
|
"Secret scanning",
|
|
612
|
-
|
|
619
|
+
B(i.secretScanning),
|
|
613
620
|
"[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
|
|
614
621
|
]
|
|
615
622
|
], g = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", _ = [
|
|
616
623
|
[
|
|
617
624
|
"Vulnerability audit",
|
|
618
|
-
|
|
619
|
-
i.npmAuditLevel === void 0 ? `[npm audit](https://docs.npmjs.com/cli/commands/npm-audit) fails when a shipped dependency has any known vulnerability, or a development dependency has a high or critical one.${
|
|
625
|
+
B(i.npmAuditInCI),
|
|
626
|
+
i.npmAuditLevel === void 0 ? `[npm audit](https://docs.npmjs.com/cli/commands/npm-audit) fails when a shipped dependency has any known vulnerability, or a development dependency has a high or critical one.${o(i.npmAuditInCI)}` : `[npm audit](https://docs.npmjs.com/cli/commands/npm-audit) fails when a dependency has a known vulnerability of ${i.npmAuditLevel} severity or above.${o(i.npmAuditInCI)}`
|
|
620
627
|
],
|
|
621
628
|
[
|
|
622
629
|
"Supply chain risk",
|
|
623
|
-
|
|
630
|
+
B(i.socket),
|
|
624
631
|
"[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
|
|
625
632
|
],
|
|
626
633
|
[
|
|
627
634
|
"Security alerts",
|
|
628
|
-
|
|
635
|
+
B(i.dependabotAlerts),
|
|
629
636
|
`${g} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
|
|
630
637
|
],
|
|
631
638
|
[
|
|
632
639
|
"Security updates",
|
|
633
|
-
|
|
634
|
-
`${g} opens pull requests that update vulnerable dependencies.${
|
|
640
|
+
B(i.dependabotSecurityUpdates),
|
|
641
|
+
`${g} opens pull requests that update vulnerable dependencies.${z(i.dependabotSecurityUpdates)}`
|
|
635
642
|
],
|
|
636
643
|
[
|
|
637
644
|
"Version updates",
|
|
638
|
-
|
|
639
|
-
`${g} opens pull requests for new dependency versions.${
|
|
645
|
+
B(i.dependabotVersionUpdates),
|
|
646
|
+
`${g} opens pull requests for new dependency versions.${z(i.dependabotVersionUpdates)}`
|
|
640
647
|
]
|
|
641
648
|
];
|
|
642
649
|
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.
|
|
643
650
|
|
|
644
|
-
${
|
|
651
|
+
${V("Testing", c)}${V("Code Quality", u)}${V("Security Analysis", h)}${V("Dependencies", _)}`;
|
|
645
652
|
}
|
|
646
653
|
function gt(e, t, n, r, i) {
|
|
647
654
|
let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && mt(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.";
|
|
@@ -666,9 +673,9 @@ var _t = "<!-- USAGE_START -->", vt = "<!-- USAGE_END -->", yt = /* @__PURE__ */
|
|
|
666
673
|
]), bt = /* @__PURE__ */ new Set(["development", "eslint"]), xt = "> [!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.", St = "This repository manages itself using the actions it implements.", Ct = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
|
|
667
674
|
async function wt() {
|
|
668
675
|
try {
|
|
669
|
-
f("Document Usage"),
|
|
670
|
-
let [e,
|
|
671
|
-
await
|
|
676
|
+
f("Document Usage"), b("1️⃣ Insert usage content into 'README.md'");
|
|
677
|
+
let [e, t] = await Promise.all([c("package.json"), c("config.json")]), r = Tt(e), i = Et(r), a = U(e.engines?.node), s = U(e.engines?.npm), l = U(e.devDependencies?.typescript), u = Dt(_(t.id), e.name), d = `${r.replace(/\.git$/, "")}/blob/main/package.json`, p = Ot(u, r, i, a, s, l, `${e.name === "@dpuse/dpuse-development" ? St : Ct} See the \`scripts\` block in [package.json](${d}) for details.`);
|
|
678
|
+
await n(p, _t, vt), o("Usage documented");
|
|
672
679
|
} catch (e) {
|
|
673
680
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
674
681
|
}
|
|
@@ -681,7 +688,7 @@ function Tt(e) {
|
|
|
681
688
|
function Et(e) {
|
|
682
689
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
683
690
|
}
|
|
684
|
-
function
|
|
691
|
+
function U(e) {
|
|
685
692
|
if (e == null) throw Error("package.json version range is required to document usage.");
|
|
686
693
|
let t = /\d+(?:\.\d+)*/.exec(e);
|
|
687
694
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
@@ -721,93 +728,93 @@ ${o}`;
|
|
|
721
728
|
}
|
|
722
729
|
//#endregion
|
|
723
730
|
//#region src/actions/documentApiReference.ts
|
|
724
|
-
var
|
|
731
|
+
var W = "API_REFERENCE.md";
|
|
725
732
|
async function kt() {
|
|
726
733
|
try {
|
|
727
734
|
f("Document API Reference");
|
|
728
|
-
let { writeAPIReference: e } = await import("./apiReference-
|
|
729
|
-
await e("1️⃣ ",
|
|
735
|
+
let { writeAPIReference: e } = await import("./apiReference-BazeHifT.js");
|
|
736
|
+
await e("1️⃣ ", W), o("API reference documented");
|
|
730
737
|
} catch (e) {
|
|
731
738
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
732
739
|
}
|
|
733
740
|
}
|
|
734
741
|
//#endregion
|
|
735
742
|
//#region src/actions/documentBundleSizes.ts
|
|
736
|
-
var
|
|
743
|
+
var G = "bundle-analysis-reports/sonda/index.json", At = "<!-- BUNDLE_START -->", jt = "<!-- BUNDLE_END -->", K = " ", q = 20, Mt = "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._", J = "(bundler output, whitespace & JSON)", Nt = `${J} = 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.`;
|
|
737
744
|
async function Pt(e) {
|
|
738
745
|
try {
|
|
739
|
-
f("Document Bundle Sizes"),
|
|
740
|
-
let
|
|
741
|
-
|
|
742
|
-
let r = Ft(
|
|
743
|
-
await
|
|
746
|
+
f("Document Bundle Sizes"), b("1️⃣ Read bundle analysis report");
|
|
747
|
+
let t = await c(G);
|
|
748
|
+
b("2️⃣ Insert table into 'README.md'");
|
|
749
|
+
let r = Ft(t, e?.moduleLevel ?? !1);
|
|
750
|
+
await n(`## Bundle Analysis\n\n${Mt}\n\n${r}\n\n${Nt}`, At, jt), o("Bundle sizes documented");
|
|
744
751
|
} catch (e) {
|
|
745
752
|
console.error("❌ Error documenting bundle sizes", e), process.exit(1);
|
|
746
753
|
}
|
|
747
754
|
}
|
|
748
755
|
function Ft(e, t) {
|
|
749
|
-
let n =
|
|
756
|
+
let n = Vt(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, Gt(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
|
|
750
757
|
for (let [e, o] of i) {
|
|
751
|
-
let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted((e, t) => t[1].sizes.uncompressed - e[1].sizes.uncompressed), s = i.length === 1 ? It(e, o,
|
|
758
|
+
let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted((e, t) => t[1].sizes.uncompressed - e[1].sizes.uncompressed), s = i.length === 1 ? It(e, o, zt(i), r, t) : Lt(e, o, i, r, t);
|
|
752
759
|
a.push(...s);
|
|
753
760
|
}
|
|
754
761
|
return a.join("\n");
|
|
755
762
|
}
|
|
756
763
|
function It(e, t, n, r, i) {
|
|
757
764
|
let [a, { sizes: o, files: s }] = n, c = r > 0 ? o.uncompressed / r * 100 : 0;
|
|
758
|
-
if (s.size === 1) return [`| ${e} → ${
|
|
765
|
+
if (s.size === 1) return [`| ${e} → ${Rt(a, Bt(s))} | ${X(t)} · ${Z(c)} |`];
|
|
759
766
|
let l = [`| ${e} → ${a} | ${X(t)} · ${Z(c)} |`];
|
|
760
|
-
return i || l.push(...
|
|
767
|
+
return i || l.push(...Y(s, K, r)), l;
|
|
761
768
|
}
|
|
762
769
|
function Lt(e, t, n, r, i) {
|
|
763
770
|
let a = [`| ${e} | ${X(t)} |`];
|
|
764
771
|
for (let [e, { sizes: t, files: o }] of n) {
|
|
765
772
|
let n = r > 0 ? t.uncompressed / r * 100 : 0;
|
|
766
773
|
if (o.size === 1) {
|
|
767
|
-
let t =
|
|
768
|
-
a.push(`| ${
|
|
774
|
+
let t = Bt(o);
|
|
775
|
+
a.push(`| ${K}${Rt(e, t)} | ${Z(n)} |`);
|
|
769
776
|
continue;
|
|
770
777
|
}
|
|
771
|
-
a.push(`| ${
|
|
778
|
+
a.push(`| ${K}${e} | ${Z(n)} |`), i || a.push(...Y(o, `${K}${K}`, r));
|
|
772
779
|
}
|
|
773
780
|
return a;
|
|
774
781
|
}
|
|
775
|
-
function
|
|
782
|
+
function Y(e, t, n) {
|
|
776
783
|
return [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed).map(([e, r]) => `| ${t}${e} | ${Z(n > 0 ? r.uncompressed / n * 100 : 0)} |`);
|
|
777
784
|
}
|
|
778
|
-
function
|
|
785
|
+
function Rt(e, t) {
|
|
779
786
|
return t === "" ? e : `${e} → ${t}`;
|
|
780
787
|
}
|
|
781
|
-
function
|
|
788
|
+
function zt(e) {
|
|
782
789
|
let [t] = e;
|
|
783
790
|
if (t === void 0) throw Error("Expected exactly one entry");
|
|
784
791
|
return t;
|
|
785
792
|
}
|
|
786
|
-
function
|
|
793
|
+
function Bt(e) {
|
|
787
794
|
let [t] = e.keys();
|
|
788
795
|
if (t === void 0) throw Error("Expected exactly one file");
|
|
789
796
|
return t;
|
|
790
797
|
}
|
|
791
|
-
function
|
|
792
|
-
let t =
|
|
798
|
+
function Vt(e) {
|
|
799
|
+
let t = Ht(e.dependencies), n = /* @__PURE__ */ new Map();
|
|
793
800
|
for (let r of e.resources) {
|
|
794
801
|
if (r.kind !== "chunk" || !r.parent) continue;
|
|
795
|
-
let { group: e, file: i } =
|
|
802
|
+
let { group: e, file: i } = Ut(r.name, t), a = Gt(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
|
|
796
803
|
n.set(r.parent, o);
|
|
797
804
|
let s = o.get(e) ?? {
|
|
798
|
-
sizes:
|
|
805
|
+
sizes: Kt(),
|
|
799
806
|
files: /* @__PURE__ */ new Map()
|
|
800
807
|
};
|
|
801
|
-
o.set(e, s),
|
|
802
|
-
let c = s.files.get(i) ??
|
|
803
|
-
s.files.set(i, c),
|
|
808
|
+
o.set(e, s), qt(s.sizes, a);
|
|
809
|
+
let c = s.files.get(i) ?? Kt();
|
|
810
|
+
s.files.set(i, c), qt(c, a);
|
|
804
811
|
}
|
|
805
812
|
return n;
|
|
806
813
|
}
|
|
807
|
-
function
|
|
814
|
+
function Ht(e) {
|
|
808
815
|
return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
|
|
809
816
|
}
|
|
810
|
-
function
|
|
817
|
+
function Ut(e, t) {
|
|
811
818
|
let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
|
|
812
819
|
if (n) {
|
|
813
820
|
let [t, r] = n;
|
|
@@ -817,55 +824,55 @@ function Vt(e, t) {
|
|
|
817
824
|
};
|
|
818
825
|
}
|
|
819
826
|
return e === "[unassigned]" ? {
|
|
820
|
-
group:
|
|
827
|
+
group: J,
|
|
821
828
|
file: ""
|
|
822
829
|
} : e.startsWith("\0") ? {
|
|
823
830
|
group: "(runtime)",
|
|
824
831
|
file: e.slice(1)
|
|
825
832
|
} : {
|
|
826
833
|
group: e.startsWith("rust/") || e.includes("vite-plugin-wasm") ? "wasm" : "src",
|
|
827
|
-
file:
|
|
834
|
+
file: Wt(e)
|
|
828
835
|
};
|
|
829
836
|
}
|
|
830
|
-
function
|
|
837
|
+
function Wt(e) {
|
|
831
838
|
return e.split("/").at(-1) ?? e;
|
|
832
839
|
}
|
|
833
|
-
function
|
|
840
|
+
function Gt(e) {
|
|
834
841
|
return {
|
|
835
842
|
uncompressed: e.uncompressed,
|
|
836
843
|
gzip: e.gzip ?? 0
|
|
837
844
|
};
|
|
838
845
|
}
|
|
839
846
|
function X(e) {
|
|
840
|
-
return `${
|
|
847
|
+
return `${Jt(e.uncompressed)} · gzip ${Jt(e.gzip)}`;
|
|
841
848
|
}
|
|
842
849
|
function Z(e) {
|
|
843
|
-
let t = Math.round(e / 100 *
|
|
844
|
-
return `\`${"█".repeat(t)}${"░".repeat(
|
|
850
|
+
let t = Math.round(e / 100 * q);
|
|
851
|
+
return `\`${"█".repeat(t)}${"░".repeat(q - t)}\` ${e.toFixed(1)}%`;
|
|
845
852
|
}
|
|
846
|
-
function
|
|
853
|
+
function Kt() {
|
|
847
854
|
return {
|
|
848
855
|
uncompressed: 0,
|
|
849
856
|
gzip: 0
|
|
850
857
|
};
|
|
851
858
|
}
|
|
852
|
-
function
|
|
859
|
+
function qt(e, t) {
|
|
853
860
|
e.uncompressed += t.uncompressed, e.gzip += t.gzip;
|
|
854
861
|
}
|
|
855
|
-
function
|
|
862
|
+
function Jt(e) {
|
|
856
863
|
return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
|
|
857
864
|
}
|
|
858
865
|
//#endregion
|
|
859
866
|
//#region src/actions/documentProject.ts
|
|
860
|
-
async function
|
|
867
|
+
async function Q(e = "MIT", t = !1) {
|
|
861
868
|
try {
|
|
862
|
-
let
|
|
863
|
-
await
|
|
864
|
-
let
|
|
865
|
-
|
|
869
|
+
let n = await c("config.json"), r = _(n.id).typeId === "connector";
|
|
870
|
+
await Je(), r && await Ae(), await wt(), await Ie(e), await i("bundle-analysis-reports/sonda/index.json") === null ? b(`ℹ️ Bundle sizes NOT documented, as there is no '${G}' yet. Build the project first.`) : await Pt({ moduleLevel: t }), await ot(), await je();
|
|
871
|
+
let a = await i(W) !== null;
|
|
872
|
+
a ? await kt() : b(`ℹ️ '${W}' NOT required by this project`), await x("ℹ️ Format generated files", "prettier", [
|
|
866
873
|
"--write",
|
|
867
874
|
"README.md",
|
|
868
|
-
...
|
|
875
|
+
...a ? [W] : []
|
|
869
876
|
]);
|
|
870
877
|
} catch (e) {
|
|
871
878
|
console.error("❌ Error documenting project", e), process.exit(1);
|
|
@@ -873,10 +880,10 @@ async function Wt(t = "MIT", n = !1) {
|
|
|
873
880
|
}
|
|
874
881
|
//#endregion
|
|
875
882
|
//#region src/actions/formatCode.ts
|
|
876
|
-
async function
|
|
883
|
+
async function Yt() {
|
|
877
884
|
try {
|
|
878
885
|
f("Format Code");
|
|
879
|
-
let
|
|
886
|
+
let e = [
|
|
880
887
|
"--write",
|
|
881
888
|
"*.json",
|
|
882
889
|
"*.md",
|
|
@@ -885,37 +892,37 @@ async function Gt() {
|
|
|
885
892
|
"app",
|
|
886
893
|
"src",
|
|
887
894
|
"tests"
|
|
888
|
-
].filter((e) =>
|
|
895
|
+
].filter((e) => ae(e)).map((e) => `${e}/**`)
|
|
889
896
|
];
|
|
890
|
-
await
|
|
897
|
+
await x("1️⃣ Format", "prettier", e), o("Code formatted");
|
|
891
898
|
} catch (e) {
|
|
892
899
|
console.error("❌ Error formatting code", e), process.exit(1);
|
|
893
900
|
}
|
|
894
901
|
}
|
|
895
902
|
//#endregion
|
|
896
903
|
//#region src/actions/lintCode.ts
|
|
897
|
-
async function
|
|
904
|
+
async function Xt() {
|
|
898
905
|
try {
|
|
899
|
-
f("Lint Code"), await
|
|
906
|
+
f("Lint Code"), await x("1️⃣ Lint", "eslint", ["."]), o("Code linted");
|
|
900
907
|
} catch (e) {
|
|
901
908
|
console.error("❌ Error linting code", e), process.exit(1);
|
|
902
909
|
}
|
|
903
910
|
}
|
|
904
911
|
//#endregion
|
|
905
912
|
//#region src/utilities/cloudflare.ts
|
|
906
|
-
async function
|
|
907
|
-
let e = await
|
|
913
|
+
async function Zt() {
|
|
914
|
+
let e = await c("config.json"), t = {
|
|
908
915
|
body: JSON.stringify(e),
|
|
909
916
|
headers: { "Content-Type": "application/json" },
|
|
910
917
|
method: "PUT"
|
|
911
918
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
912
919
|
if (!n.ok) throw Error(await n.text());
|
|
913
920
|
}
|
|
914
|
-
async function
|
|
921
|
+
async function Qt(e, t) {
|
|
915
922
|
async function n(e, t, r) {
|
|
916
923
|
for (let i of r) {
|
|
917
924
|
let r = `${e}/${i}`, a = `${t}/${i}`;
|
|
918
|
-
(await
|
|
925
|
+
(await p(r)).isDirectory() ? await n(r, a, await v(r)) : (console.info(`⚙️ Uploading '${e}/${i}'...`), await d(void 0, "wrangler", [
|
|
919
926
|
"r2",
|
|
920
927
|
"object",
|
|
921
928
|
"put",
|
|
@@ -926,10 +933,10 @@ async function Jt(e, t) {
|
|
|
926
933
|
]));
|
|
927
934
|
}
|
|
928
935
|
}
|
|
929
|
-
let r = await
|
|
936
|
+
let r = await v(`${e}/${t}/`);
|
|
930
937
|
await n(`${e}/${t}`, t, r);
|
|
931
938
|
}
|
|
932
|
-
async function
|
|
939
|
+
async function $t(e) {
|
|
933
940
|
let t = e.id, n = {
|
|
934
941
|
body: JSON.stringify(e),
|
|
935
942
|
headers: { "Content-Type": "application/json" },
|
|
@@ -937,21 +944,21 @@ async function Yt(e) {
|
|
|
937
944
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
938
945
|
if (!r.ok) throw Error(await r.text());
|
|
939
946
|
}
|
|
940
|
-
async function
|
|
947
|
+
async function en(e, t) {
|
|
941
948
|
let n = `v${e.version ?? "unknown"}`;
|
|
942
949
|
async function r(e, r = "") {
|
|
943
|
-
let i = await
|
|
950
|
+
let i = await v(e, { withFileTypes: !0 });
|
|
944
951
|
for (let a of i) {
|
|
945
952
|
if (a.isDirectory() || a.name.endsWith(".map")) continue;
|
|
946
|
-
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",
|
|
947
|
-
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await
|
|
953
|
+
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;
|
|
954
|
+
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await d(void 0, "wrangler", [
|
|
948
955
|
"r2",
|
|
949
956
|
"object",
|
|
950
957
|
"put",
|
|
951
958
|
s,
|
|
952
959
|
`--file=${i}`,
|
|
953
960
|
"--content-type",
|
|
954
|
-
|
|
961
|
+
l,
|
|
955
962
|
"--jurisdiction=eu",
|
|
956
963
|
"--remote"
|
|
957
964
|
]);
|
|
@@ -961,85 +968,85 @@ async function Xt(e, t) {
|
|
|
961
968
|
}
|
|
962
969
|
//#endregion
|
|
963
970
|
//#region src/actions/publishProject.ts
|
|
964
|
-
async function
|
|
971
|
+
async function tn() {
|
|
965
972
|
try {
|
|
966
973
|
f("Publish Project");
|
|
967
|
-
let e = await
|
|
968
|
-
await
|
|
974
|
+
let e = await c("package.json"), t = await c("config.json"), n = _(t.id);
|
|
975
|
+
n.publishedTo === "npm" ? await x("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : b("1️⃣ Publishing to npm NOT required"), await $("2️⃣ ", e, t, n), o(`Project version '${e.version ?? "unknown"}' published.`);
|
|
969
976
|
} catch (e) {
|
|
970
977
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
971
978
|
}
|
|
972
979
|
}
|
|
973
|
-
async function
|
|
974
|
-
if (r.typeId === "app")
|
|
975
|
-
else if (r.typeId === "engine")
|
|
976
|
-
else if (r.uploadGroupName === void 0)
|
|
980
|
+
async function $(e, t, n, r) {
|
|
981
|
+
if (r.typeId === "app") b(`${e} Register module`), await Zt();
|
|
982
|
+
else if (r.typeId === "engine") b(`${e} Register module`), await en(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await $t(n);
|
|
983
|
+
else if (r.uploadGroupName === void 0) b(`${e} Registration NOT required`);
|
|
977
984
|
else {
|
|
978
|
-
|
|
985
|
+
b(`${e} Register module`);
|
|
979
986
|
let i = n.id.split("-").slice(2).join("-");
|
|
980
|
-
await
|
|
987
|
+
await en(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await $t(n);
|
|
981
988
|
}
|
|
982
989
|
}
|
|
983
990
|
//#endregion
|
|
984
991
|
//#region src/actions/releaseProject.ts
|
|
985
|
-
async function
|
|
992
|
+
async function nn(e = "MIT", t = !1) {
|
|
986
993
|
try {
|
|
987
994
|
f("Release Project");
|
|
988
|
-
let
|
|
989
|
-
await
|
|
990
|
-
let
|
|
991
|
-
if (await
|
|
995
|
+
let n = await c("package.json"), r = await c("config.json"), i = _(r.id);
|
|
996
|
+
await y("1️⃣ ", n);
|
|
997
|
+
let a = await g("2️⃣ ", n, i);
|
|
998
|
+
if (await E("3️⃣ ", n), b("4️⃣ Regenerate README"), await Q(e, t), await d("5️⃣ Stage changes", "git", ["add", "."]), await d("6️⃣ Commit changes", "git", [
|
|
992
999
|
"commit",
|
|
993
1000
|
"-m",
|
|
994
|
-
`v${
|
|
995
|
-
]), await
|
|
1001
|
+
`v${n.version ?? "unknown"}`
|
|
1002
|
+
]), await d("7️⃣ Push changes", "git", [
|
|
996
1003
|
"push",
|
|
997
1004
|
"origin",
|
|
998
1005
|
"main:main"
|
|
999
|
-
]), await
|
|
1000
|
-
let
|
|
1001
|
-
await
|
|
1006
|
+
]), await $("8️⃣ ", n, a, i), i.publishedTo === "npm") {
|
|
1007
|
+
let e = `v${n.version ?? "unknown"}`;
|
|
1008
|
+
await x("9️⃣ Create GitHub release", "gh", [
|
|
1002
1009
|
"release",
|
|
1003
1010
|
"create",
|
|
1004
|
-
|
|
1011
|
+
e,
|
|
1005
1012
|
"--target",
|
|
1006
1013
|
"main",
|
|
1007
1014
|
"--generate-notes",
|
|
1008
1015
|
"--latest"
|
|
1009
1016
|
]);
|
|
1010
|
-
} else
|
|
1011
|
-
|
|
1017
|
+
} else b(`9️⃣ Publishing NOT required for package with type identifier of '${i.typeId}'.`);
|
|
1018
|
+
o(`Project version '${n.version ?? "unknown"}' released.`);
|
|
1012
1019
|
} catch (e) {
|
|
1013
1020
|
console.error("❌ Error releasing project", e), process.exit(1);
|
|
1014
1021
|
}
|
|
1015
1022
|
}
|
|
1016
1023
|
//#endregion
|
|
1017
1024
|
//#region src/actions/syncProjectWithGitHub.ts
|
|
1018
|
-
async function
|
|
1025
|
+
async function rn() {
|
|
1019
1026
|
try {
|
|
1020
1027
|
f("Synchronise Project with GitHub");
|
|
1021
|
-
let e = await
|
|
1022
|
-
await
|
|
1028
|
+
let e = await c("package.json"), t = await c("config.json"), n = _(t.id);
|
|
1029
|
+
await y("1️⃣ ", e), await g("2️⃣ ", e, n), await d("3️⃣ Stage changes", "git", ["add", "."]), await d("4️⃣ Commit changes", "git", [
|
|
1023
1030
|
"commit",
|
|
1024
1031
|
"-m",
|
|
1025
1032
|
`v${e.version ?? "unknown"}`
|
|
1026
|
-
]), await
|
|
1033
|
+
]), await d("5️⃣ Push changes", "git", [
|
|
1027
1034
|
"push",
|
|
1028
1035
|
"origin",
|
|
1029
1036
|
"main:main"
|
|
1030
|
-
]),
|
|
1037
|
+
]), o(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
|
|
1031
1038
|
} catch (e) {
|
|
1032
1039
|
console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
|
|
1033
1040
|
}
|
|
1034
1041
|
}
|
|
1035
1042
|
//#endregion
|
|
1036
1043
|
//#region src/actions/testProject.ts
|
|
1037
|
-
var
|
|
1044
|
+
var an = [
|
|
1038
1045
|
"1️⃣ ",
|
|
1039
1046
|
"2️⃣ ",
|
|
1040
1047
|
"3️⃣ ",
|
|
1041
1048
|
"4️⃣ "
|
|
1042
|
-
],
|
|
1049
|
+
], on = [{
|
|
1043
1050
|
id: "unit",
|
|
1044
1051
|
label: "Run unit tests",
|
|
1045
1052
|
command: "vitest",
|
|
@@ -1052,23 +1059,23 @@ var tn = [
|
|
|
1052
1059
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1053
1060
|
configFileName: "playwright.config.ts"
|
|
1054
1061
|
}];
|
|
1055
|
-
async function
|
|
1062
|
+
async function sn(e = ["unit"]) {
|
|
1056
1063
|
try {
|
|
1057
1064
|
f("Test Project");
|
|
1058
|
-
let
|
|
1059
|
-
for (let
|
|
1060
|
-
if (!
|
|
1061
|
-
let
|
|
1062
|
-
await
|
|
1065
|
+
let t = 0;
|
|
1066
|
+
for (let n of on) {
|
|
1067
|
+
if (!e.includes(n.id) || await i(n.configFileName) === null) continue;
|
|
1068
|
+
let r = `${an[t] ?? ""} ${n.label}`;
|
|
1069
|
+
await x(r, n.command, n.arguments), t += 1;
|
|
1063
1070
|
}
|
|
1064
|
-
if (
|
|
1071
|
+
if (t === 0) {
|
|
1065
1072
|
console.warn("\n⚠️ No tests configured for this project.\n");
|
|
1066
1073
|
return;
|
|
1067
1074
|
}
|
|
1068
|
-
|
|
1075
|
+
o("Project tested");
|
|
1069
1076
|
} catch (e) {
|
|
1070
1077
|
console.error("❌ Error testing project", e), process.exit(1);
|
|
1071
1078
|
}
|
|
1072
1079
|
}
|
|
1073
1080
|
//#endregion
|
|
1074
|
-
export {
|
|
1081
|
+
export { de as auditDependencies, fe as buildProject, we as checkProject, Q as documentProject, Yt as formatCode, Xt as lintCode, tn as publishProject, nn as releaseProject, rn as syncProjectWithGitHub, sn as testProject, Qt as uploadDirectoryToR2 };
|