-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10896 from murdos/custom-jhlite-npm-dependencies
feature(custom-jhlite): setup custom npm and maven version reader to handle custom npm/java dependencies
- Loading branch information
Showing
22 changed files
with
407 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...er/lite/module/infrastructure/secondary/javadependency/JHLiteMavenDependenciesReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package tech.jhipster.lite.module.infrastructure.secondary.javadependency; | ||
|
||
import org.springframework.core.annotation.Order; | ||
import org.springframework.stereotype.Repository; | ||
import tech.jhipster.lite.module.domain.ProjectFiles; | ||
import tech.jhipster.lite.module.domain.javadependency.JavaDependenciesVersions; | ||
|
||
@Order | ||
@Repository | ||
class JHLiteMavenDependenciesReader implements JavaDependenciesReader { | ||
|
||
private static final String CURRENT_VERSIONS_FILE = "/generator/dependencies/pom.xml"; | ||
|
||
private final FileSystemMavenDependenciesReader reader; | ||
|
||
public JHLiteMavenDependenciesReader(ProjectFiles files) { | ||
this.reader = new FileSystemMavenDependenciesReader(files, CURRENT_VERSIONS_FILE); | ||
} | ||
|
||
@Override | ||
public JavaDependenciesVersions get() { | ||
return reader.get(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...r/springboot/custom-jhlite/main/shared/dependencies/domain/NpmVersionSource.java.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package {{ packageName }}.shared.dependencies.domain; | ||
|
||
import tech.jhipster.lite.module.domain.npm.NpmVersionSource; | ||
import tech.jhipster.lite.module.domain.npm.NpmVersionSourceFactory; | ||
|
||
public enum {{ baseName }}NpmVersionSource implements NpmVersionSourceFactory { | ||
{{ baseNameUpperCased }}("{{ baseNameKebabCased }}"); | ||
|
||
private final String source; | ||
|
||
{{ baseName }}NpmVersionSource(String source) { | ||
this.source = source; | ||
} | ||
|
||
@Override | ||
public NpmVersionSource build() { | ||
return new NpmVersionSource(source); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...e/main/shared/dependencies/infrastructure/secondary/MavenDependenciesReader.java.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package {{ packageName }}.shared.dependencies.infrastructure.secondary; | ||
|
||
import org.springframework.core.Ordered; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.stereotype.Repository; | ||
import tech.jhipster.lite.module.domain.ProjectFiles; | ||
import tech.jhipster.lite.module.domain.javadependency.JavaDependenciesVersions; | ||
import tech.jhipster.lite.module.infrastructure.secondary.javadependency.FileSystemMavenDependenciesReader; | ||
import tech.jhipster.lite.module.infrastructure.secondary.javadependency.JavaDependenciesReader; | ||
|
||
@Repository | ||
@Order(Ordered.HIGHEST_PRECEDENCE) | ||
public class {{ baseName }}MavenDependenciesReader implements JavaDependenciesReader { | ||
private static final String CURRENT_VERSIONS_FILE = "/generator/{{ baseNameKebabCased }}-dependencies/pom.xml"; | ||
private final FileSystemMavenDependenciesReader reader; | ||
public {{ baseName }}MavenDependenciesReader(ProjectFiles files) { | ||
this.reader = new FileSystemMavenDependenciesReader(files, CURRENT_VERSIONS_FILE); | ||
} | ||
|
||
@Override | ||
public JavaDependenciesVersions get() { | ||
return reader.get(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...m-jhlite/main/shared/dependencies/infrastructure/secondary/NpmVersionReader.java.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package {{ packageName }}.shared.dependencies.infrastructure.secondary; | ||
|
||
import java.util.List; | ||
import org.springframework.core.Ordered; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.stereotype.Repository; | ||
import {{ packageName }}.shared.dependencies.domain.{{ baseName }}NpmVersionSource; | ||
import tech.jhipster.lite.module.domain.ProjectFiles; | ||
import tech.jhipster.lite.module.domain.npm.NpmPackagesVersions; | ||
import tech.jhipster.lite.module.infrastructure.secondary.npm.FileSystemNpmVersionReader; | ||
import tech.jhipster.lite.module.infrastructure.secondary.npm.NpmVersionsReader; | ||
|
||
@Repository | ||
@Order(Ordered.HIGHEST_PRECEDENCE) | ||
public class {{ baseName }}NpmVersionReader implements NpmVersionsReader { | ||
private static final String PARENT_FOLDER = "/generator/{{ baseNameKebabCased }}-dependencies/"; | ||
private final FileSystemNpmVersionReader reader; | ||
public {{ baseName }}NpmVersionReader(ProjectFiles projectFiles) { | ||
reader = new FileSystemNpmVersionReader(projectFiles, List.of({{ baseName }}NpmVersionSource.values()), PARENT_FOLDER); | ||
} | ||
|
||
@Override | ||
public NpmPackagesVersions get() { | ||
return reader.get(); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...rator/server/springboot/custom-jhlite/main/shared/dependencies/package-info.java.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@{{ packageName }}.SharedKernel | ||
package {{ packageName }}.shared.dependencies; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
src/main/resources/generator/server/springboot/custom-jhlite/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"dependencies": {} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/resources/generator/server/springboot/custom-jhlite/pom.xml.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<project | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>{{ baseNameKebabCased }}-dependencies</artifactId> | ||
<version>0.0.7-SNAPSHOT</version> | ||
<name>{{ projectName }} dependencies</name> | ||
<description>{{ projectName }} dependencies list</description> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<!-- Version slugs of dependencies added by jhipster-lite modules should be declared here --> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<!-- Dependencies that will be added by jhipster-lite modules should be declared here --> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> |
Oops, something went wrong.