import { Aspect , FP , sha256 , } from "@atomist/sdm-pack-fingerprint" ; import { VersionedArtifact } from "@atomist/sdm-pack-spring" ; import { findDeclaredDependencies } from "@atomist/sdm-pack-spring/lib/maven/parse/fromPom" ; const SpringBootStarterType = "spring-boot-starter" ; /**
 * Detect which Spring Boot starter dependencies are included in your projects,
 * and which versions.
 *
 * This includes maven dependencies ending in "-starter"
 *
 * The fingerprint includes the whole
 * [VersionedArtifact](https://atomist.github.io/sdm-pack-spring/interfaces/_lib_maven_versionedartifact_.versionedartifact.html)
 *
 * Only the version is displayed (or "inherited" if the version is empty).
 */ export const SpringBootStarter = { name : SpringBootStarterType , displayName : "Spring Boot Starter" , extract : async ( p ) => { const deps = await findDeclaredDependencies ( p ) ; if ( deps . dependencies . length === 0 ) { return undefined ; } return deps . dependencies . filter ( d => d . artifact . includes ( "-starter" ) ) . map ( createSpringBootStarterFingerprint ) ; } , toDisplayableFingerprint : fp => { return fp . data . version || "inherited" ; } , documentationUrl : "https://atomist-blogs.github.io/org-visualizer/modules/_lib_feature_spring_springbootstarterfeature_.html#springbootstarterfeature" , } ; function createSpringBootStarterFingerprint ( data ) { return { type : SpringBootStarterType , name : `starter:${ data . group }:${ data . artifact }` , data , sha : sha256 ( JSON . stringify ( data ) ) , } ; }