snapdrift 0.3.0 → 0.5.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 +38 -0
- package/README.md +17 -7
- package/actions/baseline/action.yml +83 -13
- package/actions/comment/action.yml +31 -3
- package/actions/pr-diff/action.yml +110 -23
- package/actions/scope/action.yml +9 -0
- package/docs/contracts.md +237 -1
- package/docs/integration-guide.md +94 -26
- package/docs/local-cli.md +107 -4
- package/docs/workflow-templates/refresh-baseline-on-merge.yml +1 -1
- package/lib/cli.mjs +161 -26
- package/lib/init-from-action.mjs +244 -0
- package/lib/migrate-baselines.mjs +199 -0
- package/lib/provider.mjs +106 -0
- package/lib/snap-provider.mjs +1033 -0
- package/lib/snapdrift-config.mjs +3 -1
- package/package.json +9 -5
- package/types/visual-diff-types.d.ts +65 -0
package/lib/snapdrift-config.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snapdrift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "SnapDrift captures, compares, and reports UI drift for Playwright-based app checks.",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"eslint": "^10.2.0",
|
|
47
47
|
"globals": "^17.4.0",
|
|
48
48
|
"jest": "^30.3.0",
|
|
49
|
-
"js-yaml": "^4.1.0",
|
|
50
49
|
"typescript": "^6.0.2"
|
|
51
50
|
},
|
|
52
51
|
"jest": {
|
|
@@ -76,7 +75,11 @@
|
|
|
76
75
|
"./lib/drift-summary.mjs": "./lib/drift-summary.mjs",
|
|
77
76
|
"./lib/pr-comment.mjs": "./lib/pr-comment.mjs",
|
|
78
77
|
"./lib/report.mjs": "./lib/report.mjs",
|
|
79
|
-
"./lib/cli.mjs": "./lib/cli.mjs"
|
|
78
|
+
"./lib/cli.mjs": "./lib/cli.mjs",
|
|
79
|
+
"./lib/provider.mjs": "./lib/provider.mjs",
|
|
80
|
+
"./lib/snap-provider.mjs": "./lib/snap-provider.mjs",
|
|
81
|
+
"./lib/migrate-baselines.mjs": "./lib/migrate-baselines.mjs",
|
|
82
|
+
"./lib/init-from-action.mjs": "./lib/init-from-action.mjs"
|
|
80
83
|
},
|
|
81
84
|
"files": [
|
|
82
85
|
"actions/",
|
|
@@ -93,9 +96,10 @@
|
|
|
93
96
|
},
|
|
94
97
|
"dependencies": {
|
|
95
98
|
"@snapdrift/adapter-fs": "^1.0.0",
|
|
96
|
-
"@snapdrift/adapter-report-md": "^1.
|
|
99
|
+
"@snapdrift/adapter-report-md": "^1.1.0",
|
|
97
100
|
"@snapdrift/compare-core": "^1.0.0",
|
|
98
|
-
"@snapdrift/manifest": "^1.
|
|
101
|
+
"@snapdrift/manifest": "^1.2.0",
|
|
102
|
+
"js-yaml": "^4.1.0",
|
|
99
103
|
"playwright": "^1.59.1",
|
|
100
104
|
"pngjs": "^7.0.0"
|
|
101
105
|
}
|
|
@@ -28,6 +28,8 @@ export interface VisualRegressionConfig {
|
|
|
28
28
|
mode: 'report-only' | 'fail-on-changes' | 'fail-on-incomplete' | 'strict';
|
|
29
29
|
};
|
|
30
30
|
selection?: VisualRegressionSelectionConfig;
|
|
31
|
+
provider?: 'local' | 'snap';
|
|
32
|
+
snap?: SnapConfig;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export interface VisualBaselineRouteResult {
|
|
@@ -135,4 +137,67 @@ export interface VisualDiffSummary {
|
|
|
135
137
|
errors: VisualDiffErrorItem[];
|
|
136
138
|
dimensionChanges: VisualDiffDimensionItem[];
|
|
137
139
|
message?: string;
|
|
140
|
+
/** Link to the provider's run detail page. Set by SnapProvider during diff(); undefined for LocalProvider. */
|
|
141
|
+
dashboardUrl?: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// --- Provider abstraction (canonical definitions in @snapdrift/manifest) ---
|
|
145
|
+
|
|
146
|
+
export type {
|
|
147
|
+
ProviderCaptureOptions,
|
|
148
|
+
ProviderCaptureResult,
|
|
149
|
+
ProviderDiffOptions,
|
|
150
|
+
ProviderDiffResult,
|
|
151
|
+
ProviderPublishBaselineOptions,
|
|
152
|
+
ProviderPublishBaselineResult,
|
|
153
|
+
ProviderFetchBaselineOptions,
|
|
154
|
+
ProviderBaselineData,
|
|
155
|
+
ProviderCommentMeta,
|
|
156
|
+
VisualProvider,
|
|
157
|
+
SnapConfig
|
|
158
|
+
} from '@snapdrift/manifest';
|
|
159
|
+
|
|
160
|
+
// --- Migration types ---
|
|
161
|
+
|
|
162
|
+
export interface MigrateToSnapResult {
|
|
163
|
+
uploaded: number;
|
|
164
|
+
skipped: number;
|
|
165
|
+
baselineId: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface ExportedBaseline {
|
|
169
|
+
results: object;
|
|
170
|
+
manifest: object;
|
|
171
|
+
screenshots: Array<{ filename: string; data: Buffer }>;
|
|
172
|
+
engine: { name: string; version: string };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// --- Init codemod types ---
|
|
176
|
+
|
|
177
|
+
export interface InitWarning {
|
|
178
|
+
field: string;
|
|
179
|
+
originalValue: string;
|
|
180
|
+
message: string;
|
|
181
|
+
severity: 'warning' | 'note';
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface InitFromActionResult {
|
|
185
|
+
configPath: string;
|
|
186
|
+
warningsCount: number;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// --- CLI options (extended) ---
|
|
190
|
+
|
|
191
|
+
export interface CliOptions {
|
|
192
|
+
command: string;
|
|
193
|
+
open: boolean;
|
|
194
|
+
configPath?: string;
|
|
195
|
+
routes: string[];
|
|
196
|
+
baselineDir: string;
|
|
197
|
+
currentDir: string;
|
|
198
|
+
diffDir: string;
|
|
199
|
+
to?: 'snap' | 'local';
|
|
200
|
+
from?: 'snap';
|
|
201
|
+
acceptCrossEngine?: boolean;
|
|
202
|
+
fromSnapAction?: string;
|
|
138
203
|
}
|