algolia / docsearch

:blue_book: The easiest way to add search to your documentation.
https://docsearch.algolia.com
MIT License
3.96k stars 383 forks source link

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

Open lex111 opened 3 years ago

lex111 commented 3 years ago

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

@docusaurus/theme-search-algolia > @docsearch/react > @algolia/autocomplete-preset-algolia@1.0.0-alpha.35" has unmet peer dependency "@algolia/client-search@^4.5.1".

@francoischalifour could you please fix this?

francoischalifour commented 3 years ago

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 commented 3 years ago

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?

lex111 commented 3 years ago

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

Haroenv commented 3 years ago

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!

lex111 commented 3 years ago

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

francoischalifour commented 3 years ago

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.

SimenB commented 11 months ago

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

warning "@docsearch/react > @algolia/autocomplete-preset-algolia@1.9.3" has unmet peer dependency "@algolia/client-search@>= 4.9.1 < 6".
warning "@docsearch/react > @algolia/autocomplete-core > @algolia/autocomplete-plugin-algolia-insights@1.9.3" has unmet peer dependency "search-insights@>= 1 < 3".
warning "@docsearch/react > @algolia/autocomplete-core > @algolia/autocomplete-shared@1.9.3" has unmet peer dependency "@algolia/client-search@>= 4.9.1 < 6".

Any plans to fix this?