From 5067675c9ca9838c9f330998f86abce855df0551 Mon Sep 17 00:00:00 2001 From: Khushhal Maheshwari <25052873+khushhalm@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:10:33 +0530 Subject: [PATCH 01/10] PAC file support via PERCY_PAC_FILE_URL env var (#1784) * PAC file support via PERCY_PAC_FILE_PATH env var * Added pac-proxy-agent lib as dependency * typo fixes * PR comments addressed * Moved pac-proxy-agent lib dependency to percy client instead of main package * Resolved conflicts --- package.json | 2 +- packages/client/package.json | 1 + packages/client/src/proxy.js | 48 ++++++++-- packages/core/src/percy.js | 7 +- yarn.lock | 164 ++++++++++++++++++++++++++++++++++- 5 files changed, 209 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 68a9ae9f6..154d7ae76 100644 --- a/package.json +++ b/package.json @@ -31,13 +31,13 @@ "@babel/eslint-parser": "^7.14.7", "@babel/preset-env": "^7.14.7", "@babel/register": "^7.17.7", - "babel-plugin-transform-import-meta": "^2.2.1", "@rollup/plugin-alias": "^5.1.1", "@rollup/plugin-babel": "^6.0.0", "@rollup/plugin-commonjs": "^21.0.0", "@rollup/plugin-node-resolve": "^15.0.0", "babel-plugin-istanbul": "^6.0.0", "babel-plugin-module-resolver": "^4.1.0", + "babel-plugin-transform-import-meta": "^2.2.1", "cross-env": "^7.0.2", "eslint": "^7.30.0", "eslint-config-standard": "^16.0.2", diff --git a/packages/client/package.json b/packages/client/package.json index 040558419..82d474aa8 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -35,6 +35,7 @@ "dependencies": { "@percy/env": "1.30.2", "@percy/logger": "1.30.2", + "pac-proxy-agent": "^7.0.2", "pako": "^2.1.0" } } diff --git a/packages/client/src/proxy.js b/packages/client/src/proxy.js index 4f5d133af..291928948 100644 --- a/packages/client/src/proxy.js +++ b/packages/client/src/proxy.js @@ -4,10 +4,28 @@ import http from 'http'; import https from 'https'; import logger from '@percy/logger'; import { stripQuotesAndSpaces } from '@percy/env/utils'; +import { PacProxyAgent } from 'pac-proxy-agent'; const CRLF = '\r\n'; const STATUS_REG = /^HTTP\/1.[01] (\d*)/; +// function to create PAC proxy agent +function createPacAgent(pacUrl, options = {}) { + pacUrl = stripQuotesAndSpaces(pacUrl); + try { + const agent = new PacProxyAgent(pacUrl, { + keepAlive: true, + ...options + }); + + logger('client:proxy').info(`Successfully loaded PAC file from: ${pacUrl}`); + return agent; + } catch (error) { + logger('client:proxy').error(`Failed to load PAC file, error message: ${error.message}, stack: ${error.stack}`); + throw new Error(`Failed to initialize PAC proxy: ${error.message}`); + } +} + // Returns true if the URL hostname matches any patterns export function hostnameMatches(patterns, url) { let subject = new URL(url); @@ -219,11 +237,31 @@ export function proxyAgentFor(url, options) { let { protocol, hostname } = new URL(url); let cachekey = `${protocol}//${hostname}`; - if (!cache.has(cachekey)) { - cache.set(cachekey, protocol === 'https:' - ? new ProxyHttpsAgent(options) - : new ProxyHttpAgent(options)); + // If we already have a cached agent, return it + if (cache.has(cachekey)) { + return cache.get(cachekey); } - return cache.get(cachekey); + try { + let agent; + const pacUrl = process.env.PERCY_PAC_FILE_URL; + + // If PAC URL is provided, use PAC proxy + if (pacUrl) { + logger('client:proxy').info(`Using PAC file from: ${pacUrl}`); + agent = createPacAgent(pacUrl, options); + } else { + // Fall back to other proxy configuration + agent = protocol === 'https:' + ? new ProxyHttpsAgent(options) + : new ProxyHttpAgent(options); + } + + // Cache the created agent + cache.set(cachekey, agent); + return agent; + } catch (error) { + logger('client:proxy').error(`Failed to create proxy agent: ${error.message}`); + throw error; + } } diff --git a/packages/core/src/percy.js b/packages/core/src/percy.js index 89de52890..607acc7fb 100644 --- a/packages/core/src/percy.js +++ b/packages/core/src/percy.js @@ -5,12 +5,11 @@ import { getProxy } from '@percy/client/utils'; import Browser from './browser.js'; import Pako from 'pako'; import { - base64encode - , + base64encode, generatePromise, yieldAll, - yieldTo - , redactSecrets, + yieldTo, + redactSecrets, detectSystemProxyAndLog } from './utils.js'; diff --git a/yarn.lock b/yarn.lock index 16f8f4fb1..c694874c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2248,6 +2248,11 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== +"@tootallnate/quickjs-emscripten@^0.23.0": + version "0.23.0" + resolved "https://registry.yarnpkg.com/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz#db4ecfd499a9765ab24002c3b696d02e6d32a12c" + integrity sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA== + "@tsd/typescript@~5.4.3": version "5.4.5" resolved "https://registry.yarnpkg.com/@tsd/typescript/-/typescript-5.4.5.tgz#a7c11d3a97ddfa201f831f4e4270a169a87f7655" @@ -2401,6 +2406,13 @@ agent-base@6, agent-base@^6.0.2: dependencies: debug "4" +agent-base@^7.0.2, agent-base@^7.1.0, agent-base@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.1.tgz#bdbded7dfb096b751a2a087eeeb9664725b2e317" + integrity sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA== + dependencies: + debug "^4.3.4" + agentkeepalive@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.2.1.tgz#a7975cbb9f83b367f06c90cc51ff28fe7d499717" @@ -2625,6 +2637,13 @@ asap@^2.0.0: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= +ast-types@^0.13.4: + version "0.13.4" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.4.tgz#ee0d77b343263965ecc3fb62da16e7222b2b6782" + integrity sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w== + dependencies: + tslib "^2.0.1" + astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" @@ -2730,6 +2749,11 @@ base64id@2.0.0, base64id@~2.0.0: resolved "https://registry.yarnpkg.com/base64id/-/base64id-2.0.0.tgz#2770ac6bc47d312af97a8bf9a634342e0cd25cb6" integrity sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog== +basic-ftp@^5.0.2: + version "5.0.5" + resolved "https://registry.yarnpkg.com/basic-ftp/-/basic-ftp-5.0.5.tgz#14a474f5fffecca1f4f406f1c26b18f800225ac0" + integrity sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg== + before-after-hook@^2.2.0: version "2.2.2" resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e" @@ -3373,6 +3397,11 @@ dargs@^7.0.0: resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== +data-uri-to-buffer@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz#8a58bb67384b261a38ef18bea1810cb01badd28b" + integrity sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw== + data-view-buffer@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.1.tgz#8ea6326efec17a2e42620696e671d7d5a8bc66b2" @@ -3436,6 +3465,13 @@ debug@^3.2.7: dependencies: ms "^2.1.1" +debug@^4.3.4: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" @@ -3513,6 +3549,15 @@ define-properties@^1.2.0, define-properties@^1.2.1: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +degenerator@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/degenerator/-/degenerator-5.0.1.tgz#9403bf297c6dad9a1ece409b37db27954f91f2f5" + integrity sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ== + dependencies: + ast-types "^0.13.4" + escodegen "^2.1.0" + esprima "^4.0.1" + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" @@ -3907,6 +3952,17 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +escodegen@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" + integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== + dependencies: + esprima "^4.0.1" + estraverse "^5.2.0" + esutils "^2.0.2" + optionalDependencies: + source-map "~0.6.1" + eslint-config-standard@^16.0.2: version "16.0.3" resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-16.0.3.tgz#6c8761e544e96c531ff92642eeb87842b8488516" @@ -4088,7 +4144,7 @@ espree@^7.3.0, espree@^7.3.1: acorn-jsx "^5.3.1" eslint-visitor-keys "^1.3.0" -esprima@^4.0.0: +esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== @@ -4402,6 +4458,15 @@ fs-extra@^10.1.0: jsonfile "^6.0.1" universalify "^2.0.0" +fs-extra@^11.2.0: + version "11.2.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b" + integrity sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs-extra@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" @@ -4579,6 +4644,16 @@ get-symbol-description@^1.0.2: es-errors "^1.3.0" get-intrinsic "^1.2.4" +get-uri@^6.0.1: + version "6.0.3" + resolved "https://registry.yarnpkg.com/get-uri/-/get-uri-6.0.3.tgz#0d26697bc13cf91092e519aa63aa60ee5b6f385a" + integrity sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw== + dependencies: + basic-ftp "^5.0.2" + data-uri-to-buffer "^6.0.2" + debug "^4.3.4" + fs-extra "^11.2.0" + git-raw-commits@^2.0.8: version "2.0.10" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.10.tgz#e2255ed9563b1c9c3ea6bd05806410290297bbc1" @@ -4902,6 +4977,14 @@ http-proxy-agent@^5.0.0: agent-base "6" debug "4" +http-proxy-agent@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz#9a8b1f246866c028509486585f62b8f2c18c270e" + integrity sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig== + dependencies: + agent-base "^7.1.0" + debug "^4.3.4" + http-proxy@^1.18.1: version "1.18.1" resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" @@ -4919,6 +5002,14 @@ https-proxy-agent@^5.0.0: agent-base "6" debug "4" +https-proxy-agent@^7.0.5: + version "7.0.5" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz#9e8b5013873299e11fab6fd548405da2d6c602b2" + integrity sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw== + dependencies: + agent-base "^7.0.2" + debug "4" + human-signals@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" @@ -5071,6 +5162,14 @@ internal-slot@^1.0.7: hasown "^2.0.0" side-channel "^1.0.4" +ip-address@^9.0.5: + version "9.0.5" + resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-9.0.5.tgz#117a960819b08780c3bd1f14ef3c1cc1d3f3ea5a" + integrity sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g== + dependencies: + jsbn "1.1.0" + sprintf-js "^1.1.3" + ip@^1.1.5: version "1.1.9" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.9.tgz#8dfbcc99a754d07f425310b86a99546b1151e396" @@ -5512,6 +5611,11 @@ js-yaml@^3.10.0, js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" +jsbn@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" + integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A== + jsesc@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" @@ -6166,7 +6270,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.0.0, ms@^2.1.1: +ms@^2.0.0, ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -6207,6 +6311,11 @@ neo-async@^2.6.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +netmask@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7" + integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg== + node-addon-api@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" @@ -6704,6 +6813,28 @@ p-waterfall@^2.1.1: dependencies: p-reduce "^2.0.0" +pac-proxy-agent@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/pac-proxy-agent/-/pac-proxy-agent-7.0.2.tgz#0fb02496bd9fb8ae7eb11cfd98386daaac442f58" + integrity sha512-BFi3vZnO9X5Qt6NRz7ZOaPja3ic0PhlsmCRYLOpN11+mWBCR6XJDqW5RF3j8jm4WGGQZtBA+bTfxYzeKW73eHg== + dependencies: + "@tootallnate/quickjs-emscripten" "^0.23.0" + agent-base "^7.0.2" + debug "^4.3.4" + get-uri "^6.0.1" + http-proxy-agent "^7.0.0" + https-proxy-agent "^7.0.5" + pac-resolver "^7.0.1" + socks-proxy-agent "^8.0.4" + +pac-resolver@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/pac-resolver/-/pac-resolver-7.0.1.tgz#54675558ea368b64d210fd9c92a640b5f3b8abb6" + integrity sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg== + dependencies: + degenerator "^5.0.0" + netmask "^2.0.2" + package-hash@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/package-hash/-/package-hash-4.0.0.tgz#3537f654665ec3cc38827387fc904c163c54f506" @@ -7592,6 +7723,15 @@ socks-proxy-agent@^7.0.0: debug "^4.3.3" socks "^2.6.2" +socks-proxy-agent@^8.0.4: + version "8.0.4" + resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-8.0.4.tgz#9071dca17af95f483300316f4b063578fa0db08c" + integrity sha512-GNAq/eg8Udq2x0eNiFkr9gRg5bA7PXEWagQdeRX4cPSG+X/8V38v637gim9bjFptMk1QWsCTr0ttrJEiXbNnRw== + dependencies: + agent-base "^7.1.1" + debug "^4.3.4" + socks "^2.8.3" + socks@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/socks/-/socks-2.6.2.tgz#ec042d7960073d40d94268ff3bb727dc685f111a" @@ -7600,6 +7740,14 @@ socks@^2.6.2: ip "^1.1.5" smart-buffer "^4.2.0" +socks@^2.8.3: + version "2.8.3" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.3.tgz#1ebd0f09c52ba95a09750afe3f3f9f724a800cb5" + integrity sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw== + dependencies: + ip-address "^9.0.5" + smart-buffer "^4.2.0" + sort-keys@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-2.0.0.tgz#658535584861ec97d730d6cf41822e1f56684128" @@ -7622,7 +7770,7 @@ source-map-support@^0.5.16: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@^0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -7684,6 +7832,11 @@ split@^1.0.0: dependencies: through "2" +sprintf-js@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.3.tgz#4914b903a2f8b685d17fdf78a70e917e872e444a" + integrity sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -8039,6 +8192,11 @@ tsd@^0.31.2: path-exists "^4.0.0" read-pkg-up "^7.0.0" +tslib@^2.0.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" From 2a2172da236472c6d183855ef6652ee073368a7b Mon Sep 17 00:00:00 2001 From: Khushhal Maheshwari <25052873+khushhalm@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:10:49 +0530 Subject: [PATCH 02/10] Fix import in ternary statement (#1779) * Fix import in ternary statement * Added comment * Typo fix in comment Co-authored-by: ninadbstack <60422475+ninadbstack@users.noreply.github.com> * Removed trailing space --------- Co-authored-by: ninadbstack <60422475+ninadbstack@users.noreply.github.com> --- packages/client/src/utils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/client/src/utils.js b/packages/client/src/utils.js index 9bb0f81fd..775963e9b 100644 --- a/packages/client/src/utils.js +++ b/packages/client/src/utils.js @@ -135,7 +135,9 @@ export async function request(url, options = {}, callback) { let { protocol, hostname, port, pathname, search, hash } = new URL(url); // reference the default export so tests can mock it - let { default: http } = await import(protocol === 'https:' ? 'https' : 'http'); + // bundling cli inside electron (LCNC) fails if we import it like + // this: await import(protocol === 'https:' ? 'https' : 'http'); + let { default: http } = protocol === 'https:' ? await import('https') : await import('http'); let { proxyAgentFor } = await import('./proxy.js'); // automatically stringify body content From 3d149589bee147703e4e884d4cac689eaaad805d Mon Sep 17 00:00:00 2001 From: Ninad Sheth Date: Tue, 19 Nov 2024 15:13:03 +0530 Subject: [PATCH 03/10] v1.30.3-alpha.0 --- lerna.json | 2 +- packages/cli-app/package.json | 8 ++++---- packages/cli-build/package.json | 6 +++--- packages/cli-command/package.json | 10 +++++----- packages/cli-config/package.json | 6 +++--- packages/cli-exec/package.json | 8 ++++---- packages/cli-snapshot/package.json | 6 +++--- packages/cli-upload/package.json | 6 +++--- packages/cli/package.json | 22 +++++++++++----------- packages/client/package.json | 8 ++++---- packages/config/package.json | 6 +++--- packages/core/package.json | 14 +++++++------- packages/dom/package.json | 4 ++-- packages/env/package.json | 6 +++--- packages/logger/package.json | 4 ++-- packages/sdk-utils/package.json | 4 ++-- packages/webdriver-utils/package.json | 8 ++++---- 17 files changed, 64 insertions(+), 64 deletions(-) diff --git a/lerna.json b/lerna.json index 4621dae1b..9776591e4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.30.2", + "version": "1.30.3-alpha.0", "packages": [ "packages/*" ], diff --git a/packages/cli-app/package.json b/packages/cli-app/package.json index 384cf09f4..570b3392a 100644 --- a/packages/cli-app/package.json +++ b/packages/cli-app/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-app", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.2", - "@percy/cli-exec": "1.30.2" + "@percy/cli-command": "1.30.3-alpha.0", + "@percy/cli-exec": "1.30.3-alpha.0" } } diff --git a/packages/cli-build/package.json b/packages/cli-build/package.json index 00bc0f7d4..8d4da27eb 100644 --- a/packages/cli-build/package.json +++ b/packages/cli-build/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-build", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.2" + "@percy/cli-command": "1.30.3-alpha.0" } } diff --git a/packages/cli-command/package.json b/packages/cli-command/package.json index 8ccb3f890..48b2a83b3 100644 --- a/packages/cli-command/package.json +++ b/packages/cli-command/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-command", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "files": [ "dist", @@ -36,8 +36,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.2", - "@percy/core": "1.30.2", - "@percy/logger": "1.30.2" + "@percy/config": "1.30.3-alpha.0", + "@percy/core": "1.30.3-alpha.0", + "@percy/logger": "1.30.3-alpha.0" } } diff --git a/packages/cli-config/package.json b/packages/cli-config/package.json index 7ef741dc3..5566bba1b 100644 --- a/packages/cli-config/package.json +++ b/packages/cli-config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-config", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.2" + "@percy/cli-command": "1.30.3-alpha.0" } } diff --git a/packages/cli-exec/package.json b/packages/cli-exec/package.json index 054b420d0..9df21a8b1 100644 --- a/packages/cli-exec/package.json +++ b/packages/cli-exec/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-exec", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -33,8 +33,8 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.2", - "@percy/logger": "1.30.2", + "@percy/cli-command": "1.30.3-alpha.0", + "@percy/logger": "1.30.3-alpha.0", "cross-spawn": "^7.0.3", "which": "^2.0.2" } diff --git a/packages/cli-snapshot/package.json b/packages/cli-snapshot/package.json index 6eba5fd2b..01b231094 100644 --- a/packages/cli-snapshot/package.json +++ b/packages/cli-snapshot/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-snapshot", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.2", + "@percy/cli-command": "1.30.3-alpha.0", "yaml": "^2.0.0" } } diff --git a/packages/cli-upload/package.json b/packages/cli-upload/package.json index ec61d54c5..d0f5fc7e9 100644 --- a/packages/cli-upload/package.json +++ b/packages/cli-upload/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-upload", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.2", + "@percy/cli-command": "1.30.3-alpha.0", "fast-glob": "^3.2.11", "image-size": "^1.0.0" } diff --git a/packages/cli/package.json b/packages/cli/package.json index e6e4ef7db..e67c7e6c7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "files": [ "bin", @@ -31,14 +31,14 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/cli-app": "1.30.2", - "@percy/cli-build": "1.30.2", - "@percy/cli-command": "1.30.2", - "@percy/cli-config": "1.30.2", - "@percy/cli-exec": "1.30.2", - "@percy/cli-snapshot": "1.30.2", - "@percy/cli-upload": "1.30.2", - "@percy/client": "1.30.2", - "@percy/logger": "1.30.2" + "@percy/cli-app": "1.30.3-alpha.0", + "@percy/cli-build": "1.30.3-alpha.0", + "@percy/cli-command": "1.30.3-alpha.0", + "@percy/cli-config": "1.30.3-alpha.0", + "@percy/cli-exec": "1.30.3-alpha.0", + "@percy/cli-snapshot": "1.30.3-alpha.0", + "@percy/cli-upload": "1.30.3-alpha.0", + "@percy/client": "1.30.3-alpha.0", + "@percy/logger": "1.30.3-alpha.0" } } diff --git a/packages/client/package.json b/packages/client/package.json index 82d474aa8..0cb95f1ee 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@percy/client", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -33,8 +33,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/env": "1.30.2", - "@percy/logger": "1.30.2", + "@percy/env": "1.30.3-alpha.0", + "@percy/logger": "1.30.3-alpha.0", "pac-proxy-agent": "^7.0.2", "pako": "^2.1.0" } diff --git a/packages/config/package.json b/packages/config/package.json index 263189096..9efe83925 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/config", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -38,7 +38,7 @@ "test:types": "tsd" }, "dependencies": { - "@percy/logger": "1.30.2", + "@percy/logger": "1.30.3-alpha.0", "ajv": "^8.6.2", "cosmiconfig": "^8.0.0", "yaml": "^2.0.0" diff --git a/packages/core/package.json b/packages/core/package.json index 81b0a03ad..46dcc977d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@percy/core", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -43,11 +43,11 @@ "test:types": "tsd" }, "dependencies": { - "@percy/client": "1.30.2", - "@percy/config": "1.30.2", - "@percy/dom": "1.30.2", - "@percy/logger": "1.30.2", - "@percy/webdriver-utils": "1.30.2", + "@percy/client": "1.30.3-alpha.0", + "@percy/config": "1.30.3-alpha.0", + "@percy/dom": "1.30.3-alpha.0", + "@percy/logger": "1.30.3-alpha.0", + "@percy/webdriver-utils": "1.30.3-alpha.0", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", "extract-zip": "^2.0.1", diff --git a/packages/dom/package.json b/packages/dom/package.json index 16c35ab07..0bd78d6f9 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@percy/dom", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "main": "dist/bundle.js", "browser": "dist/bundle.js", diff --git a/packages/env/package.json b/packages/env/package.json index d8435d254..cbd1e044c 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@percy/env", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -32,6 +32,6 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/logger": "1.30.2" + "@percy/logger": "1.30.3-alpha.0" } } diff --git a/packages/logger/package.json b/packages/logger/package.json index 6ac89f02c..5675ac071 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@percy/logger", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" diff --git a/packages/sdk-utils/package.json b/packages/sdk-utils/package.json index e5bd5f78a..b7a3686b8 100644 --- a/packages/sdk-utils/package.json +++ b/packages/sdk-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/sdk-utils", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" diff --git a/packages/webdriver-utils/package.json b/packages/webdriver-utils/package.json index 2067d3988..e72203da2 100644 --- a/packages/webdriver-utils/package.json +++ b/packages/webdriver-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/webdriver-utils", - "version": "1.30.2", + "version": "1.30.3-alpha.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "alpha" }, "engines": { "node": ">=14" @@ -29,7 +29,7 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.2", - "@percy/sdk-utils": "1.30.2" + "@percy/config": "1.30.3-alpha.0", + "@percy/sdk-utils": "1.30.3-alpha.0" } } From cacd6605c94244211374c3288f43f2344616f917 Mon Sep 17 00:00:00 2001 From: Khushhal Maheshwari <25052873+khushhalm@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:31:49 +0530 Subject: [PATCH 04/10] Cli bundling import fix (#1785) * Fix import in ternary statement * Added comment * Typo fix in comment Co-authored-by: ninadbstack <60422475+ninadbstack@users.noreply.github.com> * Removed trailing space * Fix import of PERCY_DOM in line w ESM req * made a minor comment change --------- Co-authored-by: ninadbstack <60422475+ninadbstack@users.noreply.github.com> --- packages/client/src/utils.js | 4 ++-- packages/core/src/api.js | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/client/src/utils.js b/packages/client/src/utils.js index 775963e9b..369c14a59 100644 --- a/packages/client/src/utils.js +++ b/packages/client/src/utils.js @@ -135,8 +135,8 @@ export async function request(url, options = {}, callback) { let { protocol, hostname, port, pathname, search, hash } = new URL(url); // reference the default export so tests can mock it - // bundling cli inside electron (LCNC) fails if we import it like - // this: await import(protocol === 'https:' ? 'https' : 'http'); + // bundling cli inside electron or another package fails if we import it + // like this: await import(protocol === 'https:' ? 'https' : 'http'); let { default: http } = protocol === 'https:' ? await import('https') : await import('http'); let { proxyAgentFor } = await import('./proxy.js'); diff --git a/packages/core/src/api.js b/packages/core/src/api.js index dd9a3e3ed..0ba613c11 100644 --- a/packages/core/src/api.js +++ b/packages/core/src/api.js @@ -1,13 +1,22 @@ import fs from 'fs'; import path from 'path'; -import { createRequire } from 'module'; import logger from '@percy/logger'; import { normalize } from '@percy/config/utils'; import { getPackageJSON, Server, percyAutomateRequestHandler, percyBuildEventHandler } from './utils.js'; import WebdriverUtils from '@percy/webdriver-utils'; import { handleSyncJob } from './snapshot.js'; -// need require.resolve until import.meta.resolve can be transpiled -export const PERCY_DOM = createRequire(import.meta.url).resolve('@percy/dom'); +// Previously, we used `createRequire(import.meta.url).resolve` to resolve the path to the module. +// This approach relied on `createRequire`, which is Node.js-specific and less compatible with modern ESM (ECMAScript Module) standards. +// This was leading to hard coded paths when CLI is used as a dependency in another project. +// Now, we use `fileURLToPath` and `path.resolve` to determine the absolute path in a way that's more aligned with ESM conventions. +// This change ensures better compatibility and avoids relying on Node.js-specific APIs that might cause issues in ESM environments. +import { fileURLToPath } from 'url'; +import { dirname, resolve } from 'path'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +export const PERCY_DOM = resolve(__dirname, 'node_modules/@percy/dom'); // Returns a URL encoded string of nested query params function encodeURLSearchParams(subj, prefix) { From e342330feb6be33e7234149a344faa50d1903da7 Mon Sep 17 00:00:00 2001 From: Ninad Sheth Date: Wed, 20 Nov 2024 17:35:55 +0530 Subject: [PATCH 05/10] v1.30.3-alpha.1 --- lerna.json | 2 +- packages/cli-app/package.json | 6 ++--- packages/cli-build/package.json | 4 +-- packages/cli-command/package.json | 8 +++--- packages/cli-config/package.json | 4 +-- packages/cli-exec/package.json | 6 ++--- packages/cli-snapshot/package.json | 4 +-- packages/cli-upload/package.json | 4 +-- packages/cli/package.json | 20 +++++++-------- packages/client/package.json | 6 ++--- packages/config/package.json | 4 +-- packages/core/package.json | 12 ++++----- packages/core/src/findRevision.sh | 37 +++++++++++++++++++++++++++ packages/dom/package.json | 2 +- packages/env/package.json | 4 +-- packages/logger/package.json | 2 +- packages/sdk-utils/package.json | 2 +- packages/webdriver-utils/package.json | 6 ++--- 18 files changed, 85 insertions(+), 48 deletions(-) create mode 100755 packages/core/src/findRevision.sh diff --git a/lerna.json b/lerna.json index 9776591e4..e044617c8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "packages": [ "packages/*" ], diff --git a/packages/cli-app/package.json b/packages/cli-app/package.json index 570b3392a..c12f2c12c 100644 --- a/packages/cli-app/package.json +++ b/packages/cli-app/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-app", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.0", - "@percy/cli-exec": "1.30.3-alpha.0" + "@percy/cli-command": "1.30.3-alpha.1", + "@percy/cli-exec": "1.30.3-alpha.1" } } diff --git a/packages/cli-build/package.json b/packages/cli-build/package.json index 8d4da27eb..860e47ab6 100644 --- a/packages/cli-build/package.json +++ b/packages/cli-build/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-build", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.0" + "@percy/cli-command": "1.30.3-alpha.1" } } diff --git a/packages/cli-command/package.json b/packages/cli-command/package.json index 48b2a83b3..ec8e5d7d7 100644 --- a/packages/cli-command/package.json +++ b/packages/cli-command/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-command", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -36,8 +36,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.0", - "@percy/core": "1.30.3-alpha.0", - "@percy/logger": "1.30.3-alpha.0" + "@percy/config": "1.30.3-alpha.1", + "@percy/core": "1.30.3-alpha.1", + "@percy/logger": "1.30.3-alpha.1" } } diff --git a/packages/cli-config/package.json b/packages/cli-config/package.json index 5566bba1b..99f79487a 100644 --- a/packages/cli-config/package.json +++ b/packages/cli-config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-config", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.0" + "@percy/cli-command": "1.30.3-alpha.1" } } diff --git a/packages/cli-exec/package.json b/packages/cli-exec/package.json index 9df21a8b1..0539edf65 100644 --- a/packages/cli-exec/package.json +++ b/packages/cli-exec/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-exec", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.0", - "@percy/logger": "1.30.3-alpha.0", + "@percy/cli-command": "1.30.3-alpha.1", + "@percy/logger": "1.30.3-alpha.1", "cross-spawn": "^7.0.3", "which": "^2.0.2" } diff --git a/packages/cli-snapshot/package.json b/packages/cli-snapshot/package.json index 01b231094..9d3278e89 100644 --- a/packages/cli-snapshot/package.json +++ b/packages/cli-snapshot/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-snapshot", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.0", + "@percy/cli-command": "1.30.3-alpha.1", "yaml": "^2.0.0" } } diff --git a/packages/cli-upload/package.json b/packages/cli-upload/package.json index d0f5fc7e9..fa1e28b8b 100644 --- a/packages/cli-upload/package.json +++ b/packages/cli-upload/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-upload", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.0", + "@percy/cli-command": "1.30.3-alpha.1", "fast-glob": "^3.2.11", "image-size": "^1.0.0" } diff --git a/packages/cli/package.json b/packages/cli/package.json index e67c7e6c7..f712676f7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -31,14 +31,14 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/cli-app": "1.30.3-alpha.0", - "@percy/cli-build": "1.30.3-alpha.0", - "@percy/cli-command": "1.30.3-alpha.0", - "@percy/cli-config": "1.30.3-alpha.0", - "@percy/cli-exec": "1.30.3-alpha.0", - "@percy/cli-snapshot": "1.30.3-alpha.0", - "@percy/cli-upload": "1.30.3-alpha.0", - "@percy/client": "1.30.3-alpha.0", - "@percy/logger": "1.30.3-alpha.0" + "@percy/cli-app": "1.30.3-alpha.1", + "@percy/cli-build": "1.30.3-alpha.1", + "@percy/cli-command": "1.30.3-alpha.1", + "@percy/cli-config": "1.30.3-alpha.1", + "@percy/cli-exec": "1.30.3-alpha.1", + "@percy/cli-snapshot": "1.30.3-alpha.1", + "@percy/cli-upload": "1.30.3-alpha.1", + "@percy/client": "1.30.3-alpha.1", + "@percy/logger": "1.30.3-alpha.1" } } diff --git a/packages/client/package.json b/packages/client/package.json index 0cb95f1ee..5de062caf 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@percy/client", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/env": "1.30.3-alpha.0", - "@percy/logger": "1.30.3-alpha.0", + "@percy/env": "1.30.3-alpha.1", + "@percy/logger": "1.30.3-alpha.1", "pac-proxy-agent": "^7.0.2", "pako": "^2.1.0" } diff --git a/packages/config/package.json b/packages/config/package.json index 9efe83925..2ad3cda56 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/config", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -38,7 +38,7 @@ "test:types": "tsd" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.0", + "@percy/logger": "1.30.3-alpha.1", "ajv": "^8.6.2", "cosmiconfig": "^8.0.0", "yaml": "^2.0.0" diff --git a/packages/core/package.json b/packages/core/package.json index 46dcc977d..96e53792d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@percy/core", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -43,11 +43,11 @@ "test:types": "tsd" }, "dependencies": { - "@percy/client": "1.30.3-alpha.0", - "@percy/config": "1.30.3-alpha.0", - "@percy/dom": "1.30.3-alpha.0", - "@percy/logger": "1.30.3-alpha.0", - "@percy/webdriver-utils": "1.30.3-alpha.0", + "@percy/client": "1.30.3-alpha.1", + "@percy/config": "1.30.3-alpha.1", + "@percy/dom": "1.30.3-alpha.1", + "@percy/logger": "1.30.3-alpha.1", + "@percy/webdriver-utils": "1.30.3-alpha.1", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", "extract-zip": "^2.0.1", diff --git a/packages/core/src/findRevision.sh b/packages/core/src/findRevision.sh new file mode 100755 index 000000000..73079467c --- /dev/null +++ b/packages/core/src/findRevision.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +function download_url { + if [[ "$OS" == "Linux" ]]; then + echo "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F${1}%2Fchrome-linux.zip?alt=media" + elif [[ "$OS" == "Mac" ]] || [[ "$OS" == "Mac_Arm" ]]; then + echo "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/$OS%2F${1}%2Fchrome-mac.zip?alt=media" + elif [[ "$OS" == "Win" ]] || [[ "$OS" == "Win_x64" ]]; then + echo "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/$OS%2F${1}%2Fchrome-win.zip?alt=media" + fi +} + +function get_closest_rev { + while true; do + curl -I 2>/dev/null `download_url $REVISION` | head -1 | grep 404 >/dev/null + if (($? == 1)); then + break + fi + REVISION=$(($REVISION-1)) + done + echo $REVISION +} + + +if (($# < 1)); then + printf "usage: \n" + printf " ./get_chromuim [-r] rev - will get chromium by revision\n" + exit 1 +fi + +export REVISION=$1 + +for os in "Linux" "Mac" "Mac_Arm" "Win" "Win_x64"; +do + export OS=$os + echo "$OS" `get_closest_rev` +done diff --git a/packages/dom/package.json b/packages/dom/package.json index 0bd78d6f9..0614f8f8e 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@percy/dom", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", diff --git a/packages/env/package.json b/packages/env/package.json index cbd1e044c..7cb0e1a7d 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@percy/env", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -32,6 +32,6 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.0" + "@percy/logger": "1.30.3-alpha.1" } } diff --git a/packages/logger/package.json b/packages/logger/package.json index 5675ac071..4d14cbb62 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@percy/logger", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", diff --git a/packages/sdk-utils/package.json b/packages/sdk-utils/package.json index b7a3686b8..f8098fa2c 100644 --- a/packages/sdk-utils/package.json +++ b/packages/sdk-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/sdk-utils", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", diff --git a/packages/webdriver-utils/package.json b/packages/webdriver-utils/package.json index e72203da2..d635adb84 100644 --- a/packages/webdriver-utils/package.json +++ b/packages/webdriver-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/webdriver-utils", - "version": "1.30.3-alpha.0", + "version": "1.30.3-alpha.1", "license": "MIT", "repository": { "type": "git", @@ -29,7 +29,7 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.0", - "@percy/sdk-utils": "1.30.3-alpha.0" + "@percy/config": "1.30.3-alpha.1", + "@percy/sdk-utils": "1.30.3-alpha.1" } } From aeaba47044853e43b42e979a4e676916e4d95dff Mon Sep 17 00:00:00 2001 From: Ninad Sheth Date: Wed, 20 Nov 2024 17:39:39 +0530 Subject: [PATCH 06/10] v1.30.3-alpha.2 --- lerna.json | 2 +- packages/cli-app/package.json | 6 +++--- packages/cli-build/package.json | 4 ++-- packages/cli-command/package.json | 8 ++++---- packages/cli-config/package.json | 4 ++-- packages/cli-exec/package.json | 6 +++--- packages/cli-snapshot/package.json | 4 ++-- packages/cli-upload/package.json | 4 ++-- packages/cli/package.json | 20 ++++++++++---------- packages/client/package.json | 6 +++--- packages/config/package.json | 4 ++-- packages/core/package.json | 12 ++++++------ packages/dom/package.json | 2 +- packages/env/package.json | 4 ++-- packages/logger/package.json | 2 +- packages/sdk-utils/package.json | 2 +- packages/webdriver-utils/package.json | 6 +++--- 17 files changed, 48 insertions(+), 48 deletions(-) diff --git a/lerna.json b/lerna.json index e044617c8..1ddbcf208 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "packages": [ "packages/*" ], diff --git a/packages/cli-app/package.json b/packages/cli-app/package.json index c12f2c12c..d4f1fc6ae 100644 --- a/packages/cli-app/package.json +++ b/packages/cli-app/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-app", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.1", - "@percy/cli-exec": "1.30.3-alpha.1" + "@percy/cli-command": "1.30.3-alpha.2", + "@percy/cli-exec": "1.30.3-alpha.2" } } diff --git a/packages/cli-build/package.json b/packages/cli-build/package.json index 860e47ab6..45b19f327 100644 --- a/packages/cli-build/package.json +++ b/packages/cli-build/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-build", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.1" + "@percy/cli-command": "1.30.3-alpha.2" } } diff --git a/packages/cli-command/package.json b/packages/cli-command/package.json index ec8e5d7d7..223a5f683 100644 --- a/packages/cli-command/package.json +++ b/packages/cli-command/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-command", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -36,8 +36,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.1", - "@percy/core": "1.30.3-alpha.1", - "@percy/logger": "1.30.3-alpha.1" + "@percy/config": "1.30.3-alpha.2", + "@percy/core": "1.30.3-alpha.2", + "@percy/logger": "1.30.3-alpha.2" } } diff --git a/packages/cli-config/package.json b/packages/cli-config/package.json index 99f79487a..43b428235 100644 --- a/packages/cli-config/package.json +++ b/packages/cli-config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-config", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.1" + "@percy/cli-command": "1.30.3-alpha.2" } } diff --git a/packages/cli-exec/package.json b/packages/cli-exec/package.json index 0539edf65..7ef88c8a1 100644 --- a/packages/cli-exec/package.json +++ b/packages/cli-exec/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-exec", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.1", - "@percy/logger": "1.30.3-alpha.1", + "@percy/cli-command": "1.30.3-alpha.2", + "@percy/logger": "1.30.3-alpha.2", "cross-spawn": "^7.0.3", "which": "^2.0.2" } diff --git a/packages/cli-snapshot/package.json b/packages/cli-snapshot/package.json index 9d3278e89..d02a07c9c 100644 --- a/packages/cli-snapshot/package.json +++ b/packages/cli-snapshot/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-snapshot", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.1", + "@percy/cli-command": "1.30.3-alpha.2", "yaml": "^2.0.0" } } diff --git a/packages/cli-upload/package.json b/packages/cli-upload/package.json index fa1e28b8b..f62b66271 100644 --- a/packages/cli-upload/package.json +++ b/packages/cli-upload/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-upload", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.1", + "@percy/cli-command": "1.30.3-alpha.2", "fast-glob": "^3.2.11", "image-size": "^1.0.0" } diff --git a/packages/cli/package.json b/packages/cli/package.json index f712676f7..a6350eaae 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -31,14 +31,14 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/cli-app": "1.30.3-alpha.1", - "@percy/cli-build": "1.30.3-alpha.1", - "@percy/cli-command": "1.30.3-alpha.1", - "@percy/cli-config": "1.30.3-alpha.1", - "@percy/cli-exec": "1.30.3-alpha.1", - "@percy/cli-snapshot": "1.30.3-alpha.1", - "@percy/cli-upload": "1.30.3-alpha.1", - "@percy/client": "1.30.3-alpha.1", - "@percy/logger": "1.30.3-alpha.1" + "@percy/cli-app": "1.30.3-alpha.2", + "@percy/cli-build": "1.30.3-alpha.2", + "@percy/cli-command": "1.30.3-alpha.2", + "@percy/cli-config": "1.30.3-alpha.2", + "@percy/cli-exec": "1.30.3-alpha.2", + "@percy/cli-snapshot": "1.30.3-alpha.2", + "@percy/cli-upload": "1.30.3-alpha.2", + "@percy/client": "1.30.3-alpha.2", + "@percy/logger": "1.30.3-alpha.2" } } diff --git a/packages/client/package.json b/packages/client/package.json index 5de062caf..058123768 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@percy/client", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/env": "1.30.3-alpha.1", - "@percy/logger": "1.30.3-alpha.1", + "@percy/env": "1.30.3-alpha.2", + "@percy/logger": "1.30.3-alpha.2", "pac-proxy-agent": "^7.0.2", "pako": "^2.1.0" } diff --git a/packages/config/package.json b/packages/config/package.json index 2ad3cda56..c7b083ec6 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/config", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -38,7 +38,7 @@ "test:types": "tsd" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.1", + "@percy/logger": "1.30.3-alpha.2", "ajv": "^8.6.2", "cosmiconfig": "^8.0.0", "yaml": "^2.0.0" diff --git a/packages/core/package.json b/packages/core/package.json index 96e53792d..bce250d61 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@percy/core", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -43,11 +43,11 @@ "test:types": "tsd" }, "dependencies": { - "@percy/client": "1.30.3-alpha.1", - "@percy/config": "1.30.3-alpha.1", - "@percy/dom": "1.30.3-alpha.1", - "@percy/logger": "1.30.3-alpha.1", - "@percy/webdriver-utils": "1.30.3-alpha.1", + "@percy/client": "1.30.3-alpha.2", + "@percy/config": "1.30.3-alpha.2", + "@percy/dom": "1.30.3-alpha.2", + "@percy/logger": "1.30.3-alpha.2", + "@percy/webdriver-utils": "1.30.3-alpha.2", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", "extract-zip": "^2.0.1", diff --git a/packages/dom/package.json b/packages/dom/package.json index 0614f8f8e..578dd8b2c 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@percy/dom", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", diff --git a/packages/env/package.json b/packages/env/package.json index 7cb0e1a7d..c6f93bec4 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@percy/env", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -32,6 +32,6 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.1" + "@percy/logger": "1.30.3-alpha.2" } } diff --git a/packages/logger/package.json b/packages/logger/package.json index 4d14cbb62..ab9df3a46 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@percy/logger", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", diff --git a/packages/sdk-utils/package.json b/packages/sdk-utils/package.json index f8098fa2c..b1254416d 100644 --- a/packages/sdk-utils/package.json +++ b/packages/sdk-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/sdk-utils", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", diff --git a/packages/webdriver-utils/package.json b/packages/webdriver-utils/package.json index d635adb84..807be82c9 100644 --- a/packages/webdriver-utils/package.json +++ b/packages/webdriver-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/webdriver-utils", - "version": "1.30.3-alpha.1", + "version": "1.30.3-alpha.2", "license": "MIT", "repository": { "type": "git", @@ -29,7 +29,7 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.1", - "@percy/sdk-utils": "1.30.3-alpha.1" + "@percy/config": "1.30.3-alpha.2", + "@percy/sdk-utils": "1.30.3-alpha.2" } } From 3b4c0a5fd9c5aa25d29413c6ca756c5ad9f5bb98 Mon Sep 17 00:00:00 2001 From: Khushhal Maheshwari <25052873+khushhalm@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:19:48 +0530 Subject: [PATCH 07/10] Cli bundling import fix (#1794) * Fix import in ternary statement * Added comment * Typo fix in comment Co-authored-by: ninadbstack <60422475+ninadbstack@users.noreply.github.com> * Removed trailing space * Fix import of PERCY_DOM in line w ESM req * made a minor comment change * Added PERCY_FORCE_DIRNAME flag in getPackageJSON util method * Env var name updated to PERCY_FORCE_EXECUTABLE_DIRNAME Co-authored-by: ninadbstack <60422475+ninadbstack@users.noreply.github.com> --------- Co-authored-by: ninadbstack <60422475+ninadbstack@users.noreply.github.com> --- packages/client/src/utils.js | 3 +++ packages/core/src/api.js | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/client/src/utils.js b/packages/client/src/utils.js index 369c14a59..7536aa9a3 100644 --- a/packages/client/src/utils.js +++ b/packages/client/src/utils.js @@ -37,6 +37,9 @@ export function waitForTimeout() { // Returns the package.json content at the package path. export function getPackageJSON(rel) { + /* istanbul ignore else: sanity check */ + if (process.env.PERCY_FORCE_EXECUTABLE_DIRNAME) rel = __dirname; + /* istanbul ignore else: sanity check */ if (rel.startsWith('file:')) rel = url.fileURLToPath(rel); diff --git a/packages/core/src/api.js b/packages/core/src/api.js index 0ba613c11..7f682d639 100644 --- a/packages/core/src/api.js +++ b/packages/core/src/api.js @@ -1,5 +1,5 @@ import fs from 'fs'; -import path from 'path'; +import path, { dirname, resolve } from 'path'; import logger from '@percy/logger'; import { normalize } from '@percy/config/utils'; import { getPackageJSON, Server, percyAutomateRequestHandler, percyBuildEventHandler } from './utils.js'; @@ -11,7 +11,6 @@ import { handleSyncJob } from './snapshot.js'; // Now, we use `fileURLToPath` and `path.resolve` to determine the absolute path in a way that's more aligned with ESM conventions. // This change ensures better compatibility and avoids relying on Node.js-specific APIs that might cause issues in ESM environments. import { fileURLToPath } from 'url'; -import { dirname, resolve } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); From 4d36bd849268e2aa9987509c9fdd5d1224ce5157 Mon Sep 17 00:00:00 2001 From: Ninad Sheth Date: Tue, 26 Nov 2024 11:20:50 +0530 Subject: [PATCH 08/10] v1.30.3-alpha.3 --- lerna.json | 2 +- packages/cli-app/package.json | 6 +++--- packages/cli-build/package.json | 4 ++-- packages/cli-command/package.json | 8 ++++---- packages/cli-config/package.json | 4 ++-- packages/cli-exec/package.json | 6 +++--- packages/cli-snapshot/package.json | 4 ++-- packages/cli-upload/package.json | 4 ++-- packages/cli/package.json | 20 ++++++++++---------- packages/client/package.json | 6 +++--- packages/config/package.json | 4 ++-- packages/core/package.json | 12 ++++++------ packages/dom/package.json | 2 +- packages/env/package.json | 4 ++-- packages/logger/package.json | 2 +- packages/sdk-utils/package.json | 2 +- packages/webdriver-utils/package.json | 6 +++--- 17 files changed, 48 insertions(+), 48 deletions(-) diff --git a/lerna.json b/lerna.json index 1ddbcf208..888acda23 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "packages": [ "packages/*" ], diff --git a/packages/cli-app/package.json b/packages/cli-app/package.json index d4f1fc6ae..91a008c8e 100644 --- a/packages/cli-app/package.json +++ b/packages/cli-app/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-app", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.2", - "@percy/cli-exec": "1.30.3-alpha.2" + "@percy/cli-command": "1.30.3-alpha.3", + "@percy/cli-exec": "1.30.3-alpha.3" } } diff --git a/packages/cli-build/package.json b/packages/cli-build/package.json index 45b19f327..404d45852 100644 --- a/packages/cli-build/package.json +++ b/packages/cli-build/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-build", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.2" + "@percy/cli-command": "1.30.3-alpha.3" } } diff --git a/packages/cli-command/package.json b/packages/cli-command/package.json index 223a5f683..79502ec8a 100644 --- a/packages/cli-command/package.json +++ b/packages/cli-command/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-command", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -36,8 +36,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.2", - "@percy/core": "1.30.3-alpha.2", - "@percy/logger": "1.30.3-alpha.2" + "@percy/config": "1.30.3-alpha.3", + "@percy/core": "1.30.3-alpha.3", + "@percy/logger": "1.30.3-alpha.3" } } diff --git a/packages/cli-config/package.json b/packages/cli-config/package.json index 43b428235..b87cf3d03 100644 --- a/packages/cli-config/package.json +++ b/packages/cli-config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-config", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.2" + "@percy/cli-command": "1.30.3-alpha.3" } } diff --git a/packages/cli-exec/package.json b/packages/cli-exec/package.json index 7ef88c8a1..b93e77016 100644 --- a/packages/cli-exec/package.json +++ b/packages/cli-exec/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-exec", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.2", - "@percy/logger": "1.30.3-alpha.2", + "@percy/cli-command": "1.30.3-alpha.3", + "@percy/logger": "1.30.3-alpha.3", "cross-spawn": "^7.0.3", "which": "^2.0.2" } diff --git a/packages/cli-snapshot/package.json b/packages/cli-snapshot/package.json index d02a07c9c..e7aeb47f3 100644 --- a/packages/cli-snapshot/package.json +++ b/packages/cli-snapshot/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-snapshot", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.2", + "@percy/cli-command": "1.30.3-alpha.3", "yaml": "^2.0.0" } } diff --git a/packages/cli-upload/package.json b/packages/cli-upload/package.json index f62b66271..5cfe66ecd 100644 --- a/packages/cli-upload/package.json +++ b/packages/cli-upload/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-upload", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.2", + "@percy/cli-command": "1.30.3-alpha.3", "fast-glob": "^3.2.11", "image-size": "^1.0.0" } diff --git a/packages/cli/package.json b/packages/cli/package.json index a6350eaae..cf790d065 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -31,14 +31,14 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/cli-app": "1.30.3-alpha.2", - "@percy/cli-build": "1.30.3-alpha.2", - "@percy/cli-command": "1.30.3-alpha.2", - "@percy/cli-config": "1.30.3-alpha.2", - "@percy/cli-exec": "1.30.3-alpha.2", - "@percy/cli-snapshot": "1.30.3-alpha.2", - "@percy/cli-upload": "1.30.3-alpha.2", - "@percy/client": "1.30.3-alpha.2", - "@percy/logger": "1.30.3-alpha.2" + "@percy/cli-app": "1.30.3-alpha.3", + "@percy/cli-build": "1.30.3-alpha.3", + "@percy/cli-command": "1.30.3-alpha.3", + "@percy/cli-config": "1.30.3-alpha.3", + "@percy/cli-exec": "1.30.3-alpha.3", + "@percy/cli-snapshot": "1.30.3-alpha.3", + "@percy/cli-upload": "1.30.3-alpha.3", + "@percy/client": "1.30.3-alpha.3", + "@percy/logger": "1.30.3-alpha.3" } } diff --git a/packages/client/package.json b/packages/client/package.json index 058123768..adeeafbab 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@percy/client", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/env": "1.30.3-alpha.2", - "@percy/logger": "1.30.3-alpha.2", + "@percy/env": "1.30.3-alpha.3", + "@percy/logger": "1.30.3-alpha.3", "pac-proxy-agent": "^7.0.2", "pako": "^2.1.0" } diff --git a/packages/config/package.json b/packages/config/package.json index c7b083ec6..0268f444d 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/config", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -38,7 +38,7 @@ "test:types": "tsd" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.2", + "@percy/logger": "1.30.3-alpha.3", "ajv": "^8.6.2", "cosmiconfig": "^8.0.0", "yaml": "^2.0.0" diff --git a/packages/core/package.json b/packages/core/package.json index bce250d61..587791be6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@percy/core", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -43,11 +43,11 @@ "test:types": "tsd" }, "dependencies": { - "@percy/client": "1.30.3-alpha.2", - "@percy/config": "1.30.3-alpha.2", - "@percy/dom": "1.30.3-alpha.2", - "@percy/logger": "1.30.3-alpha.2", - "@percy/webdriver-utils": "1.30.3-alpha.2", + "@percy/client": "1.30.3-alpha.3", + "@percy/config": "1.30.3-alpha.3", + "@percy/dom": "1.30.3-alpha.3", + "@percy/logger": "1.30.3-alpha.3", + "@percy/webdriver-utils": "1.30.3-alpha.3", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", "extract-zip": "^2.0.1", diff --git a/packages/dom/package.json b/packages/dom/package.json index 578dd8b2c..b1a664c9e 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@percy/dom", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", diff --git a/packages/env/package.json b/packages/env/package.json index c6f93bec4..55226b856 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@percy/env", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -32,6 +32,6 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.2" + "@percy/logger": "1.30.3-alpha.3" } } diff --git a/packages/logger/package.json b/packages/logger/package.json index ab9df3a46..665eb6594 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@percy/logger", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", diff --git a/packages/sdk-utils/package.json b/packages/sdk-utils/package.json index b1254416d..8551c975e 100644 --- a/packages/sdk-utils/package.json +++ b/packages/sdk-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/sdk-utils", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", diff --git a/packages/webdriver-utils/package.json b/packages/webdriver-utils/package.json index 807be82c9..d85846b23 100644 --- a/packages/webdriver-utils/package.json +++ b/packages/webdriver-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/webdriver-utils", - "version": "1.30.3-alpha.2", + "version": "1.30.3-alpha.3", "license": "MIT", "repository": { "type": "git", @@ -29,7 +29,7 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.2", - "@percy/sdk-utils": "1.30.3-alpha.2" + "@percy/config": "1.30.3-alpha.3", + "@percy/sdk-utils": "1.30.3-alpha.3" } } From c524e283ea199ee9169fa7f5c50a796d46864c3e Mon Sep 17 00:00:00 2001 From: Khushhal Maheshwari <25052873+khushhalm@users.noreply.github.com> Date: Tue, 26 Nov 2024 21:38:23 +0530 Subject: [PATCH 09/10] Added PERCY_FORCE_PKG_VALUE in place of PERCY_FORCE_DIRNAME (#1799) * Added PERCY_FORCE_PKG_VALUE in place of PERCY_FORCE_DIRNAME * Bumped the percy tag to 1.30.3-alpha.4 --- lerna.json | 2 +- packages/cli-app/package.json | 6 +++--- packages/cli-build/package.json | 4 ++-- packages/cli-command/package.json | 8 ++++---- packages/cli-config/package.json | 4 ++-- packages/cli-exec/package.json | 6 +++--- packages/cli-snapshot/package.json | 4 ++-- packages/cli-upload/package.json | 4 ++-- packages/cli/package.json | 20 ++++++++++---------- packages/client/package.json | 6 +++--- packages/client/src/utils.js | 2 +- packages/config/package.json | 4 ++-- packages/core/package.json | 12 ++++++------ packages/dom/package.json | 2 +- packages/env/package.json | 4 ++-- packages/logger/package.json | 2 +- packages/sdk-utils/package.json | 2 +- packages/webdriver-utils/package.json | 6 +++--- 18 files changed, 49 insertions(+), 49 deletions(-) diff --git a/lerna.json b/lerna.json index 888acda23..060a97ca4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "packages": [ "packages/*" ], diff --git a/packages/cli-app/package.json b/packages/cli-app/package.json index 91a008c8e..bf1c9c2af 100644 --- a/packages/cli-app/package.json +++ b/packages/cli-app/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-app", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.3", - "@percy/cli-exec": "1.30.3-alpha.3" + "@percy/cli-command": "1.30.3-alpha.4", + "@percy/cli-exec": "1.30.3-alpha.4" } } diff --git a/packages/cli-build/package.json b/packages/cli-build/package.json index 404d45852..c86e8b9a0 100644 --- a/packages/cli-build/package.json +++ b/packages/cli-build/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-build", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.3" + "@percy/cli-command": "1.30.3-alpha.4" } } diff --git a/packages/cli-command/package.json b/packages/cli-command/package.json index 79502ec8a..5f264b410 100644 --- a/packages/cli-command/package.json +++ b/packages/cli-command/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-command", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -36,8 +36,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.3", - "@percy/core": "1.30.3-alpha.3", - "@percy/logger": "1.30.3-alpha.3" + "@percy/config": "1.30.3-alpha.4", + "@percy/core": "1.30.3-alpha.4", + "@percy/logger": "1.30.3-alpha.4" } } diff --git a/packages/cli-config/package.json b/packages/cli-config/package.json index b87cf3d03..c39d64cbe 100644 --- a/packages/cli-config/package.json +++ b/packages/cli-config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-config", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.3" + "@percy/cli-command": "1.30.3-alpha.4" } } diff --git a/packages/cli-exec/package.json b/packages/cli-exec/package.json index b93e77016..25112f3b2 100644 --- a/packages/cli-exec/package.json +++ b/packages/cli-exec/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-exec", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.3", - "@percy/logger": "1.30.3-alpha.3", + "@percy/cli-command": "1.30.3-alpha.4", + "@percy/logger": "1.30.3-alpha.4", "cross-spawn": "^7.0.3", "which": "^2.0.2" } diff --git a/packages/cli-snapshot/package.json b/packages/cli-snapshot/package.json index e7aeb47f3..d41f78e7b 100644 --- a/packages/cli-snapshot/package.json +++ b/packages/cli-snapshot/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-snapshot", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.3", + "@percy/cli-command": "1.30.3-alpha.4", "yaml": "^2.0.0" } } diff --git a/packages/cli-upload/package.json b/packages/cli-upload/package.json index 5cfe66ecd..5e2afeb94 100644 --- a/packages/cli-upload/package.json +++ b/packages/cli-upload/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-upload", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.3", + "@percy/cli-command": "1.30.3-alpha.4", "fast-glob": "^3.2.11", "image-size": "^1.0.0" } diff --git a/packages/cli/package.json b/packages/cli/package.json index cf790d065..f393d97f9 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -31,14 +31,14 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/cli-app": "1.30.3-alpha.3", - "@percy/cli-build": "1.30.3-alpha.3", - "@percy/cli-command": "1.30.3-alpha.3", - "@percy/cli-config": "1.30.3-alpha.3", - "@percy/cli-exec": "1.30.3-alpha.3", - "@percy/cli-snapshot": "1.30.3-alpha.3", - "@percy/cli-upload": "1.30.3-alpha.3", - "@percy/client": "1.30.3-alpha.3", - "@percy/logger": "1.30.3-alpha.3" + "@percy/cli-app": "1.30.3-alpha.4", + "@percy/cli-build": "1.30.3-alpha.4", + "@percy/cli-command": "1.30.3-alpha.4", + "@percy/cli-config": "1.30.3-alpha.4", + "@percy/cli-exec": "1.30.3-alpha.4", + "@percy/cli-snapshot": "1.30.3-alpha.4", + "@percy/cli-upload": "1.30.3-alpha.4", + "@percy/client": "1.30.3-alpha.4", + "@percy/logger": "1.30.3-alpha.4" } } diff --git a/packages/client/package.json b/packages/client/package.json index adeeafbab..f8d4dc068 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@percy/client", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/env": "1.30.3-alpha.3", - "@percy/logger": "1.30.3-alpha.3", + "@percy/env": "1.30.3-alpha.4", + "@percy/logger": "1.30.3-alpha.4", "pac-proxy-agent": "^7.0.2", "pako": "^2.1.0" } diff --git a/packages/client/src/utils.js b/packages/client/src/utils.js index 7536aa9a3..3f56cdc87 100644 --- a/packages/client/src/utils.js +++ b/packages/client/src/utils.js @@ -38,7 +38,7 @@ export function waitForTimeout() { // Returns the package.json content at the package path. export function getPackageJSON(rel) { /* istanbul ignore else: sanity check */ - if (process.env.PERCY_FORCE_EXECUTABLE_DIRNAME) rel = __dirname; + if (process.env.PERCY_FORCE_PKG_VALUE) return JSON.parse(process.env.PERCY_FORCE_PKG_VALUE); /* istanbul ignore else: sanity check */ if (rel.startsWith('file:')) rel = url.fileURLToPath(rel); diff --git a/packages/config/package.json b/packages/config/package.json index 0268f444d..a8fec755a 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/config", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -38,7 +38,7 @@ "test:types": "tsd" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.3", + "@percy/logger": "1.30.3-alpha.4", "ajv": "^8.6.2", "cosmiconfig": "^8.0.0", "yaml": "^2.0.0" diff --git a/packages/core/package.json b/packages/core/package.json index 587791be6..8b4407d21 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@percy/core", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -43,11 +43,11 @@ "test:types": "tsd" }, "dependencies": { - "@percy/client": "1.30.3-alpha.3", - "@percy/config": "1.30.3-alpha.3", - "@percy/dom": "1.30.3-alpha.3", - "@percy/logger": "1.30.3-alpha.3", - "@percy/webdriver-utils": "1.30.3-alpha.3", + "@percy/client": "1.30.3-alpha.4", + "@percy/config": "1.30.3-alpha.4", + "@percy/dom": "1.30.3-alpha.4", + "@percy/logger": "1.30.3-alpha.4", + "@percy/webdriver-utils": "1.30.3-alpha.4", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", "extract-zip": "^2.0.1", diff --git a/packages/dom/package.json b/packages/dom/package.json index b1a664c9e..63bd20a8a 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@percy/dom", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", diff --git a/packages/env/package.json b/packages/env/package.json index 55226b856..b6b74a089 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@percy/env", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -32,6 +32,6 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.3" + "@percy/logger": "1.30.3-alpha.4" } } diff --git a/packages/logger/package.json b/packages/logger/package.json index 665eb6594..24df6b9c6 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@percy/logger", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", diff --git a/packages/sdk-utils/package.json b/packages/sdk-utils/package.json index 8551c975e..e48172cef 100644 --- a/packages/sdk-utils/package.json +++ b/packages/sdk-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/sdk-utils", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", diff --git a/packages/webdriver-utils/package.json b/packages/webdriver-utils/package.json index d85846b23..9993f14cf 100644 --- a/packages/webdriver-utils/package.json +++ b/packages/webdriver-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/webdriver-utils", - "version": "1.30.3-alpha.3", + "version": "1.30.3-alpha.4", "license": "MIT", "repository": { "type": "git", @@ -29,7 +29,7 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.3", - "@percy/sdk-utils": "1.30.3-alpha.3" + "@percy/config": "1.30.3-alpha.4", + "@percy/sdk-utils": "1.30.3-alpha.4" } } From b996f30c92e3c9423352d8d31c230ebe21e99e1a Mon Sep 17 00:00:00 2001 From: Khushhal Maheshwari <25052873+khushhalm@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:42:31 +0530 Subject: [PATCH 10/10] Added PERCY_FORCE_PKG_VALUE in env file and using from there (#1800) * Added PERCY_FORCE_PKG_VALUE in place of PERCY_FORCE_DIRNAME * Bumped the percy tag to 1.30.3-alpha.4 * Added PERCY_FORCE_PKG_VALUE in env file and using from there * Bumped the percy tag to 1.30.3-alpha.5 * fixed linting --- lerna.json | 2 +- packages/cli-app/package.json | 6 +++--- packages/cli-build/package.json | 4 ++-- packages/cli-command/package.json | 8 ++++---- packages/cli-config/package.json | 4 ++-- packages/cli-exec/package.json | 6 +++--- packages/cli-snapshot/package.json | 4 ++-- packages/cli-upload/package.json | 4 ++-- packages/cli/package.json | 20 ++++++++++---------- packages/client/package.json | 6 +++--- packages/client/src/client.js | 4 +++- packages/client/src/utils.js | 2 +- packages/config/package.json | 4 ++-- packages/core/package.json | 12 ++++++------ packages/core/src/api.js | 19 ++++++++++++++++--- packages/dom/package.json | 2 +- packages/env/package.json | 4 ++-- packages/env/src/environment.js | 7 +++++++ packages/logger/package.json | 2 +- packages/sdk-utils/package.json | 2 +- packages/webdriver-utils/package.json | 6 +++--- 21 files changed, 75 insertions(+), 53 deletions(-) diff --git a/lerna.json b/lerna.json index 060a97ca4..7d61987dc 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "packages": [ "packages/*" ], diff --git a/packages/cli-app/package.json b/packages/cli-app/package.json index bf1c9c2af..703dfb6aa 100644 --- a/packages/cli-app/package.json +++ b/packages/cli-app/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-app", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.4", - "@percy/cli-exec": "1.30.3-alpha.4" + "@percy/cli-command": "1.30.3-alpha.5", + "@percy/cli-exec": "1.30.3-alpha.5" } } diff --git a/packages/cli-build/package.json b/packages/cli-build/package.json index c86e8b9a0..594caec72 100644 --- a/packages/cli-build/package.json +++ b/packages/cli-build/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-build", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.4" + "@percy/cli-command": "1.30.3-alpha.5" } } diff --git a/packages/cli-command/package.json b/packages/cli-command/package.json index 5f264b410..6497f091b 100644 --- a/packages/cli-command/package.json +++ b/packages/cli-command/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-command", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -36,8 +36,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.4", - "@percy/core": "1.30.3-alpha.4", - "@percy/logger": "1.30.3-alpha.4" + "@percy/config": "1.30.3-alpha.5", + "@percy/core": "1.30.3-alpha.5", + "@percy/logger": "1.30.3-alpha.5" } } diff --git a/packages/cli-config/package.json b/packages/cli-config/package.json index c39d64cbe..0f69ea58a 100644 --- a/packages/cli-config/package.json +++ b/packages/cli-config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-config", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.4" + "@percy/cli-command": "1.30.3-alpha.5" } } diff --git a/packages/cli-exec/package.json b/packages/cli-exec/package.json index 25112f3b2..eb64ca4a7 100644 --- a/packages/cli-exec/package.json +++ b/packages/cli-exec/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-exec", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.4", - "@percy/logger": "1.30.3-alpha.4", + "@percy/cli-command": "1.30.3-alpha.5", + "@percy/logger": "1.30.3-alpha.5", "cross-spawn": "^7.0.3", "which": "^2.0.2" } diff --git a/packages/cli-snapshot/package.json b/packages/cli-snapshot/package.json index d41f78e7b..b8f9e5141 100644 --- a/packages/cli-snapshot/package.json +++ b/packages/cli-snapshot/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-snapshot", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.4", + "@percy/cli-command": "1.30.3-alpha.5", "yaml": "^2.0.0" } } diff --git a/packages/cli-upload/package.json b/packages/cli-upload/package.json index 5e2afeb94..aa9761109 100644 --- a/packages/cli-upload/package.json +++ b/packages/cli-upload/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-upload", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.30.3-alpha.4", + "@percy/cli-command": "1.30.3-alpha.5", "fast-glob": "^3.2.11", "image-size": "^1.0.0" } diff --git a/packages/cli/package.json b/packages/cli/package.json index f393d97f9..a0674c9ac 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -31,14 +31,14 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/cli-app": "1.30.3-alpha.4", - "@percy/cli-build": "1.30.3-alpha.4", - "@percy/cli-command": "1.30.3-alpha.4", - "@percy/cli-config": "1.30.3-alpha.4", - "@percy/cli-exec": "1.30.3-alpha.4", - "@percy/cli-snapshot": "1.30.3-alpha.4", - "@percy/cli-upload": "1.30.3-alpha.4", - "@percy/client": "1.30.3-alpha.4", - "@percy/logger": "1.30.3-alpha.4" + "@percy/cli-app": "1.30.3-alpha.5", + "@percy/cli-build": "1.30.3-alpha.5", + "@percy/cli-command": "1.30.3-alpha.5", + "@percy/cli-config": "1.30.3-alpha.5", + "@percy/cli-exec": "1.30.3-alpha.5", + "@percy/cli-snapshot": "1.30.3-alpha.5", + "@percy/cli-upload": "1.30.3-alpha.5", + "@percy/client": "1.30.3-alpha.5", + "@percy/logger": "1.30.3-alpha.5" } } diff --git a/packages/client/package.json b/packages/client/package.json index f8d4dc068..2e248f526 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@percy/client", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -33,8 +33,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/env": "1.30.3-alpha.4", - "@percy/logger": "1.30.3-alpha.4", + "@percy/env": "1.30.3-alpha.5", + "@percy/logger": "1.30.3-alpha.5", "pac-proxy-agent": "^7.0.2", "pako": "^2.1.0" } diff --git a/packages/client/src/client.js b/packages/client/src/client.js index 7bee9cce5..fc5e2f3b9 100644 --- a/packages/client/src/client.js +++ b/packages/client/src/client.js @@ -19,7 +19,7 @@ import { // Default client API URL can be set with an env var for API development const { PERCY_CLIENT_API_URL = 'https://percy.io/api/v1' } = process.env; -const pkg = getPackageJSON(import.meta.url); +let pkg = getPackageJSON(import.meta.url); // minimum polling interval milliseconds const MIN_POLLING_INTERVAL = 1_000; const INVALID_TOKEN_ERROR_MESSAGE = 'Unable to retrieve snapshot details with write access token. Kindly use a full access token for retrieving snapshot details with Synchronous CLI.'; @@ -83,6 +83,8 @@ export class PercyClient { // Stringifies client and environment info. userAgent() { + if (this.env.forcedPkgValue) pkg = this.env.forcedPkgValue; + let client = new Set([`Percy/${/\w+$/.exec(this.apiUrl)}`] .concat(`${pkg.name}/${pkg.version}`, ...this.clientInfo) .filter(Boolean)); diff --git a/packages/client/src/utils.js b/packages/client/src/utils.js index 3f56cdc87..d3c61e7db 100644 --- a/packages/client/src/utils.js +++ b/packages/client/src/utils.js @@ -38,7 +38,7 @@ export function waitForTimeout() { // Returns the package.json content at the package path. export function getPackageJSON(rel) { /* istanbul ignore else: sanity check */ - if (process.env.PERCY_FORCE_PKG_VALUE) return JSON.parse(process.env.PERCY_FORCE_PKG_VALUE); + if (rel.startsWith('file:')) rel = url.fileURLToPath(rel); /* istanbul ignore else: sanity check */ if (rel.startsWith('file:')) rel = url.fileURLToPath(rel); diff --git a/packages/config/package.json b/packages/config/package.json index a8fec755a..da1f4d93c 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/config", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -38,7 +38,7 @@ "test:types": "tsd" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.4", + "@percy/logger": "1.30.3-alpha.5", "ajv": "^8.6.2", "cosmiconfig": "^8.0.0", "yaml": "^2.0.0" diff --git a/packages/core/package.json b/packages/core/package.json index 8b4407d21..c85ba4a9b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@percy/core", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -43,11 +43,11 @@ "test:types": "tsd" }, "dependencies": { - "@percy/client": "1.30.3-alpha.4", - "@percy/config": "1.30.3-alpha.4", - "@percy/dom": "1.30.3-alpha.4", - "@percy/logger": "1.30.3-alpha.4", - "@percy/webdriver-utils": "1.30.3-alpha.4", + "@percy/client": "1.30.3-alpha.5", + "@percy/config": "1.30.3-alpha.5", + "@percy/dom": "1.30.3-alpha.5", + "@percy/logger": "1.30.3-alpha.5", + "@percy/webdriver-utils": "1.30.3-alpha.5", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", "extract-zip": "^2.0.1", diff --git a/packages/core/src/api.js b/packages/core/src/api.js index 7f682d639..b7c048153 100644 --- a/packages/core/src/api.js +++ b/packages/core/src/api.js @@ -12,10 +12,23 @@ import { handleSyncJob } from './snapshot.js'; // This change ensures better compatibility and avoids relying on Node.js-specific APIs that might cause issues in ESM environments. import { fileURLToPath } from 'url'; -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const getPercyDomPath = () => { + try { + const { createRequire } = require('module'); + return createRequire(import.meta.url).resolve('@percy/dom'); + } catch (error) { + logger('core:server').warn([ + 'Failed to resolve @percy/dom path using createRequire.', + 'Falling back to using fileURLToPath and path.resolve.' + ].join(' ')); + } + const __filename = fileURLToPath(import.meta.url); + const __dirname = dirname(__filename); + return resolve(__dirname, 'node_modules/@percy/dom'); +}; -export const PERCY_DOM = resolve(__dirname, 'node_modules/@percy/dom'); +// Resolved path for PERCY_DOM +export const PERCY_DOM = getPercyDomPath(); // Returns a URL encoded string of nested query params function encodeURLSearchParams(subj, prefix) { diff --git a/packages/dom/package.json b/packages/dom/package.json index 63bd20a8a..12dfe87b7 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@percy/dom", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", diff --git a/packages/env/package.json b/packages/env/package.json index b6b74a089..7985fa596 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@percy/env", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -32,6 +32,6 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/logger": "1.30.3-alpha.4" + "@percy/logger": "1.30.3-alpha.5" } } diff --git a/packages/env/src/environment.js b/packages/env/src/environment.js index e8c059eb3..8ae0ad428 100644 --- a/packages/env/src/environment.js +++ b/packages/env/src/environment.js @@ -290,6 +290,13 @@ export class PercyEnv { get token() { return this.vars.PERCY_TOKEN || null; } + + // PERCY_FORCE_PKG_VALUE for forcing package.json values + // to be used as the current environment values in client + get forcedPkgValue() { + let pkg = this.vars.PERCY_FORCE_PKG_VALUE; + return JSON.parse(pkg) || null; + } } // cache getters on initial call so subsequent calls are not re-computed diff --git a/packages/logger/package.json b/packages/logger/package.json index 24df6b9c6..81f2cda6f 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@percy/logger", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", diff --git a/packages/sdk-utils/package.json b/packages/sdk-utils/package.json index e48172cef..cff51f994 100644 --- a/packages/sdk-utils/package.json +++ b/packages/sdk-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/sdk-utils", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", diff --git a/packages/webdriver-utils/package.json b/packages/webdriver-utils/package.json index 9993f14cf..944ab94a3 100644 --- a/packages/webdriver-utils/package.json +++ b/packages/webdriver-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/webdriver-utils", - "version": "1.30.3-alpha.4", + "version": "1.30.3-alpha.5", "license": "MIT", "repository": { "type": "git", @@ -29,7 +29,7 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.30.3-alpha.4", - "@percy/sdk-utils": "1.30.3-alpha.4" + "@percy/config": "1.30.3-alpha.5", + "@percy/sdk-utils": "1.30.3-alpha.5" } }