@mikitasazan/notify 1.6.0 → 1.6.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.
Files changed (2) hide show
  1. package/dist/render.js +25 -9
  2. package/package.json +1 -1
package/dist/render.js CHANGED
@@ -199,7 +199,14 @@ const note = (text) => {
199
199
  * стоит отдельной строкой, потому что сам текст в поле не помещается: поле
200
200
  * держит одну строку и обрезает.
201
201
  */
202
- const quoted = (label, text) => text ? `<b>${esc(cap(label))}</b>\n${note(text)}` : null;
202
+ /**
203
+ * A quote that needs saying what it is. The heading is a GROUP heading — the
204
+ * same italic-underline every other card uses over a block — not a bold field
205
+ * label: a bold label means `label: value` on one line, and using it here made
206
+ * the session card the only one whose block was titled a third way. The owner
207
+ * read the card and asked where its group was.
208
+ */
209
+ const quoted = (label, text) => text ? `${group(label)}\n${note(text)}` : null;
203
210
  /**
204
211
  * Склейка карточки. Пустая строка здесь — знак смены блока, а не отступ:
205
212
  * две подряд означают пустой блок, ведущая — блок, которого нет. Обе
@@ -325,15 +332,22 @@ const labelled = (rows) => {
325
332
  * на зелёную. Строка заголовка стоит дешевле, чем необходимость каждый раз
326
333
  * заново искать глазами, где что.
327
334
  */
335
+ /**
336
+ * A deploy or a check has two subjects: the run itself and the commit it went
337
+ * out with. Facts about the RUN touch the type line with no heading, because
338
+ * the type line already names the run — that is how every job card is built,
339
+ * and `Reason:` must not sit against the name on one card and under a heading
340
+ * on another. Facts about the COMMIT are a different subject, so they keep a
341
+ * heading of their own.
342
+ *
343
+ * The `Run` heading is gone for the same reason the word `open` went: it
344
+ * announced what line 2 had already said.
345
+ */
328
346
  const twoBlocks = (run, change) => {
329
347
  const live = (rows) => rows.filter((r) => r !== null && r !== '');
330
- const out = [];
331
- for (const [name, rows] of [['Run', live(run)], ['Change', live(change)]]) {
332
- if (rows.length > 0) {
333
- out.push('', group(name), ...rows);
334
- }
335
- }
336
- return out;
348
+ const runRows = live(run);
349
+ const changeRows = live(change);
350
+ return [...runRows, ...(changeRows.length > 0 ? ['', group('Change'), ...changeRows] : [])];
337
351
  };
338
352
  // Значок и его закон живут в events.ts: от него зависит и звук.
339
353
  /** Строка 2: значок вне жирного, `<b>Тип:</b> действие` — то же поле, не особый случай. */
@@ -525,7 +539,9 @@ const renderIncident = (e) => join([
525
539
  // one place it is of any use.
526
540
  const renderSession = (e) => join([
527
541
  typeLine(iconFor(e), 'Session', e.action),
528
- '',
542
+ // No blank line under the type line: a blank means a new block, and here it
543
+ // opened a block that had no heading. Facts about the session touch the
544
+ // line that names it, the way they do on every job card.
529
545
  field('Project', e.workdir),
530
546
  field('Reason', e.reason),
531
547
  e.opened ? '' : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikitasazan/notify",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Единая типизированная отправка Telegram-уведомлений (форум-темы, маршрутизация, ретраи) для всех проектов",
5
5
  "type": "module",
6
6
  "license": "MIT",