@percy/client 1.28.0 → 1.28.1-beta.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/dist/client.js +6 -1
- package/dist/utils.js +8 -0
- package/package.json +5 -5
package/dist/client.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import PercyEnv from '@percy/env';
|
|
3
3
|
import { git } from '@percy/env/utils';
|
|
4
4
|
import logger from '@percy/logger';
|
|
5
|
-
import { pool, request, formatBytes, sha256hash, base64encode, getPackageJSON, waitForTimeout } from './utils.js';
|
|
5
|
+
import { pool, request, formatBytes, sha256hash, base64encode, getPackageJSON, waitForTimeout, validateTiles } from './utils.js';
|
|
6
6
|
|
|
7
7
|
// Default client API URL can be set with an env var for API development
|
|
8
8
|
const {
|
|
@@ -54,6 +54,8 @@ export class PercyClient {
|
|
|
54
54
|
});
|
|
55
55
|
this.addClientInfo(clientInfo);
|
|
56
56
|
this.addEnvironmentInfo(environmentInfo);
|
|
57
|
+
this.buildType = null;
|
|
58
|
+
this.screenshotFlow = null;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
// Adds additional unique client info.
|
|
@@ -551,6 +553,9 @@ export class PercyClient {
|
|
|
551
553
|
return this.post(`comparisons/${comparisonId}/finalize`);
|
|
552
554
|
}
|
|
553
555
|
async sendComparison(buildId, options) {
|
|
556
|
+
if (!validateTiles(options.tiles)) {
|
|
557
|
+
throw new Error('sha, filepath or content should be present in tiles object');
|
|
558
|
+
}
|
|
554
559
|
let snapshot = await this.createSnapshot(buildId, options);
|
|
555
560
|
let comparison = await this.createComparison(snapshot.data.id, options);
|
|
556
561
|
await this.uploadComparisonTiles(comparison.data.id, options.tiles);
|
package/dist/utils.js
CHANGED
|
@@ -223,4 +223,12 @@ export async function request(url, options = {}, callback) {
|
|
|
223
223
|
interval
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
|
+
export function validateTiles(tiles) {
|
|
227
|
+
for (const tile of tiles) {
|
|
228
|
+
if (!tile.filepath && !tile.content && !tile.sha) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
226
234
|
export { hostnameMatches, ProxyHttpAgent, ProxyHttpsAgent, proxyAgentFor } from './proxy.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/client",
|
|
3
|
-
"version": "1.28.0",
|
|
3
|
+
"version": "1.28.1-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public",
|
|
12
|
-
"tag": "
|
|
12
|
+
"tag": "beta"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=14"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"test:coverage": "yarn test --coverage"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@percy/env": "1.28.0",
|
|
36
|
-
"@percy/logger": "1.28.0"
|
|
35
|
+
"@percy/env": "1.28.1-beta.0",
|
|
36
|
+
"@percy/logger": "1.28.1-beta.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "648f81742ebf8c6f29ccdfdff77df124e4e1668d"
|
|
39
39
|
}
|