mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-21 07:29:37 +01:00
fix: improve bundle size
lodash should not be imported globally
This commit is contained in:
parent
4951131ec2
commit
a79d87bd7f
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import _ from 'lodash';
|
||||
import get from 'lodash/size';
|
||||
import Module from '../../Module';
|
||||
|
||||
import classes from './style.scss';
|
||||
@ -13,7 +13,7 @@ export default class Dependencies extends React.Component {
|
||||
};
|
||||
|
||||
get dependencies() {
|
||||
return _.get(this, 'props.packageMeta.latest.dependencies', {});
|
||||
return get(this, 'props.packageMeta.latest.dependencies', {});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -1,6 +1,9 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import _ from 'lodash';
|
||||
import get from 'lodash/get';
|
||||
import filter from 'lodash/filter';
|
||||
import size from 'lodash/size';
|
||||
import uniqBy from 'lodash/uniqBy';
|
||||
import Module from '../../Module';
|
||||
|
||||
import classes from './style.scss';
|
||||
@ -19,27 +22,27 @@ export default class Maintainers extends React.Component {
|
||||
}
|
||||
|
||||
get author() {
|
||||
return _.get(this, 'props.packageMeta.latest.author');
|
||||
return get(this, 'props.packageMeta.latest.author');
|
||||
}
|
||||
|
||||
get contributors() {
|
||||
let contributors = _.get(this, 'props.packageMeta.latest.contributors', {});
|
||||
return _.filter(contributors, (contributor) => {
|
||||
let contributors = get(this, 'props.packageMeta.latest.contributors', {});
|
||||
return filter(contributors, (contributor) => {
|
||||
return (
|
||||
contributor.name !== _.get(this, 'author.name') &&
|
||||
contributor.email !== _.get(this, 'author.email')
|
||||
contributor.name !== get(this, 'author.name') &&
|
||||
contributor.email !== get(this, 'author.email')
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
get showAllContributors() {
|
||||
return this.state.showAllContributors || _.size(this.contributors) <= 5;
|
||||
return this.state.showAllContributors || size(this.contributors) <= 5;
|
||||
}
|
||||
|
||||
get uniqueContributors() {
|
||||
if (!this.contributors) return [];
|
||||
|
||||
return _.uniqBy(this.contributors, (contributor) => contributor.name).slice(0, 5);
|
||||
return uniqBy(this.contributors, (contributor) => contributor.name).slice(0, 5);
|
||||
}
|
||||
|
||||
handleShowAllContributors() {
|
||||
|
Loading…
Reference in New Issue
Block a user