Skip to content

Commit

Permalink
Merge branch 'jhipster:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
BingZi-233 authored Nov 14, 2024
2 parents 63d965f + b71f546 commit 7d94004
Show file tree
Hide file tree
Showing 99 changed files with 937 additions and 509 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ jobs:
- customjhlite
- typescriptapp
- thymeleafapp
- langchain4japp
include:
- java-build-tool: maven
- spring-config-format: yaml
Expand All @@ -263,7 +264,7 @@ jobs:
- app: mariadbapp
spring-config-format: properties
- app: consulapp
java-version: 22
java-version: 23
- app: vuejwtapp
node-version: 'latest'
- app: fullapp
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ from the main (upstream) repository:
- reactiveapp
- customjhlite
- typescriptapp
- langchain4japp
- Below is the list of build tools that can be used for testing (supported input params for the generate.sh script):
- gradle
- maven
Expand Down
540 changes: 275 additions & 265 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jhlite",
"version": "1.21.1-SNAPSHOT",
"version": "1.22.1-SNAPSHOT",
"description": "JHipster Lite",
"homepage": "https://www.jhipster.tech/",
"bugs": "https://github.com/jhipster/jhipster-lite/issues",
Expand Down Expand Up @@ -60,19 +60,19 @@
"@prettier/plugin-xml": "3.4.1",
"@tikui/core": "6.2.1",
"@types/sinon": "17.0.3",
"@typescript-eslint/eslint-plugin": "8.12.2",
"@typescript-eslint/parser": "8.12.2",
"@typescript-eslint/eslint-plugin": "8.13.0",
"@typescript-eslint/parser": "8.13.0",
"@vitejs/plugin-vue": "5.1.4",
"@vitest/coverage-istanbul": "2.1.4",
"@vue/test-utils": "2.4.6",
"cypress": "13.15.1",
"cypress": "13.15.2",
"eslint": "9.14.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-cypress": "4.1.0",
"eslint-plugin-pug": "1.2.5",
"eslint-plugin-vue": "9.30.0",
"fontello-cli": "0.6.2",
"globals": "15.11.0",
"globals": "15.12.0",
"husky": "9.1.6",
"jsdom": "25.0.1",
"lint-staged": "15.2.10",
Expand All @@ -94,7 +94,7 @@
"stylelint-config-standard-scss": "13.1.0",
"tikuidoc-tikui": "8.0.0",
"typescript": "5.6.3",
"typescript-eslint": "8.12.2",
"typescript-eslint": "8.13.0",
"vite": "5.4.10",
"vitest": "2.1.4",
"vitest-sonar-reporter": "2.0.0",
Expand Down
11 changes: 6 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>tech.jhipster.lite</groupId>
<artifactId>jhlite</artifactId>
<version>1.21.1-SNAPSHOT</version>
<version>1.22.1-SNAPSHOT</version>
<name>jhlite</name>
<description>JHipster Lite</description>
<packaging>jar</packaging>
Expand Down Expand Up @@ -68,7 +68,7 @@
<archunit-junit5.version>1.3.0</archunit-junit5.version>
<springdoc-openapi-starter-webmvc-ui.version>2.6.0</springdoc-openapi-starter-webmvc-ui.version>
<properties-maven-plugin.version>1.2.1</properties-maven-plugin.version>
<sonar-maven-plugin.version>4.0.0.4121</sonar-maven-plugin.version>
<sonar-maven-plugin.version>5.0.0.4389</sonar-maven-plugin.version>
<apache-commons-io.version>2.17.0</apache-commons-io.version>
<cucumber.version>7.20.1</cucumber.version>
<maven-model-helper.version>37</maven-model-helper.version>
Expand Down Expand Up @@ -342,7 +342,6 @@
<excludes>
<exclude>**/generator/buildtool/maven/.mvn/wrapper/*</exclude>
<exclude>**/generator/buildtool/gradle/gradle/wrapper/*</exclude>
<exclude>src/main/webapp/app/common/primary/applicationlistener/WindowApplicationListener.ts</exclude>
</excludes>
</configuration>
</plugin>
Expand Down Expand Up @@ -711,11 +710,13 @@
<configuration>
<rules>
<requireMavenVersion>
<message>You are running an older version of Maven. JHipster requires at least Maven ${maven.version}</message>
<message>You are running an older version of Maven. JHipster Lite requires at least Maven ${maven.version}</message>
<version>${maven.version}</version>
</requireMavenVersion>
<requireJavaVersion>
<message>You are running an incompatible version of Java. JHipster engine requires at least Java ${java.version}</message>
<message>
You are running an incompatible version of Java. JHipster Lite engine requires at least Java ${java.version}
</message>
<version>${java.version}</version>
</requireJavaVersion>
</rules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
private Consumer<JHipsterModuleBuilder> patchEslintConfig(JHipsterModuleProperties properties) {
String reactConfig =
"""
\t\tfiles: ['src/main/webapp/**/*.{ts,tsx}', 'src/main/webapp/**/*.spec.ts'],
\t\tfiles: ['src/main/webapp/**/*.{ts,tsx}', 'src/test/webapp/unit/**/*.{ts,tsx}'],
\t\textends: [...typescript.configs.recommendedTypeChecked, react],
\t\tsettings: {
\t\t\treact: {
Expand All @@ -143,6 +143,10 @@ private Consumer<JHipsterModuleBuilder> patchEslintConfig(JHipsterModuleProperti
regex("[ \\t]+quotes: \\['error', 'single', \\{ avoidEscape: true }],"),
"""
\t\t\t'react/react-in-jsx-scope': 'off',
\t\t\t'@typescript-eslint/no-explicit-any': 'off',
\t\t\t'@typescript-eslint/no-unsafe-argument': 'off',
\t\t\t'@typescript-eslint/await-thenable': 'off',
\t\t\t'@typescript-eslint/consistent-type-imports': 'error',
\t\t\t'@typescript-eslint/no-misused-promises': [
\t\t\t\t'error',
\t\t\t\t{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
vi.mock('react-i18next', () => ({
useTranslation: () => {
return {
t: vi.fn().mockImplementation((_str: string) => 'Internationalization enabled'),
t: vi.fn().mockImplementation(() => 'Internationalization enabled'),
};
},
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ private Consumer<JHipsterModuleBuilder> patchEslintConfig(JHipsterModuleProperti
.add(eslintTypescriptVueRule("'vue/html-self-closing': 'off',", properties.indentation()))
.add(eslintTypescriptVueRule("'@typescript-eslint/no-explicit-any': 'off',", properties.indentation()))
.add(eslintTypescriptVueRule("'@typescript-eslint/no-empty-object-type': 'off',", properties.indentation()))
.add(eslintTypescriptVueRule("'@typescript-eslint/consistent-type-imports': 'error',", properties.indentation()))
.and()
.and();
//@formatter:on
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package tech.jhipster.lite.generator.server.springboot.langchain4j.application;

import org.springframework.stereotype.Service;
import tech.jhipster.lite.generator.server.springboot.langchain4j.domain.LangChain4jModuleFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

@Service
public class LangChain4jApplicationService {

private final LangChain4jModuleFactory factory;

public LangChain4jApplicationService() {
factory = new LangChain4jModuleFactory();
}

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
return factory.buildModule(properties);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package tech.jhipster.lite.generator.server.springboot.langchain4j.domain;

import static tech.jhipster.lite.module.domain.JHipsterModule.*;

import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.file.JHipsterSource;
import tech.jhipster.lite.module.domain.javabuild.ArtifactId;
import tech.jhipster.lite.module.domain.javabuild.GroupId;
import tech.jhipster.lite.module.domain.javabuild.VersionSlug;
import tech.jhipster.lite.module.domain.javaproperties.PropertyKey;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;
import tech.jhipster.lite.shared.error.domain.Assert;

public class LangChain4jModuleFactory {

private static final String API_KEY_DEMO_COMMENT =
"You can temporarily use 'demo' key, which is provided for free for demonstration purposes";

private static final JHipsterSource SOURCE = from("server/springboot/langchain4j");
private static final GroupId GROUP_ID = groupId("dev.langchain4j");
private static final ArtifactId ARTIFACT_ID = artifactId("langchain4j-spring-boot-starter");
private static final ArtifactId OPEN_AI_ARTIFACT_ID = artifactId("langchain4j-open-ai-spring-boot-starter");
private static final VersionSlug VERSION_SLUG = versionSlug("langchain4j");

private static final String PROPERTIES = "properties";
private static final PropertyKey LANGCHAIN4J_PROPERTY_API_KEY = propertyKey("langchain4j.open-ai.chat-model.api-key");

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
Assert.notNull(PROPERTIES, properties);

//@formatter:off
return moduleBuilder(properties)
.documentation(documentationTitle("LangChain4j"), SOURCE.template("langchain4j.md"))
.javaDependencies()
.addDependency(GROUP_ID, ARTIFACT_ID, VERSION_SLUG)
.addDependency(GROUP_ID, OPEN_AI_ARTIFACT_ID, VERSION_SLUG)
.and()
.springMainProperties()
.set(LANGCHAIN4J_PROPERTY_API_KEY, propertyValue("demo"))
.comment(LANGCHAIN4J_PROPERTY_API_KEY, comment(API_KEY_DEMO_COMMENT))
.set(propertyKey("langchain4j.open-ai.chat-model.model-name"), propertyValue("gpt-4o-mini"))
.set(propertyKey("langchain4j.open-ai.chat-model.log-requests"), propertyValue("true"))
.set(propertyKey("langchain4j.open-ai.chat-model.log-responses"), propertyValue("true"))
.and()
.springTestProperties()
.set(LANGCHAIN4J_PROPERTY_API_KEY, propertyValue("jhipster"))
.and()
.build();
//@formatter:on
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package tech.jhipster.lite.generator.server.springboot.langchain4j.infrastructure.primary;

import static tech.jhipster.lite.shared.slug.domain.JHLiteModuleSlug.LANGCHAIN4J;
import static tech.jhipster.lite.shared.slug.domain.JHLiteModuleSlug.SPRING_BOOT;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.server.springboot.langchain4j.application.LangChain4jApplicationService;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleOrganization;
import tech.jhipster.lite.module.domain.resource.JHipsterModulePropertiesDefinition;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleResource;

@Configuration
class LangChain4jModuleConfiguration {

@Bean
JHipsterModuleResource langChain4jModule(LangChain4jApplicationService langChain4j) {
return JHipsterModuleResource.builder()
.slug(LANGCHAIN4J)
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addProjectBaseName().addIndentation().build())
.apiDoc("LangChain4j", "Add LangChain4j")
.organization(JHipsterModuleOrganization.builder().addDependency(SPRING_BOOT).build())
.tags("server", "spring", "spring-boot", "langchain4j")
.factory(langChain4j::buildModule);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@tech.jhipster.lite.BusinessContext
package tech.jhipster.lite.generator.server.springboot.langchain4j;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package tech.jhipster.lite.generator.server.springboot.mvc.sample.langchain4j.application;

import org.springframework.stereotype.Service;
import tech.jhipster.lite.generator.server.springboot.mvc.sample.langchain4j.domain.SampleLangChain4jModuleFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

@Service
public class SampleLangChain4jApplicationService {

private final SampleLangChain4jModuleFactory factory;

public SampleLangChain4jApplicationService() {
factory = new SampleLangChain4jModuleFactory();
}

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
return factory.buildModule(properties);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package tech.jhipster.lite.generator.server.springboot.mvc.sample.langchain4j.domain;

import static tech.jhipster.lite.module.domain.JHipsterModule.*;

import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.file.JHipsterDestination;
import tech.jhipster.lite.module.domain.file.JHipsterSource;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;
import tech.jhipster.lite.shared.error.domain.Assert;

public class SampleLangChain4jModuleFactory {

private static final String SAMPLE = "sample";

private static final JHipsterSource SOURCE = from("server/springboot/mvc/sample/langchain4j");

private static final String PRIMARY = "infrastructure/primary";

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
Assert.notNull("properties", properties);

String packagePath = properties.packagePath();
JHipsterDestination mainDestination = toSrcMainJava().append(packagePath).append(SAMPLE);
JHipsterDestination testDestination = toSrcTestJava().append(packagePath).append(SAMPLE);

//@formatter:off
return moduleBuilder(properties)
.files()
.batch(SOURCE.append("main").append(PRIMARY), mainDestination.append(PRIMARY))
.addTemplate("ChatResource.java")
.and()
.batch(SOURCE.append("test").append(SAMPLE).append(PRIMARY), testDestination.append(PRIMARY))
.addTemplate("ChatResourceTest.java")
.and()
.and()
.build();
//@formatter:on
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package tech.jhipster.lite.generator.server.springboot.mvc.sample.langchain4j.infrastructure.primary;

import static tech.jhipster.lite.shared.slug.domain.JHLiteFeatureSlug.SPRING_MVC_SERVER;
import static tech.jhipster.lite.shared.slug.domain.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.server.springboot.mvc.sample.langchain4j.application.SampleLangChain4jApplicationService;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleOrganization;
import tech.jhipster.lite.module.domain.resource.JHipsterModulePropertiesDefinition;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleResource;

@Configuration
class SampleLangChain4jModuleConfiguration {

@Bean
JHipsterModuleResource langChain4jResourceInit(SampleLangChain4jApplicationService applicationService) {
return JHipsterModuleResource.builder()
.slug(SPRING_BOOT_LANGCHAIN4J_SAMPLE)
.propertiesDefinition(
JHipsterModulePropertiesDefinition.builder().addBasePackage().addIndentation().addSpringConfigurationFormat().build()
)
.apiDoc("Spring Boot - LangChain4j", "Add LangChain4j sample")
.organization(JHipsterModuleOrganization.builder().addDependency(SPRING_MVC_SERVER).addDependency(LANGCHAIN4J).build())
.tags("spring-boot", "spring", "server", "langchain4j")
.factory(applicationService::buildModule);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@tech.jhipster.lite.BusinessContext
package tech.jhipster.lite.generator.server.springboot.mvc.sample.langchain4j;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface NpmVersions {
* source folder for this version
* @return The version
* @throws UnknownNpmPackageException
* is the package can't be found in source
* if the package can't be found in source
*/
default NpmPackageVersion get(NpmPackageName packageName, NpmVersionSource source) {
return get().get(packageName, source);
Expand All @@ -35,7 +35,7 @@ default NpmPackageVersion get(NpmPackageName packageName, NpmVersionSource sourc
* source folder for this version
* @return The version
* @throws UnknownNpmPackageException
* is the package can't be found in source
* if the package can't be found in source
*/
default NpmPackageVersion get(String packageName, NpmVersionSource source) {
return get(new NpmPackageName(packageName), source);
Expand All @@ -50,7 +50,7 @@ default NpmPackageVersion get(String packageName, NpmVersionSource source) {
* source folder for this version
* @return The version
* @throws UnknownNpmPackageException
* is the package can't be found in source
* if the package can't be found in source
*/
default NpmPackageVersion get(String packageName, NpmVersionSourceFactory source) {
return get(packageName, source.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/**
* <p>
* Read version for an npm dependency
* Read version for a npm dependency
* </p>
*
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,11 @@ public StringAsserter notBlank() {
}

/**
* Ensure that the value does not contain whitespace
* Ensure that the value does not contain whitespace
*
* @return The current asserter
* @throws MissingMandatoryValueException
* if the value contain whitespace
* if the value contains whitespace
*/
public StringAsserter noWhitespace() {
notNull();
Expand Down
Loading

0 comments on commit 7d94004

Please sign in to comment.