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