Skip to content

Commit

Permalink
πŸ› Update SDK to use Node 14 & dynamic import (#331)
Browse files Browse the repository at this point in the history
* πŸ› Update SDK to use Node 14 & dynamic import

* βœ… Update test workflows to Node 14
  • Loading branch information
Robdel12 authored Apr 6, 2022
1 parent d24e615 commit 7e233b0
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [12]
node: [14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: v1/${{ runner.os }}/node-12/${{ hashFiles('**/yarn.lock') }}
restore-keys: v1/${{ runner.os }}/node-12/
key: v1/${{ runner.os }}/node-14/${{ hashFiles('**/yarn.lock') }}
restore-keys: v1/${{ runner.os }}/node-14/
- run: yarn
- run: yarn test:types
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const utils = require('@percy/sdk-utils');

// Collect client and environment information
const sdkPkg = require('./package.json');
const nightmarePkg = require('nightmare/package.json');
Expand All @@ -17,6 +15,8 @@ module.exports = function percySnapshot(name, options) {
});

nightmare.queue(async done => {
let utils = await import('@percy/sdk-utils');

if (!(await utils.isPercyEnabled())) return done();
let log = utils.logger('nightmare');

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"types/index.d.ts"
],
"engines": {
"node": ">=12"
"node": ">=14"
},
"scripts": {
"lint": "eslint --ignore-path .gitignore .",
Expand All @@ -26,13 +26,13 @@
"test:types": "tsd"
},
"dependencies": {
"@percy/sdk-utils": "~1.0.0-beta.44"
"@percy/sdk-utils": "^1.0.0"
},
"peerDependencies": {
"nightmare": "~3"
},
"devDependencies": {
"@percy/core": "~1.0.0-beta.44",
"@percy/core": "^1.0.0",
"@types/nightmare": "^2.10.4",
"cross-env": "^7.0.2",
"eslint": "^7.11.0",
Expand Down
3 changes: 2 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const expect = require('expect');
const Nightmare = require('nightmare');
const helpers = require('@percy/sdk-utils/test/helpers');
const percySnapshot = require('..');
let helpers;

// xvfb wrapper
const xvfb = {
Expand All @@ -19,6 +19,7 @@ describe('percySnapshot', () => {
let nightmare;

before(async function() {
({ default: helpers } = await import('@percy/sdk-utils/test/helpers'));
this.timeout(0);
await xvfb.start();
nightmare = new Nightmare();
Expand Down
85 changes: 49 additions & 36 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -275,62 +275,64 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"

"@percy/client@1.0.0-beta.76":
version "1.0.0-beta.76"
resolved "https://registry.yarnpkg.com/@percy/client/-/client-1.0.0-beta.76.tgz#cc0438ec1a2129bf41e75c33e2d1a2f91d434704"
integrity sha512-vq0npya/YobIwbqrhiCXF7liwHJNmMEiAkefv5AXLmhCxIJ9eWjvgYew4xssuf+QPHfdv10EVa5kkMSr8INxeA==
"@percy/client@1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@percy/client/-/client-1.0.5.tgz#8e4f34c906b4b7e39a0e9add02f3e5513e9bc622"
integrity sha512-wbV5yaZXjVbaEcmBdSh3i1NcBEHZeJrSNvQ43tou5ErgQk6UXdCcaM1npi0EwToSC7AyE9UIFOazAMqVEU/l1w==
dependencies:
"@percy/env" "1.0.0-beta.76"
"@percy/logger" "1.0.0-beta.76"
"@percy/env" "1.0.5"
"@percy/logger" "1.0.5"

"@percy/config@1.0.0-beta.76":
version "1.0.0-beta.76"
resolved "https://registry.yarnpkg.com/@percy/config/-/config-1.0.0-beta.76.tgz#71b0f8df28053769c964acae461bfd8b705a674d"
integrity sha512-e3sLzcrVlsax5q1RwO8sek2Qjqb617WFpa1+wnXqPSMSxiEBlr+lbUC/C5a1hHKEWdFz4RKSJC+2mjhT8ylm3g==
"@percy/config@1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@percy/config/-/config-1.0.5.tgz#a479e5ead928820da4deb1d33575690009f13747"
integrity sha512-ml0vlk4HCDtJYs8OzyB0pf+AuUw7ifyAoH6hInzObm6TnfpP4ebsJr6lUZmvDqUBChdU23lN8U7wr20TNbz7Pg==
dependencies:
"@percy/logger" "1.0.0-beta.76"
"@percy/logger" "1.0.5"
ajv "^8.6.2"
cosmiconfig "^7.0.0"
yaml "^1.10.0"

"@percy/core@~1.0.0-beta.44":
version "1.0.0-beta.76"
resolved "https://registry.yarnpkg.com/@percy/core/-/core-1.0.0-beta.76.tgz#7bca4b744c782e9dd8f9097b6af1c676b3eb7fbf"
integrity sha512-sTtwdNBmhX/IvKrNGT3TWrZ0ngJZ2Kh6Y4m9M9H4pciGHmiSFcMqsBB0tK6IMbfIsGqFz8ePOTj++4RLSMlK/g==
"@percy/core@^1.0.0":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@percy/core/-/core-1.0.5.tgz#e917c67655c2f4b2c55bdcc433053aca02022be7"
integrity sha512-P7B2LcE+5Hz2rIw2Z6HR3FI4eC17nYsjfpMJnpsNNNkgwT/eOwZGxzIbTpsOOVoZIErIOEMTn0LYVIrfwSTDwQ==
dependencies:
"@percy/client" "1.0.0-beta.76"
"@percy/config" "1.0.0-beta.76"
"@percy/dom" "1.0.0-beta.76"
"@percy/logger" "1.0.0-beta.76"
"@percy/client" "1.0.5"
"@percy/config" "1.0.5"
"@percy/dom" "1.0.5"
"@percy/logger" "1.0.5"
content-disposition "^0.5.4"
cross-spawn "^7.0.3"
extract-zip "^2.0.1"
fast-glob "^3.2.11"
micromatch "^4.0.4"
mime-types "^2.1.34"
path-to-regexp "^6.2.0"
rimraf "^3.0.2"
ws "^8.0.0"

"@percy/dom@1.0.0-beta.76":
version "1.0.0-beta.76"
resolved "https://registry.yarnpkg.com/@percy/dom/-/dom-1.0.0-beta.76.tgz#ca0e5f639db271eda4f0826af57a25e1b62bd023"
integrity sha512-9v/yXjIe2UhAkjnO2pWT0Ki4rzgIl0Z6YyWcn1b5NfsBcMm99Hcse+otDsQJF8z0MkU4ZykiPY63zmjs45wChQ==
"@percy/dom@1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@percy/dom/-/dom-1.0.5.tgz#e9f502c6ed28d2fd1982b6467809268f905afc4e"
integrity sha512-7iuPU/ri+oVwjgAVmX/nsQQaBgSffWFlMn0Lj+ZqqOKEluSWXquXsCXWMmBug3QU33qRdOOgqr5zvu7jPxFNlw==

"@percy/env@1.0.0-beta.76":
version "1.0.0-beta.76"
resolved "https://registry.yarnpkg.com/@percy/env/-/env-1.0.0-beta.76.tgz#079f3a1174717d8da15e7e0575ff821fdf035aa5"
integrity sha512-+Mx9K3wjFriMT0cMD5l+VRo6mhQ/XssKy77SUeWrOaGIk7Xs/FsnDUpLOCXAGUeJr1AznZM76ng99IOBM6pY4w==
"@percy/env@1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@percy/env/-/env-1.0.5.tgz#e6ef36450f50f5c61327ab433867f92b11bf36aa"
integrity sha512-S9sA+rmDldLCIUDN87LWlf27t1SmxIl5bDlJ/15B7kxNMRqdJPjTvFr99NHgDF8iBZOu50YFsytySS0KdzBWFw==

"@percy/logger@1.0.0-beta.76":
version "1.0.0-beta.76"
resolved "https://registry.yarnpkg.com/@percy/logger/-/logger-1.0.0-beta.76.tgz#1a75c583670acc078389a43d8b7410fd655c0b92"
integrity sha512-v5zIMNv1xqdcWBAOK5A6ZEO99ZBwzWS3phLEfkKbIlGIUxvjkJHSfZv/k1dnt2RRfpDNkM6X5pMg2yI8j1+d+g==
"@percy/logger@1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@percy/logger/-/logger-1.0.5.tgz#31aec74ddcd2f7e2d8e6fa2d0211ad65eee43897"
integrity sha512-OT3/Xiuo1V4cHwqdDQfuvfMDRf7GhMrHK9HCiHE2dOakLqmIM0fexiCoD0k5Bd7fgjZ9G5YmFT9k5ymBmT9oOA==

"@percy/sdk-utils@~1.0.0-beta.44":
version "1.0.0-beta.76"
resolved "https://registry.yarnpkg.com/@percy/sdk-utils/-/sdk-utils-1.0.0-beta.76.tgz#71b4d7a7664b7029761aea5850295defeb134f98"
integrity sha512-5B070+VlTiCjxmwHU5Q8+ow1dGdmOkukY8TkSBkkbSs2OE4IPcYBlb+t/hGhpw7D34znPXc2dmUrZrbXwkRd2A==
"@percy/sdk-utils@^1.0.0":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@percy/sdk-utils/-/sdk-utils-1.0.5.tgz#115a10b984a6332b39d401320846c6ee04c3c6eb"
integrity sha512-+ykSYLHCqRkH5DZ5YLhDslt59EljB9sF6Obhw/g5j4ot34N/PAidA6mmxhRuca+ugutgo2R/IswSDdGvyZEu1A==
dependencies:
"@percy/logger" "1.0.0-beta.76"
"@percy/logger" "1.0.5"

"@tsd/typescript@~4.6.3":
version "4.6.3"
Expand Down Expand Up @@ -1428,6 +1430,17 @@ fast-glob@^3.1.1:
micromatch "^4.0.2"
picomatch "^2.2.1"

fast-glob@^3.2.11:
version "3.2.11"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9"
integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==
dependencies:
"@nodelib/fs.stat" "^2.0.2"
"@nodelib/fs.walk" "^1.2.3"
glob-parent "^5.1.2"
merge2 "^1.3.0"
micromatch "^4.0.4"

fast-json-stable-stringify@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
Expand Down

0 comments on commit 7e233b0

Please sign in to comment.