@verdaccio/ui-components 3.0.0-next-7.3 → 3.0.0-next-7.4
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/CHANGELOG.md +6 -0
- package/build/components/Dependencies/Dependencies.js +16 -51
- package/build/components/Dependencies/DependencyBlock.js +87 -0
- package/build/components/Dependencies/utits.js +10 -0
- package/build/components/SideBarTitle/SideBarTitle.js +94 -0
- package/build/components/{SideBarTittle → SideBarTitle}/index.js +2 -2
- package/build/index.js +2 -2
- package/build/sections/Header/HeaderSettingsDialog.js +2 -5
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +5 -10
- package/build/sections/SideBar/Sidebar.js +12 -13
- package/build/src/components/Dependencies/Dependencies.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/SideBarTitle/index.d.ts +1 -0
- package/build/src/index.d.ts +1 -1
- package/build/src/sections/Home/Home.test.d.ts +1 -0
- package/package.json +1 -2
- package/src/components/Dependencies/Dependencies.test.tsx +1 -11
- package/src/components/Dependencies/Dependencies.tsx +8 -50
- package/src/components/Dependencies/DependencyBlock.test.tsx +33 -0
- package/src/components/Dependencies/DependencyBlock.tsx +69 -0
- package/src/components/Dependencies/utits.ts +3 -0
- package/src/components/Loading/Loading.test.tsx +4 -3
- package/src/components/SideBarTitle/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/sections/Header/HeaderSettingsDialog.tsx +1 -2
- package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.tsx +2 -7
- package/src/sections/Home/Home.test.tsx +29 -0
- package/src/sections/Home/Home.tsx +0 -1
- package/src/sections/SideBar/Sidebar.test.tsx +42 -85
- package/src/sections/SideBar/Sidebar.tsx +6 -17
- package/build/components/Dependencies/styles.js +0 -64
- package/build/components/SideBarTittle/SideBarTittle.js +0 -94
- package/build/src/components/Dependencies/styles.d.ts +0 -8
- package/build/src/components/SideBarTittle/index.d.ts +0 -1
- package/src/components/Dependencies/styles.ts +0 -26
- package/src/components/SideBarTittle/index.ts +0 -1
- /package/build/components/{SideBarTittle → SideBarTitle}/utils.js +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/{SideBarTittle/SideBarTittle.stories.tsx → SideBarTitle/SideBarTitle.stories.tsx} +0 -0
- /package/src/components/{SideBarTittle/SideBarTittle.tsx → SideBarTitle/SideBarTitle.tsx} +0 -0
- /package/src/components/{SideBarTittle → SideBarTitle}/utils.ts +0 -0
|
@@ -10,17 +10,16 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _ActionBar = _interopRequireDefault(require("../../components/ActionBar"));
|
|
11
11
|
var _Author = _interopRequireDefault(require("../../components/Author"));
|
|
12
12
|
var _Developers = _interopRequireWildcard(require("../../components/Developers"));
|
|
13
|
+
var _Distribution = _interopRequireDefault(require("../../components/Distribution"));
|
|
14
|
+
var _Engines = _interopRequireDefault(require("../../components/Engines"));
|
|
13
15
|
var _FundButton = _interopRequireDefault(require("../../components/FundButton"));
|
|
14
|
-
var
|
|
16
|
+
var _Install = _interopRequireDefault(require("../../components/Install"));
|
|
17
|
+
var _Repository = _interopRequireDefault(require("../../components/Repository"));
|
|
18
|
+
var _SideBarTitle = _interopRequireDefault(require("../../components/SideBarTitle"));
|
|
15
19
|
var _providers = require("../../providers");
|
|
16
|
-
var _loadable = _interopRequireDefault(require("../../utils/loadable"));
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
-
|
|
21
|
-
const Dist = (0, _loadable.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "Distribution" */'../../components/Distribution'))));
|
|
22
|
-
const Install = (0, _loadable.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "Install" */'../../components/Install'))));
|
|
23
|
-
const Repository = (0, _loadable.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "Repository" */'../../components/Repository'))));
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
23
|
const getModuleType = manifest => {
|
|
25
24
|
if (manifest.latest.main) {
|
|
26
25
|
return 'commonjs';
|
|
@@ -49,7 +48,7 @@ const DetailSidebar = () => {
|
|
|
49
48
|
position: 'sticky',
|
|
50
49
|
top: 0
|
|
51
50
|
}
|
|
52
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(_SideBarTitle.default, {
|
|
53
52
|
description: (_packageMeta$latest = packageMeta.latest) === null || _packageMeta$latest === void 0 ? void 0 : _packageMeta$latest.description,
|
|
54
53
|
hasTypes: typeof ((_packageMeta$latest2 = packageMeta.latest) === null || _packageMeta$latest2 === void 0 ? void 0 : _packageMeta$latest2.types) === 'string',
|
|
55
54
|
isLatest: typeof packageVersion === 'undefined',
|
|
@@ -61,17 +60,17 @@ const DetailSidebar = () => {
|
|
|
61
60
|
packageMeta: packageMeta,
|
|
62
61
|
showDownloadTarball: configOptions.showDownloadTarball,
|
|
63
62
|
showRaw: configOptions.showRaw
|
|
64
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
63
|
+
}), /*#__PURE__*/_react.default.createElement(_Install.default, {
|
|
65
64
|
configOptions: configOptions,
|
|
66
65
|
packageMeta: packageMeta,
|
|
67
66
|
packageName: packageName
|
|
68
67
|
}), /*#__PURE__*/_react.default.createElement(_FundButton.default, {
|
|
69
68
|
packageMeta: packageMeta
|
|
70
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
69
|
+
}), /*#__PURE__*/_react.default.createElement(_Repository.default, {
|
|
71
70
|
packageMeta: packageMeta
|
|
72
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
71
|
+
}), /*#__PURE__*/_react.default.createElement(_Engines.default, {
|
|
73
72
|
packageMeta: packageMeta
|
|
74
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
73
|
+
}), /*#__PURE__*/_react.default.createElement(_Distribution.default, {
|
|
75
74
|
packageMeta: packageMeta
|
|
76
75
|
}), /*#__PURE__*/_react.default.createElement(_Author.default, {
|
|
77
76
|
packageMeta: packageMeta
|
|
@@ -93,5 +92,5 @@ const StyledPaper = /*#__PURE__*/(0, _base.default)(_Paper.default, process.env.
|
|
|
93
92
|
theme
|
|
94
93
|
}) => ({
|
|
95
94
|
padding: theme === null || theme === void 0 ? void 0 : theme.spacing(3, 2)
|
|
96
|
-
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
95
|
+
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zZWN0aW9ucy9TaWRlQmFyL1NpZGVi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ldGF9IHR5cGU9e0RldmVsb3BlclR5cGUuTUFJTlRBSU5FUlN9IC8+XG4gICAgICA8RGV2ZWxvcGVycyBwYWNrYWdlTWV0YT17cGFja2FnZU1ldGF9IHR5cGU9e0RldmVsb3BlclR5cGUuQ09OVFJJQlVUT1JTfSAvPlxuICAgIDwvU3R5bGVkUGFwZXI+XG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBEZXRhaWxTaWRlYmFyO1xuXG5jb25zdCBTdHlsZWRQYXBlciA9IHN0eWxlZChQYXBlcik8eyB0aGVtZT86IFRoZW1lIH0+KCh7IHRoZW1lIH0pID0+ICh7XG4gIHBhZGRpbmc6IHRoZW1lPy5zcGFjaW5nKDMsIDIpLFxufSkpO1xuIl19 */");
|
|
97
96
|
//# sourceMappingURL=Sidebar.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PackageDependencies } from '../../types/packageMeta';
|
|
3
|
+
interface DependencyBlockProps {
|
|
4
|
+
title: string;
|
|
5
|
+
dependencies: PackageDependencies;
|
|
6
|
+
}
|
|
7
|
+
export declare const StyledText: import("@emotion/styled").StyledComponent<any, {}, {}>;
|
|
8
|
+
export declare const Tags: import("@emotion/styled").StyledComponent<{
|
|
9
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
10
|
+
as?: React.ElementType<any> | undefined;
|
|
11
|
+
} & {
|
|
12
|
+
theme?: import("@mui/material").Theme | undefined;
|
|
13
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
14
|
+
export declare const Tag: import("@emotion/styled").StyledComponent<any, {}, {}>;
|
|
15
|
+
export declare const DependencyBlock: React.FC<DependencyBlockProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SideBarTitle';
|
package/build/src/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * as Icons from './components/Icons';
|
|
|
14
14
|
export { default as Install } from './components/Install';
|
|
15
15
|
export { default as RawViewer } from './components/RawViewer';
|
|
16
16
|
export { default as Readme } from './components/Readme';
|
|
17
|
-
export { default as SideBarTitle } from './components/
|
|
17
|
+
export { default as SideBarTitle } from './components/SideBarTitle';
|
|
18
18
|
export { default as UpLinks } from './components/UpLinks';
|
|
19
19
|
export { default as Versions } from './components/Versions';
|
|
20
20
|
export { default as TextField } from './components/TextField';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/ui-components",
|
|
3
|
-
"version": "3.0.0-next-7.
|
|
3
|
+
"version": "3.0.0-next-7.4",
|
|
4
4
|
"description": "theme ui component",
|
|
5
5
|
"author": "Juan Picado <juanpicado19@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"react-router-dom": "5.3.4",
|
|
43
43
|
"react-virtualized": "9.22.5",
|
|
44
44
|
"redux": "4.2.1",
|
|
45
|
-
"remark-gfm": "3.0.1",
|
|
46
45
|
"validator": "13.11.0"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
@@ -6,7 +6,6 @@ import Dependencies from './Dependencies';
|
|
|
6
6
|
|
|
7
7
|
describe('<Dependencies /> component', () => {
|
|
8
8
|
test('Renders a message when there are no dependencies', () => {
|
|
9
|
-
// Given
|
|
10
9
|
const packageMeta = {
|
|
11
10
|
latest: {
|
|
12
11
|
name: 'verdaccio',
|
|
@@ -25,15 +24,12 @@ describe('<Dependencies /> component', () => {
|
|
|
25
24
|
_uplinks: {},
|
|
26
25
|
};
|
|
27
26
|
|
|
28
|
-
// When
|
|
29
27
|
const { getByText } = render(<Dependencies packageMeta={packageMeta} />);
|
|
30
28
|
|
|
31
|
-
// Then
|
|
32
29
|
expect(getByText('dependencies.has-no-dependencies')).toBeDefined();
|
|
33
30
|
});
|
|
34
31
|
|
|
35
|
-
test('
|
|
36
|
-
// Given
|
|
32
|
+
test('renders a link to each dependency', () => {
|
|
37
33
|
const packageMeta = {
|
|
38
34
|
latest: {
|
|
39
35
|
name: 'verdaccio',
|
|
@@ -59,18 +55,12 @@ describe('<Dependencies /> component', () => {
|
|
|
59
55
|
_uplinks: {},
|
|
60
56
|
};
|
|
61
57
|
|
|
62
|
-
// When
|
|
63
58
|
const { getByText } = render(
|
|
64
59
|
<HashRouter>
|
|
65
60
|
<Dependencies packageMeta={packageMeta} />
|
|
66
61
|
</HashRouter>
|
|
67
62
|
);
|
|
68
63
|
|
|
69
|
-
// Then
|
|
70
|
-
// FIXME: currently MaterialUI chips do not support the children
|
|
71
|
-
// prop, therefore it is impossible to use proper links for
|
|
72
|
-
// dependencies. Those are for now clickable spans
|
|
73
|
-
|
|
74
64
|
expect(getByText('dependencies (2)')).toBeDefined();
|
|
75
65
|
expect(getByText('devDependencies (1)')).toBeDefined();
|
|
76
66
|
expect(getByText('peerDependencies (1)')).toBeDefined();
|
|
@@ -1,63 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import Card from '@mui/material/Card';
|
|
2
3
|
import CardContent from '@mui/material/CardContent';
|
|
3
|
-
import { useTheme } from '@mui/styles';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { useHistory } from 'react-router-dom';
|
|
7
6
|
|
|
8
|
-
import {
|
|
7
|
+
import { Theme } from '../../Theme';
|
|
9
8
|
import NoItems from '../NoItems';
|
|
10
|
-
import {
|
|
9
|
+
import { DependencyBlock } from './DependencyBlock';
|
|
10
|
+
import { hasKeys } from './utits';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {
|
|
18
|
-
const history = useHistory();
|
|
19
|
-
const { t } = useTranslation();
|
|
20
|
-
const theme = useTheme();
|
|
21
|
-
|
|
22
|
-
const deps = Object.entries(dependencies);
|
|
23
|
-
|
|
24
|
-
function handleClick(name: string): void {
|
|
25
|
-
history.push(`/-/web/detail/${name}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return (
|
|
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>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
function hasKeys(object?: { [key: string]: any }): boolean {
|
|
51
|
-
return !!object && Object.keys(object).length > 0;
|
|
52
|
-
}
|
|
12
|
+
export const CardWrap = styled(Card)<{ theme?: Theme }>((props) => ({
|
|
13
|
+
marginBottom: props.theme.spacing(2),
|
|
14
|
+
}));
|
|
53
15
|
|
|
54
16
|
const Dependencies: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
55
17
|
const { t } = useTranslation();
|
|
56
18
|
|
|
57
|
-
if (!packageMeta) {
|
|
58
|
-
throw new Error(t('error.package-meta-is-required-at-detail-context'));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
19
|
const { latest } = packageMeta;
|
|
62
20
|
// FIXME: add dependencies to package meta type
|
|
63
21
|
// @ts-ignore
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import userEvent from '@testing-library/user-event';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { MemoryRouter, Route } from 'react-router';
|
|
4
|
+
|
|
5
|
+
import { render, screen } from '../../test/test-react-testing-library';
|
|
6
|
+
import { DependencyBlock } from './DependencyBlock';
|
|
7
|
+
|
|
8
|
+
describe('<DependencyBlock /> component', () => {
|
|
9
|
+
test('renders dependency block', () => {
|
|
10
|
+
render(<DependencyBlock dependencies={{ jquery: '1.0.0' }} title="foo" />);
|
|
11
|
+
|
|
12
|
+
expect(screen.getByText('foo (1)')).toBeInTheDocument();
|
|
13
|
+
expect(screen.getByText('dependencies.dependency-block')).toBeInTheDocument();
|
|
14
|
+
|
|
15
|
+
userEvent.click(screen.getByText('dependencies.dependency-block'));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test.todo('test the click event');
|
|
19
|
+
test.skip('handle change route handler', () => {
|
|
20
|
+
render(
|
|
21
|
+
<MemoryRouter
|
|
22
|
+
initialEntries={[`/-/web/detail/some-dep`, `/-/web/detail/jquery`]}
|
|
23
|
+
initialIndex={0}
|
|
24
|
+
>
|
|
25
|
+
<Route exact={true} path="/-/web/detail/:package">
|
|
26
|
+
<DependencyBlock dependencies={{ jquery: '1.0.0' }} title="foo" />
|
|
27
|
+
</Route>
|
|
28
|
+
</MemoryRouter>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
userEvent.click(screen.getByTestId('jquery'));
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Chip from '@mui/material/Chip';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import { useTheme } from '@mui/styles';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { useHistory } from 'react-router-dom';
|
|
9
|
+
|
|
10
|
+
import { Theme } from '../../Theme';
|
|
11
|
+
import { PackageDependencies } from '../../types/packageMeta';
|
|
12
|
+
|
|
13
|
+
interface DependencyBlockProps {
|
|
14
|
+
title: string;
|
|
15
|
+
dependencies: PackageDependencies;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
|
|
19
|
+
fontWeight: props.theme && props.theme.fontWeight.bold,
|
|
20
|
+
textTransform: 'capitalize',
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
export const Tags = styled('div')<{ theme?: Theme }>((props) => ({
|
|
24
|
+
display: 'flex',
|
|
25
|
+
justifyContent: 'start',
|
|
26
|
+
flexWrap: 'wrap',
|
|
27
|
+
// force title to be on the same line as the title
|
|
28
|
+
// could be better to avoid margin on the first element
|
|
29
|
+
// but it is a bit tricky to do with flexbox
|
|
30
|
+
marginLeft: props.theme.spacing(-0.6),
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
export const Tag = styled(Chip)<{ theme?: Theme }>((props) => ({
|
|
34
|
+
margin: props.theme.spacing(0.6),
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
export const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {
|
|
38
|
+
const history = useHistory();
|
|
39
|
+
const { t } = useTranslation();
|
|
40
|
+
const theme = useTheme();
|
|
41
|
+
const deps = Object.entries(dependencies);
|
|
42
|
+
|
|
43
|
+
function handleClick(name: string): void {
|
|
44
|
+
history.push(`/-/web/detail/${name}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Box data-testid={title} sx={{ margin: theme.spacing(2) }}>
|
|
49
|
+
<StyledText sx={{ marginBottom: theme.spacing(1) }} variant="subtitle1">
|
|
50
|
+
{`${title} (${deps.length})`}
|
|
51
|
+
</StyledText>
|
|
52
|
+
<Tags>
|
|
53
|
+
{deps.map(([name, version]) => (
|
|
54
|
+
<Tag
|
|
55
|
+
className={'dep-tag'}
|
|
56
|
+
clickable={true}
|
|
57
|
+
data-testid={name}
|
|
58
|
+
key={name}
|
|
59
|
+
label={t('dependencies.dependency-block', { package: name, version })}
|
|
60
|
+
// eslint-disable-next-line
|
|
61
|
+
onClick={() => {
|
|
62
|
+
handleClick(name);
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
65
|
+
))}
|
|
66
|
+
</Tags>
|
|
67
|
+
</Box>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { render } from '../../test/test-react-testing-library';
|
|
3
|
+
import { render, screen } from '../../test/test-react-testing-library';
|
|
4
4
|
import Loading from './Loading';
|
|
5
5
|
|
|
6
6
|
describe('<Loading /> component', () => {
|
|
7
7
|
test('should render the component in default state', () => {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
render(<Loading />);
|
|
9
|
+
screen.debug();
|
|
10
|
+
expect(screen.getByTestId('loading')).toBeInTheDocument();
|
|
10
11
|
});
|
|
11
12
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SideBarTitle';
|
package/src/index.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * as Icons from './components/Icons';
|
|
|
14
14
|
export { default as Install } from './components/Install';
|
|
15
15
|
export { default as RawViewer } from './components/RawViewer';
|
|
16
16
|
export { default as Readme } from './components/Readme';
|
|
17
|
-
export { default as SideBarTitle } from './components/
|
|
17
|
+
export { default as SideBarTitle } from './components/SideBarTitle';
|
|
18
18
|
export { default as UpLinks } from './components/UpLinks';
|
|
19
19
|
export { default as Versions } from './components/Versions';
|
|
20
20
|
export { default as TextField } from './components/TextField';
|
|
@@ -7,7 +7,6 @@ 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 '../../';
|
|
13
12
|
import LanguageSwitch from './LanguageSwitch';
|
|
@@ -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>
|
|
@@ -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)}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MemoryRouter } from 'react-router';
|
|
3
|
+
|
|
4
|
+
import { store } from '../../store';
|
|
5
|
+
import { 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 ComponentSideBar: React.FC = () => (
|
|
14
|
+
<MemoryRouter>
|
|
15
|
+
<Home />
|
|
16
|
+
</MemoryRouter>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
describe('Home', () => {
|
|
20
|
+
test('should render titles', async () => {
|
|
21
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
22
|
+
await waitFor(() => expect(screen.getAllByTestId('package-item-list')).toHaveLength(5));
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('should render loading', async () => {
|
|
26
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
27
|
+
await waitFor(() => expect(screen.getByTestId('loading')).toBeInTheDocument());
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -1,110 +1,67 @@
|
|
|
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
6
|
import { renderWithStore, screen, waitFor } from '../../test/test-react-testing-library';
|
|
9
|
-
import
|
|
7
|
+
import Sidebar from './Sidebar';
|
|
10
8
|
|
|
11
|
-
jest.mock('marked');
|
|
12
9
|
jest.mock('marked');
|
|
13
10
|
jest.mock('marked-highlight');
|
|
14
11
|
|
|
15
|
-
const
|
|
12
|
+
const ComponentSideBar: React.FC = () => (
|
|
16
13
|
<MemoryRouter>
|
|
17
14
|
<VersionProvider>
|
|
18
|
-
<
|
|
15
|
+
<Sidebar />
|
|
19
16
|
</VersionProvider>
|
|
20
17
|
</MemoryRouter>
|
|
21
18
|
);
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
jest.mock('react', () => {
|
|
25
|
-
const React = jest.requireActual('react');
|
|
26
|
-
React.Suspense = ({ children }) => children;
|
|
27
|
-
return React;
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const packageMeta = {
|
|
31
|
-
_uplinks: {},
|
|
32
|
-
latest: {
|
|
33
|
-
name: 'verdaccio-ui/local-storage',
|
|
34
|
-
version: '8.0.1-next.1',
|
|
35
|
-
dist: {
|
|
36
|
-
fileCount: 0,
|
|
37
|
-
unpackedSize: 0,
|
|
38
|
-
tarball: 'http://localhost:8080/bootstrap/-/bootstrap-4.3.1.tgz',
|
|
39
|
-
},
|
|
40
|
-
homepage: 'https://verdaccio.org',
|
|
41
|
-
bugs: {
|
|
42
|
-
url: 'https://github.com/verdaccio/monorepo/issues',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// const detailContextValue = {
|
|
48
|
-
// packageName: 'foo',
|
|
49
|
-
// readMe: 'test',
|
|
50
|
-
// isLoading: false,
|
|
51
|
-
// hasNotBeenFound: false,
|
|
52
|
-
// packageMeta: ,
|
|
53
|
-
// };
|
|
20
|
+
const mockPkgName = jest.fn().mockReturnValue('jquery');
|
|
54
21
|
|
|
55
22
|
jest.mock('react-router-dom', () => ({
|
|
56
23
|
...jest.requireActual('react-router-dom'), // use actual for all non-hook parts
|
|
57
24
|
useParams: () => ({
|
|
58
|
-
package:
|
|
25
|
+
package: mockPkgName(),
|
|
59
26
|
}),
|
|
60
27
|
}));
|
|
61
28
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}),
|
|
70
|
-
]
|
|
71
|
-
);
|
|
72
|
-
// describe('DetailSidebar', () => {
|
|
73
|
-
test.skip('should render commonjs module icon', async () => {
|
|
74
|
-
const { getByText } = renderWithStore(<ComponentToBeRendered />, store);
|
|
75
|
-
screen.debug();
|
|
76
|
-
await waitFor(() => expect(getByText('jquery')).toBeInTheDocument());
|
|
77
|
-
});
|
|
29
|
+
describe('Sidebar', () => {
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
jest.clearAllMocks();
|
|
32
|
+
});
|
|
33
|
+
test('should render titles', async () => {
|
|
34
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
35
|
+
await waitFor(() => expect(screen.getByText('jquery')).toBeInTheDocument());
|
|
78
36
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// },
|
|
87
|
-
// },
|
|
88
|
-
// })}
|
|
89
|
-
// />,
|
|
90
|
-
// store
|
|
91
|
-
// );
|
|
92
|
-
// expect(screen.getByAltText('typescript')).toBeInTheDocument();
|
|
93
|
-
// });
|
|
37
|
+
expect(screen.getByText(`jquery`)).toBeInTheDocument();
|
|
38
|
+
expect(screen.getByText(`sidebar.detail.latest-version`, { exact: false })).toBeInTheDocument();
|
|
39
|
+
expect(
|
|
40
|
+
screen.getByText(`sidebar.detail.published a year ago`, { exact: false })
|
|
41
|
+
).toBeInTheDocument();
|
|
42
|
+
expect(screen.getByText(`sidebar.installation.title`, { exact: false })).toBeInTheDocument();
|
|
43
|
+
});
|
|
94
44
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
45
|
+
test('should render commonJS', async () => {
|
|
46
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
47
|
+
|
|
48
|
+
await waitFor(() => expect(screen.getByText('jquery')).toBeInTheDocument());
|
|
49
|
+
expect(screen.getByAltText('commonjs')).toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('should render typescript', async () => {
|
|
53
|
+
mockPkgName.mockReturnValue('glob');
|
|
54
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
55
|
+
|
|
56
|
+
await waitFor(() => expect(screen.getByText('glob')).toBeInTheDocument());
|
|
57
|
+
expect(screen.getByAltText('typescript')).toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('should render es modules', async () => {
|
|
61
|
+
mockPkgName.mockReturnValue('got');
|
|
62
|
+
renderWithStore(<ComponentSideBar />, store);
|
|
63
|
+
|
|
64
|
+
await waitFor(() => expect(screen.getByText('got')).toBeInTheDocument());
|
|
65
|
+
expect(screen.getByAltText('es6 modules')).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
});
|