diff --git a/generators/base-application/types.d.ts b/generators/base-application/types.d.ts index dbc691ecb28b..24add83376fa 100644 --- a/generators/base-application/types.d.ts +++ b/generators/base-application/types.d.ts @@ -412,7 +412,6 @@ export type Application = BaseSimpleApplicationApplication & skipClient?: boolean; skipServer?: boolean; - monorepository?: boolean; blueprints?: { name: string; version: string }[]; testFrameworks?: string[]; diff --git a/generators/base-core/types.d.ts b/generators/base-core/types.d.ts index fbde37d9d1cf..5672a2d6c2ec 100644 --- a/generators/base-core/types.d.ts +++ b/generators/base-core/types.d.ts @@ -60,7 +60,6 @@ export type Options = YeomanOptions & { generateApplications?: boolean | (() => Promise); generateWorkspaces?: boolean; generateWith?: string; - monorepository?: boolean; workspaces?: boolean; workspacesFolders?: string[]; }; diff --git a/generators/git/generator.ts b/generators/git/generator.ts index 189c3370fc96..d004a3f4259b 100644 --- a/generators/git/generator.ts +++ b/generators/git/generator.ts @@ -26,10 +26,7 @@ import type { Config as GitConfig, Options as GitOptions } from './types.js'; export default class GitGenerator extends BaseGenerator { gitInitialized!: boolean; - skipGit!: boolean; - forceGit!: boolean; existingRepository!: boolean; - commitMsg!: string; async beforeQueue() { if (!this.fromBlueprint) { @@ -40,19 +37,14 @@ export default class GitGenerator extends BaseGenerator { get initializing() { return this.asInitializingTaskGroup({ async checkGit() { - if (!this.skipGit) { + if (!this.options.skipGit) { const gitInstalled = (await this.createGit().version()).installed; if (!gitInstalled) { this.log.warn('Git repository will not be created, as Git is not installed on your system'); - this.skipGit = true; + this.gitInitialized = false; } } }, - async initializeMonorepository() { - if (!this.skipGit && this.jhipsterConfig.monorepository) { - await this.initializeGitRepository(); - } - }, }); } @@ -63,7 +55,7 @@ export default class GitGenerator extends BaseGenerator { get preparing() { return this.asPreparingTaskGroup({ async preparing() { - if (!this.skipGit) { + if (!this.options.skipGit) { // Force write .yo-rc.json to disk, it's used to check if the application is regenerated this.jhipsterConfig.monorepository ??= undefined; } @@ -91,7 +83,7 @@ export default class GitGenerator extends BaseGenerator { return this.asPostWritingTaskGroup({ /** Husky commit hook install at install priority requires git to be initialized */ async initGitRepo() { - if (!this.skipGit && !this.jhipsterConfig.monorepository) { + if (!this.options.skipGit && !this.jhipsterConfig.monorepository) { await this.initializeGitRepository(); } }, @@ -106,25 +98,25 @@ export default class GitGenerator extends BaseGenerator { return this.asEndTaskGroup({ /** Initial commit to git repository after package manager install for package-lock.json */ async gitCommit() { - if (this.skipGit) return; + if (this.options.skipGit) return; if (!this.gitInitialized) { this.log.warn('The generated application could not be committed to Git, as a Git repository could not be initialized.'); return; } const commitFiles = async () => { - this.debug('Committing files to git'); + this.log.debug('Committing files to git'); const git = this.createGit(); const repositoryRoot = await git.revparse(['--show-toplevel']); const result = await git.log(['-n', '1', '--', '.yo-rc.json']).catch(() => ({ total: 0 })); const existingApplication = result.total > 0; - if (existingApplication && !this.forceGit) { + if (existingApplication && !this.options.forceGit) { this.log.info( `Found .yo-rc.json in Git from ${repositoryRoot}. So we assume this is application regeneration. Therefore automatic Git commit is not done. You can do Git commit manually.`, ); return; } - if (!this.forceGit) { + if (!this.options.forceGit) { const statusResult = await git.status(); if (statusResult.staged.length > 0) { this.log.verboseInfo(`The repository ${repositoryRoot} has staged files, skipping commit.`); @@ -133,7 +125,7 @@ export default class GitGenerator extends BaseGenerator { } try { let commitMsg = - this.commitMsg ?? + this.options.commitMsg ?? (existingApplication ? `Regenerated ${this.jhipsterConfig.baseName} using generator-jhipster@${this.jhipsterConfig.jhipsterVersion}` : `Initial version of ${this.jhipsterConfig.baseName} generated by generator-jhipster@${this.jhipsterConfig.jhipsterVersion}`); diff --git a/generators/git/types.d.ts b/generators/git/types.d.ts index c11ca9c4d1da..c288d0fea7fc 100644 --- a/generators/git/types.d.ts +++ b/generators/git/types.d.ts @@ -16,16 +16,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import type { HandleCommandTypes } from '../../lib/command/types.js'; +import type { Simplify } from 'type-fest'; +import type { ExportGeneratorOptionsFromCommand, ExportStoragePropertiesFromCommand, HandleCommandTypes } from '../../lib/command/types.js'; import type { Config as ProjectNameConfig, Options as ProjectNameOptions, Source as ProjectNameSource } from '../project-name/types.js'; import type { Application as BaseApplicationApplication, Entity as BaseApplicationEntity } from '../base-application/types.js'; import type command from './command.ts'; type Command = HandleCommandTypes; -export type Config = Command['Config'] & ProjectNameConfig; +export type Config = Command['Config'] & + ProjectNameConfig & + // eslint-disable-next-line @typescript-eslint/consistent-type-imports + Simplify>; -export type Options = Command['Options'] & ProjectNameOptions; +export type Options = Command['Options'] & + ProjectNameOptions & + // eslint-disable-next-line @typescript-eslint/consistent-type-imports + Simplify>; export { ProjectNameSource as Source, BaseApplicationEntity as Entity }; diff --git a/generators/jdl/types.d.ts b/generators/jdl/types.d.ts index 0a20ac4a83f6..7eb70d21b43d 100644 --- a/generators/jdl/types.d.ts +++ b/generators/jdl/types.d.ts @@ -1,6 +1,7 @@ import type { HandleCommandTypes } from '../../lib/command/types.js'; import type { ApplicationType } from '../../lib/core/application-types.ts'; import type { Config as BaseConfig, Options as BaseOptions } from '../base/types.js'; +import type { Options as WorkspaceOptions } from '../workspaces/types.js'; import type command from './command.js'; type Command = HandleCommandTypes; @@ -13,4 +14,4 @@ type JdlOptions = { export type Config = BaseConfig & JdlOptions & Command['Config']; -export type Options = BaseOptions & JdlOptions & Command['Options']; +export type Options = BaseOptions & JdlOptions & Command['Options'] & WorkspaceOptions; diff --git a/generators/workspaces/generator.ts b/generators/workspaces/generator.ts index dd2c202d8a31..9fc89dedc92d 100644 --- a/generators/workspaces/generator.ts +++ b/generators/workspaces/generator.ts @@ -56,7 +56,7 @@ export default class WorkspacesGenerator extends BaseWorkspacesGenerator; +export type Options = BaseWorkspacesOptions & GitOptions; diff --git a/lib/types/application-config-all.d.ts b/lib/types/application-config-all.d.ts index bee73f34b83b..d9a70d89ae2b 100644 --- a/lib/types/application-config-all.d.ts +++ b/lib/types/application-config-all.d.ts @@ -22,7 +22,6 @@ export type ConfigAll = Simplify< microfrontends?: { baseName: string }[]; } & ExportStoragePropertiesFromCommand & ExportStoragePropertiesFromCommand & - ExportStoragePropertiesFromCommand & ExportStoragePropertiesFromCommand & ExportStoragePropertiesFromCommand & ExportStoragePropertiesFromCommand & diff --git a/lib/types/application-options-all.d.ts b/lib/types/application-options-all.d.ts index da3239d967af..ba750d9686bf 100644 --- a/lib/types/application-options-all.d.ts +++ b/lib/types/application-options-all.d.ts @@ -15,7 +15,6 @@ export type OptionsAll = Simplify< ExportGeneratorOptionsFromCommand & ExportGeneratorOptionsFromCommand & ExportGeneratorOptionsFromCommand & - ExportGeneratorOptionsFromCommand & ExportGeneratorOptionsFromCommand & ExportGeneratorOptionsFromCommand & ExportGeneratorOptionsFromCommand & diff --git a/lib/types/application-properties-all.d.ts b/lib/types/application-properties-all.d.ts index d28d2f6b36c1..c69a36cd8aee 100644 --- a/lib/types/application-properties-all.d.ts +++ b/lib/types/application-properties-all.d.ts @@ -29,6 +29,5 @@ export type ApplicationAll = BaseApplication ClientApplication & DockerApplication & LiqbuibaseApplication & - ExportApplicationPropertiesFromCommand & ExportApplicationPropertiesFromCommand & ExportApplicationPropertiesFromCommand;