@verdaccio/ui-components 3.0.0-next.2 → 4.0.0-next-8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +1 -1
- package/CHANGELOG.md +85 -0
- package/build/AppTest/AppRoute.js +34 -0
- package/build/AppTest/pages/Front/Home.js +9 -0
- package/build/AppTest/pages/Front/index.js +14 -0
- package/build/AppTest/pages/Version/Version.js +34 -0
- package/build/AppTest/pages/Version/index.js +14 -0
- package/build/Theme/ResetStyles.js +2 -3
- package/build/Theme/StyleBaseline.js +2 -3
- package/build/Theme/ThemeProvider.js +3 -3
- package/build/Theme/colors.js +1 -2
- package/build/Theme/index.js +3 -3
- package/build/Theme/theme.js +17 -7
- package/build/__mocks__/react-markdown.js +1 -1
- package/build/components/ActionBar/ActionBar.js +8 -7
- package/build/components/ActionBar/ActionBarAction.js +13 -14
- package/build/components/ActionBar/index.js +1 -1
- package/build/components/Author/Author.js +15 -45
- package/build/components/Author/index.js +1 -1
- package/build/components/Author/styles.js +3 -5
- package/build/components/CopyClipboard/CopyToClipBoard.js +2 -3
- package/build/components/CopyClipboard/index.js +1 -1
- package/build/components/CopyClipboard/utils.js +3 -12
- package/build/components/Dependencies/Dependencies.js +31 -58
- package/build/components/Dependencies/DependencyBlock.js +102 -0
- package/build/components/Dependencies/index.js +1 -1
- package/build/components/Dependencies/utits.js +10 -0
- package/build/components/Deprecated/Deprecated.js +2 -3
- package/build/components/Deprecated/index.js +1 -1
- package/build/components/Developers/DeveloperType.js +12 -0
- package/build/components/Developers/Developers.js +26 -32
- package/build/components/Developers/Title.js +7 -13
- package/build/components/Developers/get-unique-developer-values.js +1 -2
- package/build/components/Developers/index.js +4 -4
- package/build/components/Distribution/Dist.js +3 -4
- package/build/components/Distribution/index.js +1 -1
- package/build/components/Distribution/styles.js +14 -31
- package/build/components/Engines/Engines.js +10 -5
- package/build/components/Engines/index.js +1 -1
- package/build/components/Engines/styles.js +9 -11
- package/build/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/build/components/ErrorBoundary/index.js +1 -1
- package/build/components/Forbidden/Forbidden.js +75 -0
- package/build/components/Forbidden/index.js +14 -0
- package/build/components/FundButton/FundButton.js +11 -13
- package/build/components/FundButton/index.js +1 -1
- package/build/components/HeaderInfoDialog/HeaderInfoDialog.js +5 -5
- package/build/components/HeaderInfoDialog/index.js +1 -1
- package/build/components/Heading/Heading.js +5 -6
- package/build/components/Heading/index.js +1 -1
- package/build/components/Help/Help.js +4 -5
- package/build/components/Help/index.js +1 -1
- package/build/components/Help/styles.js +2 -3
- package/build/components/Icons/DevsIcons/CommonJS.js +2 -13
- package/build/components/Icons/DevsIcons/ES6Module.js +3 -14
- package/build/components/Icons/DevsIcons/Git.js +2 -13
- package/build/components/Icons/DevsIcons/NodeJS.js +2 -13
- package/build/components/Icons/DevsIcons/TypeScript.js +2 -13
- package/build/components/Icons/Earth.js +3 -4
- package/build/components/Icons/FileBinary.js +14 -9
- package/build/components/Icons/Law.js +15 -10
- package/build/components/Icons/License.js +3 -4
- package/build/components/Icons/License.js.map +1 -1
- package/build/components/Icons/Managers/Npm.js +2 -13
- package/build/components/Icons/Managers/Pnpm.js +2 -13
- package/build/components/Icons/Managers/Yarn.js +2 -13
- package/build/components/Icons/SvgIcon.js +3 -4
- package/build/components/Icons/Time.js +3 -4
- package/build/components/Icons/Version.js +3 -4
- package/build/components/Install/Install.js +30 -26
- package/build/components/Install/InstallListItem.js +22 -23
- package/build/components/Install/index.js +1 -1
- package/build/components/Keywords/KeywordListItems.js +34 -0
- package/build/components/Keywords/Keywords.js +39 -0
- package/build/components/Keywords/index.js +14 -0
- package/build/components/Label/Label.js +3 -4
- package/build/components/Label/index.js +1 -1
- package/build/components/Link/Link.js +5 -19
- package/build/components/Link/index.js +2 -2
- package/build/components/LinkExternal/LinkExternal.js +32 -0
- package/build/components/LinkExternal/index.js +14 -0
- package/build/components/Loading/Loading.js +2 -3
- package/build/components/Loading/Spinner/Spinner.js +2 -3
- package/build/components/Loading/Spinner/index.js +1 -1
- package/build/components/Loading/index.js +1 -1
- package/build/components/Loading/styles.js +6 -7
- package/build/components/LoginDialog/LoginDialog.js +16 -6
- package/build/components/LoginDialog/LoginDialogCloseButton.js +5 -5
- package/build/components/LoginDialog/LoginDialogForm.js +7 -20
- package/build/components/LoginDialog/LoginDialogFormError.js +7 -7
- package/build/components/LoginDialog/LoginDialogHeader.js +2 -3
- package/build/components/LoginDialog/index.js +1 -1
- package/build/components/Logo/Logo.js +15 -9
- package/build/components/Logo/index.js +1 -1
- package/build/components/MenuItem/MenuItem.js +5 -6
- package/build/components/MenuItem/index.js +1 -1
- package/build/components/NoItems/NoItems.js +2 -3
- package/build/components/NoItems/index.js +1 -1
- package/build/components/NotFound/NotFound.js +20 -19
- package/build/components/NotFound/index.js +1 -1
- package/build/components/Package/Package.js +48 -40
- package/build/components/Package/index.js +2 -2
- package/build/components/Package/styles.js +59 -84
- package/build/components/PackageList/PackageList.js +2 -3
- package/build/components/PackageList/index.js +1 -1
- package/build/components/Person/Person.js +48 -0
- package/build/components/Person/PersonTooltip.js +22 -0
- package/build/components/Person/index.js +14 -0
- package/build/components/Person/utils.js +17 -0
- package/build/components/RawViewer/RawViewer.js +13 -8
- package/build/components/RawViewer/index.js +1 -1
- package/build/components/Readme/Readme.js +46 -11
- package/build/components/Readme/Readme.js.map +1 -1
- package/build/components/Readme/Readme.spec.js +20 -1
- package/build/components/Readme/Readme.spec.js.map +1 -1
- package/build/components/Readme/{github-markdown-dark.css → github-markdown.css} +266 -83
- package/build/components/Readme/index.js +1 -1
- package/build/components/Readme/utils.js +14 -17
- package/build/components/RegistryInfoDialog/RegistryInfoDialog.js +2 -3
- package/build/components/RegistryInfoDialog/index.js +1 -1
- package/build/components/RegistryInfoDialog/styles.js +13 -17
- package/build/components/Repository/Repository.js +23 -36
- package/build/components/Repository/index.js +1 -1
- package/build/components/Search/AutoComplete/AutoComplete.js +4 -5
- package/build/components/Search/AutoComplete/index.js +1 -1
- package/build/components/Search/AutoComplete/styles.js +6 -45
- package/build/components/Search/Search.js +11 -10
- package/build/components/Search/SearchItem.js +56 -45
- package/build/components/Search/index.js +1 -1
- package/build/components/Search/styles.js +3 -5
- package/build/components/Search/utils.js +23 -0
- package/build/components/SettingsMenu/SettingsMenu.js +36 -11
- package/build/components/SettingsMenu/index.js +1 -1
- package/build/components/SideBarTitle/SideBarTitle.js +104 -0
- package/build/components/SideBarTitle/index.js +14 -0
- package/build/components/{SideBarTittle → SideBarTitle}/utils.js +2 -3
- package/build/components/TextField/TextField.js +5 -6
- package/build/components/TextField/index.js +1 -1
- package/build/components/UpLinks/UpLinks.js +37 -9
- package/build/components/UpLinks/UplinkLink.js +22 -0
- package/build/components/UpLinks/index.js +1 -1
- package/build/components/UpLinks/styles.js +9 -11
- package/build/components/Versions/HistoryList.js +32 -26
- package/build/components/Versions/TagList.js +10 -7
- package/build/components/Versions/Versions.js +69 -16
- package/build/components/Versions/index.js +1 -1
- package/build/components/Versions/styles.js +3 -5
- package/build/hooks/index.js +1 -1
- package/build/hooks/useLocalStorage.js +1 -2
- package/build/hooks/useOnClickOutside.js +1 -2
- package/build/index.js +40 -8
- package/build/layouts/Version/Version.js +2 -3
- package/build/layouts/Version/index.js +1 -1
- package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +5 -5
- package/build/providers/AppConfigurationProvider/index.js +2 -2
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +5 -5
- package/build/providers/PersistenceSettingProvider/index.js +2 -2
- package/build/providers/TranslatorProvider/TranslatorProvider.js +4 -5
- package/build/providers/TranslatorProvider/TranslatorProvider.spec.js +3 -3
- package/build/providers/TranslatorProvider/index.js +2 -2
- package/build/providers/VersionProvider/VersionProvider.js +5 -7
- package/build/providers/VersionProvider/index.js +2 -2
- package/build/sections/Detail/ContainerContent.js +5 -7
- package/build/sections/Detail/Detail.js +13 -11
- package/build/sections/Detail/ReadmeSection.js +2 -3
- package/build/sections/Detail/Tabs.js +6 -8
- package/build/sections/Detail/index.js +1 -1
- package/build/sections/Footer/Footer.js +39 -11
- package/build/sections/Footer/index.js +1 -1
- package/build/sections/Footer/styles.js +19 -21
- package/build/sections/Header/Header.js +4 -5
- package/build/sections/Header/HeaderGreetings.js +2 -3
- package/build/sections/Header/HeaderLeft.js +16 -20
- package/build/sections/Header/HeaderMenu.js +3 -4
- package/build/sections/Header/HeaderRight.js +16 -8
- package/build/sections/Header/HeaderSettingsDialog.js +6 -10
- package/build/sections/Header/HeaderToolTip.js +2 -3
- package/build/sections/Header/HeaderToolTipIcon.js +4 -5
- package/build/sections/Header/LanguageSwitch.js +10 -13
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +14 -24
- package/build/sections/Header/RegistryInfoContent/index.js +1 -1
- package/build/sections/Header/RegistryInfoContent/styles.js +3 -5
- package/build/sections/Header/index.js +1 -1
- package/build/sections/Header/styles.js +54 -106
- package/build/sections/Home/Home.js +4 -5
- package/build/sections/Home/index.js +1 -1
- package/build/sections/SideBar/Sidebar.js +23 -30
- package/build/sections/SideBar/index.js +1 -1
- package/build/sections/index.js +1 -1
- package/build/src/AppTest/App.stories.d.ts +8 -0
- package/build/src/AppTest/AppRoute.d.ts +3 -0
- package/build/src/AppTest/pages/Front/Home.d.ts +2 -0
- package/build/src/AppTest/pages/Front/index.d.ts +1 -0
- package/build/src/AppTest/pages/Version/Version.d.ts +3 -0
- package/build/src/AppTest/pages/Version/index.d.ts +1 -0
- package/build/src/Theme/ThemeProvider.test.d.ts +1 -0
- package/build/src/components/Author/Author.d.ts +0 -5
- package/build/src/components/CopyClipboard/CopyToClipBoard.test.d.ts +1 -0
- package/build/src/components/Dependencies/DependencyBlock.d.ts +16 -0
- package/build/src/components/Dependencies/DependencyBlock.test.d.ts +1 -0
- package/build/src/components/Dependencies/utits.d.ts +3 -0
- package/build/src/components/Developers/DeveloperType.d.ts +4 -0
- package/build/src/components/Developers/Developers.d.ts +1 -4
- package/build/src/components/Developers/Title.d.ts +1 -4
- package/build/src/components/Developers/index.d.ts +2 -1
- package/build/src/components/Distribution/styles.d.ts +0 -1
- package/build/src/components/ErrorBoundary/ErrorBoundary.test.d.ts +1 -0
- package/build/src/components/Forbidden/Forbidden.d.ts +3 -0
- package/build/src/components/Forbidden/Forbidden.test.d.ts +1 -0
- package/build/src/components/Forbidden/index.d.ts +1 -0
- package/build/src/components/HeaderInfoDialog/HeaderInfoDialog.test.d.ts +1 -0
- package/build/src/components/Heading/Heading.test.d.ts +1 -0
- package/build/src/components/Icons/Icons.test.d.ts +1 -0
- package/build/src/components/Install/InstallListItem.d.ts +1 -1
- package/build/src/components/Keywords/KeywordListItems.d.ts +5 -0
- package/build/src/components/Keywords/Keywords.d.ts +6 -0
- package/build/src/components/Keywords/Keywords.stories.d.ts +5 -0
- package/build/src/components/Keywords/Keywords.test.d.ts +1 -0
- package/build/src/components/Keywords/index.d.ts +1 -0
- package/build/src/components/Link/Link.d.ts +0 -3
- package/build/src/components/Link/Link.test.d.ts +1 -0
- package/build/src/components/Link/index.d.ts +1 -1
- package/build/src/components/LinkExternal/LinkExternal.d.ts +3 -0
- package/build/src/components/LinkExternal/LinkExternal.test.d.ts +1 -0
- package/build/src/components/LinkExternal/index.d.ts +1 -0
- package/build/src/components/Loading/styles.d.ts +2 -2
- package/build/src/components/Logo/Logo.d.ts +1 -0
- package/build/src/components/Logo/Logo.stories.d.ts +5 -0
- package/build/src/components/Package/Package.d.ts +1 -1
- package/build/src/components/Package/styles.d.ts +7 -15
- package/build/src/components/Person/Person.d.ts +9 -0
- package/build/src/components/Person/Person.test.d.ts +1 -0
- package/build/src/components/Person/PersonTooltip.d.ts +6 -0
- package/build/src/components/Person/index.d.ts +1 -0
- package/build/src/components/Person/utils.d.ts +3 -0
- package/build/src/components/Readme/Readme.d.ts +1 -1
- package/build/src/components/RegistryInfoDialog/styles.d.ts +1 -1
- package/build/src/components/Search/AutoComplete/styles.d.ts +1 -9
- package/build/src/components/Search/SearchItem.d.ts +1 -1
- package/build/src/components/Search/utils.d.ts +1 -0
- package/build/src/components/SettingsMenu/SettingsMenu.d.ts +2 -2
- package/build/src/components/SettingsMenu/SettingsMenu.test.d.ts +1 -0
- package/build/src/components/SideBarTitle/index.d.ts +1 -0
- package/build/src/components/UpLinks/UplinkLink.d.ts +6 -0
- package/build/src/components/UpLinks/styles.d.ts +2 -2
- package/build/src/components/Versions/Versions.d.ts +1 -0
- package/build/src/components/Versions/styles.d.ts +2 -2
- package/build/src/index.d.ts +6 -2
- package/build/src/sections/Detail/Detail.stories.d.ts +1 -0
- package/build/src/sections/Detail/Tabs.d.ts +1 -0
- package/build/src/sections/Footer/styles.d.ts +5 -5
- package/build/src/sections/Header/RegistryInfoContent/RegistryInfoContent.d.ts +3 -3
- package/build/src/sections/Header/RegistryInfoContent/styles.d.ts +2 -2
- package/build/src/sections/Header/styles.d.ts +4 -11
- package/build/src/sections/Home/Home.test.d.ts +1 -0
- package/build/src/store/models/manifest.d.ts +11 -0
- package/build/src/store/models/routes.d.ts +8 -0
- package/build/src/store/models/utils.d.ts +1 -0
- package/build/src/types/packageMeta.d.ts +7 -5
- package/build/src/utils/__partials__/packageMeta.d.ts +0 -1
- package/build/src/utils/routes.d.ts +1 -0
- package/build/src/utils/utils.d.ts +1 -0
- package/build/store/api.js +14 -9
- package/build/store/index.js +1 -1
- package/build/store/models/configuration.js +4 -4
- package/build/store/models/download.js +2 -3
- package/build/store/models/index.js +1 -2
- package/build/store/models/login.js +7 -7
- package/build/store/models/manifest.js +27 -8
- package/build/store/models/packages.js +6 -5
- package/build/store/models/routes.js +18 -0
- package/build/store/models/search.js +7 -6
- package/build/store/models/utils.js +10 -0
- package/build/store/storage.js +2 -3
- package/build/store/store.js +2 -3
- package/build/test/i18n-config.js +2 -3
- package/build/test/test-react-testing-library.js +1 -1
- package/build/utils/__partials__/packageMeta.js +1 -3
- package/build/utils/index.js +3 -3
- package/build/utils/loadable.js +2 -2
- package/build/utils/routes.js +2 -2
- package/build/utils/token.js +1 -1
- package/build/utils/url.js +1 -1
- package/build/utils/utils.js +22 -4
- package/package.json +33 -32
- package/src/AppTest/App.stories.tsx +32 -0
- package/src/AppTest/AppRoute.test.tsx +65 -0
- package/src/AppTest/AppRoute.tsx +42 -0
- package/src/AppTest/pages/Front/Home.ts +3 -0
- package/src/AppTest/pages/Front/index.ts +1 -0
- package/src/AppTest/pages/Version/Version.tsx +28 -0
- package/src/AppTest/pages/Version/index.ts +1 -0
- package/src/Theme/ThemeProvider.test.tsx +27 -0
- package/src/Theme/theme.ts +12 -5
- package/src/components/ActionBar/ActionBar.test.tsx +36 -15
- package/src/components/ActionBar/ActionBar.tsx +1 -1
- package/src/components/ActionBar/ActionBarAction.tsx +8 -5
- package/src/components/Author/Author.test.tsx +7 -1
- package/src/components/Author/Author.tsx +3 -41
- package/src/components/CopyClipboard/CopyToClipBoard.test.tsx +23 -0
- package/src/components/CopyClipboard/utils.ts +2 -13
- package/src/components/Dependencies/Dependencies.stories.tsx +11 -11
- package/src/components/Dependencies/Dependencies.test.tsx +1 -11
- package/src/components/Dependencies/Dependencies.tsx +30 -69
- package/src/components/Dependencies/DependencyBlock.test.tsx +46 -0
- package/src/components/Dependencies/DependencyBlock.tsx +83 -0
- package/src/components/Dependencies/utits.ts +3 -0
- package/src/components/Developers/DeveloperType.tsx +4 -0
- package/src/components/Developers/Developers.test.tsx +37 -10
- package/src/components/Developers/Developers.tsx +13 -13
- package/src/components/Developers/Title.tsx +1 -5
- package/src/components/Developers/index.ts +2 -1
- package/src/components/Distribution/Dist.test.tsx +1 -1
- package/src/components/Distribution/Dist.tsx +2 -4
- package/src/components/Distribution/styles.ts +0 -6
- package/src/components/Engines/Engines.tsx +6 -2
- package/src/components/Engines/styles.ts +1 -1
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +39 -0
- package/src/components/Forbidden/Forbidden.test.tsx +38 -0
- package/src/components/Forbidden/Forbidden.tsx +56 -0
- package/src/components/Forbidden/index.ts +1 -0
- package/src/components/FundButton/FundButton.tsx +5 -5
- package/src/components/HeaderInfoDialog/HeaderInfoDialog.test.tsx +51 -0
- package/src/components/HeaderInfoDialog/HeaderInfoDialog.tsx +2 -2
- package/src/components/Heading/Heading.test.tsx +20 -0
- package/src/components/Help/Help.test.tsx +10 -3
- package/src/components/Icons/DevsIcons/CommonJS.tsx +1 -7
- package/src/components/Icons/DevsIcons/ES6Module.tsx +2 -8
- package/src/components/Icons/DevsIcons/Git.tsx +1 -7
- package/src/components/Icons/DevsIcons/NodeJS.tsx +1 -7
- package/src/components/Icons/DevsIcons/TypeScript.tsx +1 -7
- package/src/components/Icons/FileBinary.tsx +2 -1
- package/src/components/Icons/Icons.stories.tsx +21 -5
- package/src/components/Icons/Icons.test.tsx +70 -0
- package/src/components/Icons/Law.tsx +2 -1
- package/src/components/Icons/Managers/Npm.tsx +1 -7
- package/src/components/Icons/Managers/Pnpm.tsx +1 -7
- package/src/components/Icons/Managers/Yarn.tsx +1 -7
- package/src/components/Install/Install.test.tsx +54 -13
- package/src/components/Install/Install.tsx +12 -11
- package/src/components/Install/InstallListItem.tsx +15 -13
- package/src/components/Keywords/KeywordListItems.tsx +22 -0
- package/src/components/Keywords/Keywords.stories.tsx +19 -0
- package/src/components/Keywords/Keywords.test.tsx +57 -0
- package/src/components/Keywords/Keywords.tsx +35 -0
- package/src/components/Keywords/index.ts +1 -0
- package/src/components/Link/Link.test.tsx +25 -0
- package/src/components/Link/Link.tsx +4 -18
- package/src/components/Link/index.ts +1 -1
- package/src/components/LinkExternal/LinkExternal.test.tsx +18 -0
- package/src/components/LinkExternal/LinkExternal.tsx +22 -0
- package/src/components/LinkExternal/index.ts +1 -0
- package/src/components/Loading/Loading.test.tsx +8 -4
- package/src/components/Loading/styles.ts +1 -0
- package/src/components/LoginDialog/LoginDialog.test.tsx +1 -1
- package/src/components/LoginDialog/LoginDialog.tsx +10 -1
- package/src/components/LoginDialog/LoginDialogCloseButton.tsx +1 -0
- package/src/components/LoginDialog/LoginDialogForm.tsx +0 -2
- package/src/components/LoginDialog/LoginDialogFormError.tsx +1 -1
- package/src/components/Logo/Logo.stories.tsx +16 -0
- package/src/components/Logo/Logo.test.tsx +8 -1
- package/src/components/Logo/Logo.tsx +19 -3
- package/src/components/NotFound/NotFound.tsx +6 -5
- package/src/components/NotFound/Notfound.test.tsx +6 -3
- package/src/components/Package/Package.test.tsx +47 -14
- package/src/components/Package/Package.tsx +41 -44
- package/src/components/Package/styles.ts +7 -17
- package/src/components/PackageList/Packagelist.test.tsx +1 -0
- package/src/components/Person/Person.test.tsx +50 -0
- package/src/components/Person/Person.tsx +45 -0
- package/src/components/Person/PersonTooltip.tsx +26 -0
- package/src/components/Person/index.ts +1 -0
- package/src/components/Person/utils.ts +20 -0
- package/src/components/RawViewer/RawViewer.tsx +8 -4
- package/src/components/Readme/Readme.spec.tsx +17 -0
- package/src/components/Readme/Readme.tsx +34 -7
- package/src/components/Readme/{github-markdown-dark.css → github-markdown.css} +266 -83
- package/src/components/Readme/utils.ts +15 -14
- package/src/components/RegistryInfoDialog/styles.ts +5 -4
- package/src/components/Repository/Repository.tsx +10 -17
- package/src/components/Search/AutoComplete/AutoComplete.tsx +1 -1
- package/src/components/Search/AutoComplete/styles.ts +7 -0
- package/src/components/Search/Search.test.tsx +38 -11
- package/src/components/Search/Search.tsx +4 -2
- package/src/components/Search/SearchItem.tsx +19 -8
- package/src/components/Search/utils.ts +17 -0
- package/src/components/SettingsMenu/SettingsMenu.test.tsx +41 -0
- package/src/components/SettingsMenu/SettingsMenu.tsx +48 -10
- package/src/components/{SideBarTittle/SideBarTittle.tsx → SideBarTitle/SideBarTitle.tsx} +19 -3
- package/src/components/SideBarTitle/index.ts +1 -0
- package/src/components/UpLinks/UpLinks.test.tsx +7 -0
- package/src/components/UpLinks/UpLinks.tsx +38 -15
- package/src/components/UpLinks/UplinkLink.tsx +20 -0
- package/src/components/UpLinks/styles.ts +1 -0
- package/src/components/Versions/HistoryList.tsx +11 -6
- package/src/components/Versions/TagList.tsx +4 -3
- package/src/components/Versions/Versions.test.tsx +26 -8
- package/src/components/Versions/Versions.tsx +81 -28
- package/src/index.ts +6 -2
- package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +1 -0
- package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +2 -0
- package/src/providers/VersionProvider/VersionProvider.test.tsx +3 -3
- package/src/sections/Detail/Detail.stories.tsx +10 -0
- package/src/sections/Detail/Detail.test.tsx +8 -1
- package/src/sections/Detail/Detail.tsx +11 -4
- package/src/sections/Detail/Tabs.tsx +6 -9
- package/src/sections/Footer/Footer.tsx +26 -12
- package/src/sections/Footer/styles.ts +4 -0
- package/src/sections/Header/Header.test.tsx +12 -10
- package/src/sections/Header/HeaderLeft.tsx +19 -11
- package/src/sections/Header/HeaderMenu.tsx +1 -1
- package/src/sections/Header/HeaderRight.tsx +14 -3
- package/src/sections/Header/HeaderSettingsDialog.tsx +2 -3
- package/src/sections/Header/LanguageSwitch.tsx +10 -7
- package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -1
- package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.tsx +2 -7
- package/src/sections/Header/styles.ts +4 -16
- package/src/sections/Home/Home.test.tsx +37 -0
- package/src/sections/Home/Home.tsx +0 -1
- package/src/sections/SideBar/Sidebar.test.tsx +52 -84
- package/src/sections/SideBar/Sidebar.tsx +11 -26
- package/src/store/api.test.ts +19 -2
- package/src/store/api.ts +13 -6
- package/src/store/models/configuration.ts +2 -1
- package/src/store/models/login.ts +10 -12
- package/src/store/models/manifest.ts +25 -6
- package/src/store/models/packages.ts +4 -5
- package/src/store/models/routes.ts +10 -0
- package/src/store/models/search.ts +4 -2
- package/src/store/models/utils.ts +3 -0
- package/src/types/packageMeta.ts +7 -5
- package/src/utils/__partials__/packageMeta.ts +0 -1
- package/src/utils/routes.ts +1 -0
- package/src/utils/utils.test.ts +34 -0
- package/src/utils/utils.ts +20 -5
- package/tsconfig.json +1 -1
- package/build/components/Dependencies/styles.js +0 -68
- package/build/components/Developers/styles.js +0 -69
- package/build/components/Distribution/utils.js +0 -25
- package/build/components/Distribution/utilts.spec.js +0 -18
- package/build/components/Package/Tag/Tag.js +0 -15
- package/build/components/Package/Tag/index.js +0 -14
- package/build/components/Package/Tag/styles.js +0 -25
- package/build/components/Readme/ReadmeDark.js +0 -46
- package/build/components/Readme/ReadmeLight.js +0 -46
- package/build/components/Readme/github-markdown-light.css +0 -1014
- package/build/components/SideBarTittle/SideBarTittle.js +0 -95
- package/build/components/SideBarTittle/index.js +0 -14
- package/build/sections/Header/RegistryInfoDialog/RegistryInfoDialog.js +0 -37
- package/build/sections/Header/RegistryInfoDialog/index.js +0 -14
- package/build/sections/Header/RegistryInfoDialog/styles.js +0 -49
- package/build/sections/Header/RegistryInfoDialog/types.js +0 -6
- package/build/src/components/Dependencies/styles.d.ts +0 -8
- package/build/src/components/Developers/styles.d.ts +0 -11
- package/build/src/components/Distribution/utils.d.ts +0 -7
- package/build/src/components/Package/Tag/Tag.d.ts +0 -6
- package/build/src/components/Package/Tag/index.d.ts +0 -1
- package/build/src/components/Package/Tag/styles.d.ts +0 -5
- package/build/src/components/Readme/ReadmeDark.d.ts +0 -5
- package/build/src/components/Readme/ReadmeLight.d.ts +0 -5
- package/build/src/components/SideBarTittle/index.d.ts +0 -1
- package/build/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.d.ts +0 -4
- package/build/src/sections/Header/RegistryInfoDialog/index.d.ts +0 -1
- package/build/src/sections/Header/RegistryInfoDialog/styles.d.ts +0 -13
- package/build/src/sections/Header/RegistryInfoDialog/types.d.ts +0 -7
- package/src/components/Dependencies/styles.ts +0 -26
- package/src/components/Developers/styles.ts +0 -31
- package/src/components/Distribution/utils.ts +0 -32
- package/src/components/Distribution/utilts.spec.ts +0 -17
- package/src/components/Package/Tag/Tag.test.tsx +0 -15
- package/src/components/Package/Tag/Tag.tsx +0 -11
- package/src/components/Package/Tag/index.ts +0 -1
- package/src/components/Package/Tag/styles.ts +0 -11
- package/src/components/Readme/ReadmeDark.tsx +0 -32
- package/src/components/Readme/ReadmeLight.tsx +0 -32
- package/src/components/Readme/github-markdown-light.css +0 -1014
- package/src/components/Search/AutoComplete/styles.tsx +0 -42
- package/src/components/SideBarTittle/index.ts +0 -1
- package/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +0 -31
- package/src/sections/Header/RegistryInfoDialog/index.ts +0 -1
- package/src/sections/Header/RegistryInfoDialog/styles.ts +0 -21
- package/src/sections/Header/RegistryInfoDialog/types.ts +0 -8
- /package/build/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
- /package/build/src/{components/Package/Tag/Tag.test.d.ts → AppTest/AppRoute.test.d.ts} +0 -0
- /package/build/src/components/{SideBarTittle/SideBarTittle.d.ts → SideBarTitle/SideBarTitle.d.ts} +0 -0
- /package/build/src/components/{SideBarTittle/SideBarTittle.stories.d.ts → SideBarTitle/SideBarTitle.stories.d.ts} +0 -0
- /package/build/src/components/{SideBarTittle → SideBarTitle}/utils.d.ts +0 -0
- /package/src/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
- /package/src/components/{SideBarTittle/SideBarTittle.stories.tsx → SideBarTitle/SideBarTitle.stories.tsx} +0 -0
- /package/src/components/{SideBarTittle → SideBarTitle}/utils.ts +0 -0
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Toolbar from '@mui/material/Toolbar';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Link } from 'react-router-dom';
|
|
3
|
+
import { Link as RouterLink } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
import { Logo, Search } from '../../';
|
|
6
|
-
import {
|
|
6
|
+
import { SearchWrapper } from './styles';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
showSearch?: boolean;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const StyledLink = styled(Link)({
|
|
13
|
-
marginRight: '1em',
|
|
14
|
-
});
|
|
15
|
-
|
|
16
12
|
const HeaderLeft: React.FC<Props> = ({ showSearch }) => (
|
|
17
|
-
<
|
|
18
|
-
|
|
13
|
+
<Toolbar
|
|
14
|
+
sx={{
|
|
15
|
+
display: 'flex',
|
|
16
|
+
padding: 0,
|
|
17
|
+
marginLeft: 1,
|
|
18
|
+
flex: 1,
|
|
19
|
+
'@media (min-width: 600px)': {
|
|
20
|
+
padding: 0,
|
|
21
|
+
marginLeft: 1,
|
|
22
|
+
marginRight: '20px',
|
|
23
|
+
},
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<RouterLink to={'/'}>
|
|
19
27
|
<Logo />
|
|
20
|
-
</
|
|
28
|
+
</RouterLink>
|
|
21
29
|
{showSearch && (
|
|
22
30
|
<SearchWrapper data-testid="search-container">
|
|
23
31
|
<Search />
|
|
24
32
|
</SearchWrapper>
|
|
25
33
|
)}
|
|
26
|
-
</
|
|
34
|
+
</Toolbar>
|
|
27
35
|
);
|
|
28
36
|
|
|
29
37
|
export default HeaderLeft;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import Button from '@mui/material/Button';
|
|
2
|
+
import Toolbar from '@mui/material/Toolbar';
|
|
2
3
|
import React, { MouseEvent, useEffect, useState } from 'react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
|
|
5
6
|
import { useCustomTheme } from '../../';
|
|
6
7
|
import HeaderMenu from './HeaderMenu';
|
|
7
8
|
import HeaderToolTip from './HeaderToolTip';
|
|
8
|
-
import { RightSide } from './styles';
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
showSearch?: boolean;
|
|
@@ -75,7 +75,18 @@ const HeaderRight: React.FC<Props> = ({
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
return (
|
|
78
|
-
<
|
|
78
|
+
<Toolbar
|
|
79
|
+
data-testid="header-right"
|
|
80
|
+
sx={{
|
|
81
|
+
display: 'flex',
|
|
82
|
+
padding: 0,
|
|
83
|
+
marginRight: 0,
|
|
84
|
+
'@media (min-width: 600px)': {
|
|
85
|
+
padding: 0,
|
|
86
|
+
marginRight: 0,
|
|
87
|
+
},
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
79
90
|
{showSearch === true && (
|
|
80
91
|
<HeaderToolTip
|
|
81
92
|
onClick={onToggleMobileNav}
|
|
@@ -124,7 +135,7 @@ const HeaderRight: React.FC<Props> = ({
|
|
|
124
135
|
)}
|
|
125
136
|
</>
|
|
126
137
|
)}
|
|
127
|
-
</
|
|
138
|
+
</Toolbar>
|
|
128
139
|
);
|
|
129
140
|
};
|
|
130
141
|
|
|
@@ -7,12 +7,11 @@ import React from 'react';
|
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import ReactMarkdown from 'react-markdown';
|
|
9
9
|
import { useSelector } from 'react-redux';
|
|
10
|
-
import remarkGfm from 'remark-gfm';
|
|
11
10
|
|
|
12
11
|
import { RootState, Theme } from '../../';
|
|
12
|
+
import RegistryInfoDialog from '../../components/RegistryInfoDialog';
|
|
13
13
|
import LanguageSwitch from './LanguageSwitch';
|
|
14
14
|
import RegistryInfoContent from './RegistryInfoContent';
|
|
15
|
-
import RegistryInfoDialog from './RegistryInfoDialog';
|
|
16
15
|
|
|
17
16
|
interface Props {
|
|
18
17
|
isOpen: boolean;
|
|
@@ -71,7 +70,7 @@ const HeaderSettingsDialog: React.FC<Props> = ({ onCloseDialog, isOpen }) => {
|
|
|
71
70
|
<TabPanel index={1} value={value}>
|
|
72
71
|
<TextContent>{t('language.description')}</TextContent>
|
|
73
72
|
<LanguageSwitch />
|
|
74
|
-
<ReactMarkdown
|
|
73
|
+
<ReactMarkdown>{t('language.contribute')}</ReactMarkdown>
|
|
75
74
|
</TabPanel>
|
|
76
75
|
</Box>
|
|
77
76
|
</RegistryInfoDialog>
|
|
@@ -41,13 +41,16 @@ const LanguageContent = ({ translation, icon }) => (
|
|
|
41
41
|
|
|
42
42
|
const LanguageSwitch = () => {
|
|
43
43
|
const { language, setLanguage, listLanguages } = useLanguage();
|
|
44
|
-
const listConverted = listLanguages.reduce(
|
|
45
|
-
prev
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
const listConverted = listLanguages.reduce(
|
|
45
|
+
(prev, item) => {
|
|
46
|
+
prev[item.lng] = {
|
|
47
|
+
translation: item.menuKey,
|
|
48
|
+
icon: item.icon,
|
|
49
|
+
};
|
|
50
|
+
return prev;
|
|
51
|
+
},
|
|
52
|
+
{} as Record<string, { translation: string; icon: any }>
|
|
53
|
+
);
|
|
51
54
|
|
|
52
55
|
const [languages] = useState<string[]>(Object.keys(i18next.options?.resources || {}));
|
|
53
56
|
const { t } = useTranslation();
|
|
@@ -13,7 +13,7 @@ describe('<RegistryInfoContent /> component', () => {
|
|
|
13
13
|
expect(screen.getByText('packageManagers.description')).toBeInTheDocument();
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
test('should
|
|
16
|
+
test('should load the appropiate tab content when the tab is clicked', () => {
|
|
17
17
|
const props = { registryUrl: 'http://localhost:4872', scope: '@' };
|
|
18
18
|
render(<RegistryInfoContent registryUrl={props.registryUrl} scope={props.scope} />);
|
|
19
19
|
|
|
@@ -10,7 +10,6 @@ import makeStyles from '@mui/styles/makeStyles';
|
|
|
10
10
|
import React, { FC } from 'react';
|
|
11
11
|
import { useTranslation } from 'react-i18next';
|
|
12
12
|
import ReactMarkdown from 'react-markdown';
|
|
13
|
-
import remarkGfm from 'remark-gfm';
|
|
14
13
|
|
|
15
14
|
import {
|
|
16
15
|
CopyClipboard,
|
|
@@ -150,17 +149,13 @@ const RegistryInfoContent: FC<Props> = ({ scope, registryUrl }) => {
|
|
|
150
149
|
</AccordionSummary>
|
|
151
150
|
<AccordionDetails>
|
|
152
151
|
<Description>
|
|
153
|
-
<ReactMarkdown
|
|
154
|
-
{t('packageManagers.yarnclassicDetails')}
|
|
155
|
-
</ReactMarkdown>
|
|
152
|
+
<ReactMarkdown>{t('packageManagers.yarnclassicDetails')}</ReactMarkdown>
|
|
156
153
|
</Description>
|
|
157
154
|
<CommandContainer data-testid={'tab-content'}>
|
|
158
155
|
{renderYarnTab(scope, registryUrl)}
|
|
159
156
|
</CommandContainer>
|
|
160
157
|
<Description>
|
|
161
|
-
<ReactMarkdown
|
|
162
|
-
{t('packageManagers.yarnBerryDetails')}
|
|
163
|
-
</ReactMarkdown>
|
|
158
|
+
<ReactMarkdown>{t('packageManagers.yarnBerryDetails')}</ReactMarkdown>
|
|
164
159
|
</Description>
|
|
165
160
|
<CommandContainer data-testid={'tab-content'}>
|
|
166
161
|
{renderYarnBerryTab(scope, registryUrl)}
|
|
@@ -4,27 +4,18 @@ import AppBar from '@mui/material/AppBar';
|
|
|
4
4
|
import IconButton from '@mui/material/IconButton';
|
|
5
5
|
import Toolbar from '@mui/material/Toolbar';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Theme } from '../../Theme';
|
|
8
8
|
|
|
9
9
|
export const InnerNavBar = styled(Toolbar)({
|
|
10
10
|
justifyContent: 'space-between',
|
|
11
11
|
alignItems: 'center',
|
|
12
|
-
padding:
|
|
12
|
+
padding: 0,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export const Greetings = styled('span')({
|
|
16
16
|
margin: '0 5px 0 0',
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
export const RightSide = styled(Toolbar)({
|
|
20
|
-
display: 'flex',
|
|
21
|
-
padding: 0,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const LeftSide = styled(RightSide)({
|
|
25
|
-
flex: 1,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
19
|
export const MobileNavBar = styled('div')<{ theme?: Theme }>((props) => ({
|
|
29
20
|
alignItems: 'center',
|
|
30
21
|
display: 'flex',
|
|
@@ -50,6 +41,7 @@ export const SettingsButtom = styled(IconButton)({});
|
|
|
50
41
|
export const SearchWrapper = styled('div')({
|
|
51
42
|
display: 'none',
|
|
52
43
|
width: '100%',
|
|
44
|
+
marginLeft: 20,
|
|
53
45
|
});
|
|
54
46
|
|
|
55
47
|
export const NavBar = styled(AppBar)<{ theme?: Theme }>(({ theme }) => ({
|
|
@@ -83,7 +75,7 @@ export const NavBar = styled(AppBar)<{ theme?: Theme }>(({ theme }) => ({
|
|
|
83
75
|
`,
|
|
84
76
|
[`@media (min-width: ${theme?.breakPoints.large}px)`]: css`
|
|
85
77
|
${InnerNavBar} {
|
|
86
|
-
padding: 0
|
|
78
|
+
padding: 0 16px;
|
|
87
79
|
}
|
|
88
80
|
`,
|
|
89
81
|
[`@media (min-width: ${theme?.breakPoints.xlarge}px)`]: css`
|
|
@@ -94,7 +86,3 @@ export const NavBar = styled(AppBar)<{ theme?: Theme }>(({ theme }) => ({
|
|
|
94
86
|
}
|
|
95
87
|
`,
|
|
96
88
|
}));
|
|
97
|
-
|
|
98
|
-
export const StyledLink = styled(Link)<{ theme?: Theme }>(({ theme }) => ({
|
|
99
|
-
color: theme?.palette.white,
|
|
100
|
-
}));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MemoryRouter } from 'react-router';
|
|
3
|
+
|
|
4
|
+
import { store } from '../../store';
|
|
5
|
+
import { act, renderWithStore, screen, waitFor } from '../../test/test-react-testing-library';
|
|
6
|
+
import Home from './Home';
|
|
7
|
+
|
|
8
|
+
// force the windows to expand to display items
|
|
9
|
+
// https://github.com/bvaughn/react-virtualized/issues/493#issuecomment-640084107
|
|
10
|
+
jest.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockReturnValue(600);
|
|
11
|
+
jest.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600);
|
|
12
|
+
|
|
13
|
+
const ComponentHome: React.FC = () => (
|
|
14
|
+
<MemoryRouter>
|
|
15
|
+
<Home />
|
|
16
|
+
</MemoryRouter>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
describe('Home', () => {
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('should render titles', async () => {
|
|
25
|
+
act(() => {
|
|
26
|
+
renderWithStore(<ComponentHome />, store);
|
|
27
|
+
});
|
|
28
|
+
await waitFor(() => expect(screen.getAllByTestId('package-item-list')).toHaveLength(5));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('should render loading', async () => {
|
|
32
|
+
act(() => {
|
|
33
|
+
renderWithStore(<ComponentHome />, store);
|
|
34
|
+
});
|
|
35
|
+
await waitFor(() => expect(screen.getByTestId('loading')).toBeInTheDocument());
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -1,106 +1,74 @@
|
|
|
1
|
-
import { rest } from 'msw';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { MemoryRouter } from 'react-router';
|
|
4
3
|
|
|
5
|
-
import { server } from '../../../jest/server';
|
|
6
4
|
import { VersionProvider } from '../../providers';
|
|
7
5
|
import { store } from '../../store';
|
|
8
|
-
import { renderWithStore, waitFor } from '../../test/test-react-testing-library';
|
|
9
|
-
import
|
|
6
|
+
import { act, renderWithStore, screen, waitFor } from '../../test/test-react-testing-library';
|
|
7
|
+
import Sidebar from './Sidebar';
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
jest.mock('marked');
|
|
10
|
+
jest.mock('marked-highlight');
|
|
11
|
+
|
|
12
|
+
const ComponentSideBar: React.FC = () => (
|
|
12
13
|
<MemoryRouter>
|
|
13
14
|
<VersionProvider>
|
|
14
|
-
<
|
|
15
|
+
<Sidebar />
|
|
15
16
|
</VersionProvider>
|
|
16
17
|
</MemoryRouter>
|
|
17
18
|
);
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
jest.mock('react', () => {
|
|
21
|
-
const React = jest.requireActual('react');
|
|
22
|
-
React.Suspense = ({ children }) => children;
|
|
23
|
-
return React;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const packageMeta = {
|
|
27
|
-
_uplinks: {},
|
|
28
|
-
latest: {
|
|
29
|
-
name: 'verdaccio-ui/local-storage',
|
|
30
|
-
version: '8.0.1-next.1',
|
|
31
|
-
dist: {
|
|
32
|
-
fileCount: 0,
|
|
33
|
-
unpackedSize: 0,
|
|
34
|
-
tarball: 'http://localhost:8080/bootstrap/-/bootstrap-4.3.1.tgz',
|
|
35
|
-
},
|
|
36
|
-
homepage: 'https://verdaccio.org',
|
|
37
|
-
bugs: {
|
|
38
|
-
url: 'https://github.com/verdaccio/monorepo/issues',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// const detailContextValue = {
|
|
44
|
-
// packageName: 'foo',
|
|
45
|
-
// readMe: 'test',
|
|
46
|
-
// isLoading: false,
|
|
47
|
-
// hasNotBeenFound: false,
|
|
48
|
-
// packageMeta: ,
|
|
49
|
-
// };
|
|
20
|
+
const mockPkgName = jest.fn().mockReturnValue('jquery');
|
|
50
21
|
|
|
51
22
|
jest.mock('react-router-dom', () => ({
|
|
52
23
|
...jest.requireActual('react-router-dom'), // use actual for all non-hook parts
|
|
53
24
|
useParams: () => ({
|
|
54
|
-
package:
|
|
25
|
+
package: mockPkgName(),
|
|
55
26
|
}),
|
|
56
27
|
}));
|
|
57
28
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
);
|
|
68
|
-
// describe('DetailSidebar', () => {
|
|
69
|
-
test('should render commonjs module icon', async () => {
|
|
70
|
-
const { getByText } = renderWithStore(<ComponentToBeRendered />, store);
|
|
29
|
+
describe('Sidebar', () => {
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
jest.clearAllMocks();
|
|
32
|
+
});
|
|
33
|
+
test('should render titles', async () => {
|
|
34
|
+
act(() => {
|
|
35
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
36
|
+
});
|
|
37
|
+
await waitFor(() => expect(screen.getAllByText('jquery')).toHaveLength(2));
|
|
71
38
|
|
|
72
|
-
|
|
73
|
-
|
|
39
|
+
expect(screen.getByText(`sidebar.detail.latest-version`, { exact: false })).toBeInTheDocument();
|
|
40
|
+
expect(
|
|
41
|
+
screen.getByText(/sidebar.detail.published .*years? ago/i, { exact: false })
|
|
42
|
+
).toBeInTheDocument();
|
|
43
|
+
expect(screen.getByText(`sidebar.installation.title`, { exact: false })).toBeInTheDocument();
|
|
44
|
+
});
|
|
74
45
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// },
|
|
84
|
-
// })}
|
|
85
|
-
// />,
|
|
86
|
-
// store
|
|
87
|
-
// );
|
|
88
|
-
// expect(screen.getByAltText('typescript')).toBeInTheDocument();
|
|
89
|
-
// });
|
|
46
|
+
test('should render commonJS', async () => {
|
|
47
|
+
act(() => {
|
|
48
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
49
|
+
});
|
|
50
|
+
// package name + keyword
|
|
51
|
+
await waitFor(() => expect(screen.getAllByText('jquery')).toHaveLength(2));
|
|
52
|
+
expect(screen.getByAltText('commonjs')).toBeInTheDocument();
|
|
53
|
+
});
|
|
90
54
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
//
|
|
55
|
+
test('should render typescript', async () => {
|
|
56
|
+
mockPkgName.mockReturnValue('glob');
|
|
57
|
+
act(() => {
|
|
58
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
59
|
+
});
|
|
60
|
+
// just package name
|
|
61
|
+
await waitFor(() => expect(screen.getByText('glob')).toBeInTheDocument());
|
|
62
|
+
expect(screen.getByAltText('typescript')).toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('should render es modules', async () => {
|
|
66
|
+
mockPkgName.mockReturnValue('got');
|
|
67
|
+
act(() => {
|
|
68
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
69
|
+
});
|
|
70
|
+
// package name + keyword
|
|
71
|
+
await waitFor(() => expect(screen.getAllByText('got')).toHaveLength(2));
|
|
72
|
+
expect(screen.getByAltText('es6 modules')).toBeInTheDocument();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
import styled from '@emotion/styled';
|
|
2
1
|
import Paper from '@mui/material/Paper';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
|
|
5
|
-
import { Theme } from '../../Theme';
|
|
6
4
|
import ActionBar from '../../components/ActionBar';
|
|
7
5
|
import Author from '../../components/Author';
|
|
8
6
|
import Developers, { DeveloperType } from '../../components/Developers';
|
|
7
|
+
import Dist from '../../components/Distribution';
|
|
8
|
+
import Engines from '../../components/Engines';
|
|
9
9
|
import FundButton from '../../components/FundButton';
|
|
10
|
-
import
|
|
10
|
+
import Install from '../../components/Install';
|
|
11
|
+
import Keywords from '../../components/Keywords';
|
|
12
|
+
import Repository from '../../components/Repository';
|
|
13
|
+
import SideBarTitle from '../../components/SideBarTitle';
|
|
11
14
|
import { useConfig } from '../../providers';
|
|
12
15
|
import { useVersion } from '../../providers';
|
|
13
16
|
import { PackageMetaInterface } from '../../types/packageMeta';
|
|
14
|
-
import loadable from '../../utils/loadable';
|
|
15
|
-
|
|
16
|
-
const Engines = loadable(
|
|
17
|
-
() => import(/* webpackChunkName: "Engines" */ '../../components/Engines')
|
|
18
|
-
);
|
|
19
|
-
const Dist = loadable(
|
|
20
|
-
() => import(/* webpackChunkName: "Distribution" */ '../../components/Distribution')
|
|
21
|
-
);
|
|
22
|
-
const Install = loadable(
|
|
23
|
-
() => import(/* webpackChunkName: "Install" */ '../../components/Install')
|
|
24
|
-
);
|
|
25
|
-
const Repository = loadable(
|
|
26
|
-
() => import(/* webpackChunkName: "Repository" */ '../../components/Repository')
|
|
27
|
-
);
|
|
28
17
|
|
|
29
18
|
const getModuleType = (manifest: PackageMetaInterface) => {
|
|
30
19
|
if (manifest.latest.main) {
|
|
@@ -40,14 +29,13 @@ const DetailSidebar: React.FC = () => {
|
|
|
40
29
|
const { configOptions } = useConfig();
|
|
41
30
|
const version = packageVersion || packageMeta?.latest.version || '';
|
|
42
31
|
const time = packageMeta?.time ? packageMeta.time[version] : '';
|
|
43
|
-
|
|
44
32
|
if (!packageMeta || !packageName) {
|
|
45
33
|
return null;
|
|
46
34
|
}
|
|
47
35
|
|
|
48
36
|
return (
|
|
49
|
-
<
|
|
50
|
-
<
|
|
37
|
+
<Paper data-testid="sidebar" sx={{ position: 'sticky', top: 0, p: 2, ml: 2 }}>
|
|
38
|
+
<SideBarTitle
|
|
51
39
|
description={packageMeta.latest?.description}
|
|
52
40
|
hasTypes={typeof packageMeta.latest?.types === 'string'}
|
|
53
41
|
isLatest={typeof packageVersion === 'undefined'}
|
|
@@ -61,20 +49,17 @@ const DetailSidebar: React.FC = () => {
|
|
|
61
49
|
showDownloadTarball={configOptions.showDownloadTarball}
|
|
62
50
|
showRaw={configOptions.showRaw}
|
|
63
51
|
/>
|
|
64
|
-
<Install configOptions={configOptions} packageMeta={packageMeta} packageName={packageName} />
|
|
65
52
|
<FundButton packageMeta={packageMeta} />
|
|
53
|
+
<Install configOptions={configOptions} packageMeta={packageMeta} packageName={packageName} />
|
|
66
54
|
<Repository packageMeta={packageMeta} />
|
|
67
55
|
<Engines packageMeta={packageMeta} />
|
|
68
56
|
<Dist packageMeta={packageMeta} />
|
|
57
|
+
<Keywords packageMeta={packageMeta} />
|
|
69
58
|
<Author packageMeta={packageMeta} />
|
|
70
59
|
<Developers packageMeta={packageMeta} type={DeveloperType.MAINTAINERS} />
|
|
71
60
|
<Developers packageMeta={packageMeta} type={DeveloperType.CONTRIBUTORS} />
|
|
72
|
-
</
|
|
61
|
+
</Paper>
|
|
73
62
|
);
|
|
74
63
|
};
|
|
75
64
|
|
|
76
65
|
export default DetailSidebar;
|
|
77
|
-
|
|
78
|
-
const StyledPaper = styled(Paper)<{ theme?: Theme }>(({ theme }) => ({
|
|
79
|
-
padding: theme?.spacing(3, 2),
|
|
80
|
-
}));
|
package/src/store/api.test.ts
CHANGED
|
@@ -14,7 +14,8 @@ describe('api', () => {
|
|
|
14
14
|
|
|
15
15
|
const handled = await handleResponseType(response);
|
|
16
16
|
|
|
17
|
-
expect(handled).
|
|
17
|
+
expect(handled[0]).toBeFalsy();
|
|
18
|
+
expect(handled[1]).toBeDefined();
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
test('should test tgz scenario', async () => {
|
|
@@ -30,6 +31,22 @@ describe('api', () => {
|
|
|
30
31
|
|
|
31
32
|
expect(handled).toEqual([true, blob]);
|
|
32
33
|
});
|
|
34
|
+
|
|
35
|
+
test('should test pdf scenario', async () => {
|
|
36
|
+
const blob = new Blob(['foo']);
|
|
37
|
+
const blobPromise = Promise.resolve<Blob>(blob);
|
|
38
|
+
const response: Response = {
|
|
39
|
+
url: 'http://localhost:8080/test.pdf',
|
|
40
|
+
blob: () => blobPromise,
|
|
41
|
+
ok: true,
|
|
42
|
+
headers: new Headers({
|
|
43
|
+
'Content-Type': 'application/pdf',
|
|
44
|
+
}),
|
|
45
|
+
} as Response;
|
|
46
|
+
const handled = await handleResponseType(response);
|
|
47
|
+
|
|
48
|
+
expect(handled).toEqual([true, blob]);
|
|
49
|
+
});
|
|
33
50
|
});
|
|
34
51
|
|
|
35
52
|
describe('api client', () => {
|
|
@@ -123,7 +140,7 @@ describe('api', () => {
|
|
|
123
140
|
})
|
|
124
141
|
);
|
|
125
142
|
|
|
126
|
-
await expect(api.request('/resource')).rejects.toThrow(new Error('
|
|
143
|
+
await expect(api.request('/resource')).rejects.toThrow(new Error('Unknown error'));
|
|
127
144
|
});
|
|
128
145
|
|
|
129
146
|
test('when api returns an error 5.x.x', async () => {
|
package/src/store/api.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import storage from './storage';
|
|
2
2
|
|
|
3
|
+
class CustomError extends Error {
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
code: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
/**
|
|
4
9
|
* Handles response according to content type
|
|
5
10
|
* @param {object} response
|
|
@@ -25,7 +30,8 @@ export function handleResponseType(response: Response): Promise<[boolean, any]>
|
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
// error handling
|
|
34
|
+
return Promise.all([response.ok, response]);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
const AuthHeader = 'Authorization';
|
|
@@ -55,12 +61,13 @@ class API {
|
|
|
55
61
|
})
|
|
56
62
|
.then(handleResponseType)
|
|
57
63
|
.then((response) => {
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
const [ok, data] = response;
|
|
65
|
+
if (ok === true) {
|
|
66
|
+
resolve(data);
|
|
60
67
|
} else {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
reject(
|
|
68
|
+
const error = new CustomError(data?.statusText ?? 'Unknown error');
|
|
69
|
+
error.code = data?.status ?? 500;
|
|
70
|
+
reject(error);
|
|
64
71
|
}
|
|
65
72
|
})
|
|
66
73
|
.catch((error) => {
|
|
@@ -7,6 +7,7 @@ import { Manifest, TemplateUIOptions } from '@verdaccio/types';
|
|
|
7
7
|
import type { RootModel } from '.';
|
|
8
8
|
import { colors } from '../../Theme';
|
|
9
9
|
import API from '../api';
|
|
10
|
+
import { APIRoute } from './routes';
|
|
10
11
|
|
|
11
12
|
const defaultValues: TemplateUIOptions = {
|
|
12
13
|
primaryColor: colors.PRIMARY_COLOR,
|
|
@@ -39,7 +40,7 @@ export const configuration = createModel<RootModel>()({
|
|
|
39
40
|
},
|
|
40
41
|
effects: (dispatch) => ({
|
|
41
42
|
async getPackages() {
|
|
42
|
-
const payload: Manifest[] = await API.request(
|
|
43
|
+
const payload: Manifest[] = await API.request(APIRoute.CONFIG, 'GET');
|
|
43
44
|
dispatch.packages.savePackages(payload);
|
|
44
45
|
},
|
|
45
46
|
}),
|
|
@@ -5,6 +5,8 @@ import type { RootModel } from '.';
|
|
|
5
5
|
import { isTokenExpire } from '../../utils';
|
|
6
6
|
import API from '../api';
|
|
7
7
|
import storage from '../storage';
|
|
8
|
+
import { APIRoute } from './routes';
|
|
9
|
+
import { stripTrailingSlash } from './utils';
|
|
8
10
|
|
|
9
11
|
export const HEADERS = {
|
|
10
12
|
JSON: 'application/json',
|
|
@@ -80,19 +82,15 @@ export const login = createModel<RootModel>()({
|
|
|
80
82
|
},
|
|
81
83
|
effects: (dispatch) => ({
|
|
82
84
|
async getUser({ username, password }, state) {
|
|
83
|
-
const basePath = state.configuration.config.base;
|
|
85
|
+
const basePath = stripTrailingSlash(state.configuration.config.base);
|
|
84
86
|
try {
|
|
85
|
-
const payload: LoginResponse = await API.request(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
'Content-Type': HEADERS.JSON,
|
|
93
|
-
},
|
|
94
|
-
}
|
|
95
|
-
);
|
|
87
|
+
const payload: LoginResponse = await API.request(`${basePath}${APIRoute.LOGIN}`, 'POST', {
|
|
88
|
+
body: JSON.stringify({ username, password }),
|
|
89
|
+
headers: {
|
|
90
|
+
Accept: HEADERS.JSON,
|
|
91
|
+
'Content-Type': HEADERS.JSON,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
96
94
|
dispatch.login.logInUser(payload);
|
|
97
95
|
dispatch.packages.getPackages(undefined);
|
|
98
96
|
} catch (error: any) {
|