@kurvball/rehearse 1.12.1 → 1.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compare/gate.js +22 -2
- package/package.json +1 -1
package/dist/compare/gate.js
CHANGED
|
@@ -19,7 +19,25 @@ function clipped(text, limit) {
|
|
|
19
19
|
.trimEnd()}…`;
|
|
20
20
|
}
|
|
21
21
|
const noMention = (text) => text.replace(/@(?=[A-Za-z0-9])/g, `@${WORD_JOINER}`);
|
|
22
|
-
const
|
|
22
|
+
const escapedMarkdown = (text) => noMention(text.replace(/[\\`*_[\]<>#|~]/g, (c) => `\\${c}`));
|
|
23
|
+
const plain = (text) => escapedMarkdown(oneLine(text));
|
|
24
|
+
function withCodeSpansKept(text) {
|
|
25
|
+
const line = oneLine(text);
|
|
26
|
+
const runs = [...line.matchAll(/`+/g)].map((m) => ({ at: m.index, length: m[0].length }));
|
|
27
|
+
let out = '';
|
|
28
|
+
let from = 0;
|
|
29
|
+
for (let k = 0; k < runs.length; k += 1) {
|
|
30
|
+
const open = runs[k];
|
|
31
|
+
const j = runs.findIndex((r, i) => i > k && r.length === open.length);
|
|
32
|
+
if (j === -1)
|
|
33
|
+
continue;
|
|
34
|
+
const end = runs[j].at + open.length;
|
|
35
|
+
out += `${escapedMarkdown(line.slice(from, open.at))}${line.slice(open.at, end)}`;
|
|
36
|
+
from = end;
|
|
37
|
+
k = j;
|
|
38
|
+
}
|
|
39
|
+
return out + escapedMarkdown(line.slice(from));
|
|
40
|
+
}
|
|
23
41
|
function idOf(prefix, scenario) {
|
|
24
42
|
const id = `${prefix}${scenario}`;
|
|
25
43
|
return id.length <= ID_LIMIT ? id : `${prefix}${createHash('sha256').update(scenario).digest('hex')}`;
|
|
@@ -44,7 +62,9 @@ function itemOf(s) {
|
|
|
44
62
|
return [`${head}${why}${s.failsOnBase ? ' (it fails on the base too)' : ''}`];
|
|
45
63
|
}
|
|
46
64
|
if (s.verdict === 'said') {
|
|
47
|
-
const said = s.said === 'announced' && s.why
|
|
65
|
+
const said = s.said === 'announced' && s.why
|
|
66
|
+
? ` — announced: ${withCodeSpansKept(s.why)}`
|
|
67
|
+
: ' — its definition was edited';
|
|
48
68
|
return [`${head}${said}`];
|
|
49
69
|
}
|
|
50
70
|
const shown = s.differences.slice(0, DIFFERENCES_SHOWN).map((d) => ` - ${differenceLine(d)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurvball/rehearse",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "Rehearse a change before it ships: bring the product up, sign in as named people, start from named worlds, and compare any scenario on the base and on the head.",
|
|
5
5
|
"homepage": "https://rehearse.kurvball.ca/",
|
|
6
6
|
"repository": {
|