Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

feat: api provider and config provider#608

Merged
juanpicado merged 17 commits intomasterfrom
refactor_api
Mar 19, 2021
Merged

feat: api provider and config provider#608
juanpicado merged 17 commits intomasterfrom
refactor_api

Conversation

@juanpicado
Copy link
Copy Markdown
Member

@juanpicado juanpicado commented Mar 13, 2021

Description:

<AppConfigurationContext>
  <APIProvider>
     ---> The test of the App <--- <App />
  </APIProvider>
</AppConfigurationContext>

Introduce two new providers,

  • Add base html tag thus webpack is able to handle properly the routing
  • the AppConfigurationContext which holds the variables which are embedded at the html, then using
    const { configOptions } = useConfig(); via context can easily access each property.
  • the APIProvider which provides all API methods, one single place to rule all request instead have different references to API in different files eg: const { callDetailPage, callReadme } = useAPI();.
  • Unique global window.__VERDACCIO_BASENAME_UI_OPTIONS to rule all options, remove old global variables
  • Improve validations (specially for theme primary color, material ui crash otherwise)

This is part of verdaccio/verdaccio#2122

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 13, 2021

Codecov Report

Merging #608 (52c00ff) into master (cf283d3) will decrease coverage by 0.13%.
The diff coverage is 77.89%.

@@            Coverage Diff             @@
##           master     #608      +/-   ##
==========================================
- Coverage   79.53%   79.39%   -0.14%     
==========================================
  Files         165      167       +2     
  Lines        1285     1330      +45     
  Branches      233      227       -6     
==========================================
+ Hits         1022     1056      +34     
- Misses        223      232       +9     
- Partials       40       42       +2     
Impacted Files Coverage Δ
i18n/config.ts 66.66% <ø> (-33.34%) ⬇️
src/App/AppContext.ts 100.00% <ø> (ø)
src/App/Header/HeaderRight.tsx 79.16% <ø> (ø)
src/pages/home/PackageList/Package/styles.ts 70.00% <ø> (-2.00%) ⬇️
src/utils/login.ts 100.00% <ø> (ø)
src/utils/test-react-testing-library.tsx 100.00% <ø> (ø)
src/utils/url.ts 15.78% <ø> (-4.22%) ⬇️
src/components/ActionBar/ActionBarAction.tsx 64.28% <40.00%> (-13.50%) ⬇️
src/App/AppContextProvider.tsx 88.88% <50.00%> (-11.12%) ⬇️
src/App/Header/LoginDialog/LoginDialog.tsx 74.07% <54.54%> (+30.32%) ⬆️
... and 25 more

@juanpicado juanpicado marked this pull request as ready for review March 14, 2021 07:06
@juanpicado juanpicado changed the title refactor: api provider and config provider feat: api provider and config provider Mar 14, 2021
@juanpicado juanpicado requested review from a team March 14, 2021 07:15
@priscilawebdev
Copy link
Copy Markdown
Contributor

priscilawebdev commented Mar 17, 2021

I left some suggestions, but you did a really great job 🚀

juanpicado and others added 7 commits March 18, 2021 07:19
Co-authored-by: Priscila Oliveira <priscilawebdev@gmail.com>
Co-authored-by: Priscila Oliveira <priscilawebdev@gmail.com>
Co-authored-by: Priscila Oliveira <priscilawebdev@gmail.com>
Co-authored-by: Priscila Oliveira <priscilawebdev@gmail.com>
Copy link
Copy Markdown
Contributor

@priscilawebdev priscilawebdev left a comment

Choose a reason for hiding this comment

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

lgtm Well done 👏

@juanpicado juanpicado merged commit a2e9969 into master Mar 19, 2021
@delete-merged-branch delete-merged-branch bot deleted the refactor_api branch March 19, 2021 18:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants