Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: adjusts to property calculation #28236

Merged
merged 1 commit into from
Dec 19, 2024
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
58 changes: 32 additions & 26 deletions generators/app/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Options:
--feign-client Generate a feign client (default: false)
--sync-user-with-idp Allow relationships with User for oauth2 applications
--message-broker <value> message broker (choices: "kafka", "pulsar", "no")
--database-migration <value> Database migration (choices: "liquibase")
--database-migration <value> Database migration (choices: "liquibase", "no")
--graalvm-support Experimental GraalVM Native support
--with-generated-flag Add a GeneratedByJHipster annotation to all generated java classes and interfaces
--package-name <value> The package name for the generated application
Expand Down Expand Up @@ -254,7 +254,7 @@ exports[`generator - app with default config should match snapshot 1`] = `
"camelizedBaseName": "jhipster",
"capitalizedBaseName": "Jhipster",
"caret": undefined,
"cjsExtension": ".cjs",
"cjsExtension": ".js",
"cliName": undefined,
"clientBundler": "webpack",
"clientBundlerAny": true,
Expand All @@ -275,7 +275,7 @@ exports[`generator - app with default config should match snapshot 1`] = `
"clientSrcDir": "src/main/webapp/",
"clientTestDir": "src/test/javascript/",
"clientTestFrameworks": undefined,
"clientTestFrameworksAny": true,
"clientTestFrameworksAny": false,
"clientTestFrameworksCypress": false,
"clientTheme": "none",
"clientThemeDark": false,
Expand All @@ -288,9 +288,10 @@ exports[`generator - app with default config should match snapshot 1`] = `
"customizeTemplatePaths": [],
"cypressTests": false,
"dasherizedBaseName": "jhipster",
"databaseMigration": undefined,
"databaseMigrationAny": undefined,
"databaseMigration": "liquibase",
"databaseMigrationAny": true,
"databaseMigrationLiquibase": true,
"databaseMigrationNo": false,
"databaseType": "sql",
"databaseTypeAny": true,
"databaseTypeCassandra": false,
Expand Down Expand Up @@ -816,15 +817,16 @@ exports[`generator - app with default config should match snapshot 1`] = `
"searchEngineElasticsearch": false,
"searchEngineNo": true,
"serverPort": 8080,
"serviceDiscovery": "no",
"serviceDiscoveryAny": false,
"serviceDiscoveryConsul": false,
"serviceDiscoveryEureka": false,
"serviceDiscoveryNo": true,
"serviceDiscoveryType": "no",
"serviceDiscoveryTypeAny": undefined,
"serviceDiscoveryTypeConsul": undefined,
"serviceDiscoveryTypeEureka": undefined,
"serviceDiscoveryTypeNo": undefined,
"serviceDiscoveryTypeAny": false,
"serviceDiscoveryTypeConsul": false,
"serviceDiscoveryTypeEureka": false,
"serviceDiscoveryTypeNo": true,
"skipCheckLengthOfIdentifier": false,
"skipClient": undefined,
"skipCommitHook": undefined,
Expand Down Expand Up @@ -920,7 +922,7 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"camelizedBaseName": "jhipster",
"capitalizedBaseName": "Jhipster",
"caret": undefined,
"cjsExtension": ".cjs",
"cjsExtension": ".js",
"cliName": undefined,
"clientBundler": "webpack",
"clientBundlerAny": true,
Expand All @@ -941,7 +943,7 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"clientSrcDir": "src/main/webapp/",
"clientTestDir": "src/test/javascript/",
"clientTestFrameworks": undefined,
"clientTestFrameworksAny": true,
"clientTestFrameworksAny": false,
"clientTestFrameworksCypress": false,
"clientTheme": "none",
"clientThemeDark": false,
Expand All @@ -954,9 +956,10 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"customizeTemplatePaths": [],
"cypressTests": false,
"dasherizedBaseName": "jhipster",
"databaseMigration": undefined,
"databaseMigrationAny": undefined,
"databaseMigration": "liquibase",
"databaseMigrationAny": true,
"databaseMigrationLiquibase": true,
"databaseMigrationNo": false,
"databaseType": "sql",
"databaseTypeAny": true,
"databaseTypeCassandra": false,
Expand Down Expand Up @@ -1479,15 +1482,16 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"searchEngineElasticsearch": false,
"searchEngineNo": true,
"serverPort": 8080,
"serviceDiscovery": "consul",
"serviceDiscoveryAny": true,
"serviceDiscoveryConsul": true,
"serviceDiscoveryEureka": false,
"serviceDiscoveryNo": false,
"serviceDiscoveryType": "consul",
"serviceDiscoveryTypeAny": undefined,
"serviceDiscoveryTypeConsul": undefined,
"serviceDiscoveryTypeEureka": undefined,
"serviceDiscoveryTypeNo": undefined,
"serviceDiscoveryTypeAny": true,
"serviceDiscoveryTypeConsul": true,
"serviceDiscoveryTypeEureka": false,
"serviceDiscoveryTypeNo": false,
"skipCheckLengthOfIdentifier": false,
"skipClient": undefined,
"skipCommitHook": undefined,
Expand Down Expand Up @@ -1581,10 +1585,10 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"camelizedBaseName": "jhipster",
"capitalizedBaseName": "Jhipster",
"caret": undefined,
"cjsExtension": ".cjs",
"cjsExtension": ".js",
"cliName": undefined,
"clientBundler": undefined,
"clientBundlerAny": true,
"clientBundlerAny": false,
"clientBundlerExperimentalEsbuild": false,
"clientBundlerVite": false,
"clientBundlerWebpack": false,
Expand All @@ -1602,7 +1606,7 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"clientSrcDir": "src/main/webapp/",
"clientTestDir": "src/test/javascript/",
"clientTestFrameworks": undefined,
"clientTestFrameworksAny": true,
"clientTestFrameworksAny": false,
"clientTestFrameworksCypress": false,
"clientTheme": undefined,
"clientThemeDark": false,
Expand All @@ -1615,9 +1619,10 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"customizeTemplatePaths": [],
"cypressTests": false,
"dasherizedBaseName": "jhipster",
"databaseMigration": undefined,
"databaseMigrationAny": undefined,
"databaseMigration": "liquibase",
"databaseMigrationAny": true,
"databaseMigrationLiquibase": true,
"databaseMigrationNo": false,
"databaseType": "sql",
"databaseTypeAny": true,
"databaseTypeCassandra": false,
Expand Down Expand Up @@ -2073,15 +2078,16 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"searchEngineElasticsearch": false,
"searchEngineNo": true,
"serverPort": 8081,
"serviceDiscovery": "consul",
"serviceDiscoveryAny": true,
"serviceDiscoveryConsul": true,
"serviceDiscoveryEureka": false,
"serviceDiscoveryNo": false,
"serviceDiscoveryType": "consul",
"serviceDiscoveryTypeAny": undefined,
"serviceDiscoveryTypeConsul": undefined,
"serviceDiscoveryTypeEureka": undefined,
"serviceDiscoveryTypeNo": undefined,
"serviceDiscoveryTypeAny": true,
"serviceDiscoveryTypeConsul": true,
"serviceDiscoveryTypeEureka": false,
"serviceDiscoveryTypeNo": false,
"skipCheckLengthOfIdentifier": false,
"skipClient": true,
"skipCommitHook": undefined,
Expand Down
16 changes: 9 additions & 7 deletions generators/base-core/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ import { packageJson } from '../../lib/index.js';
import type { BaseApplication } from '../base-application/types.js';
import { GENERATOR_BOOTSTRAP } from '../generator-list.js';
import NeedleApi from '../needle-api.js';
import command from '../base/command.js';
import baseCommand from '../base/command.js';
import { GENERATOR_JHIPSTER, YO_RC_FILE } from '../generator-constants.js';
import { loadConfig } from '../../lib/internal/index.js';
import { loadConfig, loadDerivedConfig } from '../../lib/internal/index.js';
import { getGradleLibsVersionsProperties } from '../gradle/support/dependabot-gradle.js';
import { dockerPlaceholderGenerator } from '../docker/utils.js';
import { getConfigWithDefaults } from '../../lib/jhipster/index.js';
Expand Down Expand Up @@ -186,7 +186,7 @@ export default class CoreGenerator extends YeomanGenerator<JHipsterGeneratorOpti
this.sharedData = this.createSharedData({ help: this.options.help }) as any;

/* Options parsing must be executed after forcing jhipster storage namespace and after sharedData have been populated */
this.parseJHipsterOptions(command.options);
this.parseJHipsterOptions(baseCommand.options);

// Don't write jhipsterVersion to .yo-rc.json when reproducible
if (
Expand Down Expand Up @@ -418,12 +418,14 @@ You can ignore this error by passing '--skip-checks' to jhipster command.`);
try {
const command = await this.getCurrentJHipsterCommand();
if (!command.configs) return;

const taskArgs = this.getArgsForPriority(PRIORITY_NAMES.LOADING);
const [{ application }] = taskArgs as any;
loadConfig.call(this, command.configs, { application: application ?? this });
loadDerivedConfig(command.configs, { application });
} catch {
return;
// Ignore non existing command
}
const taskArgs = this.getArgsForPriority(PRIORITY_NAMES.LOADING);
const [{ application }] = taskArgs as any;
await this.loadCurrentJHipsterCommandConfig(application ?? this);
},
});
}
Expand Down
23 changes: 0 additions & 23 deletions generators/base/support/derived-property.ts

This file was deleted.

8 changes: 4 additions & 4 deletions generators/base/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from '../../../lib/utils/derived-property.js';
export * from '../../../lib/utils/logger.js';
export * from '../../../lib/utils/object.js';
export * from '../../../lib/utils/string.js';
export * from './basename.js';
export * from './configuration-helpers/options.js';
export * from '../../../lib/utils/object.js';
export * from './contents.js';
export * from './derived-property.js';
export * from './faker.js';
export { default as getHipster } from './hipster.js';
export * from './jhipster7-context.js';
export * from '../../../lib/utils/logger.js';
export * from './namespace.js';
export * from './needles.js';
export * from './path.js';
export { default as httpsGet } from './remote.js';
export * from './secret.js';
export * from '../../../lib/utils/string.js';
export * from './timestamp.js';
export * from './write-files.js';
20 changes: 10 additions & 10 deletions generators/bootstrap-application/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": false,
"javaFieldTypeUuid": true,
"javaFieldTypeUUID": true,
"javaValueGenerator": "UUID.randomUUID()",
"javaValueSample1": "UUID.fromString("23d8dc04-a48b-45d9-a01d-4b728f0ad4aa")",
"javaValueSample2": "UUID.fromString("ad79f240-3727-46c3-b89f-2cf6ebd74367")",
Expand Down Expand Up @@ -434,7 +434,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": true,
"javaFieldTypeUuid": false,
"javaFieldTypeUUID": false,
"javaValueGenerator": "UUID.randomUUID().toString()",
"javaValueSample1": ""login1"",
"javaValueSample2": ""login2"",
Expand Down Expand Up @@ -530,7 +530,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": true,
"javaFieldTypeUuid": false,
"javaFieldTypeUUID": false,
"javaValueGenerator": "UUID.randomUUID().toString()",
"javaValueSample1": ""firstName1"",
"javaValueSample2": ""firstName2"",
Expand Down Expand Up @@ -620,7 +620,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": true,
"javaFieldTypeUuid": false,
"javaFieldTypeUUID": false,
"javaValueGenerator": "UUID.randomUUID().toString()",
"javaValueSample1": ""lastName1"",
"javaValueSample2": ""lastName2"",
Expand Down Expand Up @@ -714,7 +714,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": true,
"javaFieldTypeUuid": false,
"javaFieldTypeUUID": false,
"javaValueGenerator": "UUID.randomUUID().toString()",
"javaValueSample1": ""email1"",
"javaValueSample2": ""email2"",
Expand Down Expand Up @@ -805,7 +805,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": true,
"javaFieldTypeUuid": false,
"javaFieldTypeUUID": false,
"javaValueGenerator": "UUID.randomUUID().toString()",
"javaValueSample1": ""imageUrl1"",
"javaValueSample2": ""imageUrl2"",
Expand Down Expand Up @@ -892,7 +892,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": false,
"javaFieldTypeUuid": false,
"javaFieldTypeUUID": false,
"liquibaseDefaultValueAttributeName": undefined,
"liquibaseDefaultValueAttributeValue": undefined,
"liquibaseGenerateFakeData": true,
Expand Down Expand Up @@ -978,7 +978,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": true,
"javaFieldTypeUuid": false,
"javaFieldTypeUUID": false,
"javaValueGenerator": "UUID.randomUUID().toString()",
"javaValueSample1": ""langKey1"",
"javaValueSample2": ""langKey2"",
Expand Down Expand Up @@ -1296,7 +1296,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": false,
"javaFieldTypeUuid": true,
"javaFieldTypeUUID": true,
"javaValueGenerator": "UUID.randomUUID()",
"javaValueSample1": "UUID.fromString("23d8dc04-a48b-45d9-a01d-4b728f0ad4aa")",
"javaValueSample2": "UUID.fromString("ad79f240-3727-46c3-b89f-2cf6ebd74367")",
Expand Down Expand Up @@ -1671,7 +1671,7 @@ describe(`generator - ${generator}`, () => {
"javaFieldTypeInteger": false,
"javaFieldTypeLong": false,
"javaFieldTypeString": false,
"javaFieldTypeUuid": true,
"javaFieldTypeUUID": true,
"javaValueGenerator": "UUID.randomUUID()",
"javaValueSample1": "UUID.fromString("23d8dc04-a48b-45d9-a01d-4b728f0ad4aa")",
"javaValueSample2": "UUID.fromString("ad79f240-3727-46c3-b89f-2cf6ebd74367")",
Expand Down
41 changes: 41 additions & 0 deletions generators/ci-cd/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,47 @@ describe(`generator - ${generator}`, () => {
await helpers.runCli('ci-cd github jenkins gitlab azure').withJHipsterConfig().withSkipWritingPriorities();
});

it('should match context snapshot', () => {
expect(runResult.generator.context).toMatchInlineSnapshot(`
{
"artifactoryReleasesId": "releases",
"artifactoryReleasesUrl": "http://artifactory:8081/artifactory/libs-release",
"artifactorySnapshotsId": "snapshots",
"artifactorySnapshotsUrl": "http://artifactory:8081/artifactory/libs-snapshot",
"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": "",
"insideDocker": false,
"sendBuildToGitlab": false,
"sonarName": "sonar",
"sonarOrga": undefined,
"sonarUrl": "https://sonarcloud.io",
}
`);
});
it('should populate context', () => {
expect(runResult.generator.context!.ciCd).toEqual(['github', 'jenkins', 'gitlab', 'azure']);
});
Expand Down
Loading
Loading