diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf5d89c..e8cf0da 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,6 @@ name: Test build on: - - push - pull_request jobs: diff --git a/index.js b/index.js index 8f78121..d801838 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,6 @@ import { extname } from 'path'; -import { - getPomSpringBootVersion, - getXMLFromFile, - retrieveSimilarPomPackages, - retrieveSimilarPomProperties, -} from './pom.js'; -import { - getGradleSpringBootVersion, - getJSFromFile, - retrieveSimilarGradlePackages, -} from './gradle.js'; +import { getPomSpringBootVersion, getXMLFromFile, retrieveSimilarPomPackages, retrieveSimilarPomProperties } from './pom.js'; +import { getGradleSpringBootVersion, getJSFromFile, retrieveSimilarGradlePackages } from './gradle.js'; export const checkDependencies = async () => { const start = Date.now(); @@ -22,14 +13,8 @@ export const checkDependencies = async () => { const springBootVersion = await getPomSpringBootVersion(parsedPom); if (springBootVersion) { console.log('Detected Spring Boot Version -', springBootVersion); - const declaredPackages = await retrieveSimilarPomPackages( - parsedPom, - springBootVersion, - ); - const declaredProperties = await retrieveSimilarPomProperties( - parsedPom, - springBootVersion, - ); + const declaredPackages = await retrieveSimilarPomPackages(parsedPom, springBootVersion); + const declaredProperties = await retrieveSimilarPomProperties(parsedPom, springBootVersion); return { packages: declaredPackages, properties: declaredProperties, @@ -41,10 +26,7 @@ export const checkDependencies = async () => { const springBootVersion = await getGradleSpringBootVersion(parsedGradle); if (springBootVersion) { console.log('Detected Spring Boot Version -', springBootVersion); - const declaredPackages = await retrieveSimilarGradlePackages( - parsedGradle, - springBootVersion, - ); + const declaredPackages = await retrieveSimilarGradlePackages(parsedGradle, springBootVersion); // await retrieveSimilarPomProperties(parsedPom, springBootVersion); return { packages: declaredPackages, properties: [] }; } diff --git a/package-lock.json b/package-lock.json index 242750f..cb2be25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "spring-boot-dependency-checker", - "version": "0.6.0", + "version": "0.6.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "spring-boot-dependency-checker", - "version": "0.6.0", + "version": "0.6.1", "license": "\tGPL-3.0-or-later", "dependencies": { "fast-xml-parser": "4.5.0", diff --git a/package.json b/package.json index 977fe74..4570b33 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spring-boot-dependency-checker", - "version": "0.6.0", + "version": "0.6.1", "description": "Spring Boot Dependency Checker - validate that you're using the versions Spring Boot has approved with your project.", "keywords": [ "spring boot", diff --git a/pom.js b/pom.js index 53c5422..a3671c1 100644 --- a/pom.js +++ b/pom.js @@ -157,7 +157,7 @@ export const retrieveSimilarPomProperties = async (parsedPom, springBootVersion) const declaredProperties = []; for (const pomProperty of pomProperties) { for (const defaultProperty of defaultProperties) { - if (pomProperty === defaultProperty.property) { + if (pomProperty === defaultProperty.property || pomProperty.replace('.version', '') === defaultProperty.property) { declaredProperties.push(pomProperty); break; } @@ -206,20 +206,18 @@ const replaceVariable = (properties, version) => { 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); // 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); } const versions = []; if (response.ok) { const template = await response.text(); const parsedTemplate = parse(template); - const tableBody = parsedTemplate.getElementsByTagName('tbody')[bodyIndex]; + const tableBody = parsedTemplate.querySelector('table.tableblock tbody'); // older versions of Spring Boot do not have property versions listed if (tableBody) {