Skip to content

Commit

Permalink
update to @yeoman/adapter v2
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Oct 12, 2024
1 parent 0126f88 commit 6cf65ab
Show file tree
Hide file tree
Showing 4 changed files with 626 additions and 540 deletions.
4 changes: 2 additions & 2 deletions generators/base-core/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { fileURLToPath } from 'url';
import { existsSync, readFileSync, rmSync, statSync } from 'fs';
import assert from 'assert';
import { requireNamespace } from '@yeoman/namespace';
import type { GeneratorMeta } from '@yeoman/types';
import type { GeneratorMeta, PromptAnswers, PromptQuestion, PromptQuestions } from '@yeoman/types';

Check failure on line 26 in generators/base-core/generator.ts

View workflow job for this annotation

GitHub Actions / check-npm-test

'PromptAnswers' is defined but never used

Check failure on line 26 in generators/base-core/generator.ts

View workflow job for this annotation

GitHub Actions / check-npm-test

'PromptQuestion' is defined but never used

Check failure on line 26 in generators/base-core/generator.ts

View workflow job for this annotation

GitHub Actions / check-npm-test

'PromptQuestions' is defined but never used
import chalk from 'chalk';
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
import { defaults, get, kebabCase, merge, mergeWith, set, snakeCase } from 'lodash-es';
Expand Down 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
22 changes: 11 additions & 11 deletions generators/spring-boot/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,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 +96,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 +121,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: answers => (reactive ? R2DBC_DB_OPTIONS : SQL_DB_OPTIONS),

Check warning on line 126 in generators/spring-boot/prompts.ts

View workflow job for this annotation

GitHub Actions / check-npm-test

'answers' is defined but never used. Allowed unused args must match /^_[^_]/u
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 +145,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 +185,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
Loading

0 comments on commit 6cf65ab

Please sign in to comment.