Skip to content

Commit

Permalink
chore(deps): update all dependencies (major) (#1448)
Browse files Browse the repository at this point in the history
* chore(deps): update all dependencies

* chore: downgrade graphql

* fix(quick-access): migrate fusejs changes

* fix(quick-access): more flexible handling of fuzzy search results

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Nicola Molinari <[email protected]>
  • Loading branch information
3 people authored Apr 28, 2020
1 parent 831f5df commit 9f1ba80
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 45 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"postcss-custom-properties": "9.1.1",
"postcss-import": "12.0.1",
"prettier": "2.0.4",
"puppeteer": "2.1.1",
"puppeteer": "3.0.0",
"rcfile": "1.0.3",
"read-pkg-up": "7.0.1",
"replace": "1.1.5",
Expand All @@ -157,7 +157,7 @@
"rollup-plugin-node-builtins": "2.1.2",
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-peer-deps-external": "2.2.2",
"rollup-plugin-postcss": "2.8.2",
"rollup-plugin-postcss": "3.0.0",
"rosie": "2.0.1",
"shelljs": "0.8.3",
"start-server-and-test": "1.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/application-shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"common-tags": "1.8.0",
"debounce-async": "0.0.2",
"downshift": "^5.1.1",
"fuse.js": "3.4.6",
"fuse.js": "5.2.3",
"graphql": "14.6.0",
"graphql-tag": "^2.10.3",
"history": "4.10.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,21 @@ const Butler = (props: Props) => {
{ name: 'text', weight: 0.6 },
{ name: 'keywords', weight: 0.4 },
],
tokenize: false,
minMatchCharLength: 2,
includeScore: true,
});

const results = fuse.search(searchText).slice(0, 9);
const searchResults = fuse
.search(searchText)
// Filter out results with a matching score over 0.75
.filter((result) => (result.score ? result.score < 0.75 : false))
// Keep a maximal of 9 results
.slice(0, 9);

dispatch({ type: 'setSearchTextResults', payload: results });
dispatch({
type: 'setSearchTextResults',
payload: searchResults.map((result) => result.item),
});
},
(error: Error) => {
// eslint-disable-next-line no-console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,38 @@ const createPimSearchSdkMock = (
response: {},
});

const renderQuickAccess = (options = {}, ui) =>
renderAppWithRedux(ui || <QuickAccess />, {
const renderQuickAccess = (options = {}, ui) => {
const rendered = renderAppWithRedux(ui || <QuickAccess />, {
permissions: managePermissions,
sdkMocks: [createPimAvailabilityCheckSdkMock()],
...options,
});

const findCurrentItem = ({ input, inputKey, itemTestId }) => {
let attempts = 4;
// Select the "next" item in the results until it finds the "Orders" match.
while (attempts > 0) {
fireEvent.keyDown(input, { key: inputKey });
fireEvent.keyUp(input, { key: inputKey });
const el = rendered.queryByTestId(itemTestId);
if (el.getAttribute('aria-current') === 'true') {
attempts = 0;
} else {
attempts -= 1;
}
}
expect(rendered.queryByTestId(itemTestId)).toHaveAttribute(
'aria-current',
'true'
);
};

return {
...rendered,
findCurrentItem,
};
};

beforeEach(() => {
gtm.track.mockReset();
global.open = jest.fn();
Expand Down Expand Up @@ -713,21 +738,21 @@ describe('QuickAccess', () => {

// when now pressing key down the selection should jump down
searchInput = rendered.getByTestId('quick-access-search-input');
fireEvent.keyDown(searchInput, { key: 'ArrowDown' });
fireEvent.keyUp(searchInput, { key: 'ArrowDown' });

expect(
rendered.queryByTestId('quick-access-result(go/orders)')
).toHaveAttribute('aria-current', 'true');
rendered.findCurrentItem({
input: searchInput,
inputKey: 'ArrowDown',
itemTestId: 'quick-access-result(go/orders)',
});

// when pressing up, it should jump up again
searchInput = rendered.getByTestId('quick-access-search-input');
fireEvent.keyDown(searchInput, { key: 'ArrowUp' });
fireEvent.keyUp(searchInput, { key: 'ArrowUp' });

expect(
rendered.queryByTestId('quick-access-result(go/dashboard)')
).toHaveAttribute('aria-current', 'true');
rendered.findCurrentItem({
input: searchInput,
inputKey: 'ArrowUp',
itemTestId: 'quick-access-result(go/dashboard)',
});
});

it('should find a product by sku', async () => {
Expand Down Expand Up @@ -975,13 +1000,11 @@ describe('QuickAccess', () => {
searchInput.setSelectionRange(searchText.length, searchText.length);
await rendered.findByText('Open Orders');

// go down to select Open orders
fireEvent.keyDown(searchInput, { key: 'ArrowDown' });
fireEvent.keyUp(searchInput, { key: 'ArrowDown' });

expect(
rendered.queryByTestId('quick-access-result(go/orders)')
).toHaveAttribute('aria-current', 'true');
rendered.findCurrentItem({
input: searchInput,
inputKey: 'ArrowDown',
itemTestId: 'quick-access-result(go/orders)',
});

// navigate into sub commands
fireEvent.keyDown(searchInput, { key: 'ArrowRight' });
Expand Down
2 changes: 1 addition & 1 deletion packages/l10n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"devDependencies": {
"@testing-library/react-hooks": "3.2.1",
"chalk": "3.0.0",
"chalk": "4.0.0",
"cldr": "5.6.0",
"deep-diff": "1.0.2",
"moment-timezone": "0.5.28",
Expand Down
74 changes: 55 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6032,6 +6032,13 @@
dependencies:
"@types/yargs-parser" "*"

"@types/yauzl@^2.9.1":
version "2.9.1"
resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.9.1.tgz#d10f69f9f522eef3cf98e30afb684a1e1ec923af"
integrity sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==
dependencies:
"@types/node" "*"

"@types/[email protected]":
version "1.9.1"
resolved "https://registry.yarnpkg.com/@types/yoga-layout/-/yoga-layout-1.9.1.tgz#6c00e4a151a9a529397d580e2cf6f3947a42a928"
Expand Down Expand Up @@ -8502,14 +8509,6 @@ [email protected], chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

[email protected], chalk@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

[email protected], chalk@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.0.0.tgz#6e98081ed2d17faab615eb52ac66ec1fe6209e72"
Expand All @@ -8518,6 +8517,14 @@ [email protected], chalk@^4.0.0:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

chalk@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

change-case@^3.0.1, change-case@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/change-case/-/change-case-3.1.0.tgz#0e611b7edc9952df2e8513b27b42de72647dd17e"
Expand Down Expand Up @@ -12274,6 +12281,17 @@ extract-zip@^1.6.6:
mkdirp "^0.5.4"
yauzl "^2.10.0"

extract-zip@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.0.tgz#f53b71d44f4ff5a4527a2259ade000fb8b303492"
integrity sha512-i42GQ498yibjdvIhivUsRslx608whtGoFIhF26Z7O4MYncBxp8CwalOs1lnHy21A9sIohWO2+uiE4SRtC9JXDg==
dependencies:
debug "^4.1.1"
get-stream "^5.1.0"
yauzl "^2.10.0"
optionalDependencies:
"@types/yauzl" "^2.9.1"

[email protected]:
version "1.3.0"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05"
Expand Down Expand Up @@ -13040,10 +13058,10 @@ functions-have-names@^1.2.0:
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.1.tgz#a981ac397fa0c9964551402cdc5533d7a4d52f91"
integrity sha512-j48B/ZI7VKs3sgeI2cZp7WXWmZXu7Iq5pl5/vptV5N2mq+DGFuS/ulaDjtaoLpYzuD6u8UgrUKHfgo7fDTSiBA==

fuse.js@3.4.6:
version "3.4.6"
resolved "https://registry.yarnpkg.com/fuse.js/-/fuse.js-3.4.6.tgz#545c3411fed88bf2e27c457cab6e73e7af697a45"
integrity sha512-H6aJY4UpLFwxj1+5nAvufom5b2BT2v45P1MkPvdGIK8fWjQx/7o6tTT1+ALV0yawQvbmvCF0ufl2et8eJ7v7Cg==
fuse.js@5.2.3:
version "5.2.3"
resolved "https://registry.yarnpkg.com/fuse.js/-/fuse.js-5.2.3.tgz#fdf3aa62859782b3f73ddfa57a9ca81517280c91"
integrity sha512-ld3AEgKtKnnXCtJavtygAb+aLlD5aVvLwTocXXBSStLA6JGFI6oMxTvumwh46N2/3gs3A7JNDu1px5F1/cq84g==

fwd-stream@^1.0.4:
version "1.0.4"
Expand Down Expand Up @@ -22699,7 +22717,25 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==

[email protected], puppeteer@^2.0.0:
[email protected]:
version "3.0.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-3.0.0.tgz#844c714d074c7ea63cfa3744501c1ab6ea60722e"
integrity sha512-ArmIS8w+XhL4KGP05kxMousA9SFxmeirMkNNcVe5LjK4iGCbZ8qKnG4byuXMru7Ty7a9QwiMUIf80X+zmJuf2A==
dependencies:
"@types/mime-types" "^2.1.0"
debug "^4.1.0"
extract-zip "^2.0.0"
https-proxy-agent "^4.0.0"
mime "^2.0.3"
mime-types "^2.1.25"
progress "^2.0.1"
proxy-from-env "^1.0.0"
rimraf "^3.0.2"
tar-fs "^2.0.0"
unbzip2-stream "^1.3.3"
ws "^7.2.3"

puppeteer@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-2.1.1.tgz#ccde47c2a688f131883b50f2d697bd25189da27e"
integrity sha512-LWzaDVQkk1EPiuYeTOj+CZRIjda4k2s5w4MK4xoH2+kgWV/SDlkYHmxatDdtYrciHUKSXTsGgPgPP8ILVdBsxg==
Expand Down Expand Up @@ -24227,7 +24263,7 @@ [email protected], rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf
dependencies:
glob "^7.1.3"

[email protected], rimraf@^3.0.0:
[email protected], rimraf@^3.0.0, rimraf@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==
Expand Down Expand Up @@ -24288,10 +24324,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/rollup-plugin-peer-deps-external/-/rollup-plugin-peer-deps-external-2.2.2.tgz#506cef67fb68f41cca3ec08ca6ff7936b190f568"
integrity sha512-XcHH4UW9exRTAf73d8rk2dw2UgF//cWbilhRI4Ni/n+t0zA1eBtohKyJROn0fxa4/+WZ5R3onAyIDiwRQL+59A==

rollup-plugin-postcss@2.8.2:
version "2.8.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-postcss/-/rollup-plugin-postcss-2.8.2.tgz#6408bd9301edc8bc495ce0c9547acb339010a845"
integrity sha512-IZkOIlzWJLmMUS6EDbjUYZEwdhukdcM+39rmXKVl/WQ2rnMpQxF3ByDUzq9zYok6weT7rteuzVkV5nWjnrZrtw==
rollup-plugin-postcss@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-postcss/-/rollup-plugin-postcss-3.0.0.tgz#988d6b54653ab6e67a254c3b6f34181205fdd51a"
integrity sha512-KGLKCKs1GTTuFoOyhH74VoJGPg2sFLBpMctoakLg8pL4ni2unh733AlC3+05Dt7qIllbvNbSoqKcmqjqb1Eb7g==
dependencies:
chalk "^4.0.0"
concat-with-sourcemaps "^1.1.0"
Expand Down Expand Up @@ -26909,7 +26945,7 @@ umask@^1.1.0:
resolved "https://registry.yarnpkg.com/umask/-/umask-1.1.0.tgz#f29cebf01df517912bb58ff9c4e50fde8e33320d"
integrity sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0=

unbzip2-stream@^1.0.9:
unbzip2-stream@^1.0.9, unbzip2-stream@^1.3.3:
version "1.4.1"
resolved "https://registry.yarnpkg.com/unbzip2-stream/-/unbzip2-stream-1.4.1.tgz#151b104af853df3efdaa135d8b1eca850a44b426"
integrity sha512-sgDYfSDPMsA4Hr2/w7vOlrJBlwzmyakk1+hW8ObLvxSp0LA36LcL2XItGvOT3OSblohSdevMuT8FQjLsqyy4sA==
Expand Down

1 comment on commit 9f1ba80

@vercel
Copy link

@vercel vercel bot commented on 9f1ba80 Apr 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.