@verdaccio/ui-components 2.0.0-6-next.8 → 2.0.0-6-next.10
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 -9
- package/CHANGELOG.md +12 -0
- package/build/Theme/ResetStyles.js +34 -37
- package/build/Theme/StyleBaseline.js +4 -6
- package/build/Theme/ThemeProvider.js +24 -34
- package/build/Theme/colors.js +1 -1
- package/build/Theme/index.js +9 -10
- package/build/Theme/theme.js +26 -28
- package/build/__mocks__/react-markdown.js +6 -5
- package/build/__mocks__/remark-plugin.js +1 -1
- package/build/components/ActionBar/ActionBar.js +23 -36
- package/build/components/ActionBar/ActionBarAction.js +45 -58
- package/build/components/ActionBar/index.js +3 -3
- package/build/components/Author/Author.js +26 -21
- package/build/components/Author/index.js +3 -3
- package/build/components/Author/styles.js +5 -5
- package/build/components/CopyClipboard/CopyToClipBoard.js +21 -23
- package/build/components/CopyClipboard/index.js +4 -4
- package/build/components/CopyClipboard/utils.js +14 -16
- package/build/components/Dependencies/Dependencies.js +68 -66
- package/build/components/Dependencies/index.js +3 -3
- package/build/components/Dependencies/styles.js +9 -11
- package/build/components/Deprecated/Deprecated.js +12 -15
- package/build/components/Deprecated/index.js +3 -3
- package/build/components/Developers/Developers.js +30 -45
- package/build/components/Developers/Title.js +22 -21
- package/build/components/Developers/get-unique-developer-values.js +3 -13
- package/build/components/Developers/index.js +5 -6
- package/build/components/Developers/styles.js +7 -7
- package/build/components/Distribution/Dist.js +28 -23
- package/build/components/Distribution/index.js +3 -3
- package/build/components/Distribution/styles.js +7 -7
- package/build/components/Distribution/utils.js +0 -1
- package/build/components/Distribution/utilts.spec.js +18 -0
- package/build/components/Engines/Engines.js +46 -36
- package/build/components/Engines/index.js +3 -3
- package/build/components/Engines/styles.js +4 -4
- package/build/components/ErrorBoundary/ErrorBoundary.js +29 -50
- package/build/components/ErrorBoundary/index.js +3 -3
- package/build/components/FundButton/FundButton.js +28 -29
- package/build/components/FundButton/index.js +3 -3
- package/build/components/HeaderInfoDialog/HeaderInfoDialog.js +33 -44
- package/build/components/HeaderInfoDialog/index.js +3 -3
- package/build/components/Heading/Heading.js +10 -14
- package/build/components/Heading/index.js +3 -3
- package/build/components/Help/Help.js +22 -21
- package/build/components/Help/index.js +3 -3
- package/build/components/Help/styles.js +2 -2
- package/build/components/Icons/DevsIcons/CommonJS.js +9 -10
- package/build/components/Icons/DevsIcons/ES6Module.js +9 -10
- package/build/components/Icons/DevsIcons/Git.js +9 -10
- package/build/components/Icons/DevsIcons/NodeJS.js +9 -10
- package/build/components/Icons/DevsIcons/TypeScript.js +9 -10
- package/build/components/Icons/DevsIcons/index.js +5 -5
- package/build/components/Icons/Earth.js +11 -11
- package/build/components/Icons/FileBinary.js +4 -4
- package/build/components/Icons/Law.js +4 -4
- package/build/components/Icons/License.js +5 -5
- package/build/components/Icons/License.js.map +1 -1
- package/build/components/Icons/Managers/Npm.js +9 -10
- package/build/components/Icons/Managers/Pnpm.js +9 -10
- package/build/components/Icons/Managers/Yarn.js +9 -10
- package/build/components/Icons/Managers/index.js +3 -3
- package/build/components/Icons/SvgIcon.js +14 -22
- package/build/components/Icons/Time.js +6 -6
- package/build/components/Icons/Version.js +4 -4
- package/build/components/Icons/index.js +8 -8
- package/build/components/Install/Install.js +40 -26
- package/build/components/Install/InstallListItem.js +49 -40
- package/build/components/Install/index.js +3 -3
- package/build/components/Label/Label.js +13 -18
- package/build/components/Label/index.js +3 -3
- package/build/components/Link/Link.js +16 -15
- package/build/components/Link/index.js +3 -3
- package/build/components/Loading/Loading.js +10 -12
- package/build/components/Loading/Spinner/Spinner.js +27 -37
- package/build/components/Loading/Spinner/index.js +3 -3
- package/build/components/Loading/index.js +3 -3
- package/build/components/Loading/styles.js +11 -12
- package/build/components/LoginDialog/LoginDialog.js +44 -83
- package/build/components/LoginDialog/LoginDialogCloseButton.js +20 -19
- package/build/components/LoginDialog/LoginDialogForm.js +41 -40
- package/build/components/LoginDialog/LoginDialogFormError.js +26 -28
- package/build/components/LoginDialog/LoginDialogHeader.js +29 -29
- package/build/components/LoginDialog/index.js +3 -3
- package/build/components/Logo/Logo.js +35 -36
- package/build/components/Logo/index.js +3 -3
- package/build/components/MenuItem/MenuItem.js +8 -9
- package/build/components/MenuItem/index.js +3 -3
- package/build/components/NoItems/NoItems.js +10 -21
- package/build/components/NoItems/index.js +3 -3
- package/build/components/NotFound/NotFound.js +25 -26
- package/build/components/NotFound/index.js +3 -3
- package/build/components/Package/Package.js +112 -152
- package/build/components/Package/Tag/Tag.js +6 -7
- package/build/components/Package/Tag/index.js +3 -3
- package/build/components/Package/Tag/styles.js +2 -2
- package/build/components/Package/index.js +5 -6
- package/build/components/Package/styles.js +65 -70
- package/build/components/PackageList/PackageList.js +56 -52
- package/build/components/PackageList/index.js +3 -3
- package/build/components/RawViewer/RawViewer.js +23 -22
- package/build/components/RawViewer/index.js +3 -3
- package/build/components/Readme/Readme.js +21 -21
- package/build/components/Readme/Readme.js.map +1 -1
- package/build/components/Readme/Readme.spec.js +6 -6
- package/build/components/Readme/Readme.spec.js.map +1 -1
- package/build/components/Readme/index.js +3 -3
- package/build/components/Readme/utils.js +7 -8
- package/build/components/RegistryInfoDialog/RegistryInfoDialog.js +14 -14
- package/build/components/RegistryInfoDialog/index.js +3 -3
- package/build/components/RegistryInfoDialog/styles.js +17 -19
- package/build/components/Repository/Repository.js +37 -36
- package/build/components/Repository/index.js +3 -3
- package/build/components/Search/AutoComplete/AutoComplete.js +26 -35
- package/build/components/Search/AutoComplete/index.js +3 -3
- package/build/components/Search/AutoComplete/styles.js +15 -16
- package/build/components/Search/Search.js +54 -54
- package/build/components/Search/SearchItem.js +57 -65
- package/build/components/Search/index.js +3 -3
- package/build/components/Search/styles.js +16 -17
- package/build/components/SettingsMenu/SettingsMenu.js +68 -0
- package/build/components/SettingsMenu/index.js +14 -0
- package/build/components/SideBarTittle/SideBarTittle.js +33 -31
- package/build/components/SideBarTittle/index.js +3 -3
- package/build/components/SideBarTittle/utils.js +4 -4
- package/build/components/TextField/TextField.js +18 -23
- package/build/components/TextField/index.js +3 -3
- package/build/components/UpLinks/UpLinks.js +18 -16
- package/build/components/UpLinks/index.js +3 -3
- package/build/components/UpLinks/styles.js +20 -22
- package/build/components/Versions/HistoryList.js +25 -25
- package/build/components/Versions/TagList.js +19 -22
- package/build/components/Versions/Versions.js +21 -20
- package/build/components/Versions/index.js +3 -3
- package/build/components/Versions/styles.js +19 -21
- package/build/hooks/index.js +5 -5
- package/build/hooks/useLocalStorage.js +18 -27
- package/build/hooks/useOnClickOutside.js +5 -5
- package/build/index.js +104 -97
- package/build/layouts/Version/Version.js +8 -8
- package/build/layouts/Version/index.js +3 -3
- package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +18 -31
- package/build/providers/AppConfigurationProvider/index.js +5 -6
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +38 -0
- package/build/providers/PersistenceSettingProvider/index.js +21 -0
- package/build/providers/TranslatorProvider/TranslatorProvider.js +26 -51
- package/build/providers/TranslatorProvider/TranslatorProvider.spec.js +54 -0
- package/build/providers/TranslatorProvider/index.js +6 -7
- package/build/providers/VersionProvider/VersionProvider.js +32 -34
- package/build/providers/VersionProvider/index.js +5 -6
- package/build/providers/index.js +3 -3
- package/build/sections/Detail/ContainerContent.js +24 -35
- package/build/sections/Detail/Detail.js +21 -30
- package/build/sections/Detail/ReadmeSection.js +7 -6
- package/build/sections/Detail/Tabs.js +16 -14
- package/build/sections/Detail/index.js +3 -3
- package/build/sections/Footer/Footer.js +55 -57
- package/build/sections/Footer/index.js +3 -3
- package/build/sections/Footer/styles.js +41 -47
- package/build/sections/Header/Header.js +36 -70
- package/build/sections/Header/HeaderGreetings.js +10 -8
- package/build/sections/Header/HeaderLeft.js +11 -12
- package/build/sections/Header/HeaderMenu.js +18 -17
- package/build/sections/Header/HeaderRight.js +41 -51
- package/build/sections/Header/HeaderSettingsDialog.js +48 -57
- package/build/sections/Header/HeaderToolTip.js +10 -11
- package/build/sections/Header/HeaderToolTipIcon.js +19 -19
- package/build/sections/Header/LanguageSwitch.js +51 -56
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +72 -71
- package/build/sections/Header/RegistryInfoContent/index.js +3 -3
- package/build/sections/Header/RegistryInfoContent/styles.js +13 -16
- package/build/sections/Header/RegistryInfoDialog/RegistryInfoDialog.js +14 -14
- package/build/sections/Header/RegistryInfoDialog/index.js +3 -3
- package/build/sections/Header/RegistryInfoDialog/styles.js +17 -19
- package/build/sections/Header/index.js +3 -3
- package/build/sections/Header/styles.js +35 -38
- package/build/sections/Home/Home.js +11 -14
- package/build/sections/Home/index.js +3 -3
- package/build/sections/SideBar/Sidebar.js +38 -54
- package/build/sections/SideBar/index.js +3 -3
- package/build/sections/index.js +5 -5
- package/build/src/components/ActionBar/ActionBar.stories.d.ts +11 -6
- package/build/src/components/ActionBar/ActionBarAction.d.ts +1 -34
- package/build/src/components/Author/styles.d.ts +1 -20
- package/build/src/components/Dependencies/Dependencies.stories.d.ts +8 -6
- package/build/src/components/Dependencies/styles.d.ts +2 -30
- package/build/src/components/Deprecated/Deprecated.d.ts +1 -11
- package/build/src/components/Developers/Developers.d.ts +1 -34
- package/build/src/components/Developers/styles.d.ts +1 -34
- package/build/src/components/Distribution/Dist.stories.d.ts +4 -1
- package/build/src/components/Distribution/styles.d.ts +3 -76
- package/build/src/components/Distribution/utils.d.ts +2 -1
- package/build/src/components/Engines/styles.d.ts +1 -21
- package/build/src/components/FundButton/FundButton.stories.d.ts +7 -5
- package/build/src/components/Help/styles.d.ts +1 -10
- package/build/src/components/Icons/Earth.d.ts +2 -2
- package/build/src/components/Icons/FileBinary.d.ts +2 -2
- package/build/src/components/Icons/Law.d.ts +2 -2
- package/build/src/components/Icons/License.d.ts +2 -2
- package/build/src/components/Icons/SvgIcon.d.ts +1 -1
- package/build/src/components/Icons/Time.d.ts +2 -2
- package/build/src/components/Icons/Version.d.ts +2 -2
- package/build/src/components/Install/Install.stories.d.ts +9 -5
- package/build/src/components/MenuItem/MenuItem.d.ts +1 -1
- package/build/src/components/NoItems/NoItems.d.ts +0 -1
- package/build/src/components/Package/styles.d.ts +3 -61
- package/build/src/components/RegistryInfoDialog/styles.d.ts +1 -11
- package/build/src/components/Repository/Repository.stories.d.ts +8 -6
- package/build/src/components/Search/AutoComplete/styles.d.ts +1 -1
- package/build/src/components/Search/Search.d.ts +1 -1
- package/build/src/components/Search/styles.d.ts +2 -16
- package/build/src/components/SettingsMenu/SettingsMenu.d.ts +6 -0
- package/build/src/components/SettingsMenu/index.d.ts +1 -0
- package/build/src/components/SideBarTittle/SideBarTittle.stories.d.ts +9 -0
- package/build/src/components/TextField/TextField.d.ts +1 -1
- package/build/src/components/Versions/types.d.ts +0 -2
- package/build/src/index.d.ts +1 -0
- package/build/src/layouts/Version/Version.stories.d.ts +7 -6
- package/build/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.d.ts +6 -0
- package/build/src/providers/PersistenceSettingProvider/index.d.ts +1 -0
- package/build/src/providers/TranslatorProvider/TranslatorProvider.d.ts +2 -1
- package/build/src/providers/TranslatorProvider/TranslatorProvider.spec.d.ts +1 -0
- package/build/src/providers/VersionProvider/VersionProvider.d.ts +0 -2
- package/build/src/sections/Header/LanguageSwitch.d.ts +3 -23
- package/build/src/sections/Header/RegistryInfoDialog/styles.d.ts +1 -11
- package/build/src/sections/Header/styles.d.ts +8 -166
- package/build/src/types/packageMeta.d.ts +6 -6
- package/build/store/api.js +35 -52
- package/build/store/index.js +9 -9
- package/build/store/models/configuration.js +12 -34
- package/build/store/models/download.js +22 -46
- package/build/store/models/index.js +1 -1
- package/build/store/models/login.js +55 -79
- package/build/store/models/manifest.js +52 -78
- package/build/store/models/packages.js +22 -51
- package/build/store/models/search.js +59 -87
- package/build/store/storage.js +5 -5
- package/build/store/store.js +3 -3
- package/build/test/i18n-config.js +5 -5
- package/build/test/test-react-testing-library.js +19 -24
- package/build/utils/__partials__/packageMeta.js +1 -1
- package/build/utils/cli-utils.js +27 -20
- package/build/utils/index.js +10 -11
- package/build/utils/loadable.js +9 -12
- package/build/utils/routes.js +4 -4
- package/build/utils/url.js +9 -9
- package/build/utils/utils.js +18 -22
- package/package.json +22 -19
- package/src/Theme/ThemeProvider.tsx +0 -1
- package/src/components/ActionBar/ActionBar.stories.tsx +60 -46
- package/src/components/Author/Author.stories.tsx +1 -1
- package/src/components/CopyClipboard/CopyToClipBoard.stories.tsx +1 -1
- package/src/components/CopyClipboard/CopyToClipBoard.tsx +2 -2
- package/src/components/Dependencies/Dependencies.stories.tsx +151 -51
- package/src/components/Dependencies/Dependencies.tsx +61 -51
- package/src/components/Deprecated/Deprecated.stories.tsx +1 -1
- package/src/components/Deprecated/Deprecated.tsx +1 -1
- package/src/components/Developers/Developers.stories.tsx +1 -1
- package/src/components/Distribution/Dist.stories.tsx +46 -3
- package/src/components/Distribution/Dist.test.tsx +33 -6
- package/src/components/Distribution/Dist.tsx +13 -5
- package/src/components/Distribution/utils.ts +3 -2
- package/src/components/Distribution/utilts.spec.ts +17 -0
- package/src/components/Engines/Engines.stories.tsx +1 -1
- package/src/components/FundButton/FundButton.stories.tsx +48 -17
- package/src/components/Help/Help.stories.tsx +1 -1
- package/src/components/Icons/Icons.stories.tsx +1 -1
- package/src/components/Install/Install.stories.tsx +79 -26
- package/src/components/Install/Install.tsx +28 -14
- package/src/components/Install/InstallListItem.tsx +24 -8
- package/src/components/Loading/Loading.stories.tsx +1 -1
- package/src/components/LoginDialog/LoginDialog.stories.tsx +1 -1
- package/src/components/NoItems/NoItems.stories.tsx +1 -1
- package/src/components/NoItems/NoItems.tsx +5 -6
- package/src/components/Package/Package.tsx +1 -1
- package/src/components/Repository/Repository.stories.tsx +39 -12
- package/src/components/Repository/Repository.tsx +2 -4
- package/src/components/Search/Search.stories.tsx +1 -1
- package/src/components/SettingsMenu/SettingsMenu.tsx +67 -0
- package/src/components/SettingsMenu/index.ts +1 -0
- package/src/components/SideBarTittle/SideBarTittle.stories.tsx +68 -0
- package/src/components/UpLinks/Uplinks.stories.tsx +1 -1
- package/src/components/Versions/types.ts +0 -2
- package/src/index.ts +2 -0
- package/src/layouts/Version/Version.stories.tsx +35 -20
- package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +0 -1
- package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +57 -0
- package/src/providers/PersistenceSettingProvider/index.ts +1 -0
- package/src/providers/TranslatorProvider/TranslatorProvider.spec.tsx +52 -0
- package/src/providers/TranslatorProvider/TranslatorProvider.tsx +2 -1
- package/src/providers/VersionProvider/VersionProvider.test.tsx +1 -1
- package/src/providers/VersionProvider/VersionProvider.tsx +0 -2
- package/src/sections/Detail/Detail.stories.tsx +1 -1
- package/src/sections/Header/Header.stories.tsx +1 -1
- package/src/sections/Home/Home.stories.tsx +1 -1
- package/src/sections/SideBar/Sidebar.stories.tsx +1 -1
- package/src/sections/SideBar/Sidebar.test.tsx +0 -1
- package/src/test/test-react-testing-library.tsx +17 -12
- package/src/types/index.d.ts +2 -0
- package/src/types/packageMeta.ts +6 -6
- package/src/utils/url.test.ts +4 -0
- package/src/utils/url.ts +1 -1
- package/tsconfig.build.json +1 -0
- package/tsconfig.json +0 -1
|
@@ -34,12 +34,12 @@ function CopyToClipBoard({ text, children, dataTestId, title, ...props }: Props)
|
|
|
34
34
|
<Content>{children ?? text}</Content>
|
|
35
35
|
{title ? (
|
|
36
36
|
<Tooltip disableFocusListener={true} title={title}>
|
|
37
|
-
<IconButton data-testid={dataTestId} onClick={copyToClipBoardUtility(text)} size="
|
|
37
|
+
<IconButton data-testid={dataTestId} onClick={copyToClipBoardUtility(text)} size="small">
|
|
38
38
|
<FileCopy fontSize="small" />
|
|
39
39
|
</IconButton>
|
|
40
40
|
</Tooltip>
|
|
41
41
|
) : (
|
|
42
|
-
<IconButton data-testid={dataTestId} onClick={copyToClipBoardUtility(text)} size="
|
|
42
|
+
<IconButton data-testid={dataTestId} onClick={copyToClipBoardUtility(text)} size="small">
|
|
43
43
|
<FileCopy fontSize="small" />
|
|
44
44
|
</IconButton>
|
|
45
45
|
)}
|
|
@@ -1,58 +1,158 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import { default as Dependencies } from '.';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
title: 'Dependencies
|
|
6
|
+
const meta: Meta<typeof Dependencies> = {
|
|
7
|
+
title: 'Components/Detail/Dependencies',
|
|
8
|
+
component: Dependencies,
|
|
7
9
|
};
|
|
8
10
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
packageMeta={{
|
|
12
|
-
latest: {
|
|
13
|
-
name: 'verdaccio',
|
|
14
|
-
version: '4.0.0',
|
|
15
|
-
author: {
|
|
16
|
-
name: 'verdaccio user',
|
|
17
|
-
email: 'verdaccio.user@verdaccio.org',
|
|
18
|
-
url: '',
|
|
19
|
-
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
20
|
-
},
|
|
21
|
-
dist: { fileCount: 0, unpackedSize: 0 },
|
|
22
|
-
dependencies: {
|
|
23
|
-
react: '16.9.0',
|
|
24
|
-
'react-dom': '16.9.0',
|
|
25
|
-
},
|
|
26
|
-
devDependencies: {
|
|
27
|
-
'babel-core': '7.0.0-beta6',
|
|
28
|
-
},
|
|
29
|
-
peerDependencies: {
|
|
30
|
-
'styled-components': '5.0.0',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
_uplinks: {},
|
|
34
|
-
}}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof Dependencies>;
|
|
37
13
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
14
|
+
const packageMeta = {
|
|
15
|
+
latest: {
|
|
16
|
+
name: 'verdaccio',
|
|
17
|
+
version: '4.0.0',
|
|
18
|
+
author: {
|
|
19
|
+
name: 'verdaccio user',
|
|
20
|
+
email: 'verdaccio.user@verdaccio.org',
|
|
21
|
+
url: '',
|
|
22
|
+
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
23
|
+
},
|
|
24
|
+
dist: { fileCount: 0, unpackedSize: 0 },
|
|
25
|
+
dependencies: {
|
|
26
|
+
react: '16.9.0',
|
|
27
|
+
'react-dom': '16.9.0',
|
|
28
|
+
'@storybook/codemod': '^3.2.6',
|
|
29
|
+
chalk: '^2.1.0',
|
|
30
|
+
'child-process-promise': '^2.2.1',
|
|
31
|
+
commander: '^2.11.0',
|
|
32
|
+
'cross-spawn': '^5.0.1',
|
|
33
|
+
jscodeshift: '^0.3.30',
|
|
34
|
+
json5: '^0.5.1',
|
|
35
|
+
'latest-version': '^3.1.0',
|
|
36
|
+
'merge-dirs': '^0.2.1',
|
|
37
|
+
opencollective: '^1.0.3',
|
|
38
|
+
shelljs: '^0.7.8',
|
|
39
|
+
'update-notifier': '^2.1.0',
|
|
40
|
+
},
|
|
41
|
+
devDependencies: {
|
|
42
|
+
'babel-core': '7.0.0-beta6',
|
|
43
|
+
'cross-spawn': '^5.0.1',
|
|
44
|
+
jscodeshift: '^0.3.30',
|
|
45
|
+
json5: '^0.5.1',
|
|
46
|
+
'latest-version': '^3.1.0',
|
|
47
|
+
'merge-dirs': '^0.2.1',
|
|
48
|
+
opencollective: '^1.0.3',
|
|
49
|
+
shelljs: '^0.7.8',
|
|
50
|
+
'update-notifier': '^2.1.0',
|
|
51
|
+
},
|
|
52
|
+
peerDependencies: {
|
|
53
|
+
'styled-components': '5.0.0',
|
|
54
|
+
'cross-spawn': '^5.0.1',
|
|
55
|
+
jscodeshift: '^0.3.30',
|
|
56
|
+
json5: '^0.5.1',
|
|
57
|
+
'latest-version': '^3.1.0',
|
|
58
|
+
'merge-dirs': '^0.2.1',
|
|
59
|
+
opencollective: '^1.0.3',
|
|
60
|
+
shelljs: '^0.7.8',
|
|
61
|
+
'update-notifier': '^2.1.0',
|
|
62
|
+
},
|
|
63
|
+
optionalDependencies: {
|
|
64
|
+
'styled-components': '5.0.0',
|
|
65
|
+
'cross-spawn': '^5.0.1',
|
|
66
|
+
jscodeshift: '^0.3.30',
|
|
67
|
+
json5: '^0.5.1',
|
|
68
|
+
'latest-version': '^3.1.0',
|
|
69
|
+
'merge-dirs': '^0.2.1',
|
|
70
|
+
opencollective: '^1.0.3',
|
|
71
|
+
shelljs: '^0.7.8',
|
|
72
|
+
'update-notifier': '^2.1.0',
|
|
73
|
+
},
|
|
74
|
+
bundleDependencies: {
|
|
75
|
+
'styled-components': '5.0.0',
|
|
76
|
+
'cross-spawn': '^5.0.1',
|
|
77
|
+
jscodeshift: '^0.3.30',
|
|
78
|
+
json5: '^0.5.1',
|
|
79
|
+
'latest-version': '^3.1.0',
|
|
80
|
+
'merge-dirs': '^0.2.1',
|
|
81
|
+
opencollective: '^1.0.3',
|
|
82
|
+
shelljs: '^0.7.8',
|
|
83
|
+
'update-notifier': '^2.1.0',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
_uplinks: {},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const Primary: Story = {
|
|
90
|
+
name: 'Default',
|
|
91
|
+
render: () => {
|
|
92
|
+
return <Dependencies packageMeta={packageMeta} />;
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const OnlyDeps: Story = {
|
|
97
|
+
name: 'Only dependencies',
|
|
98
|
+
render: () => {
|
|
99
|
+
return (
|
|
100
|
+
<Dependencies
|
|
101
|
+
packageMeta={{
|
|
102
|
+
latest: {
|
|
103
|
+
name: 'verdaccio',
|
|
104
|
+
version: '4.0.0',
|
|
105
|
+
author: {
|
|
106
|
+
name: 'verdaccio user',
|
|
107
|
+
email: 'verdaccio.user@verdaccio.org',
|
|
108
|
+
url: '',
|
|
109
|
+
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
110
|
+
},
|
|
111
|
+
dist: { fileCount: 0, unpackedSize: 0 },
|
|
112
|
+
dependencies: {
|
|
113
|
+
'styled-components': '5.0.0',
|
|
114
|
+
'cross-spawn': '^5.0.1',
|
|
115
|
+
jscodeshift: '^0.3.30',
|
|
116
|
+
json5: '^0.5.1',
|
|
117
|
+
'latest-version': '^3.1.0',
|
|
118
|
+
'merge-dirs': '^0.2.1',
|
|
119
|
+
opencollective: '^1.0.3',
|
|
120
|
+
shelljs: '^0.7.8',
|
|
121
|
+
'update-notifier': '^2.1.0',
|
|
122
|
+
},
|
|
123
|
+
devDependencies: { jscodeshift: '^0.3.30', json5: '^0.5.1' },
|
|
124
|
+
peerDependencies: {},
|
|
125
|
+
},
|
|
126
|
+
_uplinks: {},
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const NoDependencies: Story = {
|
|
134
|
+
name: 'No dependencies',
|
|
135
|
+
render: () => {
|
|
136
|
+
return (
|
|
137
|
+
<Dependencies
|
|
138
|
+
packageMeta={{
|
|
139
|
+
latest: {
|
|
140
|
+
name: 'verdaccio',
|
|
141
|
+
version: '4.0.0',
|
|
142
|
+
author: {
|
|
143
|
+
name: 'verdaccio user',
|
|
144
|
+
email: 'verdaccio.user@verdaccio.org',
|
|
145
|
+
url: '',
|
|
146
|
+
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
147
|
+
},
|
|
148
|
+
dist: { fileCount: 0, unpackedSize: 0 },
|
|
149
|
+
dependencies: {},
|
|
150
|
+
devDependencies: {},
|
|
151
|
+
peerDependencies: {},
|
|
152
|
+
},
|
|
153
|
+
_uplinks: {},
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
1
2
|
import CardContent from '@mui/material/CardContent';
|
|
3
|
+
import { useTheme } from '@mui/styles';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { useTranslation } from 'react-i18next';
|
|
4
6
|
import { useHistory } from 'react-router-dom';
|
|
@@ -10,44 +12,38 @@ import { CardWrap, StyledText, Tag, Tags } from './styles';
|
|
|
10
12
|
interface DependencyBlockProps {
|
|
11
13
|
title: string;
|
|
12
14
|
dependencies: PackageDependencies;
|
|
13
|
-
enableLoading?: () => void;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
const DependencyBlock: React.FC<DependencyBlockProps> = ({
|
|
17
|
-
title,
|
|
18
|
-
dependencies,
|
|
19
|
-
enableLoading,
|
|
20
|
-
}) => {
|
|
17
|
+
const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {
|
|
21
18
|
const history = useHistory();
|
|
22
19
|
const { t } = useTranslation();
|
|
20
|
+
const theme = useTheme();
|
|
23
21
|
|
|
24
22
|
const deps = Object.entries(dependencies);
|
|
25
23
|
|
|
26
24
|
function handleClick(name: string): void {
|
|
27
|
-
enableLoading?.();
|
|
28
|
-
|
|
29
25
|
history.push(`/-/web/detail/${name}`);
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
return (
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</
|
|
50
|
-
</
|
|
29
|
+
<Box data-testid={title} sx={{ margin: theme.spacing(2) }}>
|
|
30
|
+
<StyledText sx={{ marginBottom: theme.spacing(1) }} variant="subtitle1">
|
|
31
|
+
{`${title} (${deps.length})`}
|
|
32
|
+
</StyledText>
|
|
33
|
+
<Tags>
|
|
34
|
+
{deps.map(([name, version]) => (
|
|
35
|
+
<Tag
|
|
36
|
+
className={'dep-tag'}
|
|
37
|
+
clickable={true}
|
|
38
|
+
data-testid={name}
|
|
39
|
+
key={name}
|
|
40
|
+
label={t('dependencies.dependency-block', { package: name, version })}
|
|
41
|
+
// eslint-disable-next-line
|
|
42
|
+
onClick={() => handleClick(name)}
|
|
43
|
+
/>
|
|
44
|
+
))}
|
|
45
|
+
</Tags>
|
|
46
|
+
</Box>
|
|
51
47
|
);
|
|
52
48
|
};
|
|
53
49
|
|
|
@@ -65,37 +61,51 @@ const Dependencies: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
|
65
61
|
const { latest } = packageMeta;
|
|
66
62
|
// FIXME: add dependencies to package meta type
|
|
67
63
|
// @ts-ignore
|
|
68
|
-
const {
|
|
69
|
-
|
|
64
|
+
const {
|
|
65
|
+
dependencies,
|
|
66
|
+
devDependencies,
|
|
67
|
+
peerDependencies,
|
|
68
|
+
optionalDependencies,
|
|
69
|
+
bundleDependencies,
|
|
70
|
+
name,
|
|
71
|
+
} = latest;
|
|
72
|
+
const dependencyMap = {
|
|
73
|
+
dependencies,
|
|
74
|
+
devDependencies,
|
|
75
|
+
peerDependencies,
|
|
76
|
+
bundleDependencies,
|
|
77
|
+
optionalDependencies,
|
|
78
|
+
};
|
|
70
79
|
const hasDependencies =
|
|
71
|
-
hasKeys(dependencies) ||
|
|
72
|
-
|
|
80
|
+
hasKeys(dependencies) ||
|
|
81
|
+
hasKeys(bundleDependencies) ||
|
|
82
|
+
hasKeys(optionalDependencies) ||
|
|
83
|
+
hasKeys(devDependencies) ||
|
|
84
|
+
hasKeys(peerDependencies);
|
|
73
85
|
if (hasDependencies) {
|
|
74
86
|
return (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
<CardWrap>
|
|
88
|
+
<CardContent>
|
|
89
|
+
{Object.entries(dependencyMap).map(([dependencyType, dependencies]) => {
|
|
90
|
+
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return (
|
|
94
|
+
<>
|
|
95
|
+
<DependencyBlock
|
|
96
|
+
dependencies={dependencies}
|
|
97
|
+
key={dependencyType}
|
|
98
|
+
title={dependencyType}
|
|
99
|
+
/>
|
|
100
|
+
</>
|
|
101
|
+
);
|
|
102
|
+
})}
|
|
103
|
+
</CardContent>
|
|
104
|
+
</CardWrap>
|
|
90
105
|
);
|
|
91
106
|
}
|
|
92
107
|
|
|
93
|
-
return (
|
|
94
|
-
<NoItems
|
|
95
|
-
className="no-dependencies"
|
|
96
|
-
text={t('dependencies.has-no-dependencies', { package: name })}
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
108
|
+
return <NoItems text={t('dependencies.has-no-dependencies', { package: name })} />;
|
|
99
109
|
};
|
|
100
110
|
|
|
101
111
|
export default Dependencies;
|
|
@@ -3,10 +3,10 @@ import React from 'react';
|
|
|
3
3
|
import { default as Dist } from '.';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
title: 'Dist',
|
|
6
|
+
title: 'Components/Sidebar/Dist',
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const AllProperties: any = () => (
|
|
10
10
|
<Dist
|
|
11
11
|
packageMeta={{
|
|
12
12
|
latest: {
|
|
@@ -16,7 +16,50 @@ export const DistFileAll: any = () => (
|
|
|
16
16
|
fileCount: 7,
|
|
17
17
|
unpackedSize: 10,
|
|
18
18
|
},
|
|
19
|
-
license: '',
|
|
19
|
+
license: 'MIT',
|
|
20
|
+
},
|
|
21
|
+
_uplinks: {},
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const NoFileSize: any = () => (
|
|
27
|
+
<Dist
|
|
28
|
+
packageMeta={{
|
|
29
|
+
latest: {
|
|
30
|
+
name: 'verdaccio1',
|
|
31
|
+
version: '4.0.0',
|
|
32
|
+
dist: {
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
fileCount: undefined,
|
|
35
|
+
unpackedSize: 10,
|
|
36
|
+
},
|
|
37
|
+
license: 'MIT',
|
|
38
|
+
},
|
|
39
|
+
_uplinks: {},
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export const OnlyLicense: any = () => (
|
|
45
|
+
<Dist
|
|
46
|
+
packageMeta={{
|
|
47
|
+
latest: {
|
|
48
|
+
name: 'verdaccio1',
|
|
49
|
+
version: '4.0.0',
|
|
50
|
+
license: { type: 'MIT' },
|
|
51
|
+
},
|
|
52
|
+
_uplinks: {},
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
export const NoRender: any = () => (
|
|
58
|
+
<Dist
|
|
59
|
+
packageMeta={{
|
|
60
|
+
latest: {
|
|
61
|
+
name: 'verdaccio1',
|
|
62
|
+
version: '4.0.0',
|
|
20
63
|
},
|
|
21
64
|
_uplinks: {},
|
|
22
65
|
}}
|
|
@@ -14,7 +14,7 @@ describe('<Dist /> component', () => {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
test('should render the component in default state', () => {
|
|
17
|
-
const
|
|
17
|
+
const { getByText } = render(
|
|
18
18
|
withDistComponent({
|
|
19
19
|
latest: {
|
|
20
20
|
name: 'verdaccio1',
|
|
@@ -28,11 +28,16 @@ describe('<Dist /> component', () => {
|
|
|
28
28
|
_uplinks: {},
|
|
29
29
|
})
|
|
30
30
|
);
|
|
31
|
-
expect(
|
|
31
|
+
expect(getByText('sidebar.distribution.title')).toBeInTheDocument();
|
|
32
|
+
expect(getByText('sidebar.distribution.file-count')).toBeInTheDocument();
|
|
33
|
+
expect(getByText('sidebar.distribution.size')).toBeInTheDocument();
|
|
34
|
+
expect(getByText('sidebar.distribution.size')).toBeInTheDocument();
|
|
35
|
+
expect(getByText('7', { exact: false })).toBeInTheDocument();
|
|
36
|
+
expect(getByText('10.00 Bytes', { exact: false })).toBeInTheDocument();
|
|
32
37
|
});
|
|
33
38
|
|
|
34
39
|
test('should render the component with license as string', () => {
|
|
35
|
-
const
|
|
40
|
+
const { getByText } = render(
|
|
36
41
|
withDistComponent({
|
|
37
42
|
latest: {
|
|
38
43
|
name: 'verdaccio2',
|
|
@@ -46,11 +51,11 @@ describe('<Dist /> component', () => {
|
|
|
46
51
|
_uplinks: {},
|
|
47
52
|
})
|
|
48
53
|
);
|
|
49
|
-
expect(
|
|
54
|
+
expect(getByText('MIT', { exact: false })).toBeInTheDocument();
|
|
50
55
|
});
|
|
51
56
|
|
|
52
57
|
test('should render the component with license as object', () => {
|
|
53
|
-
const
|
|
58
|
+
const { getByText } = render(
|
|
54
59
|
withDistComponent({
|
|
55
60
|
latest: {
|
|
56
61
|
name: 'verdaccio3',
|
|
@@ -67,6 +72,28 @@ describe('<Dist /> component', () => {
|
|
|
67
72
|
_uplinks: {},
|
|
68
73
|
})
|
|
69
74
|
);
|
|
70
|
-
expect(
|
|
75
|
+
expect(getByText('MIT', { exact: false })).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('should not render if latest is missing', () => {
|
|
79
|
+
const { queryAllByText } = render(
|
|
80
|
+
withDistComponent({
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
latest: undefined,
|
|
83
|
+
_uplinks: {},
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
expect(queryAllByText('sidebar.distribution.title')).toHaveLength(0);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('should not render if latest content is missing', () => {
|
|
90
|
+
const { queryAllByText } = render(
|
|
91
|
+
withDistComponent({
|
|
92
|
+
// @ts-expect-error
|
|
93
|
+
latest: { dist: undefined, license: undefined },
|
|
94
|
+
_uplinks: {},
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
expect(queryAllByText('sidebar.distribution.title')).toHaveLength(0);
|
|
71
98
|
});
|
|
72
99
|
});
|
|
@@ -25,23 +25,31 @@ const DistChip: FC<{ name: string; children?: React.ReactElement | string }> = (
|
|
|
25
25
|
const Dist: FC<{ packageMeta: PackageMetaInterface }> = ({ packageMeta }) => {
|
|
26
26
|
const { t } = useTranslation();
|
|
27
27
|
|
|
28
|
-
if (!packageMeta) {
|
|
28
|
+
if (!packageMeta?.latest) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const { dist, license } = packageMeta
|
|
32
|
+
const { dist, license } = packageMeta.latest;
|
|
33
|
+
|
|
34
|
+
if (!dist && !license) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
33
37
|
|
|
34
38
|
return (
|
|
35
39
|
<List
|
|
36
40
|
subheader={<StyledText variant="subtitle1">{t('sidebar.distribution.title')}</StyledText>}
|
|
37
41
|
>
|
|
38
42
|
<DistListItem>
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
{dist?.fileCount && (
|
|
44
|
+
<DistChip name={t('sidebar.distribution.file-count')}>{`${dist.fileCount}`}</DistChip>
|
|
45
|
+
)}
|
|
46
|
+
{dist?.unpackedSize ? (
|
|
41
47
|
<DistChip name={t('sidebar.distribution.size')}>{fileSizeSI(dist.unpackedSize)}</DistChip>
|
|
42
48
|
) : null}
|
|
43
49
|
|
|
44
|
-
<DistChip name={t('sidebar.distribution.license')}>
|
|
50
|
+
<DistChip name={t('sidebar.distribution.license')}>
|
|
51
|
+
{formatLicense(license as string)}
|
|
52
|
+
</DistChip>
|
|
45
53
|
</DistListItem>
|
|
46
54
|
</List>
|
|
47
55
|
);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { LicenseInterface } from '../../types/packageMeta';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Formats license field for webui.
|
|
3
5
|
* @see https://docs.npmjs.com/files/package.json#license
|
|
4
6
|
*/
|
|
5
7
|
// License should use type License defined above, but conflicts with the unit test that provide array or empty object
|
|
6
|
-
|
|
7
|
-
export function formatLicense(license: any): string | undefined {
|
|
8
|
+
export function formatLicense(license: string | LicenseInterface): string | undefined {
|
|
8
9
|
if (typeof license === 'string') {
|
|
9
10
|
return license;
|
|
10
11
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fileSizeSI, formatLicense } from './utils';
|
|
2
|
+
|
|
3
|
+
test('formatLicense as string', () => {
|
|
4
|
+
expect(formatLicense('MIT')).toEqual('MIT');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
test('formatLicense as format object', () => {
|
|
8
|
+
expect(formatLicense({ type: 'MIT' })).toEqual('MIT');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('fileSizeSI as number 1000', () => {
|
|
12
|
+
expect(fileSizeSI(1000)).toEqual('1.00 kB');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('fileSizeSI as number 0', () => {
|
|
16
|
+
expect(fileSizeSI(0)).toEqual('0.00 Bytes');
|
|
17
|
+
});
|