Update package title extraction for renovate bot
This commit is contained in:
parent
557d4c4ddd
commit
05482e952b
@ -497,11 +497,12 @@ ${printList(items)}
|
|||||||
|
|
||||||
const dependencies = Object.keys(packageJson.dependencies);
|
const dependencies = Object.keys(packageJson.dependencies);
|
||||||
const devDependencies = Object.keys(packageJson.devDependencies);
|
const devDependencies = Object.keys(packageJson.devDependencies);
|
||||||
|
const optionalDependencies = Object.keys(packageJson.optionalDependencies);
|
||||||
|
|
||||||
// Returns the package.json section in which that package exists, or undefined
|
// Returns the package.json section in which that package exists, or undefined
|
||||||
// if that package is not listed there.
|
// if that package is not listed there.
|
||||||
function whichDependencyType(packageName) {
|
function whichDependencyType(packageName) {
|
||||||
if (dependencies.includes(packageName)) {
|
if (dependencies.includes(packageName) || optionalDependencies.includes(packageName)) {
|
||||||
return "dependencies";
|
return "dependencies";
|
||||||
} else if (devDependencies.includes(packageName)) {
|
} else if (devDependencies.includes(packageName)) {
|
||||||
return "devDependencies";
|
return "devDependencies";
|
||||||
@ -562,8 +563,20 @@ function isFeature({labels}) {
|
|||||||
// Update `stylelint` to v1.2.3
|
// Update `stylelint` to v1.2.3
|
||||||
// Update `express` and `ua-parser-js` to latest versions
|
// Update `express` and `ua-parser-js` to latest versions
|
||||||
// Update `express`, `chai`, and `ua-parser-js` to ...
|
// Update `express`, `chai`, and `ua-parser-js` to ...
|
||||||
|
// Update @fortawesome/fontawesome-free-webfonts to the latest version
|
||||||
|
// Update dependency request to v2.87.0
|
||||||
|
// chore(deps): update dependency mini-css-extract-plugin to v0.4.3
|
||||||
|
// fix(deps): update dependency web-push to v3.3.3
|
||||||
|
// chore(deps): update babel monorepo to v7.1.0
|
||||||
function extractPackages(title) {
|
function extractPackages(title) {
|
||||||
return /^Update ([\w-,`. ]+) to /.exec(title)[1]
|
const extracted = /(?:U|u)pdate(?: dependency)? ([\w-,` ./@]+?) (?:monorepo )?to /.exec(title);
|
||||||
|
|
||||||
|
if (!extracted) {
|
||||||
|
log.warn(`Failed to extract package from: ${title}`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return extracted[1]
|
||||||
.replace(/`/g, "")
|
.replace(/`/g, "")
|
||||||
.split(/, and |, | and /);
|
.split(/, and |, | and /);
|
||||||
}
|
}
|
||||||
@ -572,10 +585,12 @@ function extractPackages(title) {
|
|||||||
// based on different information that describes them.
|
// based on different information that describes them.
|
||||||
function parse(entries) {
|
function parse(entries) {
|
||||||
return entries.reduce((result, entry) => {
|
return entries.reduce((result, entry) => {
|
||||||
|
let deps;
|
||||||
|
|
||||||
if (isSkipped(entry)) {
|
if (isSkipped(entry)) {
|
||||||
result.skipped.push(entry);
|
result.skipped.push(entry);
|
||||||
} else if (isDependency(entry)) {
|
} else if (isDependency(entry) && (deps = extractPackages(entry.title))) {
|
||||||
extractPackages(entry.title).forEach((packageName) => {
|
deps.forEach((packageName) => {
|
||||||
const dependencyType = whichDependencyType(packageName);
|
const dependencyType = whichDependencyType(packageName);
|
||||||
|
|
||||||
if (dependencyType) {
|
if (dependencyType) {
|
||||||
|
Loading…
Reference in New Issue
Block a user