Skip to content

Commit

Permalink
update @yeoman/adapter to v2.0.0 (#27553)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Oct 12, 2024
1 parent b8b8c5d commit 2e581a9
Show file tree
Hide file tree
Showing 6 changed files with 631 additions and 556 deletions.
2 changes: 0 additions & 2 deletions generators/app/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ describe(`generator - ${generator}`, () => {
"databaseType",
"prodDatabaseType",
"devDatabaseType",
"cacheProvider",
"enableHibernateCache",
"serverSideOptions",
"enableGradleEnterprise",
"clientFramework",
Expand Down
2 changes: 1 addition & 1 deletion generators/base-core/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ You can ignore this error by passing '--skip-checks' to jhipster command.`);
if (!generatorCommand.configs) {
throw new Error(`Configs not found for generator ${this.options.namespace}`);
}
return this.prompt(this.prepareQuestions(generatorCommand.configs));
return this.prompt(this.prepareQuestions(generatorCommand.configs) as any);
}

/**
Expand Down
33 changes: 12 additions & 21 deletions generators/spring-boot/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,7 @@ const { GATEWAY, MONOLITH } = applicationTypes;
const { CAFFEINE, EHCACHE, HAZELCAST, INFINISPAN, MEMCACHED, REDIS } = cacheTypes;
const { OAUTH2 } = authenticationTypes;
const { CASSANDRA, H2_DISK, H2_MEMORY, MONGODB, NEO4J, SQL, COUCHBASE } = databaseTypes;
const {
CACHE_PROVIDER,
DATABASE_TYPE,
DEV_DATABASE_TYPE,
PROD_DATABASE_TYPE,
SERVICE_DISCOVERY_TYPE,
WEBSOCKET,
SEARCH_ENGINE,
ENABLE_SWAGGER_CODEGEN,
} = OptionNames;
const { SERVICE_DISCOVERY_TYPE, WEBSOCKET, SEARCH_ENGINE, ENABLE_SWAGGER_CODEGEN } = OptionNames;
const NO_DATABASE = databaseTypes.NO;
const NO_CACHE_PROVIDER = cacheTypes.NO;
const { GATLING, CUCUMBER } = testFrameworkTypes;
Expand All @@ -71,17 +62,17 @@ const getOptionFromArray = (array, option) => {
export async function askForServerSideOpts(this: CoreGenerator, { control }) {
if (control.existingProject && !this.options.askAnswered) return;

const { applicationType } = this.jhipsterConfigWithDefaults;
const { applicationType, authenticationType, reactive } = this.jhipsterConfigWithDefaults;

await this.prompt(
[
{
type: 'list',
name: DATABASE_TYPE,
name: 'databaseType',
message: `Which ${chalk.yellow('*type*')} of database would you like to use?`,
choices: answers => {
choices: () => {
const opts: any[] = [];
if (!answers.reactive) {
if (!reactive) {
opts.push({
value: SQL,
name: 'SQL (H2, PostgreSQL, MySQL, MariaDB, Oracle, MSSQL)',
Expand All @@ -96,7 +87,7 @@ export async function askForServerSideOpts(this: CoreGenerator, { control }) {
value: MONGODB,
name: 'MongoDB',
});
if (answers.authenticationType !== OAUTH2) {
if (authenticationType !== OAUTH2) {
opts.push({
value: CASSANDRA,
name: 'Cassandra',
Expand All @@ -121,15 +112,15 @@ export async function askForServerSideOpts(this: CoreGenerator, { control }) {
{
when: response => response.databaseType === SQL,
type: 'list',
name: PROD_DATABASE_TYPE,
name: 'prodDatabaseType',
message: `Which ${chalk.yellow('*production*')} database would you like to use?`,
choices: answers => (answers.reactive ? R2DBC_DB_OPTIONS : SQL_DB_OPTIONS),
choices: reactive ? R2DBC_DB_OPTIONS : SQL_DB_OPTIONS,
default: this.jhipsterConfigWithDefaults.prodDatabaseType,
},
{
when: response => response.databaseType === SQL,
type: 'list',
name: DEV_DATABASE_TYPE,
name: 'devDatabaseType',
message: `Which ${chalk.yellow('*development*')} database would you like to use?`,
choices: response =>
[SQL_DB_OPTIONS.find(it => it.value === response.prodDatabaseType)].concat([
Expand All @@ -145,9 +136,9 @@ export async function askForServerSideOpts(this: CoreGenerator, { control }) {
default: this.jhipsterConfigWithDefaults.devDatabaseType,
},
{
when: answers => !answers.reactive,
when: !reactive,
type: 'list',
name: CACHE_PROVIDER,
name: 'cacheProvider',
message: 'Which cache do you want to use? (Spring cache abstraction)',
choices: [
{
Expand Down Expand Up @@ -185,7 +176,7 @@ export async function askForServerSideOpts(this: CoreGenerator, { control }) {
when: answers =>
((answers.cacheProvider !== NO_CACHE_PROVIDER && answers.cacheProvider !== MEMCACHED) || applicationType === GATEWAY) &&
answers.databaseType === SQL &&
!answers.reactive,
!reactive,
type: 'confirm',
name: 'enableHibernateCache',
message: 'Do you want to use Hibernate 2nd level cache?',
Expand Down
10 changes: 5 additions & 5 deletions lib/jdl/core/parsing/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
/* eslint-disable no-useless-escape */

import { first, flatten, includes, values } from 'lodash-es';
import type { ICstVisitor, TokenType } from 'chevrotain';
import { first, flatten, includes } from 'lodash-es';
import type { ICstVisitor, IToken, TokenType } from 'chevrotain';
import { tokenMatcher as matchesToken } from 'chevrotain';

import type { JDLRuntime } from '../types/runtime.js';
Expand Down Expand Up @@ -411,7 +411,7 @@ export default function performAdditionalSyntaxChecks(cst, runtime: JDLRuntime)
this.visit(context.configValue, context.CONFIG_KEY[0]);
}

configValue(context, configKey) {
configValue(context: Record<string, any>, configKey: IToken) {
const configValue = first(first(Object.values(context)));
this.checkConfigPropSyntax(configKey, configValue);
}
Expand All @@ -420,8 +420,8 @@ export default function performAdditionalSyntaxChecks(cst, runtime: JDLRuntime)
this.visit(context.deploymentConfigValue, context.DEPLOYMENT_KEY[0]);
}

deploymentConfigValue(context, configKey) {
const configValue = first(first(values(context)));
deploymentConfigValue(context: Record<string, any>, configKey: IToken) {
const configValue = first(first(Object.values(context)));
this.checkDeploymentConfigPropSyntax(configKey, configValue);
}
}
Expand Down
Loading

0 comments on commit 2e581a9

Please sign in to comment.