Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement search v1 endpoint #2256

Merged
merged 8 commits into from
May 15, 2021
Merged

feat: implement search v1 endpoint #2256

merged 8 commits into from
May 15, 2021

Conversation

juanpicado
Copy link
Member

@juanpicado juanpicado commented May 14, 2021

Enable npm search v1 endpoint support by default

  • The npm search is able to use two endpoints, the /-all/ and the v1. Unfortunately npm 7 dropped /-/all support and requires v1. This PR add support for v1 .

  • npm6 or minor will try to hit v1 and if get 404 will fallback to /-/all endpoint.

  • Check for allow_access peer package (if you are using a plugin will ask for every package, even uplinks)

  • The experiment search has been removed and v1 is enabled by default.

  • Finish v1 search implementation

  • Add test

  • Add missing security layer

  • Support /-/all and v1 at the same time

  • Add CLI test

  • Remove search experiment

Disclaimer

  • The endpoint combines local packages and uplinks, eliminate duplicates and give priority to the ones fetched from uplinks (this could be improved in the next release)
  • Uplinks cannot be skipped (this could be improved in the future)
  • If the uplinks fails, the endpoint will return 0 results, (this could be improved in the future)

How to use

npm search react --registry http://localhost:4873       
NAME                      | DESCRIPTION          | AUTHOR          | DATE       | VERSION  | KEYWORDS
react                     | React is a…          | =sebmarkbage…   | 2021-03-22 | 17.0.2   | react   
react-dom                 | React package for…   | =sebmarkbage…   | 2021-03-22 | 17.0.2   | react
eslint-plugin-react       | React specific…      | =yannickcr…     | 2021-04-08 | 7.23.2   | eslint eslint-plu
react-draggable           | React draggable…     | =mzabriskie…    | 2020-06-08 | 4.4.3    | react draggable r
react-select              | A Select control…    | =jedwatson…     | 2021-05-11 | 4.3.1    | combobox form inp
react-redux               | Official React…      | =gaearon…       | 2021-04-24 | 7.2.4    | react reactjs red
react-popper              | Official library to… | =fezvrasta…     | 2021-03-25 | 2.2.5    | react react-poppe
react-dropzone            | Simple HTML5…        | =rolandjitsu…   | 2021-03-26 | 11.3.2   | react-component r
react-color               | A Collection of…     | =case           | 2020-10-28 | 2.19.3   | react color picke
react-scripts             | Configuration and…   | =gaearon =fb…   | 2021-02-22 | 4.0.3    | 
react-table               | Hooks for building…  | =tannerlinsley  | 2021-04-25 | 7.7.0    | react table react
react-toastify            | React notification…  | =sniphpet       | 2021-04-23 | 7.0.4    | react notificatio
react-ga                  | React Google…        | =simeonc…       | 2020-11-21 | 3.3.0    | React GA Google A
react-transition-group    | A react component…   | =monastic.panic | 2020-05-06 | 4.4.1    | react transition 
react-native-svg          | SVG library for…     | =brentvatne…    | 2021-04-16 | 12.1.1   | react-component r
babel-preset-react-app    | Babel preset used…   | =gaearon =fb…   | 2020-10-23 | 10.0.0   | 
@types/react-dev-utils    | TypeScript…          | =undefined      | prehistoric |          | 
@types/react-dom          | TypeScript…          | =undefined      | prehistoric |          | 
@types/react-inspector    | TypeScript…          | =undefined      | prehistoric |          | 
@types/react-syntax-highl | TypeScript…          | =undefined      | prehistoric |          | 
ighter          

@juanpicado
Copy link
Member Author

cc: @favoyang

@juanpicado
Copy link
Member Author

Feedback is welcome (using npm7)

docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio:search-v1

@favoyang
Copy link
Contributor

It seems just adding the access control #1839 for v1 search. Looks to me now.

@juanpicado juanpicado marked this pull request as ready for review May 15, 2021 14:29
Verdaccio 5 automation moved this from In progress to Reviewer approved May 15, 2021
@juanpicado juanpicado added this to the 5.x milestone May 15, 2021
@juanpicado juanpicado merged commit 251bd95 into 5.x May 15, 2021
Verdaccio 5 automation moved this from Reviewer approved to Done May 15, 2021
@delete-merged-branch delete-merged-branch bot deleted the search-v1 branch May 15, 2021 14:39
@juanpicado
Copy link
Member Author

Note: We need to copy this logic to master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Verdaccio 5
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants