From 67f59f29d2d8253fa565e540912d415e190a8a0d Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 28 Dec 2024 09:24:21 -0300 Subject: [PATCH] fix prompt condition (#292) --- generators/java-audit/__snapshots__/generator.spec.js.snap | 2 +- generators/java-audit/command.js | 2 +- generators/java-audit/generator.js | 4 ++++ generators/java-audit/generator.spec.js | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/generators/java-audit/__snapshots__/generator.spec.js.snap b/generators/java-audit/__snapshots__/generator.spec.js.snap index a62a2dc..7f39ee2 100644 --- a/generators/java-audit/__snapshots__/generator.spec.js.snap +++ b/generators/java-audit/__snapshots__/generator.spec.js.snap @@ -154,7 +154,7 @@ exports[`SubGenerator java-audit of entity-audit JHipster blueprint > run using } `; -exports[`SubGenerator java-audit of entity-audit JHipster blueprint > run using auditFramework undefined > should succeed 1`] = ` +exports[`SubGenerator java-audit of entity-audit JHipster blueprint > run using auditFramework null > should succeed 1`] = ` { ".jhipster/Audited.json": { "stateCleared": "modified", diff --git a/generators/java-audit/command.js b/generators/java-audit/command.js index fa2858e..fc474d6 100644 --- a/generators/java-audit/command.js +++ b/generators/java-audit/command.js @@ -36,8 +36,8 @@ export default asCommand({ prompt: { type: 'confirm', message: 'Do you want to add an audit log page for entities?', - default: true, }, + default: true, scope: 'blueprint', }, auditUpdateType: { diff --git a/generators/java-audit/generator.js b/generators/java-audit/generator.js index c36635f..e04fc4e 100644 --- a/generators/java-audit/generator.js +++ b/generators/java-audit/generator.js @@ -137,4 +137,8 @@ export default class extends BaseApplicationGenerator { }, }; } + + shouldAskForPrompts() { + return this.initialRun; + } } diff --git a/generators/java-audit/generator.spec.js b/generators/java-audit/generator.spec.js index 51f2cab..afbeafa 100644 --- a/generators/java-audit/generator.spec.js +++ b/generators/java-audit/generator.spec.js @@ -6,7 +6,7 @@ const SUB_GENERATOR = 'java-audit'; const SUB_GENERATOR_NAMESPACE = `jhipster-entity-audit:${SUB_GENERATOR}`; describe('SubGenerator java-audit of entity-audit JHipster blueprint', () => { - for (const auditFramework of [undefined, 'javers', 'custom']) { + for (const auditFramework of [null, 'javers', 'custom']) { describe(`run using auditFramework ${auditFramework}`, () => { beforeAll(async function () { await helpers