Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Test build

on:
- push
- pull_request

jobs:
Expand Down
28 changes: 5 additions & 23 deletions index.js
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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,
Expand All @@ -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: [] };
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 2 additions & 4 deletions pom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down