avancement planning
This commit is contained in:
+6
-9
@@ -1,8 +1,8 @@
|
||||
// Originally normalize-package-data
|
||||
|
||||
const url = require('node:url')
|
||||
const { URL } = require('node:url')
|
||||
const hostedGitInfo = require('hosted-git-info')
|
||||
const validateLicense = require('validate-npm-package-license')
|
||||
const validateLicense = require('./license.js')
|
||||
|
||||
const typos = {
|
||||
dependancies: 'dependencies',
|
||||
@@ -123,8 +123,7 @@ function normalizeData (data, changes) {
|
||||
if (typeof data.bugs === 'string') {
|
||||
if (isEmail(data.bugs)) {
|
||||
data.bugs = { email: data.bugs }
|
||||
/* eslint-disable-next-line node/no-deprecated-api */
|
||||
} else if (url.parse(data.bugs).protocol) {
|
||||
} else if (URL.canParse(data.bugs)) {
|
||||
data.bugs = { url: data.bugs }
|
||||
} else {
|
||||
changes?.push(`Bug string field must be url, email, or {email,url}`)
|
||||
@@ -140,8 +139,7 @@ function normalizeData (data, changes) {
|
||||
const oldBugs = data.bugs
|
||||
data.bugs = {}
|
||||
if (oldBugs.url) {
|
||||
/* eslint-disable-next-line node/no-deprecated-api */
|
||||
if (typeof (oldBugs.url) === 'string' && url.parse(oldBugs.url).protocol) {
|
||||
if (URL.canParse(oldBugs.url)) {
|
||||
data.bugs.url = oldBugs.url
|
||||
} else {
|
||||
changes?.push('bugs.url field must be a string url. Deleted.')
|
||||
@@ -216,8 +214,7 @@ function normalizeData (data, changes) {
|
||||
changes?.push('homepage field must be a string url. Deleted.')
|
||||
delete data.homepage
|
||||
} else {
|
||||
/* eslint-disable-next-line node/no-deprecated-api */
|
||||
if (!url.parse(data.homepage).protocol) {
|
||||
if (!URL.canParse(data.homepage)) {
|
||||
data.homepage = 'http://' + data.homepage
|
||||
}
|
||||
}
|
||||
@@ -233,7 +230,7 @@ function normalizeData (data, changes) {
|
||||
changes?.push('No license field.')
|
||||
} else if (typeof (license) !== 'string' || license.length < 1 || license.trim() === '') {
|
||||
changes?.push('license should be a valid SPDX license expression')
|
||||
} else if (!validateLicense(license).validForNewPackages) {
|
||||
} else if (!validateLicense(license)) {
|
||||
changes?.push('license should be a valid SPDX license expression')
|
||||
}
|
||||
// fixPeople
|
||||
|
||||
Reference in New Issue
Block a user