diff --git a/generators/app/__snapshots__/generator.spec.ts.snap b/generators/app/__snapshots__/generator.spec.ts.snap index fb493a563456..1bdb6ec8c3df 100644 --- a/generators/app/__snapshots__/generator.spec.ts.snap +++ b/generators/app/__snapshots__/generator.spec.ts.snap @@ -226,6 +226,10 @@ exports[`generator - app with default config should match snapshot 1`] = ` "applicationTypeGateway": false, "applicationTypeMicroservice": false, "applicationTypeMonolith": true, + "artifactoryReleasesId": undefined, + "artifactoryReleasesUrl": undefined, + "artifactorySnapshotsId": undefined, + "artifactorySnapshotsUrl": undefined, "authenticationType": "jwt", "authenticationTypeAny": true, "authenticationTypeJwt": true, @@ -255,6 +259,22 @@ exports[`generator - app with default config should match snapshot 1`] = ` "camelizedBaseName": "jhipster", "capitalizedBaseName": "Jhipster", "caret": undefined, + "ciCd": undefined, + "ciCdAny": false, + "ciCdAzure": false, + "ciCdCircle": false, + "ciCdGithub": false, + "ciCdGitlab": false, + "ciCdIntegrations": undefined, + "ciCdIntegrationsAny": false, + "ciCdIntegrationsCypressDashboard": false, + "ciCdIntegrationsDeploy": false, + "ciCdIntegrationsHeroku": false, + "ciCdIntegrationsPublishDocker": false, + "ciCdIntegrationsSnyk": false, + "ciCdIntegrationsSonar": false, + "ciCdJenkins": false, + "ciCdTravis": false, "cjsExtension": ".js", "cliName": undefined, "clientBundler": "webpack", @@ -451,6 +471,7 @@ exports[`generator - app with default config should match snapshot 1`] = ` "zipkinImage": "zipkin-image-placeholder", "zipkinTag": "zipkin-tag-placeholder", }, + "dockerImage": undefined, "dockerServices": [ "app", "postgresql", @@ -490,6 +511,7 @@ exports[`generator - app with default config should match snapshot 1`] = ` "githubWorkflows": undefined, "graalvmSupport": undefined, "gradleEnterpriseHost": undefined, + "herokuAppName": undefined, "hipster": "jhipster_family_member_3", "hipsterBugTrackerLink": "https://github.com/jhipster/generator-jhipster/issues?state=open", "hipsterBugTrackerProductName": "JHipster", @@ -507,6 +529,7 @@ exports[`generator - app with default config should match snapshot 1`] = ` "humanizedBaseName": "JHipster", "imperativeOrReactive": "imperative", "incrementalChangelog": undefined, + "insideDocker": undefined, "javaCompatibleVersions": [ "17", "21", @@ -817,6 +840,7 @@ exports[`generator - app with default config should match snapshot 1`] = ` "searchEngineCouchbase": false, "searchEngineElasticsearch": false, "searchEngineNo": true, + "sendBuildToGitlab": undefined, "serverPort": 8080, "serviceDiscovery": "no", "serviceDiscoveryAny": false, @@ -835,6 +859,9 @@ exports[`generator - app with default config should match snapshot 1`] = ` "skipJhipsterDependencies": undefined, "skipServer": undefined, "skipUserManagement": false, + "sonarName": undefined, + "sonarOrga": undefined, + "sonarUrl": undefined, "springBootDependencies": Any, "srcMainDir": "src/main/", "srcMainJava": "src/main/java/", @@ -895,6 +922,10 @@ exports[`generator - app with gateway should match snapshot 1`] = ` "applicationTypeGateway": true, "applicationTypeMicroservice": false, "applicationTypeMonolith": false, + "artifactoryReleasesId": undefined, + "artifactoryReleasesUrl": undefined, + "artifactorySnapshotsId": undefined, + "artifactorySnapshotsUrl": undefined, "authenticationType": "jwt", "authenticationTypeAny": true, "authenticationTypeJwt": true, @@ -924,6 +955,22 @@ exports[`generator - app with gateway should match snapshot 1`] = ` "camelizedBaseName": "jhipster", "capitalizedBaseName": "Jhipster", "caret": undefined, + "ciCd": undefined, + "ciCdAny": false, + "ciCdAzure": false, + "ciCdCircle": false, + "ciCdGithub": false, + "ciCdGitlab": false, + "ciCdIntegrations": undefined, + "ciCdIntegrationsAny": false, + "ciCdIntegrationsCypressDashboard": false, + "ciCdIntegrationsDeploy": false, + "ciCdIntegrationsHeroku": false, + "ciCdIntegrationsPublishDocker": false, + "ciCdIntegrationsSnyk": false, + "ciCdIntegrationsSonar": false, + "ciCdJenkins": false, + "ciCdTravis": false, "cjsExtension": ".js", "cliName": undefined, "clientBundler": "webpack", @@ -1120,6 +1167,7 @@ exports[`generator - app with gateway should match snapshot 1`] = ` "zipkinImage": "zipkin-image-placeholder", "zipkinTag": "zipkin-tag-placeholder", }, + "dockerImage": undefined, "dockerServices": [ "app", "consul", @@ -1161,6 +1209,7 @@ exports[`generator - app with gateway should match snapshot 1`] = ` "githubWorkflows": undefined, "graalvmSupport": undefined, "gradleEnterpriseHost": undefined, + "herokuAppName": undefined, "hipster": "jhipster_family_member_3", "hipsterBugTrackerLink": "https://github.com/jhipster/generator-jhipster/issues?state=open", "hipsterBugTrackerProductName": "JHipster", @@ -1178,6 +1227,7 @@ exports[`generator - app with gateway should match snapshot 1`] = ` "humanizedBaseName": "JHipster", "imperativeOrReactive": "reactive", "incrementalChangelog": undefined, + "insideDocker": undefined, "javaCompatibleVersions": [ "17", "21", @@ -1483,6 +1533,7 @@ exports[`generator - app with gateway should match snapshot 1`] = ` "searchEngineCouchbase": false, "searchEngineElasticsearch": false, "searchEngineNo": true, + "sendBuildToGitlab": undefined, "serverPort": 8080, "serviceDiscovery": "consul", "serviceDiscoveryAny": true, @@ -1501,6 +1552,9 @@ exports[`generator - app with gateway should match snapshot 1`] = ` "skipJhipsterDependencies": undefined, "skipServer": undefined, "skipUserManagement": false, + "sonarName": undefined, + "sonarOrga": undefined, + "sonarUrl": undefined, "springBootDependencies": Any, "srcMainDir": "src/main/", "srcMainJava": "src/main/java/", @@ -1559,6 +1613,10 @@ exports[`generator - app with microservice should match snapshot 1`] = ` "applicationTypeGateway": false, "applicationTypeMicroservice": true, "applicationTypeMonolith": false, + "artifactoryReleasesId": undefined, + "artifactoryReleasesUrl": undefined, + "artifactorySnapshotsId": undefined, + "artifactorySnapshotsUrl": undefined, "authenticationType": "jwt", "authenticationTypeAny": true, "authenticationTypeJwt": true, @@ -1587,6 +1645,22 @@ exports[`generator - app with microservice should match snapshot 1`] = ` "camelizedBaseName": "jhipster", "capitalizedBaseName": "Jhipster", "caret": undefined, + "ciCd": undefined, + "ciCdAny": false, + "ciCdAzure": false, + "ciCdCircle": false, + "ciCdGithub": false, + "ciCdGitlab": false, + "ciCdIntegrations": undefined, + "ciCdIntegrationsAny": false, + "ciCdIntegrationsCypressDashboard": false, + "ciCdIntegrationsDeploy": false, + "ciCdIntegrationsHeroku": false, + "ciCdIntegrationsPublishDocker": false, + "ciCdIntegrationsSnyk": false, + "ciCdIntegrationsSonar": false, + "ciCdJenkins": false, + "ciCdTravis": false, "cjsExtension": ".js", "cliName": undefined, "clientBundler": undefined, @@ -1783,6 +1857,7 @@ exports[`generator - app with microservice should match snapshot 1`] = ` "zipkinImage": "zipkin-image-placeholder", "zipkinTag": "zipkin-tag-placeholder", }, + "dockerImage": undefined, "dockerServices": [ "app", "consul", @@ -1824,6 +1899,7 @@ exports[`generator - app with microservice should match snapshot 1`] = ` "githubWorkflows": undefined, "graalvmSupport": undefined, "gradleEnterpriseHost": undefined, + "herokuAppName": undefined, "hipster": "jhipster_family_member_3", "hipsterBugTrackerLink": "https://github.com/jhipster/generator-jhipster/issues?state=open", "hipsterBugTrackerProductName": "JHipster", @@ -1841,6 +1917,7 @@ exports[`generator - app with microservice should match snapshot 1`] = ` "humanizedBaseName": "JHipster", "imperativeOrReactive": "imperative", "incrementalChangelog": undefined, + "insideDocker": undefined, "javaCompatibleVersions": [ "17", "21", @@ -2079,6 +2156,7 @@ exports[`generator - app with microservice should match snapshot 1`] = ` "searchEngineCouchbase": false, "searchEngineElasticsearch": false, "searchEngineNo": true, + "sendBuildToGitlab": undefined, "serverPort": 8081, "serviceDiscovery": "consul", "serviceDiscoveryAny": true, @@ -2097,6 +2175,9 @@ exports[`generator - app with microservice should match snapshot 1`] = ` "skipJhipsterDependencies": undefined, "skipServer": undefined, "skipUserManagement": true, + "sonarName": undefined, + "sonarOrga": undefined, + "sonarUrl": undefined, "springBootDependencies": Any, "srcMainDir": "src/main/", "srcMainJava": "src/main/java/", diff --git a/generators/bootstrap-application-client/types-partials.d.ts b/generators/bootstrap-application-client/types-partials.d.ts new file mode 100644 index 000000000000..800aaaa6f79c --- /dev/null +++ b/generators/bootstrap-application-client/types-partials.d.ts @@ -0,0 +1,26 @@ +/** + * Copyright 2013-2025 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @deprecated will be deprecated in favor of a generator-dedicated class, every attribute will be moved there then. + */ +export type PartialApplicationBootstrapApplicationClient = { + clientBundlerWebpack?: boolean; + clientBundlerExperimentalEsbuild?: boolean; + clientBundlerVite?: boolean; +}; diff --git a/generators/ci-cd/__snapshots__/ci-cd.spec.ts.snap b/generators/ci-cd/__snapshots__/ci-cd.spec.ts.snap index 60a8b822967a..14b24fe6a3e1 100644 --- a/generators/ci-cd/__snapshots__/ci-cd.spec.ts.snap +++ b/generators/ci-cd/__snapshots__/ci-cd.spec.ts.snap @@ -5,10 +5,25 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: Gradle Angular ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "gradle", + "ciCd": [ + "azure" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -122,10 +137,27 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: Gradle Angular ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "gradle", + "ciCd": [ + "azure" + ], + "ciCdIntegrations": [ + "snyk" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -251,10 +283,27 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: Maven Angular ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "azure" + ], + "ciCdIntegrations": [ + "cypressDashboard" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -368,10 +417,27 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: Maven Angular ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "azure" + ], + "ciCdIntegrations": [ + "snyk" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -497,10 +563,25 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: autoconfigure ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "azure" + ], + "ciCdIntegrations": null, "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -674,10 +755,25 @@ jobs: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "gradle", + "ciCd": [ + "circle" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -765,10 +861,27 @@ jobs: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "gradle", + "ciCd": [ + "circle" + ], + "ciCdIntegrations": [ + "snyk" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -845,10 +958,27 @@ jobs: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "circle" + ], + "ciCdIntegrations": [ + "cypressDashboard" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -936,10 +1066,27 @@ jobs: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "circle" + ], + "ciCdIntegrations": [ + "snyk" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -1011,10 +1158,25 @@ jobs: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "gradle", + "ciCd": [ + "github" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -1126,10 +1288,30 @@ jobs: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "gradle", + "ciCd": [ + "github" + ], + "ciCdIntegrations": [ + "sonar", + "publishDocker", + "heroku", + "snyk" + ], "creationTimestamp": 1577836800000, + "dockerImage": "jhipster-publish-docker", "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": "http://sonar.com:9000", "testFrameworks": [ "cypress" ] @@ -1238,10 +1420,25 @@ jobs: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "github" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -1347,10 +1544,32 @@ jobs: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": "releases", + "artifactoryReleasesUrl": "http://artifactory:8081/artifactory/libs-release", + "artifactorySnapshotsId": "snapshots", + "artifactorySnapshotsUrl": "http://artifactory:8081/artifactory/libs-snapshot", "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "github" + ], + "ciCdIntegrations": [ + "deploy", + "sonar", + "publishDocker", + "heroku", + "snyk", + "cypressDashboard" + ], "creationTimestamp": 1577836800000, + "dockerImage": "jhipster-publish-docker", "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": "http://sonar.com:9000", "testFrameworks": [ "cypress" ] @@ -1478,10 +1697,25 @@ jobs: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "github" + ], + "ciCdIntegrations": null, "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -1592,10 +1826,25 @@ gradle-package: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "gradle", + "ciCd": [ + "gitlab" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": false, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -1730,10 +1979,30 @@ deploy-to-production: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": "releases", + "artifactoryReleasesUrl": "http://artifactory:8081/artifactory/libs-release", + "artifactorySnapshotsId": "snapshots", + "artifactorySnapshotsUrl": "http://artifactory:8081/artifactory/libs-snapshot", "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "gitlab" + ], + "ciCdIntegrations": [ + "deploy", + "sonar", + "heroku", + "snyk" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": true, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": "http://localhost:9000", "testFrameworks": [ "cypress" ] @@ -1855,10 +2124,25 @@ maven-package: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "gitlab" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": false, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -1985,10 +2269,30 @@ deploy-to-production: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": "releases", + "artifactoryReleasesUrl": "http://artifactory:8081/artifactory/libs-release", + "artifactorySnapshotsId": "snapshots", + "artifactorySnapshotsUrl": "http://artifactory:8081/artifactory/libs-snapshot", "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "gitlab" + ], + "ciCdIntegrations": [ + "deploy", + "sonar", + "heroku", + "snyk" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": false, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": "http://localhost:9000", "testFrameworks": [ "cypress" ] @@ -2118,10 +2422,25 @@ maven-package: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "gitlab" + ], + "ciCdIntegrations": null, "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": true, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -2255,11 +2574,26 @@ webapp-prod: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "jhipster", "buildTool": "maven", + "ciCd": [ + "gitlab" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], - "skipServer": true + "herokuAppName": null, + "insideDocker": true, + "sendBuildToGitlab": null, + "skipServer": true, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null } } ", @@ -2273,10 +2607,25 @@ exports[`generator - CI-CD Jenkins tests Jenkins: Gradle Angular NPM should matc ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "gradle", + "ciCd": [ + "jenkins" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": false, + "sendBuildToGitlab": false, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -2457,10 +2806,31 @@ exports[`generator - CI-CD Jenkins tests Jenkins: Maven Angular NPM inside Docke ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": "releases", + "artifactoryReleasesUrl": "http://artifactory:8081/artifactory/libs-release", + "artifactorySnapshotsId": "snapshots", + "artifactorySnapshotsUrl": "http://artifactory:8081/artifactory/libs-snapshot", "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "jenkins" + ], + "ciCdIntegrations": [ + "deploy", + "sonar", + "publishDocker", + "heroku", + "snyk" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": true, + "sendBuildToGitlab": false, + "sonarName": "sonarName", + "sonarOrga": null, + "sonarUrl": "https://sonarcloud.io", "testFrameworks": [ "cypress" ] @@ -2733,10 +3103,25 @@ exports[`generator - CI-CD Jenkins tests Jenkins: Maven Angular NPM should match ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "jenkins" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": false, + "sendBuildToGitlab": false, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -2920,10 +3305,31 @@ exports[`generator - CI-CD Jenkins tests Jenkins: Maven Angular NPM with full op ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": "releases", + "artifactoryReleasesUrl": "http://artifactory:8081/artifactory/libs-release", + "artifactorySnapshotsId": "snapshots", + "artifactorySnapshotsUrl": "http://artifactory:8081/artifactory/libs-snapshot", "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "jenkins" + ], + "ciCdIntegrations": [ + "deploy", + "sonar", + "publishDocker", + "heroku", + "snyk" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": false, + "sendBuildToGitlab": false, + "sonarName": "sonarName", + "sonarOrga": null, + "sonarUrl": "https://sonarcloud.io", "testFrameworks": [ "cypress" ] @@ -3248,10 +3654,25 @@ notifications: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "gradle", + "ciCd": [ + "travis" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -3324,10 +3745,25 @@ notifications: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": null, + "artifactoryReleasesUrl": null, + "artifactorySnapshotsId": null, + "artifactorySnapshotsUrl": null, "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "travis" + ], + "ciCdIntegrations": [], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": null, "testFrameworks": [ "cypress" ] @@ -3406,10 +3842,31 @@ notifications: ".yo-rc.json": { "contents": "{ "generator-jhipster": { + "artifactoryReleasesId": "releases", + "artifactoryReleasesUrl": "http://artifactory:8081/artifactory/libs-release", + "artifactorySnapshotsId": "snapshots", + "artifactorySnapshotsUrl": "http://artifactory:8081/artifactory/libs-snapshot", "baseName": "sampleMysql", "buildTool": "maven", + "ciCd": [ + "travis" + ], + "ciCdIntegrations": [ + "deploy", + "sonar", + "heroku", + "snyk", + "cypressDashboard" + ], "creationTimestamp": 1577836800000, + "dockerImage": null, "entities": [], + "herokuAppName": null, + "insideDocker": null, + "sendBuildToGitlab": null, + "sonarName": null, + "sonarOrga": null, + "sonarUrl": "http://localhost:9000", "testFrameworks": [ "cypress" ] diff --git a/generators/ci-cd/command.ts b/generators/ci-cd/command.ts index dba7ccce0f6b..f9d2747379fe 100644 --- a/generators/ci-cd/command.ts +++ b/generators/ci-cd/command.ts @@ -19,20 +19,28 @@ import chalk from 'chalk'; import { intersection, kebabCase } from 'lodash-es'; import type { JHipsterCommandDefinition } from '../../lib/command/index.js'; +import { GENERATOR_BOOTSTRAP_APPLICATION_BASE } from '../generator-list.js'; const includesValue = (prop, values) => answers => answers[prop] && intersection(answers[prop], values).length > 0; -const command: JHipsterCommandDefinition = { +const command = { + arguments: { + ciCd: { + type: Array, + required: false, + scope: 'storage', + }, + }, options: {}, configs: { ciCd: { - argument: { + cli: { type: Array, }, - prompt: { + prompt: () => ({ type: 'checkbox', message: 'What CI/CD pipeline do you want to generate?', - }, + }), choices: [ { name: 'GitHub Actions', value: 'github' }, { name: 'Jenkins pipeline', value: 'jenkins' }, @@ -41,13 +49,16 @@ const command: JHipsterCommandDefinition = { { name: 'Travis CI', value: 'travis' }, { name: 'CircleCI', value: 'circle' }, ], - scope: 'context', + scope: 'storage', }, ciCdIntegrations: { - prompt: { + cli: { + type: Array, + }, + prompt: () => ({ type: 'checkbox', message: 'What tasks/integrations do you want to include ?', - }, + }), choices: [ // ['jenkins', 'gitlab'] { name: `Deploy your application to an ${chalk.yellow('*Artifactory*')}`, value: 'deploy' }, @@ -73,113 +84,147 @@ const command: JHipsterCommandDefinition = { value: 'cypressDashboard', }, ], - scope: 'context', + scope: 'storage', }, insideDocker: { - prompt: { - when: includesValue('ciCd', ['jenkins', 'gitlab']), + cli: { + type: Boolean, + }, + prompt: () => ({ + when: answers => answers.ciCd?.includes('jenkins') || answers.ciCd?.includes('gitlab'), type: 'confirm', message: 'Would you like to perform the build in a Docker container ?', default: false, - }, - scope: 'context', + }), + scope: 'storage', }, sendBuildToGitlab: { - prompt: { - when: includesValue('ciCd', ['jenkins']), + cli: { + type: Boolean, + }, + prompt: () => ({ + when: answers => answers.ciCd?.includes('jenkins'), type: 'confirm', message: 'Would you like to send build status to GitLab ?', default: false, - }, - scope: 'context', + }), + scope: 'storage', }, artifactorySnapshotsId: { - prompt: { - when: includesValue('ciCdIntegrations', ['deploy']), + cli: { + type: String, + }, + prompt: () => ({ + when: answers => answers.ciCdIntegrations?.includes('deploy'), type: 'input', message: `${chalk.yellow('*Artifactory*')}: what is the ID of distributionManagement for snapshots ?`, - }, - default: 'snapshots', - scope: 'context', + default: 'snapshots', + }), + scope: 'storage', }, artifactorySnapshotsUrl: { - prompt: { - when: includesValue('ciCdIntegrations', ['deploy']), + cli: { + type: String, + }, + prompt: () => ({ + when: answers => answers.ciCdIntegrations?.includes('deploy'), type: 'input', message: `${chalk.yellow('*Artifactory*')}: what is the URL of distributionManagement for snapshots ?`, - }, - default: 'http://artifactory:8081/artifactory/libs-snapshot', - scope: 'context', + default: 'http://artifactory:8081/artifactory/libs-snapshot', + }), + scope: 'storage', }, artifactoryReleasesId: { - prompt: { - when: includesValue('ciCdIntegrations', ['deploy']), + cli: { + type: String, + }, + prompt: () => ({ + when: answers => answers.ciCdIntegrations?.includes('deploy'), type: 'input', message: `${chalk.yellow('*Artifactory*')}: what is the ID of distributionManagement for releases ?`, - }, - default: 'releases', - scope: 'context', + default: 'releases', + }), + scope: 'storage', }, artifactoryReleasesUrl: { - prompt: { - when: includesValue('ciCdIntegrations', ['deploy']), + cli: { + type: String, + }, + prompt: () => ({ + when: answers => answers.ciCdIntegrations?.includes('deploy'), type: 'input', message: `${chalk.yellow('*Artifactory*')}: what is the URL of distributionManagement for releases ?`, - }, - default: 'http://artifactory:8081/artifactory/libs-release', - scope: 'context', + default: 'http://artifactory:8081/artifactory/libs-release', + }), + scope: 'storage', }, sonarName: { - prompt: { - when: answers => includesValue('ciCd', ['jenkins'])(answers) && includesValue('ciCdIntegrations', ['sonar'])(answers), + cli: { + type: String, + }, + prompt: gen => ({ + when: answers => answers.ciCd?.includes('jenkins') && answers.ciCdIntegrations?.includes('sonar'), type: 'input', message: `${chalk.yellow('*Sonar*')}: what is the name of the Sonar server ?`, - }, - default: 'sonar', - scope: 'context', + default: 'sonar', + }), + scope: 'storage', }, sonarUrl: { - prompt: { + cli: { + type: String, + }, + prompt: () => ({ when: answers => includesValue('ciCd', ['jenkins', 'github', 'gitlab', 'travis'])(answers) && includesValue('ciCdIntegrations', ['sonar'])(answers), type: 'input', message: `${chalk.yellow('*Sonar*')}: what is the URL of the Sonar server ?`, - }, - default: 'https://sonarcloud.io', - scope: 'context', + default: 'https://sonarcloud.io', + }), + scope: 'storage', }, sonarOrga: { - prompt: { + cli: { + type: String, + }, + prompt: () => ({ when: answers => includesValue('ciCd', ['jenkins', 'github', 'gitlab', 'travis'])(answers) && includesValue('ciCdIntegrations', ['sonar'])(answers), type: 'input', message: `${chalk.yellow('*Sonar*')}: what is the Organization of the Sonar server ?`, - }, - scope: 'context', + }), + scope: 'storage', }, dockerImage: { + cli: { + type: String, + }, prompt: ({ jhipsterConfigWithDefaults: config }) => ({ when: answers => includesValue('ciCd', ['github'])(answers) && includesValue('ciCdIntegrations', ['publishDocker'])(answers), type: 'input', message: `${chalk.yellow('*Docker*')}: what is the name of the image ?`, - default: () => `jhipster/${config.dasherizedBaseName}`, + default: () => `jhipster/${config?.dasherizedBaseName}`, }), - scope: 'context', + scope: 'storage', }, herokuAppName: { - prompt: { + cli: { + type: String, + }, + prompt: () => ({ when: includesValue('ciCdIntegrations', ['heroku']), type: 'input', message: `${chalk.yellow('*Heroku*')}: name of your Heroku Application ?`, - }, - scope: 'context', + }), + scope: 'storage', default() { return kebabCase(this.jhipsterConfigWithDefaults.baseName); }, }, }, -}; + import: [GENERATOR_BOOTSTRAP_APPLICATION_BASE], +} as const satisfies JHipsterCommandDefinition; export default command; diff --git a/generators/ci-cd/generator.spec.ts b/generators/ci-cd/generator.spec.ts index 31ba44bbe0ee..1efd6ec01b65 100644 --- a/generators/ci-cd/generator.spec.ts +++ b/generators/ci-cd/generator.spec.ts @@ -65,53 +65,47 @@ describe(`generator - ${generator}`, () => { describe('with multiples values', () => { before(async () => { - await helpers.runCli('ci-cd github jenkins gitlab azure').withJHipsterConfig().withSkipWritingPriorities(); + const deploymentConfig = { + ciCdIntegrations: ['deploy', 'sonar'], + }; + await helpers + .runCli('ci-cd github jenkins gitlab azure') + // @ts-ignore + .withJHipsterConfig(deploymentConfig as any) + .withSkipWritingPriorities(); }); it('should match context snapshot', () => { - expect(runResult.generator.context).toMatchInlineSnapshot(` + expect(runResult.generator.jhipsterConfig).toMatchInlineSnapshot(` { "artifactoryReleasesId": "releases", "artifactoryReleasesUrl": "http://artifactory:8081/artifactory/libs-release", "artifactorySnapshotsId": "snapshots", "artifactorySnapshotsUrl": "http://artifactory:8081/artifactory/libs-snapshot", + "baseName": "jhipster", "ciCd": [ "github", "jenkins", "gitlab", "azure", ], - "ciCdAny": true, - "ciCdAzure": true, - "ciCdCircle": false, - "ciCdGithub": true, - "ciCdGitlab": true, - "ciCdIntegrations": [], - "ciCdIntegrationsAny": false, - "ciCdIntegrationsCypressDashboard": false, - "ciCdIntegrationsDeploy": false, - "ciCdIntegrationsHeroku": false, - "ciCdIntegrationsPublishDocker": false, - "ciCdIntegrationsSnyk": false, - "ciCdIntegrationsSonar": false, - "ciCdJenkins": true, - "ciCdTravis": false, - "dockerImage": undefined, - "frontTestCommand": "test", - "gitLabIndent": "", - "herokuAppName": "jhipster", - "indent": "", + "ciCdIntegrations": [ + "deploy", + "sonar", + ], + "creationTimestamp": 1577836800000, + "dockerImage": null, + "entities": [], + "herokuAppName": null, "insideDocker": false, + "jhipsterVersion": "8.8.0", "sendBuildToGitlab": false, "sonarName": "sonar", - "sonarOrga": undefined, + "sonarOrga": null, "sonarUrl": "https://sonarcloud.io", } `); }); - it('should populate context', () => { - expect(runResult.generator.context!.ciCd).toEqual(['github', 'jenkins', 'gitlab', 'azure']); - }); }); describe('with github', () => { diff --git a/generators/ci-cd/generator.ts b/generators/ci-cd/generator.ts index 944e38fd21ab..c1d556c8b877 100644 --- a/generators/ci-cd/generator.ts +++ b/generators/ci-cd/generator.ts @@ -19,19 +19,16 @@ */ import chalk from 'chalk'; - +import { intersection } from 'lodash-es'; import BaseApplicationGenerator from '../base-application/index.js'; import { clientFrameworkTypes } from '../../lib/jhipster/index.js'; import { createPomStorage } from '../maven/support/pom-store.js'; import { loadConfig, loadDerivedConfig } from '../../lib/internal/config-def.js'; import command from './command.js'; - +import type { CiCdApplication } from './types.js'; const { REACT } = clientFrameworkTypes; -export default class CiCdGenerator extends BaseApplicationGenerator { - insideDocker; - context = {}; - +export default class CiCdGenerator extends BaseApplicationGenerator { async beforeQueue() { if (!this.fromBlueprint) { await this.composeWithBlueprints(); @@ -48,6 +45,20 @@ export default class CiCdGenerator extends BaseApplicationGenerator { sayHello() { this.log.log(chalk.white('🚀 Welcome to the JHipster CI/CD Sub-Generator 🚀')); }, + validateSupportedCICD() { + if (this.jhipsterConfig.ciCd?.length > 0) { + if ( + intersection( + command.configs.ciCd.choices.map(entry => entry.value), + this.jhipsterConfig.ciCd, + ).length !== this.jhipsterConfig.ciCd.length + ) { + throw new Error( + `error: command-argument value '${this.jhipsterConfig.ciCd}' is invalid for argument 'ciCd'. Allowed choices are github, jenkins, gitlab, azure, travis, circle.`, + ); + } + } + }, }); } @@ -58,8 +69,8 @@ export default class CiCdGenerator extends BaseApplicationGenerator { // Public API method used by the getter and also by Blueprints get loading() { return this.asLoadingTaskGroup({ - loadSharedConfig() { - loadConfig.call(this, command.configs, { application: this.context }); + loadSharedConfig({ application }) { + loadConfig(command.configs, { config: this.jhipsterConfigWithDefaults, application }); }, }); } @@ -70,19 +81,19 @@ export default class CiCdGenerator extends BaseApplicationGenerator { get preparing() { return this.asPreparingTaskGroup({ - setTemplateConstants() { - loadDerivedConfig(command.configs, { application: this.context }); + setTemplateConstants({ application }) { + loadDerivedConfig(command.configs, { application }); - if (this.context.ciCdIntegrations === undefined) { - this.context.ciCdIntegrations = []; + if (application.ciCdIntegrations === undefined) { + application.ciCdIntegrations = []; } - this.context.gitLabIndent = this.context.sendBuildToGitlab ? ' ' : ''; - this.context.indent = this.context.insideDocker ? ' ' : ''; - this.context.indent += this.context.gitLabIndent; - if (this.context.clientFramework === REACT) { - this.context.frontTestCommand = 'test-ci'; + application.gitLabIndent = application.sendBuildToGitlab ? ' ' : ''; + application.indent = application.insideDocker ? ' ' : ''; + application.indent += application.gitLabIndent; + if (application.clientFramework === REACT) { + application.frontTestCommand = 'test-ci'; } else { - this.context.frontTestCommand = 'test'; + application.frontTestCommand = 'test'; } }, }); @@ -92,18 +103,6 @@ export default class CiCdGenerator extends BaseApplicationGenerator { return this.delegateTasksToBlueprint(() => this.preparing); } - get default() { - return this.asDefaultTaskGroup({ - loadContext({ application }) { - Object.assign(application, this.context); - }, - }); - } - - get [BaseApplicationGenerator.DEFAULT]() { - return this.delegateTasksToBlueprint(() => this.default); - } - // Public API method used by the getter and also by Blueprints get writing() { return this.asWritingTaskGroup({ diff --git a/generators/ci-cd/types.d.ts b/generators/ci-cd/types.d.ts new file mode 100644 index 000000000000..4502480b3826 --- /dev/null +++ b/generators/ci-cd/types.d.ts @@ -0,0 +1,23 @@ +import type { ApplicationType } from '../../lib/types/application/application.js'; +import type { ExportApplicationPropertiesFromCommand } from '../../lib/command/index.js'; + +/** + * Copyright 2013-2025 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// eslint-disable-next-line @typescript-eslint/consistent-type-imports +export type CiCdApplication = ApplicationType & ExportApplicationPropertiesFromCommand; diff --git a/generators/client/types.d.ts b/generators/client/types.d.ts index 5858a4b4db5a..34d21c26678a 100644 --- a/generators/client/types.d.ts +++ b/generators/client/types.d.ts @@ -5,13 +5,15 @@ import type { JavaScriptApplication, JavaScriptSourceType } from '../javascript/ import type { PostWritingEntitiesTaskParam } from '../../lib/types/application/tasks.js'; import type { PartialAngularApplication } from '../angular/types-partial.js'; import type { Language } from '../languages/support/languages.ts'; +import type { PartialApplicationBootstrapApplicationClient } from '../bootstrap-application-client/types-partials.js'; import type Command from './command.ts'; type ApplicationClientProperties = ExportApplicationPropertiesFromCommand; export type FrontendApplication = ApplicationClientProperties & JavaScriptApplication & - CypressApplication & { + CypressApplication & + PartialApplicationBootstrapApplicationClient & { webappLoginRegExp: string; clientWebappDir?: string; webappEnumerationsDir?: string; diff --git a/lib/utils/derived-property.ts b/lib/utils/derived-property.ts index 132619a25a36..84a58fd89747 100644 --- a/lib/utils/derived-property.ts +++ b/lib/utils/derived-property.ts @@ -17,9 +17,12 @@ export const applyDerivedProperty = ( const flattenedChoices = flatChoices(possibleValues); let isAny = false; for (const value of flattenedChoices) { - const valueProterty = value.includes('-') ? upperFirstCamelCase(value) : upperFirst(value); + const valueProperty = value.includes('-') ? upperFirstCamelCase(value) : upperFirst(value); const isProperty = Array.isArray(actualValue) ? actualValue.includes(value) : actualValue === value; - data[`${camelCaseProp}${valueProterty}`] ??= isProperty; + data[`${camelCaseProp}${valueProperty}`] ??= isProperty; + if (data[`${camelCaseProp}${valueProperty}`] === false) { + data[`${camelCaseProp}${valueProperty}`] = isProperty; + } if (isProperty && value !== 'no') { isAny = true; }