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