@percy/core 1.31.2-beta.1 → 1.31.2-beta.2
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/percy.js +7 -1
- package/dist/utils.js +65 -1
- package/package.json +8 -8
package/dist/percy.js
CHANGED
|
@@ -13,7 +13,7 @@ import logger from '@percy/logger';
|
|
|
13
13
|
import { getProxy } from '@percy/client/utils';
|
|
14
14
|
import Browser from './browser.js';
|
|
15
15
|
import Pako from 'pako';
|
|
16
|
-
import { base64encode, generatePromise, yieldAll, yieldTo, redactSecrets, detectSystemProxyAndLog } from './utils.js';
|
|
16
|
+
import { base64encode, generatePromise, yieldAll, yieldTo, redactSecrets, detectSystemProxyAndLog, checkSDKVersion } from './utils.js';
|
|
17
17
|
import { createPercyServer, createStaticServer } from './api.js';
|
|
18
18
|
import { gatherSnapshots, createSnapshotsQueue, validateSnapshotOptions } from './snapshot.js';
|
|
19
19
|
import { discoverSnapshotResources, createDiscoveryQueue } from './discovery.js';
|
|
@@ -113,6 +113,7 @@ export class Percy {
|
|
|
113
113
|
// if there is none, stop it
|
|
114
114
|
this.resetMonitoringId = null;
|
|
115
115
|
this.monitoringCheckLastExecutedAt = null;
|
|
116
|
+
this.sdkInfoDisplayed = false;
|
|
116
117
|
|
|
117
118
|
// generator methods are wrapped to autorun and return promises
|
|
118
119
|
for (let m of ['start', 'stop', 'flush', 'idle', 'snapshot', 'upload']) {
|
|
@@ -433,6 +434,11 @@ export class Percy {
|
|
|
433
434
|
return async function* () {
|
|
434
435
|
let server;
|
|
435
436
|
try {
|
|
437
|
+
// Check SDK version
|
|
438
|
+
if (!this.sdkInfoDisplayed && options.clientInfo) {
|
|
439
|
+
await checkSDKVersion(options.clientInfo);
|
|
440
|
+
this.sdkInfoDisplayed = true;
|
|
441
|
+
}
|
|
436
442
|
if ('serve' in options) {
|
|
437
443
|
// create and start a static server
|
|
438
444
|
let {
|
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EventEmitter from 'events';
|
|
2
|
-
import { sha256hash } from '@percy/client/utils';
|
|
2
|
+
import { sha256hash, request } from '@percy/client/utils';
|
|
3
3
|
import { camelcase, merge } from '@percy/config/utils';
|
|
4
4
|
import YAML from 'yaml';
|
|
5
5
|
import path from 'path';
|
|
@@ -576,4 +576,68 @@ export async function* maybeScrollToBottom(page, discovery) {
|
|
|
576
576
|
if (discovery.scrollToBottom && page.enableJavaScript) {
|
|
577
577
|
yield page.eval('await scrollToBottom()');
|
|
578
578
|
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// Package to GitHub repo mapping
|
|
582
|
+
const PACKAGE_TO_REPO = {
|
|
583
|
+
'@percy/selenium-webdriver': 'percy-selenium-js',
|
|
584
|
+
'@percy/playwright': 'percy-playwright',
|
|
585
|
+
'@percy/appium-app': 'percy-appium-js',
|
|
586
|
+
'@percy/storybook': 'percy-storybook',
|
|
587
|
+
'@percy/ember': 'percy-ember',
|
|
588
|
+
'@percy/cypress': 'percy-cypress',
|
|
589
|
+
'@percy/puppeteer': 'percy-puppeteer',
|
|
590
|
+
'@percy/testcafe': 'percy-testcafe',
|
|
591
|
+
'@percy/nightwatch': 'percy-nightwatch',
|
|
592
|
+
'percy-java-selenium': 'percy-selenium-java',
|
|
593
|
+
'percy-playwright-java': 'percy-playwright-java',
|
|
594
|
+
'percy-appium-dotnet': 'percy-appium-dotnet',
|
|
595
|
+
'percy-selenium-dotnet': 'percy-selenium-dotnet',
|
|
596
|
+
'percy-playwright-dotnet': 'percy-playwright-dotnet',
|
|
597
|
+
'percy-playwright-python': 'percy-playwright-python',
|
|
598
|
+
'percy-selenium-python': 'percy-selenium-python',
|
|
599
|
+
'percy-selenium-ruby': 'percy-selenium-ruby',
|
|
600
|
+
'percy-capybara': 'percy-capybara'
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
// Utility function to check SDK version updates
|
|
604
|
+
export async function checkSDKVersion(clientInfo) {
|
|
605
|
+
const log = logger('core:sdk-version');
|
|
606
|
+
try {
|
|
607
|
+
// Split on the last '/' to get package name and version
|
|
608
|
+
const lastSlashIndex = clientInfo.lastIndexOf('/');
|
|
609
|
+
if (lastSlashIndex === -1) {
|
|
610
|
+
log.debug(`Invalid clientInfo format: ${clientInfo}`);
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
const packageName = clientInfo.substring(0, lastSlashIndex);
|
|
614
|
+
const currentVersion = clientInfo.substring(lastSlashIndex + 1);
|
|
615
|
+
|
|
616
|
+
// Get GitHub repo name from mapping
|
|
617
|
+
const repoName = PACKAGE_TO_REPO[packageName];
|
|
618
|
+
if (!repoName) {
|
|
619
|
+
log.debug(`No repo mapping found for package: ${packageName}`);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// Fetch latest version from GitHub releases
|
|
624
|
+
const githubData = await request(`https://api.github.com/repos/percy/${repoName}/releases?page=1`, {
|
|
625
|
+
headers: {
|
|
626
|
+
'User-Agent': '@percy/cli'
|
|
627
|
+
},
|
|
628
|
+
retries: 0
|
|
629
|
+
});
|
|
630
|
+
const latestRelease = githubData.find(r => !r.prerelease);
|
|
631
|
+
if (!latestRelease) {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
const latestVersion = latestRelease.tag_name.replace(/^v/, ''); // Remove 'v' prefix if present
|
|
635
|
+
|
|
636
|
+
log.debug(`[SDK Version Check] Current: ${currentVersion}, Latest: ${latestVersion}`);
|
|
637
|
+
if (currentVersion !== latestVersion) {
|
|
638
|
+
log.warn(`[SDK Update Available] ${packageName}: ${currentVersion} -> ${latestVersion}`);
|
|
639
|
+
}
|
|
640
|
+
} catch (error) {
|
|
641
|
+
log.debug('Could not check SDK version', error);
|
|
642
|
+
}
|
|
579
643
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.31.2-beta.
|
|
3
|
+
"version": "1.31.2-beta.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"test:types": "tsd"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@percy/client": "1.31.2-beta.
|
|
47
|
-
"@percy/config": "1.31.2-beta.
|
|
48
|
-
"@percy/dom": "1.31.2-beta.
|
|
49
|
-
"@percy/logger": "1.31.2-beta.
|
|
50
|
-
"@percy/monitoring": "1.31.2-beta.
|
|
51
|
-
"@percy/webdriver-utils": "1.31.2-beta.
|
|
46
|
+
"@percy/client": "1.31.2-beta.2",
|
|
47
|
+
"@percy/config": "1.31.2-beta.2",
|
|
48
|
+
"@percy/dom": "1.31.2-beta.2",
|
|
49
|
+
"@percy/logger": "1.31.2-beta.2",
|
|
50
|
+
"@percy/monitoring": "1.31.2-beta.2",
|
|
51
|
+
"@percy/webdriver-utils": "1.31.2-beta.2",
|
|
52
52
|
"content-disposition": "^0.5.4",
|
|
53
53
|
"cross-spawn": "^7.0.3",
|
|
54
54
|
"extract-zip": "^2.0.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"ws": "^8.17.1",
|
|
62
62
|
"yaml": "^2.4.1"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "3002538e11412bea43ddc5e15da7ce338ff44b4f"
|
|
65
65
|
}
|