diff --git a/generators/angular/generator.ts b/generators/angular/generator.ts index 5d9dbe57bf4..f04dc0c7198 100644 --- a/generators/angular/generator.ts +++ b/generators/angular/generator.ts @@ -94,7 +94,7 @@ export default class AngularGenerator extends BaseApplicationGenerator { eslintConfigFile: app => `eslint.config.${app.packageJsonType === 'module' ? 'js' : 'mjs'}`, webappEnumerationsDir: app => `${app.clientSrcDir}app/entities/enumerations/`, angularLocaleId: app => app.nativeLanguageDefinition.angularLocale ?? defaultLanguage.angularLocale, - }); + } as any); application.addPrettierExtensions?.(['html', 'css', 'scss']); }, diff --git a/generators/bootstrap-application-base/generator.ts b/generators/bootstrap-application-base/generator.ts index 7d00ff2ac61..6dcafae99f7 100644 --- a/generators/bootstrap-application-base/generator.ts +++ b/generators/bootstrap-application-base/generator.ts @@ -165,12 +165,15 @@ export default class BootstrapApplicationBase extends BaseApplicationGenerator { prepareApplication({ application, applicationDefaults }) { loadDerivedAppConfig({ application }); + applicationDefaults({ + // TODO drop clientPackageManager + clientPackageManager: ({ nodePackageManager }) => nodePackageManager, + } as any); + applicationDefaults({ __override__: false, nodePackageManager: 'npm', dockerServicesDir: JAVA_DOCKER_DIR, - // TODO drop clientPackageManager - clientPackageManager: ({ nodePackageManager }) => nodePackageManager, hipsterName: 'Java Hipster', hipsterProductName: 'JHipster', hipsterHomePageProductName: 'JHipster', @@ -187,7 +190,7 @@ export default class BootstrapApplicationBase extends BaseApplicationGenerator { backendTypeSpringBoot: ({ backendType }) => backendType === 'Java', backendTypeJavaAny: ({ backendTypeSpringBoot }) => backendTypeSpringBoot, - clientFrameworkBuiltIn: ({ clientFramework }) => ['angular', 'vue', 'react'].includes(clientFramework), + clientFrameworkBuiltIn: ({ clientFramework }) => ['angular', 'vue', 'react'].includes(clientFramework!), }); }, userRelationship({ applicationDefaults }) { @@ -196,7 +199,7 @@ export default class BootstrapApplicationBase extends BaseApplicationGenerator { anyEntityHasRelationshipWithUser: this.getExistingEntities().some(entity => (entity.definition.relationships ?? []).some(relationship => relationship.otherEntityName.toLowerCase() === 'user'), ), - }); + } as any); }, syncUserWithIdp({ application, applicationDefaults }) { if (!application.backendTypeSpringBoot) return; @@ -216,7 +219,7 @@ export default class BootstrapApplicationBase extends BaseApplicationGenerator { generateBuiltInUserEntity: ({ generateUserManagement, syncUserWithIdp }) => generateUserManagement || syncUserWithIdp, generateBuiltInAuthorityEntity: ({ generateBuiltInUserEntity, databaseType }) => generateBuiltInUserEntity && databaseType !== 'cassandra', - }); + } as any); }, }); } diff --git a/generators/bootstrap-application/generator.ts b/generators/bootstrap-application/generator.ts index b4b40817011..c510969205d 100644 --- a/generators/bootstrap-application/generator.ts +++ b/generators/bootstrap-application/generator.ts @@ -86,7 +86,7 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera useNpmWrapper: application => application.clientFrameworkAny && application.backendTypeJavaAny, documentationArchiveUrl: ({ jhipsterVersion }) => `${JHIPSTER_DOCUMENTATION_URL}${JHIPSTER_DOCUMENTATION_ARCHIVE_PATH}v${jhipsterVersion}`, - }); + } as any); }, }); } diff --git a/generators/javascript/generators/prettier/generator.ts b/generators/javascript/generators/prettier/generator.ts index 62c11cd8b36..df1c53a55a5 100644 --- a/generators/javascript/generators/prettier/generator.ts +++ b/generators/javascript/generators/prettier/generator.ts @@ -54,7 +54,7 @@ export default class PrettierGenerator extends BaseApplicationGenerator { applicationDefaults({ prettierFolders: ',**/', prettierExtensions: 'md,json,yml,js,cjs,mjs,ts,cts,mts', - }); + } as any); application.addPrettierExtensions = (extensions: string[]) => { const currentExtensions = application.prettierExtensions!.split(','); diff --git a/generators/server/generator.ts b/generators/server/generator.ts index 03a1fe4a27c..f6819d4e4c3 100644 --- a/generators/server/generator.ts +++ b/generators/server/generator.ts @@ -164,7 +164,7 @@ export default class JHipsterServerGenerator extends BaseApplicationGenerator { ANGULAR, VUE, REACT, - }); + } as any); if (this.projectVersion) { application.projectVersion = this.projectVersion; diff --git a/generators/vue/generator.ts b/generators/vue/generator.ts index 6c0401cc34d..32fca66eb22 100644 --- a/generators/vue/generator.ts +++ b/generators/vue/generator.ts @@ -83,7 +83,7 @@ export default class VueGenerator extends BaseApplicationGenerator { eslintConfigFile: app => `eslint.config.${app.packageJsonType === 'module' ? 'js' : 'mjs'}`, clientWebappDir: app => `${app.clientSrcDir}app/`, webappEnumerationsDir: app => `${app.clientWebappDir}shared/model/enumerations/`, - }); + } as any); }, prepareForTemplates({ application, source }) { application.addPrettierExtensions?.(['html', 'vue', 'css', 'scss']); diff --git a/lib/types/application/tasks.d.ts b/lib/types/application/tasks.d.ts index f9987a9274a..cd15c6257e5 100644 --- a/lib/types/application/tasks.d.ts +++ b/lib/types/application/tasks.d.ts @@ -1,12 +1,12 @@ import type { Storage } from 'yeoman-generator'; -import type { Merge } from 'type-fest'; +import type { Merge, OmitIndexSignature, Simplify } from 'type-fest'; import type { Entity as BaseEntity } from '../base/entity.js'; import type { GetFieldType, GetRelationshipType } from '../utils/entity-utils.ts'; import type { TaskTypes as BaseTaskTypes, TaskParamWithControl, TaskParamWithSource } from '../base/tasks.js'; import type { Entity } from './entity.js'; import type { ApplicationType, BaseApplicationSource } from './application.js'; -type ApplicationDefaultsTaskParam = { +type ApplicationDefaultsTaskParam> = { /** * Parameter properties accepts: * - functions: receives the application and the return value is set at the application property. @@ -22,7 +22,17 @@ type ApplicationDefaultsTaskParam = { * { prop: ({ prop }) => prop + '-bar', prop2: 'won\'t override' }, * ); */ - applicationDefaults: (...defaults: Record[]) => void; + applicationDefaults: ( + ...defaults: Simplify< + OmitIndexSignature<{ + [Key in keyof (Partial & { __override__?: boolean })]?: Key extends '__override__' + ? boolean + : Key extends keyof A + ? A[Key] | ((ctx: A) => A[Key]) + : never; + }> + >[] + ) => void; }; type TaskParamWithApplication> = TaskParamWithControl & { @@ -35,7 +45,7 @@ type TaskParamWithEntities> = TaskParamWithAp type TaskParamWithApplicationDefaults> = TaskParamWithControl & TaskParamWithApplication & - ApplicationDefaultsTaskParam; + ApplicationDefaultsTaskParam; type PreparingTaskParam> = TaskParamWithApplicationDefaults & TaskParamWithSource;