2020-08-13 16:27:00 -05:00
|
|
|
import { Package } from '@verdaccio/types';
|
2020-03-03 17:59:19 -05:00
|
|
|
import _ from 'lodash';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether the package metadta has enough data to be published
|
|
|
|
* @param pkg metadata
|
|
|
|
*/
|
|
|
|
|
|
|
|
export function isPublishablePackage(pkg: Package): boolean {
|
2020-08-13 16:27:00 -05:00
|
|
|
const keys: string[] = Object.keys(pkg);
|
2020-03-03 17:59:19 -05:00
|
|
|
|
2020-08-13 16:27:00 -05:00
|
|
|
return _.includes(keys, 'versions');
|
2020-03-03 17:59:19 -05:00
|
|
|
}
|
2021-02-03 11:33:04 -05:00
|
|
|
|
|
|
|
export function isRelatedToDeprecation(pkgInfo: Package): boolean {
|
|
|
|
const { versions } = pkgInfo;
|
|
|
|
for (const version in versions) {
|
|
|
|
if (Object.prototype.hasOwnProperty.call(versions[version], 'deprecated')) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|