Skip to content

Commit

Permalink
fix(dependencies): upgrade dependencies (#1015)
Browse files Browse the repository at this point in the history
shortcuts authored Jul 9, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent bf18c73 commit 9300cb4
Showing 28 changed files with 3,962 additions and 1,664 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@ dist
/examples
build
.cache
.parcel-cache
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ node_modules/
*.log
coverage/
.cache
.parcel-cache

# Bundle build files
dist/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@ node_modules
dist
build
.cache
.parcel-cache
4 changes: 2 additions & 2 deletions bundlesize.config.json
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@
},
{
"path": "packages/docsearch-react/dist/umd/index.js",
"maxSize": "18.3 kB"
"maxSize": "19 kB"
},
{
"path": "packages/docsearch-js/dist/umd/index.js",
"maxSize": "25.9 kB"
"maxSize": "26.5 kB"
}
]
}
Binary file added examples/demo/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions examples/demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="shortcut icon" href="favicon.png" type="image/x-icon" />

<title>DocSearch v3 - React</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>

<script src="src/index.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@docsearch/react-example",
"description": "DocSearch v3 React example",
"version": "3.0.0-alpha.36",
"private": true,
"license": "MIT",
"scripts": {
"build": "parcel build index.html",
"start": "parcel index.html"
},
"dependencies": {
"@docsearch/react": "3.0.0-alpha.36",
"@docsearch/css": "3.0.0-alpha.36",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"parcel": "2.0.0-beta.2"
}
}
19 changes: 19 additions & 0 deletions examples/demo/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { DocSearch } from '@docsearch/react';

import './app.css';
import '@docsearch/css';

function App() {
return (
<div>
<h1>DocSearch v3 - React</h1>
<DocSearch
indexName="docsearch"
apiKey="25626fae796133dc1e734c6bcaaeac3c"
/>
</div>
);
}

export default App;
4 changes: 4 additions & 0 deletions examples/demo/src/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
}
6 changes: 6 additions & 0 deletions examples/demo/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';

import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));
Empty file added examples/js-demo/README.md
Empty file.
4 changes: 4 additions & 0 deletions examples/js-demo/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
}
10 changes: 10 additions & 0 deletions examples/js-demo/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import docsearch from '@docsearch/js/dist/umd';

import './app.css';
import '@docsearch/css';

docsearch({
container: '#docsearch',
indexName: 'docsearch',
apiKey: '25626fae796133dc1e734c6bcaaeac3c',
});
Binary file added examples/js-demo/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions examples/js-demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="shortcut icon" href="favicon.png" type="image/x-icon" />

<title>DocSearch v3 - Vanilla JavaScript</title>
</head>

<body>
<div class="container">
<h1>DocSearch v3 - Vanilla JavaScript</h1>

<div id="docsearch"></div>
</div>

<script src="app.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions examples/js-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@docsearch/js-example",
"description": "DocSearch v3 Vanilla JavaScript example",
"version": "3.0.0-alpha.36",
"private": true,
"license": "MIT",
"scripts": {
"build": "parcel build index.html",
"start": "parcel index.html"
},
"dependencies": {
"@docsearch/js": "3.0.0-alpha.36",
"@docsearch/css": "3.0.0-alpha.36"
},
"devDependencies": {
"parcel": "2.0.0-beta.2"
}
}
36 changes: 0 additions & 36 deletions examples/js/index.html

This file was deleted.

21 changes: 0 additions & 21 deletions examples/js/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packages": ["packages/*"],
"packages": ["packages/*", "examples/*"],
"version": "3.0.0-alpha.36",
"npmClient": "yarn"
}
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@
"private": true,
"workspaces": {
"packages": [
"packages/*"
"packages/*",
"examples/*"
],
"nohoist": [
"**/html-minifier-terser"
@@ -26,6 +27,8 @@
"lint:css": "stylelint **/src/**/*.css",
"lint": "eslint --ext .js,.ts,.tsx .",
"prepare": "lerna run prepare",
"playground:start": "yarn workspace @docsearch/react-example start",
"playground-js:start": "yarn workspace @docsearch/js-example start",
"release": "shipjs prepare",
"start": "yarn run watch",
"test:size": "bundlesize",
@@ -53,7 +56,7 @@
"@types/react-dom": "^17.0.0",
"@typescript-eslint/eslint-plugin": "2.19.0",
"@typescript-eslint/parser": "2.19.0",
"algoliasearch": "4.8.0",
"algoliasearch": "4.10.3",
"babel-eslint": "10.1.0",
"babel-loader": "8.1.0",
"babel-plugin-inline-replace-variables": "1.3.1",
@@ -76,11 +79,11 @@
"eslint-plugin-react-hooks": "2.3.0",
"jest": "26.4.2",
"jest-watch-typeahead": "0.6.0",
"lerna": "3.22.1",
"lerna": "4.0.0",
"postcss": "7.0.32",
"prettier": "2.1.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"rimraf": "3.0.2",
"rollup": "1.31.0",
"rollup-plugin-babel": "4.4.0",
4 changes: 2 additions & 2 deletions packages/docsearch-react/package.json
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@
"watch": "watch \"yarn on:change\" --ignoreDirectoryPattern \"/dist/\""
},
"dependencies": {
"@algolia/autocomplete-core": "1.0.0-alpha.44",
"@algolia/autocomplete-preset-algolia": "1.0.0-alpha.44",
"@algolia/autocomplete-core": "1.2.1",
"@algolia/autocomplete-preset-algolia": "1.2.1",
"@docsearch/css": "3.0.0-alpha.36",
"algoliasearch": "^4.0.0"
},
2 changes: 1 addition & 1 deletion packages/docsearch-react/src/DocSearch.tsx
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import {
AutocompleteState,
AutocompleteOptions,
} from '@algolia/autocomplete-core';
import { SearchClient } from 'algoliasearch/lite';
import React from 'react';
import { createPortal } from 'react-dom';

@@ -11,7 +12,6 @@ import {
DocSearchHit,
InternalDocSearchHit,
StoredDocSearchHit,
SearchClient,
} from './types';
import { useDocSearchKeyboardEvents } from './useDocSearchKeyboardEvents';

76 changes: 33 additions & 43 deletions packages/docsearch-react/src/DocSearchModal.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import {
AutocompleteState,
createAutocomplete,
} from '@algolia/autocomplete-core';
import { getAlgoliaResults } from '@algolia/autocomplete-preset-algolia';
import React from 'react';

import { MAX_QUERY_SIZE } from './constants';
@@ -128,7 +127,7 @@ export function DocSearchModal({
},
navigator,
onStateChange({ state }) {
setState(state as any);
setState(state);
},
// @ts-ignore Temporarily ignore bad typing in autocomplete-core.
getSources({ query, state, setContext, setStatus }) {
@@ -173,43 +172,36 @@ export function DocSearchModal({
];
}

return getAlgoliaResults<DocSearchHit>({
searchClient,
queries: [
{
indexName,
query,
params: {
attributesToRetrieve: [
'hierarchy.lvl0',
'hierarchy.lvl1',
'hierarchy.lvl2',
'hierarchy.lvl3',
'hierarchy.lvl4',
'hierarchy.lvl5',
'hierarchy.lvl6',
'content',
'type',
'url',
],
attributesToSnippet: [
`hierarchy.lvl1:${snippetLength.current}`,
`hierarchy.lvl2:${snippetLength.current}`,
`hierarchy.lvl3:${snippetLength.current}`,
`hierarchy.lvl4:${snippetLength.current}`,
`hierarchy.lvl5:${snippetLength.current}`,
`hierarchy.lvl6:${snippetLength.current}`,
`content:${snippetLength.current}`,
],
snippetEllipsisText: '…',
highlightPreTag: '<mark>',
highlightPostTag: '</mark>',
hitsPerPage: 20,
...searchParameters,
},
},
],
})
return searchClient
.initIndex(indexName)
.search<DocSearchHit>(query, {
attributesToRetrieve: [
'hierarchy.lvl0',
'hierarchy.lvl1',
'hierarchy.lvl2',
'hierarchy.lvl3',
'hierarchy.lvl4',
'hierarchy.lvl5',
'hierarchy.lvl6',
'content',
'type',
'url',
],
attributesToSnippet: [
`hierarchy.lvl1:${snippetLength.current}`,
`hierarchy.lvl2:${snippetLength.current}`,
`hierarchy.lvl3:${snippetLength.current}`,
`hierarchy.lvl4:${snippetLength.current}`,
`hierarchy.lvl5:${snippetLength.current}`,
`hierarchy.lvl6:${snippetLength.current}`,
`content:${snippetLength.current}`,
],
snippetEllipsisText: '…',
highlightPreTag: '<mark>',
highlightPostTag: '</mark>',
hitsPerPage: 20,
...searchParameters,
})
.catch((error) => {
// The Algolia `RetryError` happens when all the servers have
// failed, meaning that there's no chance the response comes
@@ -221,13 +213,11 @@ export function DocSearchModal({

throw error;
})
.then((results) => {
const hits = results[0].hits;
const nbHits: number = results[0].nbHits;
.then(({ hits, nbHits }) => {
const sources = groupBy(hits, (hit) => removeHighlightTags(hit));

// We store the `lvl0`s to display them as search suggestions
// in the no results screen.
// in the "no results" screen.
if (
(state.context.searchSuggestions as any[]).length <
Object.keys(sources).length
1 change: 0 additions & 1 deletion packages/docsearch-react/src/types/SearchClient.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/docsearch-react/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './DocSearchHit';
export * from './InternalDocSearchHit';
export * from './SearchClient';
export * from './StoredDocSearchHit';
2 changes: 1 addition & 1 deletion packages/docsearch-react/src/useSearchClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import algoliasearch from 'algoliasearch/dist/algoliasearch-lite.esm.browser';
import { SearchClient } from 'algoliasearch/lite';
import React from 'react';

import { SearchClient } from './types';
import { version } from './version';

export function useSearchClient(
4 changes: 2 additions & 2 deletions packages/website/package.json
Original file line number Diff line number Diff line change
@@ -13,11 +13,11 @@
},
"dependencies": {
"@algolia/ui-library": "2.35.0",
"@docsearch/react": "1.0.0-alpha.28",
"@docsearch/react": "3.0.0-alpha.36",
"@docusaurus/core": "2.0.0-alpha.69",
"@docusaurus/preset-classic": "2.0.0-alpha.69",
"@docusaurus/theme-live-codeblock": "2.0.0-alpha.69",
"algoliasearch": "4.1.0",
"algoliasearch": "4.10.3",
"classnames": "2.2.6",
"docsearch.js": "2.6.3",
"file-loader": "4.3.0",
5,338 changes: 3,790 additions & 1,548 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 9300cb4

Please sign in to comment.