@percy/client 1.26.3-beta.1 → 1.27.0-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 +29 -5
- package/dist/proxy.js +5 -1
- package/package.json +4 -4
package/dist/client.js
CHANGED
|
@@ -75,9 +75,9 @@ export class PercyClient {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
// Checks for a Percy token and returns it.
|
|
78
|
-
getToken() {
|
|
78
|
+
getToken(raiseIfMissing = true) {
|
|
79
79
|
let token = this.token || this.env.token;
|
|
80
|
-
if (!token) throw new Error('Missing Percy token');
|
|
80
|
+
if (!token && raiseIfMissing) throw new Error('Missing Percy token');
|
|
81
81
|
return token;
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -364,9 +364,11 @@ export class PercyClient {
|
|
|
364
364
|
tag,
|
|
365
365
|
tiles = [],
|
|
366
366
|
externalDebugUrl,
|
|
367
|
-
ignoredElementsData
|
|
367
|
+
ignoredElementsData,
|
|
368
|
+
domInfoSha
|
|
368
369
|
} = {}) {
|
|
369
370
|
validateId('snapshot', snapshotId);
|
|
371
|
+
// Remove post percy api deploy
|
|
370
372
|
this.log.debug(`Creating comparision: ${tag.name}...`);
|
|
371
373
|
for (let tile of tiles) {
|
|
372
374
|
if (tile.sha) continue;
|
|
@@ -382,7 +384,8 @@ export class PercyClient {
|
|
|
382
384
|
type: 'comparisons',
|
|
383
385
|
attributes: {
|
|
384
386
|
'external-debug-url': externalDebugUrl || null,
|
|
385
|
-
'ignore-elements-data': ignoredElementsData || null
|
|
387
|
+
'ignore-elements-data': ignoredElementsData || null,
|
|
388
|
+
'dom-info-sha': domInfoSha || null
|
|
386
389
|
},
|
|
387
390
|
relationships: {
|
|
388
391
|
tag: {
|
|
@@ -394,7 +397,10 @@ export class PercyClient {
|
|
|
394
397
|
height: tag.height || null,
|
|
395
398
|
'os-name': tag.osName || null,
|
|
396
399
|
'os-version': tag.osVersion || null,
|
|
397
|
-
orientation: tag.orientation || null
|
|
400
|
+
orientation: tag.orientation || null,
|
|
401
|
+
'browser-name': tag.browserName || null,
|
|
402
|
+
'browser-version': tag.browserVersion || null,
|
|
403
|
+
resolution: tag.resolution || null
|
|
398
404
|
}
|
|
399
405
|
}
|
|
400
406
|
},
|
|
@@ -498,5 +504,23 @@ export class PercyClient {
|
|
|
498
504
|
await this.finalizeComparison(comparison.data.id);
|
|
499
505
|
return comparison;
|
|
500
506
|
}
|
|
507
|
+
|
|
508
|
+
// decides project type
|
|
509
|
+
tokenType() {
|
|
510
|
+
let token = this.getToken(false) || '';
|
|
511
|
+
const type = token.split('_')[0];
|
|
512
|
+
switch (type) {
|
|
513
|
+
case 'auto':
|
|
514
|
+
return 'automate';
|
|
515
|
+
case 'web':
|
|
516
|
+
return 'web';
|
|
517
|
+
case 'app':
|
|
518
|
+
return 'app';
|
|
519
|
+
case 'ss':
|
|
520
|
+
return 'generic';
|
|
521
|
+
default:
|
|
522
|
+
return 'web';
|
|
523
|
+
}
|
|
524
|
+
}
|
|
501
525
|
}
|
|
502
526
|
export default PercyClient;
|
package/dist/proxy.js
CHANGED
|
@@ -3,6 +3,7 @@ import tls from 'tls';
|
|
|
3
3
|
import http from 'http';
|
|
4
4
|
import https from 'https';
|
|
5
5
|
import logger from '@percy/logger';
|
|
6
|
+
import { stripQuotesAndSpaces } from '@percy/env/utils';
|
|
6
7
|
const CRLF = '\r\n';
|
|
7
8
|
const STATUS_REG = /^HTTP\/1.[01] (\d*)/;
|
|
8
9
|
|
|
@@ -62,7 +63,10 @@ export function href(options) {
|
|
|
62
63
|
// Returns the proxy URL for a set of request options
|
|
63
64
|
export function getProxy(options) {
|
|
64
65
|
let proxyUrl = options.protocol === 'https:' && (process.env.https_proxy || process.env.HTTPS_PROXY) || process.env.http_proxy || process.env.HTTP_PROXY;
|
|
65
|
-
let shouldProxy = !!proxyUrl && !hostnameMatches(process.env.no_proxy || process.env.NO_PROXY, href(options));
|
|
66
|
+
let shouldProxy = !!proxyUrl && !hostnameMatches(stripQuotesAndSpaces(process.env.no_proxy || process.env.NO_PROXY), href(options));
|
|
67
|
+
if (proxyUrl && typeof proxyUrl === 'string') {
|
|
68
|
+
proxyUrl = stripQuotesAndSpaces(proxyUrl);
|
|
69
|
+
}
|
|
66
70
|
if (shouldProxy) {
|
|
67
71
|
proxyUrl = new URL(proxyUrl);
|
|
68
72
|
let isHttps = proxyUrl.protocol === 'https:';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"test:coverage": "yarn test --coverage"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@percy/env": "1.
|
|
36
|
-
"@percy/logger": "1.
|
|
35
|
+
"@percy/env": "1.27.0-beta.0",
|
|
36
|
+
"@percy/logger": "1.27.0-beta.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "2bc16314f51dddcc1cda459e7aa4b7b2db85f00a"
|
|
39
39
|
}
|