snapdrift 0.8.1 → 0.9.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/CHANGELOG.md +61 -0
- package/README.md +12 -4
- package/action.yml +16 -9
- package/actions/baseline/action.yml +68 -47
- package/actions/pr-diff/action.yml +208 -107
- package/actions/resolve-baseline/action.yml +36 -50
- package/actions/scope/action.yml +24 -1
- package/bin/snapdrift.mjs +6 -3
- package/docs/contracts.md +141 -9
- package/docs/integration-guide.md +54 -13
- package/docs/local-cli.md +6 -5
- package/docs/workflow-templates/refresh-baseline-on-merge.yml +25 -13
- package/lib/cli.mjs +243 -168
- package/lib/init-from-action.mjs +24 -13
- package/lib/outage-policy.mjs +278 -0
- package/lib/provider.mjs +20 -2
- package/lib/resolve-baseline-artifact.mjs +147 -0
- package/lib/resolve-baseline-paths.mjs +40 -0
- package/lib/snap-provider.mjs +1246 -303
- package/package.json +15 -9
- package/types/visual-diff-types.d.ts +28 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snapdrift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "SnapDrift captures, compares, and reports UI drift for Playwright-based app checks.",
|
|
@@ -25,11 +25,15 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"lint": "eslint .",
|
|
27
27
|
"typecheck": "tsc --project tsconfig.json",
|
|
28
|
+
"check:package-types": "node scripts/check-package-types.mjs",
|
|
29
|
+
"check:package-runtime": "node scripts/check-package-runtime.mjs",
|
|
28
30
|
"validate:actions": "node scripts/validate-actions.mjs",
|
|
31
|
+
"validate:release": "node scripts/validate-release.mjs",
|
|
32
|
+
"check:pin-stale": "node scripts/check-pin-stale.mjs",
|
|
29
33
|
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
30
34
|
"test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage --runInBand",
|
|
31
35
|
"pack:check": "npm pack --dry-run --cache .npm-cache",
|
|
32
|
-
"ci": "npm run lint && npm run typecheck && npm run validate:actions && npm run test:coverage && npm run pack:check"
|
|
36
|
+
"ci": "npm run lint && npm run typecheck && npm run check:package-types && npm run check:package-runtime && npm run validate:actions && npm run test:coverage && npm run pack:check"
|
|
33
37
|
},
|
|
34
38
|
"engines": {
|
|
35
39
|
"node": ">=22"
|
|
@@ -40,7 +44,6 @@
|
|
|
40
44
|
"devDependencies": {
|
|
41
45
|
"@eslint/js": "^10.0.1",
|
|
42
46
|
"@types/jest": "^30.0.0",
|
|
43
|
-
"@types/js-yaml": "^4.0.9",
|
|
44
47
|
"@types/node": "^26.1.0",
|
|
45
48
|
"@types/pngjs": "^6.0.5",
|
|
46
49
|
"eslint": "^10.2.0",
|
|
@@ -77,10 +80,13 @@
|
|
|
77
80
|
"./lib/report.mjs": "./lib/report.mjs",
|
|
78
81
|
"./lib/cli.mjs": "./lib/cli.mjs",
|
|
79
82
|
"./lib/provider.mjs": "./lib/provider.mjs",
|
|
83
|
+
"./lib/outage-policy.mjs": "./lib/outage-policy.mjs",
|
|
80
84
|
"./lib/snap-provider.mjs": "./lib/snap-provider.mjs",
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
"./lib/migrate-baselines.mjs": "./lib/migrate-baselines.mjs",
|
|
86
|
+
"./lib/init-from-action.mjs": "./lib/init-from-action.mjs",
|
|
87
|
+
"./lib/resolve-baseline-paths.mjs": "./lib/resolve-baseline-paths.mjs",
|
|
88
|
+
"./lib/resolve-baseline-artifact.mjs": "./lib/resolve-baseline-artifact.mjs"
|
|
89
|
+
},
|
|
84
90
|
"files": [
|
|
85
91
|
"action.yml",
|
|
86
92
|
"actions/",
|
|
@@ -96,11 +102,11 @@
|
|
|
96
102
|
"registry": "https://registry.npmjs.org"
|
|
97
103
|
},
|
|
98
104
|
"dependencies": {
|
|
99
|
-
"@snapdrift/adapter-fs": "^1.0
|
|
105
|
+
"@snapdrift/adapter-fs": "^1.1.0",
|
|
100
106
|
"@snapdrift/adapter-report-md": "^1.1.0",
|
|
101
107
|
"@snapdrift/compare-core": "^1.0.0",
|
|
102
|
-
"@snapdrift/manifest": "^1.
|
|
103
|
-
"js-yaml": "^5.
|
|
108
|
+
"@snapdrift/manifest": "^1.3.0",
|
|
109
|
+
"js-yaml": "^5.4.0",
|
|
104
110
|
"playwright": "^1.59.1",
|
|
105
111
|
"pngjs": "^7.0.0"
|
|
106
112
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SnapConfig } from '@snapdrift/manifest';
|
|
2
|
+
|
|
1
3
|
/** Object-shaped data decoded from an external JSON or YAML boundary. */
|
|
2
4
|
export type JsonObject = Record<string, any>;
|
|
3
5
|
|
|
@@ -74,6 +76,32 @@ export interface VisualBaselineResults {
|
|
|
74
76
|
passed?: boolean;
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
/** Exact route/viewport capture identity persisted for hosted baseline validation. */
|
|
80
|
+
export interface SnapExpectedCaptureIdentity {
|
|
81
|
+
routeId: string;
|
|
82
|
+
routePath: string;
|
|
83
|
+
viewportDescriptorJson: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Metadata written by SnapProvider.capture() and consumed by publishBaseline(). */
|
|
87
|
+
export interface SnapRunMetadata {
|
|
88
|
+
runId: string;
|
|
89
|
+
projectId: string;
|
|
90
|
+
purpose: 'baseline' | 'capture' | 'diff';
|
|
91
|
+
/** CI source branch for hosted baseline runs; omitted for ordinary diff runs. */
|
|
92
|
+
refBranch?: string;
|
|
93
|
+
/** Resolved 40-character CI commit for hosted baseline runs. */
|
|
94
|
+
refSha?: string;
|
|
95
|
+
/** Stable CI workflow identity that owns the publication sequence. */
|
|
96
|
+
publicationWorkflowRef?: string;
|
|
97
|
+
/** Monotonic CI publication sequence for stale-publisher rejection. */
|
|
98
|
+
publicationSequence?: number;
|
|
99
|
+
startedAt: string;
|
|
100
|
+
configuredRouteIds: string[];
|
|
101
|
+
selectedRouteIds: string[];
|
|
102
|
+
expectedCaptures: SnapExpectedCaptureIdentity[];
|
|
103
|
+
}
|
|
104
|
+
|
|
77
105
|
export interface VisualDiffMissingItem {
|
|
78
106
|
id: string;
|
|
79
107
|
reason: string;
|