create-pmos 0.455.0 → 0.457.0

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.
@@ -0,0 +1,56 @@
1
+ /* pm/upd-weeks.js — the published kits' change log, grouped by calendar week (Settings › Updates; initiative premium-updates, the weekly log).
2
+ * Pure: no DOM, no network. The two Settings screens (cozy-settings.js, premium-shell.js) draw what it returns.
3
+ * weeksOf(entries, now, mine) → [{ key, name, range, kits: [oldest, newest], newer, groups: { new, imp, fix }, count }] newest week first
4
+ * lineOf(item) → { b, s } a bold name and the sentence under it (the PR's title and its summary), or just the sentence
5
+ * An entry is { v, at, prs: [{ n, t, s, k }] } as scripts/kit-changelog.js writes it. A week runs Monday to Sunday in this computer's time zone.
6
+ * Each PR becomes one line in New, Improved or Fixed by its kind k; chore, docs, test and CI PRs (k = x) are left out, and a week with no line
7
+ * is not listed (zero is silence). A kit published before kinds were kept has no k, so its title decides: a fix word means Fixed, else Improved. */
8
+ export const KINDS = [['new', 'New'], ['imp', 'Improved'], ['fix', 'Fixed']];
9
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
10
+ const cmpVer = (a, b) => { const x = String(a || '0').split('-')[0].split('.').map(Number), y = String(b || '0').split('-')[0].split('.').map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) < (y[i] || 0) ? -1 : 1; return 0; };
11
+ const FIX = /\b(fix|fixes|fixed|hotfix|bug|no longer|sticks|stops?)\b/i;
12
+
13
+ /** 'new' | 'imp' | 'fix' | 'x' (left out). */
14
+ export function kindOf(p) {
15
+ if (p && (p.k === 'new' || p.k === 'imp' || p.k === 'fix' || p.k === 'x')) return p.k;
16
+ return FIX.test((p && (p.t || p.s)) || '') ? 'fix' : 'imp';
17
+ }
18
+ export function lineOf(p) {
19
+ const s = String((p && p.s) || ''), t = String((p && p.t) || '');
20
+ return t && t !== s ? { b: t, s } : { b: '', s };
21
+ }
22
+ const mondayOf = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate() - ((d.getDay() + 6) % 7));
23
+ const keyOf = (d) => d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
24
+ const dm = (d) => d.getDate() + ' ' + MON[d.getMonth()];
25
+ function rangeOf(mon) {
26
+ const sun = new Date(mon.getFullYear(), mon.getMonth(), mon.getDate() + 6);
27
+ return mon.getMonth() === sun.getMonth() ? mon.getDate() + ' – ' + dm(sun) : dm(mon) + ' – ' + dm(sun);
28
+ }
29
+
30
+ export function weeksOf(entries, now = Date.now(), mine = null) {
31
+ const thisMon = mondayOf(new Date(now)), lastMon = new Date(thisMon.getFullYear(), thisMon.getMonth(), thisMon.getDate() - 7);
32
+ const by = new Map();
33
+ for (const e of Array.isArray(entries) ? entries : []) {
34
+ if (!e || !e.v) continue;
35
+ const d = e.at ? new Date(e.at) : null, dated = d && !isNaN(d), mon = dated ? mondayOf(d) : null, key = dated ? keyOf(mon) : 'undated';
36
+ if (!by.has(key)) by.set(key, { key, mon, kits: [], newer: false, groups: { new: [], imp: [], fix: [] }, seen: new Set() });
37
+ const w = by.get(key);
38
+ w.kits.push(e.v);
39
+ if (mine && cmpVer(e.v, mine) > 0) w.newer = true;
40
+ for (const p of e.prs || []) {
41
+ const k = kindOf(p); if (k === 'x') continue;
42
+ if (p.n && w.seen.has(p.n)) continue;
43
+ if (p.n) w.seen.add(p.n);
44
+ w.groups[k].push({ n: p.n || null, t: p.t || '', s: p.s || '', v: e.v });
45
+ }
46
+ }
47
+ const out = [];
48
+ for (const w of by.values()) {
49
+ const count = w.groups.new.length + w.groups.imp.length + w.groups.fix.length;
50
+ if (!count) continue;
51
+ const sorted = [...w.kits].sort(cmpVer);
52
+ const name = !w.mon ? 'Date not recorded' : keyOf(w.mon) === keyOf(thisMon) ? 'This week' : keyOf(w.mon) === keyOf(lastMon) ? 'Last week' : 'Week of ' + dm(w.mon);
53
+ out.push({ key: w.key, name, range: w.mon ? rangeOf(w.mon) : '', kits: [sorted[0], sorted[sorted.length - 1]], newer: w.newer, groups: w.groups, count, mon: w.mon });
54
+ }
55
+ return out.sort((a, b) => (a.mon && b.mon ? b.mon - a.mon : a.mon ? -1 : b.mon ? 1 : 0)).map(({ mon, ...w }) => w);
56
+ }
@@ -193,6 +193,13 @@ async function pure() {
193
193
  ok('D1b the Milestones card sits under the card: "Milestones 1 of 3 done", the done one ticked', !!mc && mc.after && /^Milestones ?1 of 3 done$/.test(mc.head) && mc.tick === 1 && /^dn:Brief signed off/.test(mc.rows[0]), JSON.stringify(mc));
194
194
  ok('D1b the next one is marked with "in N days", and the release says so', !!mc && /^up:Rollout to all workspacesDec 1 · in \d+ days · release$/.test(mc.rows[1]) && /^:Did it work\?Feb 1/.test(mc.rows[2]), JSON.stringify(mc && mc.rows));
195
195
  ok('D1b each row is a press for its task', !!mc && mc.press, JSON.stringify(mc));
196
+ const layout = await p.evaluate((v) => {
197
+ const root = document.querySelector(v + ' .iv'), summary = root.querySelector('.iv-cl'), tasks = root.querySelector('.iv-tasks'), picture = root.querySelector('.iv-mi');
198
+ const s = summary.getBoundingClientRect(), t = tasks.getBoundingClientRect(), pic = picture.getBoundingClientRect();
199
+ return { stacked: t.top >= s.bottom, full: Math.abs(t.width - s.width) < 2, compact: pic.width <= 261 && pic.height < 150,
200
+ scroll: getComputedStyle(tasks).overflowY, overflow: root.scrollWidth > root.clientWidth };
201
+ }, V);
202
+ ok('D1b desktop puts full-width Tasks below a compact summary, with one page scroll', layout.stacked && layout.full && layout.compact && layout.scroll === 'visible' && !layout.overflow, JSON.stringify(layout));
196
203
  // Wawan 11:58 (0.442.0 hotfix): in two columns the dates line, ⋯ and the next stage show under the picture without a tap, and the
197
204
  // milestones are said once, in this card; a tap on the picture does not list them again
198
205
  ok('D1b in two columns the dates line and the next stage show under the picture at once', await miShown(p) && await p.evaluate((v) => { const n = document.querySelector(v + ' .iv-sc [data-iv-next]'); return !!n && !!n.offsetParent; }, V));
@@ -0,0 +1,5 @@
1
+ {
2
+ "_comment": "Settings › Updates with the weekly change log (What's new merged into Updates; layout C, the week picker). pm/upd-weeks.js groups the published kits by week and kind in node; the screens that draw it are checked by ev-everywhere-test.js. scripts/tests/kit-changelog.test.js covers the kind each PR keeps.",
3
+ "modules": ["upd-weeks.test.mjs"],
4
+ "seconds": { "upd-weeks.test.mjs": 1 }
5
+ }