@steve31415/baselib 3.36.0 → 3.36.1
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/deploy/deploy.js +17 -3
- package/package.json +1 -1
package/dist/deploy/deploy.js
CHANGED
|
@@ -15,6 +15,20 @@ import { acquireLock, clearHold, publishRetainedAssets, readHold, readReleaseRec
|
|
|
15
15
|
import { consistentBaseSha, readServingState, SHA40 } from './plan.js';
|
|
16
16
|
const RELEASE_DEADLINE_MS = 25 * 60_000;
|
|
17
17
|
const IMAGE_DIGEST = /@sha256:[0-9a-f]{64}$/;
|
|
18
|
+
const MAX_DIRTY_PATHS = 20;
|
|
19
|
+
/** The clean-worktree refusal, naming what made the tree dirty (`git status
|
|
20
|
+
* --porcelain` lines) so the reader need not go and look (2026-10-11: games'
|
|
21
|
+
* deploy checkout held untracked Cloudflare-era build outputs). */
|
|
22
|
+
function dirtyWorktreeMessage(porcelain) {
|
|
23
|
+
const lines = porcelain.split('\n').filter((l) => l.trim() !== '');
|
|
24
|
+
const shown = lines.slice(0, MAX_DIRTY_PATHS);
|
|
25
|
+
const more = lines.length - shown.length;
|
|
26
|
+
return [
|
|
27
|
+
'deploys require a clean worktree; uncommitted or untracked files:',
|
|
28
|
+
...shown.map((l) => ` ${l}`),
|
|
29
|
+
...(more > 0 ? [` … and ${more} more`] : []),
|
|
30
|
+
].join('\n');
|
|
31
|
+
}
|
|
18
32
|
export async function runDeploy(options) {
|
|
19
33
|
const log = options.log ?? ((m) => console.error(`[pw-deploy] ${m}`));
|
|
20
34
|
const runner = options.runner;
|
|
@@ -37,9 +51,9 @@ export async function runDeploy(options) {
|
|
|
37
51
|
throw new Error('deploys run from main');
|
|
38
52
|
const dirty = (await must(runner, 'git', ['status', '--porcelain=v1', '--untracked-files=all'], {
|
|
39
53
|
cwd: options.repoRoot,
|
|
40
|
-
})).stdout
|
|
41
|
-
if (dirty)
|
|
42
|
-
throw new Error(
|
|
54
|
+
})).stdout;
|
|
55
|
+
if (dirty.trim())
|
|
56
|
+
throw new Error(dirtyWorktreeMessage(dirty));
|
|
43
57
|
const sha = (await must(runner, 'git', ['rev-parse', 'HEAD'], { cwd: options.repoRoot })).stdout.trim();
|
|
44
58
|
const originMain = (await must(runner, 'git', ['rev-parse', 'origin/main'], { cwd: options.repoRoot })).stdout.trim();
|
|
45
59
|
if (sha !== originMain)
|
package/package.json
CHANGED