docsearch icon indicating copy to clipboard operation
docsearch copied to clipboard

`autocomplete-preset-algolia` has missing peer dependency `algolia/client-search`

Open lex111 opened this issue 4 years ago • 7 comments

When installing docsearch/react (eg, latest version), I noticed warning like this:

@docusaurus/theme-search-algolia > @docsearch/react > @algolia/[email protected]" has unmet peer dependency "@algolia/client-search@^4.5.1".

@francoischalifour could you please fix this?

lex111 avatar Feb 12 '21 11:02 lex111

I believe this is fixed with newer versions of Autocomplete (underlying library of DocSearch): https://github.com/algolia/autocomplete.js/blob/971305a3250acf3f775207d172b6c68a37345028/packages/autocomplete-preset-algolia/package.json#L41

We haven't yet updated DocSearch to the latest Autocomplete version though, which should be why you see this warning.

I'll let you know here once we upgrade Autocomplete. Thanks for flagging.

francoischalifour avatar Feb 12 '21 13:02 francoischalifour

Actually to fix this we need to add @algolia/client-search to the DocSearch peer dependencies. We only import @algolia/client-search to use a type though.

I'm wondering if that's OK to ignore this npm warning?

francoischalifour avatar Feb 12 '21 13:02 francoischalifour

Honesty, I don't know how best to do it, but I just wanted to get rid of such warnings, if possible.

lex111 avatar Feb 12 '21 14:02 lex111

The warning doesn't really have an impact on day-to-day development, since the dependency is already installed by another package (algoliasearch), so until we fix it (make the error no longer show up by updating autocomplete in docsearch), the warning will show but can be ignored!

Haroenv avatar Feb 12 '21 22:02 Haroenv

Yes, I understand that this warning can be ignored, but I would like them not to exist at all.

By the way, I also noticed that you do not mark the latest versions with the appropriate label, please do not forget about this in the next releases.

image

lex111 avatar Feb 13 '21 17:02 lex111

This is the npm behavior (or rather bug) when you start publishing versions with the alpha tag. The first version released will be tagged as latest on npm, so we cannot do anything about it. Once we release stable on the latest tag, it'll behave as expected.

francoischalifour avatar Feb 13 '21 18:02 francoischalifour

Running yarn add @docsearch/react now (installing 3.5.2) prints the following warnings:

warning "@docsearch/react > @algolia/[email protected]" has unmet peer dependency "@algolia/client-search@>= 4.9.1 < 6".
warning "@docsearch/react > @algolia/autocomplete-core > @algolia/[email protected]" has unmet peer dependency "search-insights@>= 1 < 3".
warning "@docsearch/react > @algolia/autocomplete-core > @algolia/[email protected]" has unmet peer dependency "@algolia/client-search@>= 4.9.1 < 6".

Any plans to fix this?

SimenB avatar Nov 03 '23 10:11 SimenB