@verdaccio/ui-theme 6.0.0-6-next.9 → 6.0.0-6-next.13
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/.babelrc +1 -1
- package/.eslintrc +0 -15
- package/CHANGELOG.md +61 -0
- package/jest/api/packages.json +42 -0
- package/jest/jest.config.js +2 -2
- package/jest/server-handlers.ts +9 -0
- package/jest/server.ts +6 -0
- package/jest/setup-env.ts +18 -0
- package/jest/setup.ts +2 -7
- package/jest/unit/components/__mocks__/token.ts +0 -1
- package/jest/unit/components/store/login.ts +1 -0
- package/package.json +43 -33
- package/src/App/App.test.tsx +75 -51
- package/src/App/App.tsx +7 -42
- package/src/App/AppRoute.tsx +3 -16
- package/src/App/Footer/Footer.test.tsx +0 -1
- package/src/App/Footer/Footer.tsx +35 -22
- package/src/App/Footer/__snapshots__/Footer.test.tsx.snap +208 -302
- package/src/App/Footer/styles.ts +2 -3
- package/src/App/Header/Header.test.tsx +53 -61
- package/src/App/Header/Header.tsx +13 -24
- package/src/App/Header/HeaderGreetings.tsx +0 -1
- package/src/App/Header/HeaderLeft.tsx +0 -1
- package/src/App/Header/HeaderMenu.tsx +6 -6
- package/src/App/Header/HeaderRight.tsx +1 -2
- package/src/App/Header/HeaderToolTip.tsx +0 -1
- package/src/App/Header/HeaderToolTipIcon.tsx +10 -10
- package/src/App/Header/LanguageSwitch.tsx +17 -79
- package/src/App/Header/LoginDialog/LoginDialog.test.tsx +25 -35
- package/src/App/Header/LoginDialog/LoginDialog.tsx +28 -46
- package/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +1 -2
- package/src/App/Header/LoginDialog/LoginDialogForm.tsx +0 -1
- package/src/App/Header/LoginDialog/LoginDialogFormError.tsx +1 -2
- package/src/App/Header/LoginDialog/LoginDialogHeader.tsx +4 -4
- package/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -3
- package/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +9 -10
- package/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +1 -2
- package/src/App/Header/RegistryInfoDialog/styles.ts +0 -1
- package/src/App/Header/Search/Search.test.tsx +48 -43
- package/src/App/Header/Search/Search.tsx +23 -108
- package/src/App/Header/Search/__snapshots__/Search.test.tsx.snap +392 -28
- package/src/App/Header/styles.ts +2 -3
- package/src/App/index.ts +0 -1
- package/src/App/utils/loadable.tsx +3 -1
- package/src/components/ActionBar/ActionBar.test.tsx +13 -14
- package/src/components/ActionBar/ActionBar.tsx +0 -2
- package/src/components/ActionBar/ActionBarAction.tsx +11 -14
- package/src/components/ActionBar/__snapshots__/ActionBar.test.tsx.snap +198 -53
- package/src/components/AppBar.tsx +1 -1
- package/src/components/Author/Author.test.tsx +1 -4
- package/src/components/Author/Author.tsx +2 -4
- package/src/components/Author/__snapshots__/Author.test.tsx.snap +804 -48
- package/src/components/Author/styles.ts +0 -1
- package/src/components/AutoComplete/AutoComplete.tsx +85 -163
- package/src/components/AutoComplete/AutoCompleteV2.tsx +8 -10
- package/src/components/AutoComplete/styles.tsx +0 -15
- package/src/components/Avatar.tsx +1 -1
- package/src/components/Box.tsx +1 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/Card.tsx +1 -1
- package/src/components/CardActions.tsx +1 -1
- package/src/components/CardContent.tsx +1 -1
- package/src/components/Chip.tsx +1 -1
- package/src/components/CircularProgress.tsx +2 -2
- package/src/components/CopyToClipBoard.tsx +2 -3
- package/src/components/Dialog.tsx +1 -1
- package/src/components/DialogActions.tsx +2 -2
- package/src/components/DialogContent.tsx +2 -2
- package/src/components/DialogTitle.tsx +1 -1
- package/src/components/Divider.tsx +1 -1
- package/src/components/FloatingActionButton.tsx +1 -1
- package/src/components/FormControl.tsx +1 -1
- package/src/components/FormHelperText.tsx +2 -2
- package/src/components/Grid.tsx +1 -1
- package/src/components/Heading.tsx +1 -1
- package/src/components/IconButton.tsx +1 -1
- package/src/components/Icons/index.ts +1 -17
- package/src/components/Input.tsx +1 -1
- package/src/components/InputAdornment/InputAdornment.tsx +2 -2
- package/src/components/InputLabel.tsx +1 -1
- package/src/components/Label/Label.test.tsx +0 -1
- package/src/components/Label/Label.tsx +2 -3
- package/src/components/List.tsx +1 -1
- package/src/components/ListItem.tsx +1 -1
- package/src/components/ListItemText.tsx +1 -4
- package/src/components/Loading/Loading.test.tsx +0 -1
- package/src/components/Loading/Loading.tsx +1 -2
- package/src/components/Loading/Spinner/Spinner.test.tsx +1 -2
- package/src/components/Loading/Spinner/Spinner.tsx +1 -2
- package/src/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +114 -16
- package/src/components/Loading/__snapshots__/Loading.test.tsx.snap +63 -11
- package/src/components/Loading/styles.ts +1 -2
- package/src/components/Logo/Logo.test.tsx +0 -1
- package/src/components/Logo/Logo.tsx +1 -2
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +2 -0
- package/src/components/Menu.tsx +1 -1
- package/src/components/MenuItem.tsx +1 -1
- package/src/components/NotFound/NotFound.tsx +1 -3
- package/src/components/NotFound/Notfound.test.tsx +1 -2
- package/src/components/NotFound/__snapshots__/Notfound.test.tsx.snap +138 -11
- package/src/components/NotFound/styles.ts +0 -1
- package/src/components/Paper.tsx +1 -1
- package/src/components/SnackbarContent.tsx +1 -1
- package/src/components/SvgIcon.tsx +1 -1
- package/src/components/Tab.tsx +1 -1
- package/src/components/Tabs.tsx +1 -1
- package/src/components/Text/Text.tsx +1 -1
- package/src/components/Text/TextConfig.ts +1 -1
- package/src/components/TextField/TextField.test.tsx +0 -1
- package/src/components/TextField/TextField.tsx +2 -2
- package/src/components/TextField/__snapshots__/TextField.test.tsx.snap +216 -3
- package/src/components/Toolbar.tsx +1 -1
- package/src/components/Tooltip.tsx +1 -1
- package/src/design-tokens/ResetStyles.tsx +1 -1
- package/src/design-tokens/StyleBaseline.tsx +2 -2
- package/src/design-tokens/ThemeContext.ts +1 -1
- package/src/design-tokens/ThemeProvider.tsx +15 -12
- package/src/design-tokens/theme.ts +28 -26
- package/src/design-tokens/useTheme.ts +1 -1
- package/src/{design-tokens → hooks}/useLocalStorage.ts +0 -0
- package/src/{design-tokens → hooks}/useOnClickOutside.ts +0 -0
- package/src/i18n/ABOUT_TRANSLATIONS.md +13 -0
- package/src/i18n/__mocks__/loadTranslationFile.ts +5 -0
- package/src/i18n/config.ts +38 -0
- package/src/i18n/crowdin/ui.json +170 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/cs-CZ.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/de-DE.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/en-US.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/es-ES.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/fr-FR.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/ja-JP.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/km-KH.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/pt-BR.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/ru-RU.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/tr-TR.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/uk-UA.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/zh-CN.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/zh-TW.json +0 -0
- package/src/i18n/download_translations/ar-SA/ui.json +170 -0
- package/src/i18n/download_translations/cs-CZ/ui.json +170 -0
- package/src/i18n/download_translations/de-DE/ui.json +170 -0
- package/src/i18n/download_translations/es-ES/ui.json +170 -0
- package/src/i18n/download_translations/fi-FI/ui.json +170 -0
- package/src/i18n/download_translations/fil-PH/ui.json +170 -0
- package/src/i18n/download_translations/fr-FR/ui.json +170 -0
- package/src/i18n/download_translations/gl-ES/ui.json +170 -0
- package/src/i18n/download_translations/hi-IN/ui.json +170 -0
- package/src/i18n/download_translations/it-IT/ui.json +170 -0
- package/src/i18n/download_translations/ja-JP/ui.json +170 -0
- package/src/i18n/download_translations/km-KH/ui.json +170 -0
- package/src/i18n/download_translations/ko-KR/ui.json +170 -0
- package/src/i18n/download_translations/pl-PL/ui.json +170 -0
- package/src/i18n/download_translations/pt-BR/ui.json +170 -0
- package/src/i18n/download_translations/pt-PT/ui.json +170 -0
- package/src/i18n/download_translations/ro-RO/ui.json +170 -0
- package/src/i18n/download_translations/ru-RU/ui.json +170 -0
- package/src/i18n/download_translations/si-LK/ui.json +170 -0
- package/src/i18n/download_translations/sr-CS/ui.json +170 -0
- package/src/i18n/download_translations/sr-SP/ui.json +170 -0
- package/src/i18n/download_translations/tg-TJ/ui.json +170 -0
- package/src/i18n/download_translations/tr-TR/ui.json +170 -0
- package/src/i18n/download_translations/uk-UA/ui.json +170 -0
- package/src/i18n/download_translations/vi-VN/ui.json +170 -0
- package/src/i18n/download_translations/yo-NG/ui.json +170 -0
- package/src/i18n/download_translations/zh-CN/ui.json +170 -0
- package/src/i18n/download_translations/zh-TW/ui.json +170 -0
- package/src/i18n/enabledLanguages.ts +35 -0
- package/src/i18n/loadTranslationFile.ts +14 -0
- package/src/index.tsx +13 -11
- package/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +0 -2
- package/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +1 -3
- package/src/pages/Version/DetailContainer/Dependencies/styles.ts +0 -1
- package/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +1 -3
- package/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +2 -3
- package/src/pages/Version/DetailContainer/DetailContainer.test.tsx +0 -1
- package/src/pages/Version/DetailContainer/DetailContainer.tsx +1 -3
- package/src/pages/Version/DetailContainer/DetailContainerContent.tsx +0 -1
- package/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +0 -1
- package/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +0 -1
- package/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +0 -1
- package/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +0 -1
- package/src/pages/Version/DetailContainer/NoItems/__snapshots__/Noitems.test.tsx.snap +10 -1
- package/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +1 -2
- package/src/pages/Version/DetailContainer/Readme/Readme.tsx +1 -2
- package/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +1 -9
- package/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +1 -3
- package/src/pages/Version/DetailContainer/UpLinks/__snapshots__/UpLinks.test.tsx.snap +184 -26
- package/src/pages/Version/DetailContainer/UpLinks/styles.ts +2 -3
- package/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +3 -5
- package/src/pages/Version/DetailContainer/Versions/Versions.tsx +1 -2
- package/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +2 -4
- package/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +1 -3
- package/src/pages/Version/DetailContainer/Versions/styles.ts +2 -3
- package/src/pages/Version/DetailContainer/__snapshots__/DetailContainer.test.tsx.snap +168 -34
- package/src/pages/Version/DetailSidebar/DetailSidebar.tsx +0 -2
- package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +0 -2
- package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +1 -2
- package/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +0 -1
- package/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +3 -5
- package/src/pages/Version/DetailSidebar/Developers/Developers.tsx +3 -5
- package/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +0 -1
- package/src/pages/Version/DetailSidebar/Developers/__snapshots__/Developers.test.tsx.snap +328 -40
- package/src/pages/Version/DetailSidebar/Developers/styles.ts +0 -1
- package/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Dist/Dist.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Dist/__snapshots__/Dist.test.tsx.snap +1436 -74
- package/src/pages/Version/DetailSidebar/Dist/styles.ts +2 -1
- package/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Engines/Engines.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Engines/styles.ts +0 -1
- package/src/pages/Version/DetailSidebar/Install/Install.test.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Install/Install.tsx +0 -2
- package/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +0 -1
- package/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Repository/Repository.tsx +1 -3
- package/src/pages/Version/Version.test.tsx +3 -5
- package/src/pages/Version/Version.tsx +21 -6
- package/src/pages/Version/VersionContextProvider.tsx +14 -45
- package/src/pages/Version/VersionLayout.tsx +1 -1
- package/src/pages/Version/context.ts +1 -1
- package/src/pages/home/Home.tsx +9 -28
- package/src/pages/home/PackageList/Help/Help.test.tsx +0 -1
- package/src/pages/home/PackageList/Help/Help.tsx +0 -1
- package/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap +298 -59
- package/src/pages/home/PackageList/Help/styles.ts +0 -1
- package/src/pages/home/PackageList/Package/Package.test.tsx +5 -4
- package/src/pages/home/PackageList/Package/Package.tsx +20 -28
- package/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +0 -1
- package/src/pages/home/PackageList/Package/styles.ts +5 -6
- package/src/pages/home/PackageList/PackageList.tsx +17 -17
- package/src/pages/home/PackageList/Packagelist.test.tsx +6 -5
- package/src/providers/API/api.test.ts +1 -0
- package/src/providers/API/api.ts +7 -3
- package/src/providers/config/AppConfigurationProvider.tsx +3 -3
- package/src/store/index.ts +1 -0
- package/src/store/models/configuration.ts +41 -0
- package/src/store/models/download.ts +30 -0
- package/src/store/models/index.ts +18 -0
- package/src/store/models/login.ts +92 -0
- package/src/store/models/manifest.ts +91 -0
- package/src/store/models/packages.ts +36 -0
- package/src/store/models/search.ts +81 -0
- package/src/store/store.ts +15 -0
- package/src/utils/login.test.ts +3 -4
- package/src/utils/package.test.ts +2 -3
- package/src/utils/package.ts +2 -1
- package/src/utils/sec-utils.ts +1 -1
- package/src/utils/test-react-testing-library.tsx +22 -5
- package/src/utils/url.test.ts +1 -1
- package/src/utils/url.ts +1 -0
- package/static/Dependencies.15768a14646212b71166.js +2 -0
- package/static/Dependencies.15768a14646212b71166.js.LICENSE.txt +78 -0
- package/static/Dist.15768a14646212b71166.js +2 -0
- package/static/Dist.15768a14646212b71166.js.LICENSE.txt +60 -0
- package/static/Engines.15768a14646212b71166.js +2 -0
- package/static/Engines.15768a14646212b71166.js.LICENSE.txt +66 -0
- package/static/Home.15768a14646212b71166.js +2 -0
- package/static/Home.15768a14646212b71166.js.LICENSE.txt +222 -0
- package/static/Install.15768a14646212b71166.js +2 -0
- package/static/Install.15768a14646212b71166.js.LICENSE.txt +66 -0
- package/static/NotFound.15768a14646212b71166.js +2 -0
- package/static/NotFound.15768a14646212b71166.js.LICENSE.txt +40 -0
- package/static/Provider.15768a14646212b71166.js +2 -0
- package/static/Provider.15768a14646212b71166.js.LICENSE.txt +32 -0
- package/static/Repository.15768a14646212b71166.js +2 -0
- package/static/Repository.15768a14646212b71166.js.LICENSE.txt +50 -0
- package/static/UpLinks.15768a14646212b71166.js +2 -0
- package/static/UpLinks.15768a14646212b71166.js.LICENSE.txt +56 -0
- package/static/Version.15768a14646212b71166.js +2 -0
- package/static/Version.15768a14646212b71166.js.LICENSE.txt +380 -0
- package/static/Versions.15768a14646212b71166.js +2 -0
- package/static/Versions.15768a14646212b71166.js.LICENSE.txt +64 -0
- package/static/index.html +1 -1
- package/static/main.15768a14646212b71166.js +2 -0
- package/static/main.15768a14646212b71166.js.LICENSE.txt +972 -0
- package/static/manifest.json +17 -3
- package/static/runtime.15768a14646212b71166.js +2 -0
- package/static/{runtime.9525ddaaf85378590c63.js.LICENSE.txt → runtime.15768a14646212b71166.js.LICENSE.txt} +2 -2
- package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-123400.15768a14646212b71166.js +2 -0
- package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-123400.15768a14646212b71166.js.LICENSE.txt +148 -0
- package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-d2b578.15768a14646212b71166.js +2 -0
- package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-d2b578.15768a14646212b71166.js.LICENSE.txt +218 -0
- package/static/vendors-node_modules_pnpm_mui_material_5_0_6_033766d34292bd5d464212fd95cb4b6d_node_modules_mu-1fb115.15768a14646212b71166.js +2 -0
- package/static/vendors-node_modules_pnpm_mui_material_5_0_6_033766d34292bd5d464212fd95cb4b6d_node_modules_mu-1fb115.15768a14646212b71166.js.LICENSE.txt +316 -0
- package/static/vendors.15768a14646212b71166.js +103 -0
- package/static/vendors.15768a14646212b71166.js.LICENSE.txt +3158 -0
- package/tools/dev.server.js +0 -1
- package/tools/webpack.dev.config.babel.js +1 -3
- package/tools/webpack.prod.config.babel.js +1 -1
- package/tsconfig.json +1 -3
- package/types/index.ts +3 -20
- package/i18n/config.ts +0 -94
- package/src/App/AppContext.ts +0 -18
- package/src/App/AppContextProvider.tsx +0 -44
- package/src/App/Header/Search/SearchAdornment.tsx +0 -18
- package/src/components/Icons/Austria.tsx +0 -23
- package/src/components/Icons/Brazil.tsx +0 -44
- package/src/components/Icons/China.tsx +0 -33
- package/src/components/Icons/Czech.tsx +0 -21
- package/src/components/Icons/France.tsx +0 -27
- package/src/components/Icons/Germany.tsx +0 -27
- package/src/components/Icons/India.tsx +0 -44
- package/src/components/Icons/Japan.tsx +0 -23
- package/src/components/Icons/Khmer.tsx +0 -40
- package/src/components/Icons/Nicaragua.tsx +0 -66
- package/src/components/Icons/Russia.tsx +0 -27
- package/src/components/Icons/Spain.tsx +0 -43
- package/src/components/Icons/Taiwan.tsx +0 -25
- package/src/components/Icons/Turkey.tsx +0 -23
- package/src/components/Icons/Ukraine.tsx +0 -30
- package/src/components/Icons/Usa.tsx +0 -34
- package/src/design-tokens/emotion.ts +0 -5
- package/src/lib/constants.ts +0 -9
- package/src/pages/Version/DetailSidebar/ActionBar/ActionBar.test.tsx +0 -84
- package/src/pages/Version/DetailSidebar/ActionBar/__snapshots__/ActionBar.test.tsx.snap +0 -122
- package/src/pages/Version/is-package-version-valid.ts +0 -19
- package/src/providers/API/APIProvider.tsx +0 -109
- package/src/providers/API/index.ts +0 -1
- package/static/main.9525ddaaf85378590c63.js +0 -2
- package/static/main.9525ddaaf85378590c63.js.LICENSE.txt +0 -1588
- package/static/runtime.9525ddaaf85378590c63.js +0 -2
- package/static/vendors.9525ddaaf85378590c63.js +0 -2
- package/static/vendors.9525ddaaf85378590c63.js.LICENSE.txt +0 -4540
|
@@ -3,7 +3,6 @@ import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer';
|
|
|
3
3
|
import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
4
4
|
import { List, ListRowProps } from 'react-virtualized/dist/commonjs/List';
|
|
5
5
|
import { WindowScroller } from 'react-virtualized/dist/commonjs/WindowScroller';
|
|
6
|
-
|
|
7
6
|
import Divider from 'verdaccio-ui/components/Divider';
|
|
8
7
|
import { formatLicense } from 'verdaccio-ui/utils/package';
|
|
9
8
|
|
|
@@ -26,7 +25,6 @@ const PackageList: React.FC<Props> = ({ packages }) => {
|
|
|
26
25
|
packages[index];
|
|
27
26
|
// TODO: move format license to API side.
|
|
28
27
|
const formattedLicense = formatLicense(license);
|
|
29
|
-
|
|
30
28
|
return (
|
|
31
29
|
<CellMeasurer cache={cache} columnIndex={0} key={key} parent={parent} rowIndex={index}>
|
|
32
30
|
<div style={style}>
|
|
@@ -56,21 +54,23 @@ const PackageList: React.FC<Props> = ({ packages }) => {
|
|
|
56
54
|
<WindowScroller>
|
|
57
55
|
{({ height, isScrolling, scrollTop, onChildScroll }) => (
|
|
58
56
|
<AutoSizer disableHeight={true}>
|
|
59
|
-
{({ width }) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
{({ width }) => {
|
|
58
|
+
return (
|
|
59
|
+
<List
|
|
60
|
+
autoHeight={true}
|
|
61
|
+
deferredMeasurementCache={cache}
|
|
62
|
+
height={height}
|
|
63
|
+
isScrolling={isScrolling}
|
|
64
|
+
onScroll={onChildScroll}
|
|
65
|
+
overscanRowCount={3}
|
|
66
|
+
rowCount={packages.length}
|
|
67
|
+
rowHeight={cache.rowHeight}
|
|
68
|
+
rowRenderer={renderRow}
|
|
69
|
+
scrollTop={scrollTop}
|
|
70
|
+
width={width}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}}
|
|
74
74
|
</AutoSizer>
|
|
75
75
|
)}
|
|
76
76
|
</WindowScroller>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BrowserRouter } from 'react-router-dom';
|
|
3
|
+
import { cleanup, renderWithStore } from 'verdaccio-ui/utils/test-react-testing-library';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
5
|
+
import { store } from '../../../store';
|
|
6
6
|
import { PackageList } from './PackageList';
|
|
7
7
|
|
|
8
8
|
describe('<PackageList /> component', () => {
|
|
@@ -12,7 +12,7 @@ describe('<PackageList /> component', () => {
|
|
|
12
12
|
const props = {
|
|
13
13
|
packages: [],
|
|
14
14
|
};
|
|
15
|
-
const wrapper =
|
|
15
|
+
const wrapper = renderWithStore(<PackageList packages={props.packages} />, store);
|
|
16
16
|
expect(wrapper.getByText('No Package Published Yet.')).toBeInTheDocument();
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -46,10 +46,11 @@ describe('<PackageList /> component', () => {
|
|
|
46
46
|
help: false,
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
const wrapper =
|
|
49
|
+
const wrapper = renderWithStore(
|
|
50
50
|
<BrowserRouter>
|
|
51
51
|
<PackageList packages={props.packages} />
|
|
52
|
-
</BrowserRouter
|
|
52
|
+
</BrowserRouter>,
|
|
53
|
+
store
|
|
53
54
|
);
|
|
54
55
|
|
|
55
56
|
expect(wrapper.queryAllByTestId('package-item-list')).toHaveLength(3);
|
package/src/providers/API/api.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import storage from './storage';
|
|
2
1
|
import '../../../types';
|
|
2
|
+
import storage from './storage';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Handles response according to content type
|
|
@@ -29,6 +29,8 @@ export function handleResponseType(response: Response): Promise<[boolean, any]>
|
|
|
29
29
|
return Promise.all([response.ok, response.text()]);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
const AuthHeader = 'Authorization';
|
|
33
|
+
|
|
32
34
|
class API {
|
|
33
35
|
public request<T>(
|
|
34
36
|
url: string,
|
|
@@ -38,11 +40,13 @@ class API {
|
|
|
38
40
|
const token = storage.getItem('token');
|
|
39
41
|
const headers = new Headers(options.headers);
|
|
40
42
|
|
|
41
|
-
if (token && headers.has(
|
|
42
|
-
headers.set(
|
|
43
|
+
if (token && headers.has(AuthHeader) === false) {
|
|
44
|
+
headers.set(AuthHeader, `Bearer ${token}`);
|
|
43
45
|
options.headers = headers;
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
headers.set('x-client', 'verdaccio-ui');
|
|
49
|
+
|
|
46
50
|
return new Promise((resolve, reject) => {
|
|
47
51
|
fetch(url, {
|
|
48
52
|
method,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TemplateUIOptions } from '@verdaccio/types';
|
|
2
1
|
import isEmpty from 'lodash/isEmpty';
|
|
3
2
|
import isNil from 'lodash/isNil';
|
|
4
|
-
import React, {
|
|
5
|
-
|
|
3
|
+
import React, { FunctionComponent, createContext, useContext, useMemo, useState } from 'react';
|
|
6
4
|
import { PRIMARY_COLOR } from 'verdaccio-ui/utils/colors';
|
|
7
5
|
|
|
6
|
+
import { TemplateUIOptions } from '@verdaccio/types';
|
|
7
|
+
|
|
8
8
|
type ConfigProviderProps = {
|
|
9
9
|
configOptions: TemplateUIOptions;
|
|
10
10
|
setConfigOptions: Function;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { store } from './store';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createModel } from '@rematch/core';
|
|
2
|
+
import isEmpty from 'lodash/isEmpty';
|
|
3
|
+
import isNil from 'lodash/isNil';
|
|
4
|
+
import { PRIMARY_COLOR } from 'verdaccio-ui/utils/colors';
|
|
5
|
+
|
|
6
|
+
import { Package, TemplateUIOptions } from '@verdaccio/types';
|
|
7
|
+
|
|
8
|
+
import type { RootModel } from '.';
|
|
9
|
+
import API from '../../providers/API/api';
|
|
10
|
+
|
|
11
|
+
const defaultValues: TemplateUIOptions = {
|
|
12
|
+
primaryColor: PRIMARY_COLOR,
|
|
13
|
+
darkMode: false,
|
|
14
|
+
pkgManagers: ['yarn', 'pnpm', 'npm'],
|
|
15
|
+
scope: '',
|
|
16
|
+
base: '',
|
|
17
|
+
login: true,
|
|
18
|
+
url_prefix: '',
|
|
19
|
+
title: 'Verdaccio',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function getConfiguration() {
|
|
23
|
+
const uiConfiguration = window?.__VERDACCIO_BASENAME_UI_OPTIONS ?? defaultValues;
|
|
24
|
+
if (isNil(uiConfiguration.primaryColor) || isEmpty(uiConfiguration.primaryColor)) {
|
|
25
|
+
uiConfiguration.primaryColor = PRIMARY_COLOR;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return uiConfiguration;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const configuration = createModel<RootModel>()({
|
|
32
|
+
state: {
|
|
33
|
+
config: getConfiguration(),
|
|
34
|
+
},
|
|
35
|
+
effects: (dispatch) => ({
|
|
36
|
+
async getPackages() {
|
|
37
|
+
const payload: Package[] = await API.request(`/-/verdaccio/packages`, 'GET');
|
|
38
|
+
dispatch.packages.savePackages(payload);
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createModel } from '@rematch/core';
|
|
2
|
+
|
|
3
|
+
import type { RootModel } from '.';
|
|
4
|
+
import API from '../../providers/API/api';
|
|
5
|
+
import { downloadFile, extractFileName } from '../../utils/url';
|
|
6
|
+
|
|
7
|
+
export const download = createModel<RootModel>()({
|
|
8
|
+
state: {},
|
|
9
|
+
reducers: {},
|
|
10
|
+
effects: () => ({
|
|
11
|
+
async getTarball({ link }) {
|
|
12
|
+
// const basePath = state.configuration.config.base;
|
|
13
|
+
try {
|
|
14
|
+
const fileStream: Blob = await API.request(link, 'GET', {
|
|
15
|
+
headers: {
|
|
16
|
+
['accept']:
|
|
17
|
+
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
|
|
18
|
+
},
|
|
19
|
+
credentials: 'include',
|
|
20
|
+
});
|
|
21
|
+
const fileName = extractFileName(link);
|
|
22
|
+
downloadFile(fileStream, fileName);
|
|
23
|
+
} catch (error: any) {
|
|
24
|
+
// TODO: handle better error
|
|
25
|
+
// eslint-disable-next-line no-console
|
|
26
|
+
console.error('error on download', error);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Models } from '@rematch/core';
|
|
2
|
+
|
|
3
|
+
import { configuration } from './configuration';
|
|
4
|
+
import { download } from './download';
|
|
5
|
+
import { login } from './login';
|
|
6
|
+
import { manifest } from './manifest';
|
|
7
|
+
import { packages } from './packages';
|
|
8
|
+
import { search } from './search';
|
|
9
|
+
|
|
10
|
+
export interface RootModel extends Models<RootModel> {
|
|
11
|
+
packages: typeof packages;
|
|
12
|
+
manifest: typeof manifest;
|
|
13
|
+
configuration: typeof configuration;
|
|
14
|
+
download: typeof download;
|
|
15
|
+
login: typeof login;
|
|
16
|
+
search: typeof search;
|
|
17
|
+
}
|
|
18
|
+
export const models: RootModel = { packages, configuration, search, download, login, manifest };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createModel } from '@rematch/core';
|
|
2
|
+
import i18next from 'i18next';
|
|
3
|
+
|
|
4
|
+
import type { RootModel } from '.';
|
|
5
|
+
import API from '../../providers/API/api';
|
|
6
|
+
import storage from '../../utils/storage';
|
|
7
|
+
|
|
8
|
+
export const HEADERS = {
|
|
9
|
+
JSON: 'application/json',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type LoginError = {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type LoginResponse = {
|
|
18
|
+
username: string | null;
|
|
19
|
+
token: string | null;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type LoginBody = {
|
|
23
|
+
error?: LoginError;
|
|
24
|
+
} & LoginResponse;
|
|
25
|
+
|
|
26
|
+
const token = storage.getItem('token');
|
|
27
|
+
const username = storage.getItem('username');
|
|
28
|
+
const defaultUserState: LoginBody = {
|
|
29
|
+
token,
|
|
30
|
+
username,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const login = createModel<RootModel>()({
|
|
34
|
+
state: {
|
|
35
|
+
username: defaultUserState.username,
|
|
36
|
+
token: defaultUserState.token,
|
|
37
|
+
},
|
|
38
|
+
reducers: {
|
|
39
|
+
logOutUser(state) {
|
|
40
|
+
storage.removeItem('username');
|
|
41
|
+
storage.removeItem('token');
|
|
42
|
+
return {
|
|
43
|
+
...state,
|
|
44
|
+
username: null,
|
|
45
|
+
token: null,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
addError(state, error: LoginError) {
|
|
49
|
+
return {
|
|
50
|
+
...state,
|
|
51
|
+
error,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
clearError(state) {
|
|
55
|
+
return {
|
|
56
|
+
...state,
|
|
57
|
+
error: undefined,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
logInUser(state, response: LoginResponse) {
|
|
61
|
+
// we might persist this in another way with
|
|
62
|
+
storage.setItem('username', response.username as string);
|
|
63
|
+
storage.setItem('token', response.token as string);
|
|
64
|
+
return {
|
|
65
|
+
...state,
|
|
66
|
+
token: response.token as string,
|
|
67
|
+
username: response.username as string,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
effects: (dispatch) => ({
|
|
72
|
+
async getUser({ username, password }, state) {
|
|
73
|
+
const basePath = state.configuration.config.base;
|
|
74
|
+
try {
|
|
75
|
+
const payload: LoginResponse = await API.request(`${basePath}-/verdaccio/login`, 'POST', {
|
|
76
|
+
body: JSON.stringify({ username, password }),
|
|
77
|
+
headers: {
|
|
78
|
+
Accept: HEADERS.JSON,
|
|
79
|
+
'Content-Type': HEADERS.JSON,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
dispatch.login.logInUser(payload);
|
|
83
|
+
dispatch.packages.getPackages();
|
|
84
|
+
} catch (error: any) {
|
|
85
|
+
dispatch.login.addError({
|
|
86
|
+
type: 'error',
|
|
87
|
+
description: i18next.t('form-validation.unable-to-sign-in'),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createModel } from '@rematch/core';
|
|
2
|
+
import { PackageMetaInterface } from 'types/packageMeta';
|
|
3
|
+
|
|
4
|
+
import { Package } from '@verdaccio/types';
|
|
5
|
+
|
|
6
|
+
import type { RootModel } from '.';
|
|
7
|
+
import API from '../../providers/API/api';
|
|
8
|
+
|
|
9
|
+
function isPackageVersionValid(
|
|
10
|
+
packageMeta: Partial<PackageMetaInterface>,
|
|
11
|
+
packageVersion?: string
|
|
12
|
+
): boolean {
|
|
13
|
+
if (!packageVersion || typeof packageVersion === 'undefined') {
|
|
14
|
+
// if is undefined, that means versions does not exist, we continue
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (packageMeta.versions) {
|
|
19
|
+
return Object.keys(packageMeta.versions).includes(packageVersion);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const manifest = createModel<RootModel>()({
|
|
26
|
+
state: {},
|
|
27
|
+
reducers: {
|
|
28
|
+
notFound(state) {
|
|
29
|
+
return {
|
|
30
|
+
...state,
|
|
31
|
+
hasNotBeenFound: true,
|
|
32
|
+
manifest: undefined,
|
|
33
|
+
packageName: undefined,
|
|
34
|
+
packageVersion: undefined,
|
|
35
|
+
readme: undefined,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
clearError(state) {
|
|
39
|
+
return {
|
|
40
|
+
...state,
|
|
41
|
+
isError: null,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
isError(state) {
|
|
45
|
+
return {
|
|
46
|
+
...state,
|
|
47
|
+
isError: true,
|
|
48
|
+
hasNotBeenFound: false,
|
|
49
|
+
manifest: undefined,
|
|
50
|
+
packageName: undefined,
|
|
51
|
+
packageVersion: undefined,
|
|
52
|
+
readme: undefined,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
saveManifest(state, { packageName, packageVersion, manifest, readme }) {
|
|
56
|
+
return {
|
|
57
|
+
...state,
|
|
58
|
+
manifest,
|
|
59
|
+
packageName,
|
|
60
|
+
packageVersion,
|
|
61
|
+
readme,
|
|
62
|
+
hasNotBeenFound: false,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
effects: (dispatch) => ({
|
|
67
|
+
async getManifest({ packageName, packageVersion }, state) {
|
|
68
|
+
const basePath = state.configuration.config.base;
|
|
69
|
+
try {
|
|
70
|
+
if (!isPackageVersionValid(packageName, packageVersion)) {
|
|
71
|
+
throw new Error('not found');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const manifest: Package = await API.request(
|
|
75
|
+
`${basePath}-/verdaccio/sidebar/${packageName}${
|
|
76
|
+
packageVersion ? `?v=${packageVersion}` : ''
|
|
77
|
+
}`
|
|
78
|
+
);
|
|
79
|
+
const readme: string = await API.request<string>(
|
|
80
|
+
`${basePath}-/verdaccio/package/readme/${packageName}${
|
|
81
|
+
packageVersion ? `?v=${packageVersion}` : ''
|
|
82
|
+
}`,
|
|
83
|
+
'GET'
|
|
84
|
+
);
|
|
85
|
+
dispatch.manifest.saveManifest({ packageName, packageVersion, manifest, readme });
|
|
86
|
+
} catch (error: any) {
|
|
87
|
+
dispatch.manifest.notFound();
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createModel } from '@rematch/core';
|
|
2
|
+
|
|
3
|
+
import { Package } from '@verdaccio/types';
|
|
4
|
+
|
|
5
|
+
import type { RootModel } from '.';
|
|
6
|
+
import API from '../../providers/API/api';
|
|
7
|
+
|
|
8
|
+
export const packages = createModel<RootModel>()({
|
|
9
|
+
state: {
|
|
10
|
+
response: [] as Package[],
|
|
11
|
+
},
|
|
12
|
+
reducers: {
|
|
13
|
+
savePackages(state, response: Package[]) {
|
|
14
|
+
return {
|
|
15
|
+
...state,
|
|
16
|
+
response,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
effects: (dispatch) => ({
|
|
21
|
+
async getPackages(_payload, state) {
|
|
22
|
+
const basePath = state.configuration.config.base;
|
|
23
|
+
try {
|
|
24
|
+
const payload: Package[] = await API.request(`${basePath}-/verdaccio/packages`, 'GET');
|
|
25
|
+
dispatch.packages.savePackages(payload);
|
|
26
|
+
} catch (error: any) {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.error({
|
|
29
|
+
title: 'Warning',
|
|
30
|
+
message: `Unable to load package list: ${error.message}`,
|
|
31
|
+
});
|
|
32
|
+
// TODO: handle error, display something retry or something
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createModel } from '@rematch/core';
|
|
2
|
+
|
|
3
|
+
import { SearchResultWeb } from '@verdaccio/types';
|
|
4
|
+
|
|
5
|
+
import type { RootModel } from '.';
|
|
6
|
+
import API from '../../providers/API/api';
|
|
7
|
+
|
|
8
|
+
const CONSTANTS = {
|
|
9
|
+
API_DELAY: 300,
|
|
10
|
+
ABORT_ERROR: 'AbortError',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type SearchState = {
|
|
14
|
+
suggestions: SearchResultWeb[];
|
|
15
|
+
controller: AbortController[];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const search = createModel<RootModel>()({
|
|
19
|
+
state: {
|
|
20
|
+
suggestions: [],
|
|
21
|
+
controller: [],
|
|
22
|
+
} as SearchState,
|
|
23
|
+
reducers: {
|
|
24
|
+
clearRequestQueue(state) {
|
|
25
|
+
const controllers = state.controller;
|
|
26
|
+
controllers.forEach((request) => request.abort());
|
|
27
|
+
return {
|
|
28
|
+
...state,
|
|
29
|
+
controller: [],
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
addControllerToQueue(state, { controller }: { controller: AbortController }) {
|
|
33
|
+
const currentControllers = state.controller;
|
|
34
|
+
return {
|
|
35
|
+
...state,
|
|
36
|
+
controller: [...currentControllers, controller],
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
setError(state) {
|
|
40
|
+
return {
|
|
41
|
+
...state,
|
|
42
|
+
isError: true,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
saveSearch(state, { suggestions }: { suggestions: SearchResultWeb[] }) {
|
|
46
|
+
return {
|
|
47
|
+
...state,
|
|
48
|
+
suggestions,
|
|
49
|
+
isError: null,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
effects: (dispatch) => ({
|
|
54
|
+
async getSuggestions({ value }, state) {
|
|
55
|
+
const basePath = state.configuration.config.base;
|
|
56
|
+
try {
|
|
57
|
+
const controller = new window.AbortController();
|
|
58
|
+
dispatch.search.addControllerToQueue({ controller });
|
|
59
|
+
const signal = controller.signal;
|
|
60
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#Browser_compatibility
|
|
61
|
+
// FUTURE: signal is not well supported for IE and Samsung Browser
|
|
62
|
+
const suggestions: SearchResultWeb[] = await API.request(
|
|
63
|
+
`${basePath}-/verdaccio/search/${encodeURIComponent(value)}`,
|
|
64
|
+
'GET',
|
|
65
|
+
{
|
|
66
|
+
signal,
|
|
67
|
+
headers: {},
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
dispatch.search.saveSearch({ suggestions });
|
|
72
|
+
} catch (error: any) {
|
|
73
|
+
if (error.name === CONSTANTS.ABORT_ERROR) {
|
|
74
|
+
dispatch.search.saveSearch({ suggestions: [] });
|
|
75
|
+
} else {
|
|
76
|
+
dispatch.search.setError();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RematchDispatch, RematchRootState, init } from '@rematch/core';
|
|
2
|
+
import loadingPlugin, { ExtraModelsFromLoading } from '@rematch/loading';
|
|
3
|
+
|
|
4
|
+
import { RootModel, models } from './models';
|
|
5
|
+
|
|
6
|
+
type FullModel = ExtraModelsFromLoading<RootModel>;
|
|
7
|
+
|
|
8
|
+
export const store = init<RootModel, FullModel>({
|
|
9
|
+
models,
|
|
10
|
+
plugins: [loadingPlugin()],
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type Store = typeof store;
|
|
14
|
+
export type Dispatch = RematchDispatch<RootModel>;
|
|
15
|
+
export type RootState = RematchRootState<RootModel, FullModel>;
|
package/src/utils/login.test.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// eslint-disable-next-line jest/no-mocks-import
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
generateInvalidToken,
|
|
4
4
|
generateTokenWithExpirationAsString,
|
|
5
5
|
generateTokenWithOutExpiration,
|
|
6
|
-
|
|
6
|
+
generateTokenWithTimeRange,
|
|
7
7
|
} from '../../jest/unit/components/__mocks__/token';
|
|
8
|
-
|
|
9
8
|
import { isTokenExpire } from './login';
|
|
10
9
|
|
|
11
10
|
/* eslint-disable no-console */
|
|
@@ -17,7 +16,7 @@ jest.mock('verdaccio-ui/providers/API/api', () => ({
|
|
|
17
16
|
}));
|
|
18
17
|
|
|
19
18
|
jest.mock('i18next', () => {
|
|
20
|
-
const translationEN = require('../../i18n/translations/
|
|
19
|
+
const translationEN = require('../../i18n/translations/ui.json');
|
|
21
20
|
return {
|
|
22
21
|
t: (key: string) => {
|
|
23
22
|
const splittedKey = key.split('.');
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { packageMeta } from '../../jest/unit/components/store/packageMeta';
|
|
2
|
-
|
|
3
2
|
import {
|
|
4
|
-
formatLicense,
|
|
5
|
-
formatRepository,
|
|
6
3
|
formatDate,
|
|
7
4
|
formatDateDistance,
|
|
5
|
+
formatLicense,
|
|
6
|
+
formatRepository,
|
|
8
7
|
getLastUpdatedPackageTime,
|
|
9
8
|
getRecentReleases,
|
|
10
9
|
} from './package';
|
package/src/utils/package.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { UpLinks } from '@verdaccio/types';
|
|
2
1
|
import dayjs from 'dayjs';
|
|
3
2
|
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
4
3
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
5
4
|
import i18next from 'i18next';
|
|
6
5
|
import isString from 'lodash/isString';
|
|
7
6
|
|
|
7
|
+
import { UpLinks } from '@verdaccio/types';
|
|
8
|
+
|
|
8
9
|
import { Time } from '../../types/packageMeta';
|
|
9
10
|
|
|
10
11
|
export const TIMEFORMAT = 'L LTS';
|
package/src/utils/sec-utils.ts
CHANGED
|
@@ -1,25 +1,42 @@
|
|
|
1
|
+
import { StyledEngineProvider } from '@mui/material/styles';
|
|
1
2
|
import { render } from '@testing-library/react';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { I18nextProvider } from 'react-i18next';
|
|
4
|
-
|
|
5
|
+
import { Provider } from 'react-redux';
|
|
5
6
|
import ThemeProvider from 'verdaccio-ui/design-tokens/ThemeProvider';
|
|
6
|
-
import APIProvider from 'verdaccio-ui/providers/API/APIProvider';
|
|
7
7
|
import AppConfigurationProvider from 'verdaccio-ui/providers/config';
|
|
8
8
|
|
|
9
|
-
import i18nConfig from '
|
|
9
|
+
import i18nConfig from '../i18n/config';
|
|
10
|
+
|
|
11
|
+
const renderWithStore = (ui, store) =>
|
|
12
|
+
render(ui, {
|
|
13
|
+
wrapper: ({ children }) => (
|
|
14
|
+
<Provider store={store}>
|
|
15
|
+
<AppConfigurationProvider>
|
|
16
|
+
<StyledEngineProvider injectFirst={true}>
|
|
17
|
+
<ThemeProvider>
|
|
18
|
+
<I18nextProvider i18n={i18nConfig}>{children}</I18nextProvider>
|
|
19
|
+
</ThemeProvider>
|
|
20
|
+
</StyledEngineProvider>
|
|
21
|
+
</AppConfigurationProvider>
|
|
22
|
+
</Provider>
|
|
23
|
+
),
|
|
24
|
+
});
|
|
10
25
|
|
|
11
26
|
const customRender = (node: React.ReactElement, ...options: any) => {
|
|
12
27
|
return render(
|
|
13
28
|
<AppConfigurationProvider>
|
|
14
|
-
<
|
|
29
|
+
<StyledEngineProvider injectFirst={true}>
|
|
15
30
|
<ThemeProvider>
|
|
16
31
|
<I18nextProvider i18n={i18nConfig}>{node}</I18nextProvider>
|
|
17
32
|
</ThemeProvider>
|
|
18
|
-
</
|
|
33
|
+
</StyledEngineProvider>
|
|
19
34
|
</AppConfigurationProvider>,
|
|
20
35
|
...options
|
|
21
36
|
);
|
|
22
37
|
};
|
|
23
38
|
|
|
24
39
|
export * from '@testing-library/react';
|
|
40
|
+
// FIXME: rename all references with customRemder
|
|
25
41
|
export { customRender as render };
|
|
42
|
+
export { customRender, renderWithStore };
|
package/src/utils/url.test.ts
CHANGED