@juangadm/pre-post 0.3.0 → 1.1.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.
- package/README.md +174 -233
- package/dist/baseline.d.ts +119 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/baseline.js +316 -0
- package/dist/baseline.js.map +1 -0
- package/dist/bin/cli.js +243 -458
- package/dist/bin/cli.js.map +1 -1
- package/dist/browser.d.ts +68 -25
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +500 -105
- package/dist/browser.js.map +1 -1
- package/dist/capture.d.ts +1 -6
- package/dist/capture.d.ts.map +1 -1
- package/dist/capture.js +12 -36
- package/dist/capture.js.map +1 -1
- package/dist/commands/compare.d.ts +18 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +82 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/detect.d.ts +25 -0
- package/dist/commands/detect.d.ts.map +1 -0
- package/dist/commands/detect.js +22 -0
- package/dist/commands/detect.js.map +1 -0
- package/dist/commands/doctor.d.ts +42 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +119 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/login.d.ts +6 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +34 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/pr.d.ts +32 -0
- package/dist/commands/pr.d.ts.map +1 -0
- package/dist/commands/pr.js +259 -0
- package/dist/commands/pr.js.map +1 -0
- package/dist/commands/prune.d.ts +10 -0
- package/dist/commands/prune.d.ts.map +1 -0
- package/dist/commands/prune.js +13 -0
- package/dist/commands/prune.js.map +1 -0
- package/dist/comparison.d.ts +104 -0
- package/dist/comparison.d.ts.map +1 -0
- package/dist/comparison.js +236 -0
- package/dist/comparison.js.map +1 -0
- package/dist/config.d.ts +46 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +82 -0
- package/dist/config.js.map +1 -0
- package/dist/deployments.d.ts +71 -0
- package/dist/deployments.d.ts.map +1 -0
- package/dist/deployments.js +204 -0
- package/dist/deployments.js.map +1 -0
- package/dist/diff-pool.d.ts +17 -0
- package/dist/diff-pool.d.ts.map +1 -0
- package/dist/diff-pool.js +92 -0
- package/dist/diff-pool.js.map +1 -0
- package/dist/diff-worker.d.ts +32 -0
- package/dist/diff-worker.d.ts.map +1 -0
- package/dist/diff-worker.js +39 -0
- package/dist/diff-worker.js.map +1 -0
- package/dist/diff.d.ts +47 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +281 -0
- package/dist/diff.js.map +1 -0
- package/dist/doctor.d.ts +79 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +138 -0
- package/dist/doctor.js.map +1 -0
- package/dist/errors.d.ts +38 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +59 -0
- package/dist/errors.js.map +1 -0
- package/dist/git.d.ts +61 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +182 -0
- package/dist/git.js.map +1 -0
- package/dist/github.d.ts +163 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +411 -0
- package/dist/github.js.map +1 -0
- package/dist/index.d.ts +22 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -67
- package/dist/index.js.map +1 -1
- package/dist/landing.d.ts +48 -0
- package/dist/landing.d.ts.map +1 -0
- package/dist/landing.js +93 -0
- package/dist/landing.js.map +1 -0
- package/dist/pkg.d.ts +17 -0
- package/dist/pkg.d.ts.map +1 -0
- package/dist/pkg.js +49 -0
- package/dist/pkg.js.map +1 -0
- package/dist/report.d.ts +20 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +130 -0
- package/dist/report.js.map +1 -0
- package/dist/routes/imports.d.ts +46 -0
- package/dist/routes/imports.d.ts.map +1 -0
- package/dist/routes/imports.js +208 -0
- package/dist/routes/imports.js.map +1 -0
- package/dist/routes/vite.d.ts +15 -0
- package/dist/routes/vite.d.ts.map +1 -0
- package/dist/routes/vite.js +130 -0
- package/dist/routes/vite.js.map +1 -0
- package/dist/routes.d.ts +65 -11
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +346 -141
- package/dist/routes.js.map +1 -1
- package/dist/run.d.ts +116 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +316 -0
- package/dist/run.js.map +1 -0
- package/dist/sameness.d.ts +91 -0
- package/dist/sameness.d.ts.map +1 -0
- package/dist/sameness.js +157 -0
- package/dist/sameness.js.map +1 -0
- package/dist/sessions.d.ts +50 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/sessions.js +80 -0
- package/dist/sessions.js.map +1 -0
- package/dist/shift.d.ts +67 -0
- package/dist/shift.d.ts.map +1 -0
- package/dist/shift.js +184 -0
- package/dist/shift.js.map +1 -0
- package/dist/types.d.ts +179 -68
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/url.d.ts +12 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/url.js +30 -0
- package/dist/url.js.map +1 -0
- package/dist/viewport.d.ts +6 -1
- package/dist/viewport.d.ts.map +1 -1
- package/dist/viewport.js +13 -7
- package/dist/viewport.js.map +1 -1
- package/package.json +21 -14
- package/skill/SKILL.md +56 -221
- package/dist/clipboard.d.ts +0 -9
- package/dist/clipboard.d.ts.map +0 -1
- package/dist/clipboard.js +0 -26
- package/dist/clipboard.js.map +0 -1
- package/dist/upload.d.ts +0 -39
- package/dist/upload.d.ts.map +0 -1
- package/dist/upload.js +0 -159
- package/dist/upload.js.map +0 -1
- package/dist/video.d.ts +0 -19
- package/dist/video.d.ts.map +0 -1
- package/dist/video.js +0 -263
- package/dist/video.js.map +0 -1
- package/skill/scripts/adapters/0x0st.sh +0 -36
- package/skill/scripts/adapters/blob.sh +0 -55
- package/skill/scripts/adapters/git-native.sh +0 -51
- package/skill/scripts/upload-and-copy.sh +0 -230
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pre-post pr` — the one-shot path: detect → capture → diff → publish → comment.
|
|
3
|
+
*/
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import os from 'os';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { loadConfig, resolveSettings, updateConfig } from '../config.js';
|
|
8
|
+
import { currentBranch, headSha, repoRoot, resolveOwnerRepo } from '../git.js';
|
|
9
|
+
import { detectRoutesForRepo, resolveSample } from '../routes.js';
|
|
10
|
+
import { closeBrowser } from '../browser.js';
|
|
11
|
+
import { parseViewport } from '../viewport.js';
|
|
12
|
+
import { authHint, detectDevServer, ensureBrowser, NeedsHumanError, probeUrl } from '../doctor.js';
|
|
13
|
+
import { cannotPublishHint, checkWriteAccess, findOpenPr, findToken, getPr, GitHub, publishAssets, requireToken, upsertPrDescription, upsertStickyComment } from '../github.js';
|
|
14
|
+
import { buildComment, STICKY_MARKER } from '../report.js';
|
|
15
|
+
import { resolveAuth } from '../sessions.js';
|
|
16
|
+
import { routeSlug, runTasks } from '../run.js';
|
|
17
|
+
import { joinUrl } from '../url.js';
|
|
18
|
+
import { describeComparison, resolveComparison } from '../comparison.js';
|
|
19
|
+
/**
|
|
20
|
+
* What ends up on the assets branch. The diff overlay is an intermediate used
|
|
21
|
+
* to locate the changed region; Pre beside Post is the comparison a reviewer
|
|
22
|
+
* reads, so shipping the overlay is upload time and storage for nothing.
|
|
23
|
+
*/
|
|
24
|
+
const PUBLISHED_KINDS = ['before', 'after', 'cropBefore', 'cropAfter'];
|
|
25
|
+
function headersFor(config, opts) {
|
|
26
|
+
return resolveAuth({ configHeaders: config.headers, headers: opts.headers, urls: [] })?.headers ?? {};
|
|
27
|
+
}
|
|
28
|
+
function runId(now) {
|
|
29
|
+
return now.toISOString().replace(/[-:]/g, '').replace('T', '-').slice(0, 15);
|
|
30
|
+
}
|
|
31
|
+
export async function runPr(opts = {}) {
|
|
32
|
+
const started = Date.now();
|
|
33
|
+
const log = opts.log ?? (() => undefined);
|
|
34
|
+
const root = repoRoot(opts.cwd);
|
|
35
|
+
const config = loadConfig(root);
|
|
36
|
+
const settings = resolveSettings(config, opts);
|
|
37
|
+
const ownerRepo = resolveOwnerRepo(root);
|
|
38
|
+
const branch = currentBranch(root);
|
|
39
|
+
/** Tears down anything resolution started (a local dev server). */
|
|
40
|
+
let cleanupComparison = async () => undefined;
|
|
41
|
+
// --- GitHub access (checked before any time is spent) -----------------------
|
|
42
|
+
// A dry run still has to *read* GitHub: the PR, and the deployments that
|
|
43
|
+
// decide what Pre and Post are. Only writing is off. Withholding the client
|
|
44
|
+
// entirely made --dry-run the one mode that could never use a deployment,
|
|
45
|
+
// so it always demanded a dev server — from the person least likely to have
|
|
46
|
+
// one. Reads use `gh`; publishing and commenting use `writeGh`.
|
|
47
|
+
const found = opts.dryRun ? findToken() : requireToken();
|
|
48
|
+
const gh = found ? new GitHub(found.token) : null;
|
|
49
|
+
const writeGh = opts.dryRun ? null : gh;
|
|
50
|
+
// --- Start the slow, independent things now; they overlap route detection ----
|
|
51
|
+
const browserReady = ensureBrowser();
|
|
52
|
+
/**
|
|
53
|
+
* Everything this run started, in a form every early exit can call.
|
|
54
|
+
*
|
|
55
|
+
* The browser is launched from here rather than at the capture, so any throw
|
|
56
|
+
* before that block owns closing it: the CLI's `process.exit` hides the
|
|
57
|
+
* difference, but a caller using `runPr()` as a library catches the error and
|
|
58
|
+
* is left with a Chromium nothing references. Awaiting the launch first is
|
|
59
|
+
* what makes it work — `closeBrowser()` drops a pending launch and closes
|
|
60
|
+
* nothing, and the launch then resolves into an orphan.
|
|
61
|
+
*/
|
|
62
|
+
const stopEverything = async () => {
|
|
63
|
+
await browserReady.catch(() => undefined);
|
|
64
|
+
await closeBrowser();
|
|
65
|
+
await cleanupComparison();
|
|
66
|
+
};
|
|
67
|
+
// Whether the token may write, asked at the same time as the PR lookup so it
|
|
68
|
+
// costs no wall clock, and answered before anything expensive begins. A token
|
|
69
|
+
// that cannot read fails the lookup below and never reaches capture; one that
|
|
70
|
+
// reads but cannot write passes every check this run makes until the publish,
|
|
71
|
+
// which is a whole capture pass later — 22.7s for one route at one viewport,
|
|
72
|
+
// measured on a runner.
|
|
73
|
+
const writeAccess = writeGh && found
|
|
74
|
+
? checkWriteAccess(writeGh, ownerRepo).then(access => ({ access, source: found.source }))
|
|
75
|
+
: null;
|
|
76
|
+
const lookup = gh
|
|
77
|
+
? opts.pr ? getPr(gh, ownerRepo, opts.pr) : branch ? findOpenPr(gh, ownerRepo, branch) : Promise.resolve(null)
|
|
78
|
+
: Promise.resolve(null);
|
|
79
|
+
// A dry run used to touch GitHub not at all, and must still work when it
|
|
80
|
+
// cannot: it is what someone runs before anything is set up. A stale token or
|
|
81
|
+
// an unreachable API degrades it to "no PR", never ends the run. A real run
|
|
82
|
+
// needs the PR to publish against, so there the failure still surfaces.
|
|
83
|
+
const prLookup = opts.dryRun
|
|
84
|
+
? lookup.catch(err => { log(`GitHub lookup failed (${err instanceof Error ? err.message : err}); continuing without it.`); return null; })
|
|
85
|
+
: lookup;
|
|
86
|
+
// Local detection runs regardless: it is cheap, and it is the fallback when
|
|
87
|
+
// the PR has no preview deployment.
|
|
88
|
+
const explicitAfter = opts.after ?? config.after;
|
|
89
|
+
const devServer = explicitAfter ? Promise.resolve(explicitAfter) : detectDevServer();
|
|
90
|
+
// Detection is synchronous git + fs work, so run it while the PR lookup is in
|
|
91
|
+
// flight rather than after it.
|
|
92
|
+
const detection = detectRoutesForRepo({ cwd: root, config, maxRoutes: settings.maxRoutes, framework: opts.framework, diffTarget: opts.base, log });
|
|
93
|
+
const appPrefix = path.relative(root, detection.appRoot) || undefined;
|
|
94
|
+
const head = headSha(root);
|
|
95
|
+
const pr = await prLookup;
|
|
96
|
+
// Before the local baseline, which can install and build a whole app, and
|
|
97
|
+
// long before the captures. An answer that is not about access — a 500, a
|
|
98
|
+
// dropped connection — is not evidence of anything, so it says so and the run
|
|
99
|
+
// continues to fail wherever it really fails.
|
|
100
|
+
const write = await writeAccess;
|
|
101
|
+
if (write && !write.access.writable) {
|
|
102
|
+
if (write.access.reason === 'rejected') {
|
|
103
|
+
await stopEverything();
|
|
104
|
+
throw new NeedsHumanError(cannotPublishHint(ownerRepo, write.source));
|
|
105
|
+
}
|
|
106
|
+
log(`Could not check whether the token can publish (${write.access.detail}); continuing.`);
|
|
107
|
+
}
|
|
108
|
+
// --- What are we comparing? ---------------------------------------------------
|
|
109
|
+
const headers = headersFor(config, opts);
|
|
110
|
+
const comparison = await resolveComparison({
|
|
111
|
+
gh, ownerRepo, pr, repoRoot: root, appPrefix, config,
|
|
112
|
+
// Detection already established this; the baseline must be built from the
|
|
113
|
+
// same commit, or Pre and the route list disagree about what changed.
|
|
114
|
+
baseSha: detection.base?.sha,
|
|
115
|
+
// --base is a constraint on the baseline, not just on the route list.
|
|
116
|
+
baseExplicit: detection.base?.source === 'explicit',
|
|
117
|
+
// So a preview can be found for a branch that has been pushed but has no
|
|
118
|
+
// PR open yet — the host builds on push, not on PR.
|
|
119
|
+
headSha: head ?? undefined,
|
|
120
|
+
before: opts.before, after: explicitAfter,
|
|
121
|
+
devServer, probe: url => probeUrl(url, headers),
|
|
122
|
+
allowLocalBaseline: opts.localBaseline, log,
|
|
123
|
+
});
|
|
124
|
+
cleanupComparison = comparison.stop;
|
|
125
|
+
for (const line of describeComparison(comparison))
|
|
126
|
+
log(line);
|
|
127
|
+
const before = comparison.before.url;
|
|
128
|
+
const after = comparison.after.url;
|
|
129
|
+
if (opts.before && config.before !== before) {
|
|
130
|
+
updateConfig(root, { before });
|
|
131
|
+
log('Saved production URL to .pre-post.json');
|
|
132
|
+
}
|
|
133
|
+
// --- Routes (sync: git + import graph) ----------------------------------------
|
|
134
|
+
const samples = config.samples || {};
|
|
135
|
+
let routes;
|
|
136
|
+
let skippedDynamic = [];
|
|
137
|
+
if (opts.routes?.length) {
|
|
138
|
+
routes = opts.routes;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
routes = detection.routes.map(r => r.path);
|
|
142
|
+
skippedDynamic = detection.skippedDynamic;
|
|
143
|
+
log(`Routes (${detection.framework}, ${detection.durationMs}ms): ${routes.length ? routes.join(', ') : 'none detected'}`);
|
|
144
|
+
for (const r of detection.routes)
|
|
145
|
+
log(` ${r.path.padEnd(28)} ${r.confidence.padEnd(6)} ${r.reason}`);
|
|
146
|
+
if (routes.length === 0) {
|
|
147
|
+
routes = ['/'];
|
|
148
|
+
log('No routes detected from the diff; capturing / only.');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// --- Reachability ---------------------------------------------------------------
|
|
152
|
+
// Resolution already probed whatever it chose; this catches a side that died
|
|
153
|
+
// in between, and names which one so the message is actionable.
|
|
154
|
+
const fail = async (message) => {
|
|
155
|
+
await stopEverything();
|
|
156
|
+
throw new NeedsHumanError(message);
|
|
157
|
+
};
|
|
158
|
+
const [probe, afterProbe] = await Promise.all([
|
|
159
|
+
comparison.before.probe ?? probeUrl(before, headers),
|
|
160
|
+
comparison.after.probe ?? probeUrl(after, headers),
|
|
161
|
+
]);
|
|
162
|
+
if (probe.status === null)
|
|
163
|
+
await fail(`Cannot reach ${before} (Pre — ${comparison.before.detail}).`);
|
|
164
|
+
if (probe.status === 401 || probe.status === 403)
|
|
165
|
+
await fail(authHint({ url: before, vercel: probe.vercel }));
|
|
166
|
+
if (afterProbe.status === null)
|
|
167
|
+
await fail(`Cannot reach ${after} (Post — ${comparison.after.detail}).`);
|
|
168
|
+
if (afterProbe.status === 401 || afterProbe.status === 403)
|
|
169
|
+
await fail(authHint({ url: after, vercel: afterProbe.vercel }));
|
|
170
|
+
const auth = resolveAuth({ configHeaders: config.headers, headers: opts.headers, cookies: opts.cookies, cookieUrl: before, urls: [before, after] });
|
|
171
|
+
// --- Capture -------------------------------------------------------------------
|
|
172
|
+
const now = new Date();
|
|
173
|
+
const id = runId(now);
|
|
174
|
+
const outputDir = opts.output || path.join(os.tmpdir(), 'pre-post', ownerRepo.replace('/', '__'), id);
|
|
175
|
+
const viewports = settings.viewports.map(parseViewport);
|
|
176
|
+
const tasks = [];
|
|
177
|
+
for (const route of routes) {
|
|
178
|
+
const resolved = resolveSample(route, samples);
|
|
179
|
+
for (const vp of viewports) {
|
|
180
|
+
tasks.push({ route, resolvedRoute: resolved, viewport: vp.label, size: vp.size, beforeUrl: joinUrl(before, resolved), afterUrl: joinUrl(after, resolved) });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
log(`Capturing ${tasks.length * 2} screenshots (${routes.length} route(s) × ${viewports.length} viewport(s)) ...`);
|
|
184
|
+
await browserReady;
|
|
185
|
+
let run;
|
|
186
|
+
try {
|
|
187
|
+
run = await runTasks(tasks, {
|
|
188
|
+
outputDir, ...settings, wait: opts.wait, auth, log,
|
|
189
|
+
// So the verdict can name how Pre was chosen, not just where it points.
|
|
190
|
+
sides: { before: comparison.before, after: comparison.after },
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
await stopEverything();
|
|
195
|
+
}
|
|
196
|
+
const { outcomes } = run;
|
|
197
|
+
// The pipeline judges whether it compared the two sites or something standing
|
|
198
|
+
// in front of them — a sign-in wall, or a baseline that is a different site
|
|
199
|
+
// altogether. Either way there is no honest result to publish, so stop with
|
|
200
|
+
// the one thing a human has to do.
|
|
201
|
+
if (run.verdict)
|
|
202
|
+
throw new NeedsHumanError(run.verdict.hint);
|
|
203
|
+
// --- Publish -------------------------------------------------------------------
|
|
204
|
+
const changed = outcomes.filter(o => (o.status === 'changed' || o.status === 'added' || o.status === 'removed') && o.files);
|
|
205
|
+
if (writeGh && changed.length) {
|
|
206
|
+
const folder = pr ? `pr-${pr.number}/${id}` : `branch/${routeSlug(branch || 'detached')}/${id}`;
|
|
207
|
+
const keyFor = (o, kind) => `${folder}/${routeSlug(o.route)}-${o.viewport}-${kind}.png`;
|
|
208
|
+
const files = [];
|
|
209
|
+
for (const o of changed) {
|
|
210
|
+
for (const kind of PUBLISHED_KINDS) {
|
|
211
|
+
const local = o.files[kind];
|
|
212
|
+
if (local)
|
|
213
|
+
files.push({ path: keyFor(o, kind), content: fs.readFileSync(local) });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
log(`Publishing ${files.length} image(s) to ${ownerRepo}@${settings.assetsBranch} ...`);
|
|
217
|
+
const published = await publishAssets(writeGh, ownerRepo, settings.assetsBranch, files, pr ? `Screenshots for #${pr.number} (${id})` : `Screenshots for ${branch || 'detached'} (${id})`);
|
|
218
|
+
for (const o of changed) {
|
|
219
|
+
const urls = {};
|
|
220
|
+
for (const kind of PUBLISHED_KINDS)
|
|
221
|
+
if (o.files[kind])
|
|
222
|
+
urls[kind] = published.urls.get(keyFor(o, kind));
|
|
223
|
+
o.urls = urls;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const result = {
|
|
227
|
+
repo: ownerRepo,
|
|
228
|
+
prNumber: pr?.number,
|
|
229
|
+
beforeBase: before,
|
|
230
|
+
afterBase: after,
|
|
231
|
+
outcomes,
|
|
232
|
+
skippedDynamic,
|
|
233
|
+
durationMs: Date.now() - started,
|
|
234
|
+
markdown: '',
|
|
235
|
+
outputDir,
|
|
236
|
+
};
|
|
237
|
+
result.markdown = buildComment(result, { version: opts.version, headSha: head, now });
|
|
238
|
+
if (writeGh && (opts.comment ?? true)) {
|
|
239
|
+
if (pr) {
|
|
240
|
+
// The description is what a reviewer reads first, so put the images there
|
|
241
|
+
// and fall back to a comment only when the PR cannot be edited.
|
|
242
|
+
const described = await upsertPrDescription(writeGh, ownerRepo, pr.number, result.markdown, 'pre-post');
|
|
243
|
+
if (described.updated) {
|
|
244
|
+
result.commentUrl = described.html_url;
|
|
245
|
+
log(`Updated PR description: ${described.html_url}`);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
const comment = await upsertStickyComment(writeGh, ownerRepo, pr.number, result.markdown, STICKY_MARKER);
|
|
249
|
+
result.commentUrl = comment.html_url;
|
|
250
|
+
log(`Cannot edit the PR description; ${comment.created ? 'posted' : 'updated'} a comment instead: ${comment.html_url}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
log(`No open PR for branch "${branch}". Open one and re-run, or paste the markdown below.`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=pr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr.js","sourceRoot":"","sources":["../../src/commands/pr.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAY,YAAY,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,EAAa,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC3L,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAe,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AA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— delete screenshots for PRs closed more than N days ago.
|
|
3
|
+
*/
|
|
4
|
+
import { PruneResult } from '../github.js';
|
|
5
|
+
export declare function runPrune(opts?: {
|
|
6
|
+
cwd?: string;
|
|
7
|
+
days?: number;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
}): Promise<PruneResult>;
|
|
10
|
+
//# sourceMappingURL=prune.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune.d.ts","sourceRoot":"","sources":["../../src/commands/prune.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAuB,WAAW,EAAgB,MAAM,cAAc,CAAC;AAE9E,wBAAsB,QAAQ,CAAC,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAKjH"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pre-post prune` — delete screenshots for PRs closed more than N days ago.
|
|
3
|
+
*/
|
|
4
|
+
import { loadConfig, resolveSettings } from '../config.js';
|
|
5
|
+
import { repoRoot, resolveOwnerRepo } from '../git.js';
|
|
6
|
+
import { GitHub, pruneAssets, requireToken } from '../github.js';
|
|
7
|
+
export async function runPrune(opts = {}) {
|
|
8
|
+
const root = repoRoot(opts.cwd);
|
|
9
|
+
const settings = resolveSettings(loadConfig(root), { pruneDays: opts.days });
|
|
10
|
+
const gh = new GitHub(requireToken('prune screenshots').token);
|
|
11
|
+
return pruneAssets(gh, resolveOwnerRepo(root), settings.assetsBranch, settings.pruneDays, opts.dryRun);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=prune.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune.js","sourceRoot":"","sources":["../../src/commands/prune.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAe,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAA0D,EAAE;IACzF,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7E,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,KAAK,CAAC,CAAC;IAC/D,OAAO,WAAW,CAAC,EAAE,EAAE,gBAAgB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AACzG,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Choosing what to compare against what.
|
|
3
|
+
*
|
|
4
|
+
* Pre and Post used to be resolved independently, which could pair a production
|
|
5
|
+
* deployment against a local dev server. Different fonts, different data,
|
|
6
|
+
* different analytics — a diff full of changes the PR did not make. Nobody
|
|
7
|
+
* reviews the raw images (the skill forbids it), so a noisy diff is believed.
|
|
8
|
+
*
|
|
9
|
+
* So a *pair* is resolved, not two URLs. Each strategy either produces both
|
|
10
|
+
* sides from the same kind of environment or yields to the next one. Mixing
|
|
11
|
+
* happens only when the caller asked for it by name, and is reported when it
|
|
12
|
+
* does.
|
|
13
|
+
*/
|
|
14
|
+
import { GitHub, PullRequestRef } from './github.js';
|
|
15
|
+
import { serveBaseCommit, serveWorkingTree } from './baseline.js';
|
|
16
|
+
import { NeedsHumanError, ProbeResult } from './doctor.js';
|
|
17
|
+
import { PrePostConfig } from './types.js';
|
|
18
|
+
export type StrategyName = 'explicit' | 'deployed' | 'local';
|
|
19
|
+
export interface Side {
|
|
20
|
+
url: string;
|
|
21
|
+
/** Human-readable provenance, e.g. "Preview deployment for 7bbb138". */
|
|
22
|
+
detail: string;
|
|
23
|
+
/** The probe resolution already took, so callers need not repeat it. */
|
|
24
|
+
probe?: ProbeResult;
|
|
25
|
+
}
|
|
26
|
+
export interface Comparison {
|
|
27
|
+
strategy: StrategyName;
|
|
28
|
+
before: Side;
|
|
29
|
+
after: Side;
|
|
30
|
+
/** True when the two sides come from different kinds of environment. */
|
|
31
|
+
mixed: boolean;
|
|
32
|
+
/** Tear down anything started to make this comparison possible. */
|
|
33
|
+
stop: () => Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export interface ResolveContext {
|
|
36
|
+
gh: GitHub | null;
|
|
37
|
+
ownerRepo: string;
|
|
38
|
+
pr: PullRequestRef | null;
|
|
39
|
+
repoRoot: string;
|
|
40
|
+
appPrefix?: string;
|
|
41
|
+
config: PrePostConfig;
|
|
42
|
+
before?: string;
|
|
43
|
+
after?: string;
|
|
44
|
+
/** Local dev server URL, if one is already running. */
|
|
45
|
+
devServer: Promise<string | null>;
|
|
46
|
+
probe: (url: string) => Promise<ProbeResult>;
|
|
47
|
+
/**
|
|
48
|
+
* The commit detection compared against, when it resolved one.
|
|
49
|
+
*
|
|
50
|
+
* This wins over the PR's base: it is what `--base` sets, and it is the
|
|
51
|
+
* commit the route list was built from. The PR's base is the fallback for a
|
|
52
|
+
* caller that has a PR but no detection of its own.
|
|
53
|
+
*/
|
|
54
|
+
baseSha?: string;
|
|
55
|
+
/**
|
|
56
|
+
* True when `baseSha` is a ref the caller named with `--base`, which makes it
|
|
57
|
+
* a constraint rather than a starting point: no strategy may widen past it.
|
|
58
|
+
*/
|
|
59
|
+
baseExplicit?: boolean;
|
|
60
|
+
/** This checkout's HEAD, so a preview can be found before a PR is opened. */
|
|
61
|
+
headSha?: string;
|
|
62
|
+
/** Skip building the base commit locally. */
|
|
63
|
+
allowLocalBaseline?: boolean;
|
|
64
|
+
/** Injectable for tests; defaults to a real git worktree + dev server. */
|
|
65
|
+
serveBaseline?: typeof serveBaseCommit;
|
|
66
|
+
/** Injectable for tests; defaults to booting this checkout's dev server. */
|
|
67
|
+
servePost?: typeof serveWorkingTree;
|
|
68
|
+
log: (msg: string) => void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolve both sides together, cheapest strategy first.
|
|
72
|
+
*
|
|
73
|
+
* `explicit` when the caller named both; then `deployed`, which needs a preview
|
|
74
|
+
* for this commit and a deployed baseline; then `local`, which needs nothing but
|
|
75
|
+
* the repository itself.
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveComparison(ctx: ResolveContext): Promise<Comparison>;
|
|
78
|
+
export declare class NoPostError extends NeedsHumanError {
|
|
79
|
+
constructor();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A preview exists but nothing could stand beside it.
|
|
83
|
+
*
|
|
84
|
+
* Worth its own error because the generic one says "no preview deployment for
|
|
85
|
+
* this commit", which in this case is the opposite of what happened — and the
|
|
86
|
+
* person hitting it is the one least able to act on advice about dev servers.
|
|
87
|
+
*
|
|
88
|
+
* The instruction depends on *why* there was no baseline. Telling someone to
|
|
89
|
+
* pass `--before` when the baseline was found and turned them away at a login
|
|
90
|
+
* wall sends them back to the same URL for the same failure; the fix there is
|
|
91
|
+
* access, not an argument.
|
|
92
|
+
*/
|
|
93
|
+
export declare class NoDeployedBaselineError extends NeedsHumanError {
|
|
94
|
+
constructor(previewUrl: string, rejected?: {
|
|
95
|
+
side: Side;
|
|
96
|
+
probe: ProbeResult | null;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export declare class NoBaselineError extends NeedsHumanError {
|
|
100
|
+
constructor();
|
|
101
|
+
}
|
|
102
|
+
/** The plan, for the log — an unattended tool has to say what it chose. */
|
|
103
|
+
export declare function describeComparison(c: Comparison): string[];
|
|
104
|
+
//# sourceMappingURL=comparison.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../src/comparison.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAiB,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,EAAE,IAAI,CAAC;IACZ,wEAAwE;IACxE,KAAK,EAAE,OAAO,CAAC;IACf,mEAAmE;IACnE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC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