From ffa8a3570b705ab4bad172f104f06920d506b049 Mon Sep 17 00:00:00 2001 From: Matt Busche Date: Mon, 27 May 2024 21:44:44 -0500 Subject: [PATCH 1/2] handle gradle wild card --- gradle.js | 3 ++- package-lock.json | 6 +++--- package.json | 2 +- pom.js | 6 ++++-- shared.js | 6 ++++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gradle.js b/gradle.js index 1b0a5ae..2996775 100644 --- a/gradle.js +++ b/gradle.js @@ -19,7 +19,8 @@ export const getGradleDependenciesWithVersions = async (parsedGradle) => { export const getGradleSpringBootVersion = async (parsedGradle) => { const springBootPlugin = parsedGradle?.plugins?.filter(plugin => plugin.id === 'org.springframework.boot'); if (Array.isArray(springBootPlugin) && springBootPlugin.length && springBootPlugin[0].version) { - return springBootPlugin[0].version; + // Handle build.gradle, which allows 3.2.+ format + return springBootPlugin[0].version.replace('+', 'x'); } console.log('No Spring Boot version found.'); return ''; diff --git a/package-lock.json b/package-lock.json index dab0e1d..b9f9584 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "\tGPL-3.0-or-later", "dependencies": { "fast-xml-parser": "^4.3.6", - "gradle-to-js": "^2.0.1", + "gradle-to-js": "github:mrbusche/gradle-to-js#8960d1c3f9dab922c9545289abf7b29b25a26f54", "node-html-parser": "6.1.13" }, "bin": { @@ -540,8 +540,8 @@ }, "node_modules/gradle-to-js": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/gradle-to-js/-/gradle-to-js-2.0.1.tgz", - "integrity": "sha512-is3hDn9zb8XXnjbEeAEIqxTpLHUiGBqjegLmXPuyMBfKAggpadWFku4/AP8iYAGBX6qR9/5UIUIp47V0XI3aMw==", + "resolved": "git+ssh://git@github.com/mrbusche/gradle-to-js.git#8960d1c3f9dab922c9545289abf7b29b25a26f54", + "integrity": "sha512-ZiBGye/qLAA7VMbIiyPjFHzZ+Nvsvf087olJnxTV3ss2ArlZR91v2SHj9PGnXEjLZyEUew0nteyZT4Hye0jaLg==", "license": "Apache-2.0", "dependencies": { "lodash.merge": "^4.6.2" diff --git a/package.json b/package.json index 294538c..da3e9ea 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ }, "dependencies": { "fast-xml-parser": "^4.3.6", - "gradle-to-js": "^2.0.1", + "gradle-to-js": "github:mrbusche/gradle-to-js#8960d1c3f9dab922c9545289abf7b29b25a26f54", "node-html-parser": "6.1.13" }, "devDependencies": { diff --git a/pom.js b/pom.js index 060b11f..ad8f638 100644 --- a/pom.js +++ b/pom.js @@ -131,8 +131,10 @@ const downloadSpringVersionProperties = async (springBootVersion) => { let url = `https://docs.spring.io/spring-boot/docs/${springBootVersion}/reference/html/dependency-versions.html`; let bodyIndex = 1; let response = await fetch(url); - if (response.status === 404) { - url = `https://docs.spring.io/spring-boot/${springBootVersion}/appendix/dependency-versions/properties.html`; + // Handle new Spring Boot URL, count redirects as failures, and handle 3.3.+ gradle format + if (response.status === 404 || response.url.includes('redirect.html')) { + const springMinorVersion = springBootVersion.replace('.x', ''); + url = `https://docs.spring.io/spring-boot/${springMinorVersion}/appendix/dependency-versions/properties.html`; bodyIndex = 0; response = await fetch(url); } diff --git a/shared.js b/shared.js index b522dc8..232d080 100644 --- a/shared.js +++ b/shared.js @@ -34,8 +34,10 @@ const getSpringDefaultVersions = async (springBootVersion) => { const downloadSpringDefaultVersions = async (springBootVersion) => { let url = `https://docs.spring.io/spring-boot/docs/${springBootVersion}/reference/html/dependency-versions.html`; let response = await fetch(url); - if (response.status === 404) { - url = `https://docs.spring.io/spring-boot/${springBootVersion}/appendix/dependency-versions/coordinates.html`; + // Handle new Spring Boot URL, count redirects as failures, and handle 3.3.+ gradle format + if (response.status === 404 || response.url.includes('redirect.html')) { + const springMinorVersion = springBootVersion.replace('.x', ''); + url = `https://docs.spring.io/spring-boot/${springMinorVersion}/appendix/dependency-versions/coordinates.html`; response = await fetch(url); } const versions = []; From b499610c0b16091ad06c5f06f7751dfd8b616c10 Mon Sep 17 00:00:00 2001 From: Matt Busche Date: Mon, 27 May 2024 21:45:41 -0500 Subject: [PATCH 2/2] bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b9f9584..2f7e3d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "spring-boot-dependency-checker", - "version": "0.2.5", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "spring-boot-dependency-checker", - "version": "0.2.5", + "version": "0.3.0", "license": "\tGPL-3.0-or-later", "dependencies": { "fast-xml-parser": "^4.3.6", diff --git a/package.json b/package.json index da3e9ea..b953dcc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spring-boot-dependency-checker", - "version": "0.2.5", + "version": "0.3.0", "description": "Spring Boot Dependency Checker - validate that you're using the versions Spring Boot has approved with your project.", "keywords": [ "spring boot",