diff --git a/.yo-rc.json b/.yo-rc.json index 9a3833267..a911fe15c 100644 --- a/.yo-rc.json +++ b/.yo-rc.json @@ -13,12 +13,6 @@ "sbs": true, "written": true }, - "project-name": { - "command": false, - "priorities": ["initializing", "prompting", "configuring", "default", "end"], - "sbs": true, - "written": true - }, "react-native": { "command": false, "priorities": ["initializing", "prompting", "configuring", "default", "end"], @@ -39,6 +33,6 @@ "packageJsonType": "module", "sampleWritten": true, "skipCommitHook": true, - "subGenerators": ["app", "project-name", "react-native", "spring-boot"] + "subGenerators": ["app", "react-native", "spring-boot"] } } diff --git a/cli/cli-customizations.cjs b/cli/cli-customizations.cjs index ed312c312..6d7b687c9 100644 --- a/cli/cli-customizations.cjs +++ b/cli/cli-customizations.cjs @@ -1,6 +1,6 @@ // This file will not be overwritten by generate-blueprint module.exports = { - defaultCommand: 'app', + defaultCommand: 'react-native', printBlueprintLogo: undefined, printLogo: async () => { const { printJHipsterLogo } = await import('./print-jhipster-logo.js'); diff --git a/generators/project-name/__snapshots__/generator.spec.mjs.snap b/generators/project-name/__snapshots__/generator.spec.mjs.snap deleted file mode 100644 index e2da6e4ca..000000000 --- a/generators/project-name/__snapshots__/generator.spec.mjs.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`SubGenerator project-name of react-native JHipster blueprint > run > should succeed 1`] = ` -{ - ".yo-rc.json": { - "stateCleared": "modified", - }, -} -`; diff --git a/generators/project-name/command.mjs b/generators/project-name/command.mjs deleted file mode 100644 index 59167cf2f..000000000 --- a/generators/project-name/command.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import { asCommand } from 'generator-jhipster'; - -export default asCommand({ - options: {}, -}); diff --git a/generators/project-name/generator.mjs b/generators/project-name/generator.mjs deleted file mode 100644 index 2e3234555..000000000 --- a/generators/project-name/generator.mjs +++ /dev/null @@ -1,114 +0,0 @@ -import ProjectNameGenerator from 'generator-jhipster/generators/project-name'; -import { DEFAULT_REACT_NATIVE_APP_NAME } from '../constants.mjs'; -import command from './command.mjs'; - -export default class extends ProjectNameGenerator { - constructor(args, opts, features) { - super(args, opts, { checkBlueprint: true, ...features }); - } - - get [ProjectNameGenerator.INITIALIZING]() { - return this.asInitializingTaskGroup({ - ...super.initializing, - async initializingTemplateTask() { - this.parseJHipsterArguments(command.arguments); - this.parseJHipsterOptions(command.options); - }, - defaults() { - if (this.options.defaults || this.options.force) { - this.config.defaults({ - baseName: this.getDefaultReactNativeName(), - }); - } - }, - }); - } - - get [ProjectNameGenerator.PROMPTING]() { - return this.asPromptingTaskGroup({ - ...super.prompting, - - // Replace prompts with custom questions - async showPrompts() { - await this.prompt( - [ - { - name: 'baseName', - type: 'input', - validate: input => this.validateBaseName(input), - message: 'What do you want to name your ReactNative application?', - default: this.getDefaultReactNativeName(), - }, - ], - this.config, - ); - }, - }); - } - - get [ProjectNameGenerator.CONFIGURING]() { - return this.asConfiguringTaskGroup({ - ...super.configuring, - async configuringTemplateTask() {}, - }); - } - - get [ProjectNameGenerator.COMPOSING]() { - return this.asComposingTaskGroup({ - ...super.composing, - async composingTemplateTask() {}, - }); - } - - get [ProjectNameGenerator.LOADING]() { - return this.asLoadingTaskGroup({ - ...super.loading, - async loadingTemplateTask() {}, - }); - } - - get [ProjectNameGenerator.PREPARING]() { - return this.asPreparingTaskGroup({ - ...super.preparing, - async preparingTemplateTask() {}, - }); - } - - get [ProjectNameGenerator.DEFAULT]() { - return this.asDefaultTaskGroup({ - ...super.default, - async defaultTemplateTask() {}, - }); - } - - get [ProjectNameGenerator.WRITING]() { - return this.asWritingTaskGroup({ - ...super.writing, - }); - } - - get [ProjectNameGenerator.POST_WRITING]() { - return this.asPostWritingTaskGroup({ - ...super.postWriting, - async postWritingTemplateTask() {}, - }); - } - - get [ProjectNameGenerator.INSTALL]() { - return this.asInstallTaskGroup({ - ...super.install, - async installTemplateTask() {}, - }); - } - - get [ProjectNameGenerator.END]() { - return this.asEndTaskGroup({ - ...super.end, - async endTemplateTask() {}, - }); - } - - getDefaultReactNativeName() { - return DEFAULT_REACT_NATIVE_APP_NAME; - } -} diff --git a/generators/project-name/generator.spec.mjs b/generators/project-name/generator.spec.mjs deleted file mode 100644 index 6505e1a9a..000000000 --- a/generators/project-name/generator.spec.mjs +++ /dev/null @@ -1,26 +0,0 @@ -import { beforeAll, describe, expect, it } from 'vitest'; - -import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; - -const SUB_GENERATOR = 'project-name'; -const BLUEPRINT_NAMESPACE = `jhipster:${SUB_GENERATOR}`; - -describe('SubGenerator project-name of react-native JHipster blueprint', () => { - describe('run', () => { - beforeAll(async function () { - await helpers - .run(BLUEPRINT_NAMESPACE) - .withJHipsterConfig() - .withOptions({ - ignoreNeedlesError: true, - blueprint: ['react-native'], - }) - .withJHipsterLookup() - .withParentBlueprintLookup(); - }); - - it('should succeed', () => { - expect(result.getStateSnapshot()).toMatchSnapshot(); - }); - }); -}); diff --git a/generators/project-name/index.mjs b/generators/project-name/index.mjs deleted file mode 100644 index 3dd0513e5..000000000 --- a/generators/project-name/index.mjs +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './generator.mjs'; -export { default as command } from './command.mjs'; diff --git a/generators/react-native/command.mjs b/generators/react-native/command.mjs index 03db177af..27bbd6fe8 100644 --- a/generators/react-native/command.mjs +++ b/generators/react-native/command.mjs @@ -1,9 +1,16 @@ import { asCommand } from 'generator-jhipster'; +import { DEFAULT_ENABLE_DETOX } from '../constants.mjs'; export default asCommand({ configs: { detox: { description: 'Generate Detox tests', + prompt: { + name: 'detox', + type: 'confirm', + message: 'Do you want to enable end-to-end tests with Detox?', + default: DEFAULT_ENABLE_DETOX, + }, scope: 'blueprint', }, }, diff --git a/generators/react-native/generator.mjs b/generators/react-native/generator.mjs index 7c8b3bedc..530d08b46 100644 --- a/generators/react-native/generator.mjs +++ b/generators/react-native/generator.mjs @@ -5,7 +5,7 @@ import BaseApplicationGenerator from 'generator-jhipster/generators/base-applica import { generateTestEntity } from 'generator-jhipster/generators/client/support'; import { camelCase, kebabCase, snakeCase, startCase } from 'lodash-es'; import semver from 'semver'; -import { DEFAULT_BACKEND_PATH, DEFAULT_ENABLE_DETOX } from '../constants.mjs'; +import { DEFAULT_BACKEND_PATH, DEFAULT_REACT_NATIVE_APP_NAME } from '../constants.mjs'; import files from './files.mjs'; import entityFiles from './entity-files.mjs'; import { @@ -22,7 +22,7 @@ import { export default class extends BaseApplicationGenerator { constructor(args, opts, features) { - super(args, opts, { ...features, sbsBlueprint: true, jhipster7Migration: true }); + super(args, opts, { ...features, queueCommandTasks: true, sbsBlueprint: true, jhipster7Migration: true }); if (this.options.help) return; @@ -65,22 +65,20 @@ export default class extends BaseApplicationGenerator { message: 'Enter the directory where your JHipster app is located:', default: DEFAULT_BACKEND_PATH, }, - { - name: 'detox', - type: 'confirm', - message: 'Do you want to enable end-to-end tests with Detox?', - default: DEFAULT_ENABLE_DETOX, - }, ], this.reactNativeStorage, ); - this.reactNativeStorage.defaults({ appDir: DEFAULT_BACKEND_PATH, reactNativeDir: null, detox: DEFAULT_ENABLE_DETOX }); + this.reactNativeStorage.defaults({ appDir: DEFAULT_BACKEND_PATH, reactNativeDir: null }); if (this.reactNativeConfig.appDir) { this.addBackendStorages(); } - await this.dependsOnJHipster('bootstrap-application'); + await this.dependsOnJHipster('bootstrap-application', { + generatorOptions: { + defaultBaseName: () => DEFAULT_REACT_NATIVE_APP_NAME, + }, + }); await this.dependsOnJHipster('init'); } @@ -152,14 +150,6 @@ export default class extends BaseApplicationGenerator { }); } - get [BaseApplicationGenerator.LOADING]() { - return this.asLoadingTaskGroup({ - async loadCommand({ application }) { - await this.loadCurrentJHipsterCommandConfig(application); - }, - }); - } - get [BaseApplicationGenerator.PREPARING]() { return this.asPreparingTaskGroup({ dependencies({ application }) {