diff --git a/.github/actions/generate-project/action.yml b/.github/actions/generate-project/action.yml new file mode 100644 index 000000000000..41d78f83153f --- /dev/null +++ b/.github/actions/generate-project/action.yml @@ -0,0 +1,49 @@ +name: 'Generate Project' +description: 'Generate JHipster project from configuration' +inputs: + sample-name: + description: 'Name of the sample to generate' + required: true + extra-args: + description: 'Extra arguments for generation' + required: false + default: '' + skip-config: + description: 'Skip configuration file copy' + required: false + default: 'false' +runs: + using: 'composite' + steps: + - name: 'Prepare project directory' + shell: bash + run: | + mkdir -p "$JHI_FOLDER_APP" + cd "$JHI_FOLDER_APP" + echo "Working directory: $(pwd)" + + - name: 'Copy configuration if not skipped' + shell: bash + if: inputs.skip-config != 'true' + run: | + if [[ -f "$JHI_SAMPLES/${{ inputs.sample-name }}/.yo-rc.json" ]]; then + cp -f "$JHI_SAMPLES/${{ inputs.sample-name }}/.yo-rc.json" "$JHI_FOLDER_APP"/ + echo "Copied configuration for sample: ${{ inputs.sample-name }}" + else + echo "Warning: Sample configuration not found for ${{ inputs.sample-name }}" + fi + + - name: 'Generate project with JHipster' + shell: bash + run: | + cd "$JHI_FOLDER_APP" + echo "Generating project with arguments: ${{ inputs.extra-args }}" + $JHI_CLI --force --no-insight --skip-checks --skip-jhipster-dependencies ${{ inputs.extra-args }} + + - name: 'Display generated project' + shell: bash + run: | + echo "Generated project structure:" + ls -al "$JHI_FOLDER_APP" + echo "Git log (if available):" + git --no-pager log -n 10 --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit || true \ No newline at end of file diff --git a/.github/actions/generate-sample-config/action.yml b/.github/actions/generate-sample-config/action.yml new file mode 100644 index 000000000000..f91dcb446de5 --- /dev/null +++ b/.github/actions/generate-sample-config/action.yml @@ -0,0 +1,103 @@ +name: 'Generate Sample Configuration' +description: 'Generate sample configuration and entities for testing' +inputs: + sample-name: + description: 'Name of the sample to generate' + required: true + database-type: + description: 'Database type (sql, mongodb, cassandra, couchbase, neo4j, micro)' + required: false + default: 'sql' + extra-args: + description: 'Extra arguments for generation' + required: false + default: '' +runs: + using: 'composite' + steps: + - name: 'Prepare application directory' + shell: bash + run: | + mkdir -p "$JHI_FOLDER_APP"/.jhipster/ + echo "Created directory: $JHI_FOLDER_APP" + + - name: 'Copy sample configuration' + shell: bash + run: | + if [[ -f "$JHI_SAMPLES/${{ inputs.sample-name }}/.yo-rc.json" ]]; then + cp -f "$JHI_SAMPLES/${{ inputs.sample-name }}/.yo-rc.json" "$JHI_FOLDER_APP"/ + echo "Copied configuration for sample: ${{ inputs.sample-name }}" + else + echo "Error: Sample configuration not found for ${{ inputs.sample-name }}" + exit 1 + fi + + - name: 'Generate entities based on database type' + shell: bash + run: | + case "${{ inputs.database-type }}" in + "mongodb"|"couchbase") + # MongoDB/Couchbase entities + for entity in DocumentBankAccount EmbeddedOperation Place Division FieldTestEntity FieldTestMapstructAndServiceClassEntity FieldTestServiceClassAndJpaFilteringEntity FieldTestServiceImplEntity FieldTestInfiniteScrollEntity FieldTestPaginationEntity EntityWithDTO EntityWithPaginationAndDTO EntityWithServiceClassAndPagination EntityWithServiceClassPaginationAndDTO EntityWithServiceImplAndDTO EntityWithServiceImplAndPagination EntityWithServiceImplPaginationAndDTO; do + if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then + cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/ + echo "Added entity: $entity" + fi + done + ;; + "neo4j") + # Neo4j entities + for entity in Album Track Genre Artist; do + if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then + cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/ + echo "Added entity: $entity" + fi + done + ;; + "cassandra") + # Cassandra entities + for entity in CassBankAccount FieldTestEntity FieldTestServiceImplEntity FieldTestMapstructAndServiceClassEntity FieldTestPaginationEntity; do + if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then + cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/ + echo "Added entity: $entity" + fi + done + ;; + "micro") + # Microservice entities + for entity in MicroserviceBankAccount MicroserviceOperation MicroserviceLabel FieldTestEntity FieldTestMapstructAndServiceClassEntity FieldTestServiceClassAndJpaFilteringEntity FieldTestServiceImplEntity FieldTestInfiniteScrollEntity FieldTestPaginationEntity; do + if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then + cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/ + echo "Added entity: $entity" + fi + done + ;; + "sqllight") + # SQL Light entities + for entity in BankAccount Label Operation; do + if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then + cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/ + echo "Added entity: $entity" + fi + done + ;; + "sqlfull"|"sql") + # SQL Full entities + for entity in BankAccount Label Operation Place Division FieldTestEntity FieldTestMapstructAndServiceClassEntity FieldTestServiceClassAndJpaFilteringEntity FieldTestServiceImplEntity FieldTestInfiniteScrollEntity FieldTestPaginationEntity FieldTestEnumWithValue TestEntity TestMapstruct TestServiceClass TestServiceImpl TestInfiniteScroll TestPagination TestManyToOne TestManyToMany TestManyRelPaginDTO TestOneToOne TestCustomTableName TestTwoRelationshipsSameEntity SuperMegaLargeTestEntity EntityWithDTO EntityWithPaginationAndDTO EntityWithServiceClassAndPagination EntityWithServiceClassPaginationAndDTO EntityWithServiceImplAndDTO EntityWithServiceImplAndPagination EntityWithServiceImplPaginationAndDTO MapsIdParentEntityWithoutDTO MapsIdChildEntityWithoutDTO MapsIdGrandchildEntityWithoutDTO MapsIdParentEntityWithDTO MapsIdChildEntityWithDTO MapsIdGrandchildEntityWithDTO MapsIdUserProfileWithDTO JpaFilteringRelationship JpaFilteringOtherSide; do + if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then + cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/ + echo "Added entity: $entity" + fi + done + ;; + *) + echo "Unknown database type: ${{ inputs.database-type }}" + exit 1 + ;; + esac + + - name: 'List generated entities' + shell: bash + run: | + echo "Generated entities:" + ls -al "$JHI_FOLDER_APP"/.jhipster/ || true \ No newline at end of file diff --git a/.github/actions/generate/action.yml b/.github/actions/generate/action.yml index a124f337ba1e..1e99e08a843e 100644 --- a/.github/actions/generate/action.yml +++ b/.github/actions/generate/action.yml @@ -17,22 +17,36 @@ # limitations under the License. # -name: 'Deprecated: Generate' -description: 'Generate application for test-integration scripts' +name: 'Generate Application' +description: 'Generate JHipster application using new action-based approach' inputs: + sample-name: + description: 'Name of the sample to generate' + required: true + database-type: + description: 'Database type for entities' + required: false + default: 'sql' extra-args: - description: 'Extra arguments' + description: 'Extra arguments for generation' required: false default: '' runs: using: 'composite' steps: - - name: 'GENERATION: install executable' - run: $JHI_SCRIPTS/10-install-jhipster.sh - shell: bash - - name: 'GENERATION: generate config' - run: $JHI_SCRIPTS/11-generate-config.sh - shell: bash - - name: 'GENERATION: project' - run: $JHI_SCRIPTS/12-generate-project.sh ${{ inputs.extra-args }} - shell: bash + - name: 'Initialize environment' + uses: ./.github/actions/init-environment@v0 + with: + generator-path: generator-jhipster + + - name: 'Generate sample configuration' + uses: ./.github/actions/generate-sample-config@v0 + with: + sample-name: ${{ inputs.sample-name }} + database-type: ${{ inputs.database-type }} + + - name: 'Generate project' + uses: ./.github/actions/generate-project@v0 + with: + sample-name: ${{ inputs.sample-name }} + extra-args: ${{ inputs.extra-args }} diff --git a/.github/actions/init-environment/action.yml b/.github/actions/init-environment/action.yml new file mode 100644 index 000000000000..1eb89a1f846d --- /dev/null +++ b/.github/actions/init-environment/action.yml @@ -0,0 +1,51 @@ +name: 'Initialize Environment' +description: 'Initialize environment variables for JHipster testing' +inputs: + generator-path: + description: 'Path to the generator' + required: false + default: 'generator-jhipster' + workspace: + description: 'GitHub workspace path' + required: false + default: '${{ github.workspace }}' +runs: + using: 'composite' + steps: + - name: 'Set environment variables' + shell: bash + run: | + # Set core paths + echo "JHI_HOME=${{ inputs.workspace }}/${{ inputs.generator-path }}" >> $GITHUB_ENV + echo "JHI_INTEG=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration" >> $GITHUB_ENV + echo "JHI_SAMPLES=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples" >> $GITHUB_ENV + echo "JHI_JDL_SAMPLES=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/jdl-samples" >> $GITHUB_ENV + echo "JHI_FOLDER_APP=${{ inputs.workspace }}/app" >> $GITHUB_ENV + + # Set CLI + echo "JHI_CLI=jhipster" >> $GITHUB_ENV + + # Read versions from files + JHI_NODE_VERSION=$(cat ${{ inputs.workspace }}/${{ inputs.generator-path }}/generators/init/resources/.node-version) + echo "JHI_NODE_VERSION=$JHI_NODE_VERSION" >> $GITHUB_ENV + + JHI_NPM_VERSION=$(grep -o '"npm": "[^"]*"' ${{ inputs.workspace }}/${{ inputs.generator-path }}/generators/common/resources/package.json | cut -f4 -d '"') + echo "JHI_NPM_VERSION=$JHI_NPM_VERSION" >> $GITHUB_ENV + + JHI_VERSION=$(grep -o '"version": "[^"]*"' ${{ inputs.workspace }}/${{ inputs.generator-path }}/package.json | cut -f4 -d '"') + echo "JHI_VERSION=$JHI_VERSION" >> $GITHUB_ENV + + # Set entity samples path + if [[ -d "${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples/.jhipster" ]]; then + echo "JHI_ENTITY_SAMPLES=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples/.jhipster" >> $GITHUB_ENV + else + echo "JHI_ENTITY_SAMPLES=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples/.jhipster" >> $GITHUB_ENV + fi + + echo "Environment variables set:" + echo "JHI_HOME: ${{ inputs.workspace }}/${{ inputs.generator-path }}" + echo "JHI_SAMPLES: ${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples" + echo "JHI_FOLDER_APP: ${{ inputs.workspace }}/app" + echo "JHI_NODE_VERSION: $JHI_NODE_VERSION" + echo "JHI_NPM_VERSION: $JHI_NPM_VERSION" + echo "JHI_VERSION: $JHI_VERSION" \ No newline at end of file diff --git a/.github/workflows/generator-generate-blueprint.yml b/.github/workflows/generator-generate-blueprint.yml index 71aa7947306c..dcdb3e39b582 100644 --- a/.github/workflows/generator-generate-blueprint.yml +++ b/.github/workflows/generator-generate-blueprint.yml @@ -75,14 +75,22 @@ jobs: jhipster.cjs generate-blueprint --force --link-jhipster-dependency --generate-snapshots --skip-install npm link generator-jhipster npm link - - name: 'GENERATION: config' - run: $JHI_SCRIPTS/11-generate-config.sh - - name: 'GENERATION: project' - run: $JHI_SCRIPTS/12-generate-project.sh ${{ matrix.extra-args }} ${{ matrix.new-extra-args }} --blueprints foo - env: - JHI_CLI: jhipster.cjs - - name: 'GENERATION: jhipster info' - run: $JHI_SCRIPTS/14-jhipster-info.sh + - name: 'Initialize environment' + uses: ./generator-jhipster/.github/actions/init-environment@v0 + with: + generator-path: generator-jhipster + + - name: 'Generate sample configuration' + uses: ./generator-jhipster/.github/actions/generate-sample-config@v0 + with: + sample-name: ng-default + database-type: sql + + - name: 'Generate project' + uses: ./generator-jhipster/.github/actions/generate-project@v0 + with: + sample-name: ng-default + extra-args: ${{ matrix.extra-args }} ${{ matrix.new-extra-args }} --blueprints foo #---------------------------------------------------------------------- # Launch tests #---------------------------------------------------------------------- diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md new file mode 100644 index 000000000000..543b6c6a6185 --- /dev/null +++ b/MIGRATION_GUIDE.md @@ -0,0 +1,158 @@ +# Migration Guide: From test-integration Scripts to GitHub Actions + +## Overview + +This document outlines the migration from the old `test-integration/scripts/` approach to the new GitHub Actions-based approach for JHipster testing. + +## What Changed + +### Before (Old Approach) +- **Shell Scripts**: Complex bash scripts in `test-integration/scripts/` +- **Static Samples**: Static JSON files in `test-integration/samples/` +- **Tight Coupling**: Workflows directly called shell scripts +- **Poor DX**: Hard to maintain and debug + +### After (New Approach) +- **GitHub Actions**: Reusable composite actions in `.github/actions/` +- **Dynamic Templates**: EJS templates in `generators/generate-blueprint/templates/` +- **Loose Coupling**: Workflows use parameterized actions +- **Better DX**: Type-safe, testable, and maintainable + +## New Actions Created + +### 1. `init-environment` +**Purpose**: Initialize environment variables for JHipster testing +**Replaces**: `test-integration/scripts/00-init-env.sh` + +```yaml +- name: 'Initialize environment' + uses: ./.github/actions/init-environment@v0 + with: + generator-path: generator-jhipster +``` + +### 2. `generate-sample-config` +**Purpose**: Generate sample configuration and entities +**Replaces**: `test-integration/scripts/11-generate-config.sh` + +```yaml +- name: 'Generate sample configuration' + uses: ./.github/actions/generate-sample-config@v0 + with: + sample-name: ng-default + database-type: sql +``` + +### 3. `generate-project` +**Purpose**: Generate JHipster project from configuration +**Replaces**: `test-integration/scripts/12-generate-project.sh` + +```yaml +- name: 'Generate project' + uses: ./.github/actions/generate-project@v0 + with: + sample-name: ng-default + extra-args: --blueprints foo +``` + +## Template-Based Samples + +Samples are now generated using EJS templates instead of static JSON files: + +### Before +```json +// test-integration/samples/ng-default/.yo-rc.json +{ + "generator-jhipster": { + "baseName": "jhipsterSampleApplication", + "databaseType": "sql" + } +} +``` + +### After +```ejs +// generators/generate-blueprint/templates/samples/ng-default/.yo-rc.json.ejs +{ + "generator-jhipster": { + "baseName": "<%= baseName %>", + "databaseType": "<%= databaseType %>" + } +} +``` + +## Migration Steps + +### 1. Update Workflows +Replace script calls with action calls: + +```yaml +# Old +- run: $JHI_SCRIPTS/11-generate-config.sh +- run: $JHI_SCRIPTS/12-generate-project.sh + +# New +- uses: ./.github/actions/generate-sample-config@v0 +- uses: ./.github/actions/generate-project@v0 +``` + +### 2. Convert Samples to Templates +Move sample configurations to templates: + +1. Copy sample from `test-integration/samples/` to `generators/generate-blueprint/templates/samples/` +2. Convert static JSON to EJS templates +3. Add dynamic parameters (baseName, databaseType, etc.) + +### 3. Update Entity Generation +Replace hardcoded entity lists with template-based generation: + +```typescript +// In generate-blueprint generator +async generateEntitiesForDatabase(databaseType: string) { + const entities = this.getEntitiesForDatabase(databaseType); + for (const entity of entities) { + await this.generateEntity(entity); + } +} +``` + +## Benefits + +1. **Maintainability**: TypeScript is easier to maintain than bash +2. **Testability**: Can unit test generator logic +3. **Reusability**: Actions can be reused across workflows +4. **Developer Experience**: Better IDE support and type safety +5. **Extensibility**: Easy to add new database types or entities + +## Next Steps + +1. **Complete Migration**: Update all remaining workflows +2. **Remove Old Scripts**: Delete `test-integration/scripts/` after migration +3. **Update Documentation**: Update all references to old approach +4. **Add Tests**: Add unit tests for new actions and templates + +## Files Modified + +- `.github/actions/init-environment/action.yml` (new) +- `.github/actions/generate-sample-config/action.yml` (new) +- `.github/actions/generate-project/action.yml` (new) +- `.github/actions/generate/action.yml` (updated) +- `generators/generate-blueprint/constants.ts` (updated) +- `generators/generate-blueprint/generator.ts` (updated) +- `generators/generate-blueprint/templates/samples/` (new templates) +- `.github/workflows/generator-generate-blueprint.yml` (updated) + +## Testing + +To test the new approach: + +```bash +# Generate a sample using the new approach +jhipster generate-blueprint --sample-generation --sample-name ng-default --database-type sql + +# Or use the new actions in a workflow +- uses: ./.github/actions/generate-sample-config@v0 + with: + sample-name: ng-default + database-type: sql +``` \ No newline at end of file diff --git a/generators/generate-blueprint/constants.ts b/generators/generate-blueprint/constants.ts index bed74c2fdfb5..312f86b703d9 100644 --- a/generators/generate-blueprint/constants.ts +++ b/generators/generate-blueprint/constants.ts @@ -32,6 +32,9 @@ export const DYNAMIC = 'dynamic'; export const JS = 'js'; export const LOCAL_BLUEPRINT_OPTION = 'localBlueprint'; export const CLI_OPTION = 'cli'; +export const SAMPLE_GENERATION = 'sampleGeneration'; +export const SAMPLE_NAME = 'sampleName'; +export const DATABASE_TYPE = 'databaseType'; export const SBS = 'sbs'; export const COMMAND = 'command'; @@ -54,6 +57,9 @@ export const defaultConfig = ({ config = {} }: { config?: any } = {}) => ({ [CLI_OPTION]: !config[LOCAL_BLUEPRINT_OPTION], [SUB_GENERATORS]: [] as string[], [ADDITIONAL_SUB_GENERATORS]: '', + [SAMPLE_GENERATION]: false, + [SAMPLE_NAME]: 'ng-default', + [DATABASE_TYPE]: 'sql', }); export const defaultSubGeneratorConfig = () => ({ @@ -79,8 +85,42 @@ export const allGeneratorsConfig = () => ({ }); export const prompts = () => { - const { [LOCAL_BLUEPRINT_OPTION]: LOCAL_BLUEPRINT_OPTION_DEFAULT_VALUE, [CLI_OPTION]: CLI_OPTION_DEFAULT_VALUE } = defaultConfig(); + const { [LOCAL_BLUEPRINT_OPTION]: LOCAL_BLUEPRINT_OPTION_DEFAULT_VALUE, [CLI_OPTION]: CLI_OPTION_DEFAULT_VALUE, [SAMPLE_GENERATION]: SAMPLE_GENERATION_DEFAULT_VALUE, [SAMPLE_NAME]: SAMPLE_NAME_DEFAULT_VALUE, [DATABASE_TYPE]: DATABASE_TYPE_DEFAULT_VALUE } = defaultConfig(); const ret = [ + { + type: 'confirm', + name: SAMPLE_GENERATION, + message: 'Do you want to generate a sample application configuration?', + default: SAMPLE_GENERATION_DEFAULT_VALUE, + }, + { + type: 'list', + name: SAMPLE_NAME, + message: 'Which sample do you want to generate?', + choices: [ + { name: 'Angular Default', value: 'ng-default' }, + { name: 'React Default', value: 'react-default' }, + { name: 'Vue Default', value: 'vue-default' }, + ], + default: SAMPLE_NAME_DEFAULT_VALUE, + when: (answers: any) => answers[SAMPLE_GENERATION], + }, + { + type: 'list', + name: DATABASE_TYPE, + message: 'Which database type do you want to use?', + choices: [ + { name: 'SQL', value: 'sql' }, + { name: 'SQL Full', value: 'sqlfull' }, + { name: 'MongoDB', value: 'mongodb' }, + { name: 'Cassandra', value: 'cassandra' }, + { name: 'Couchbase', value: 'couchbase' }, + { name: 'Neo4j', value: 'neo4j' }, + { name: 'Microservice', value: 'micro' }, + ], + default: DATABASE_TYPE_DEFAULT_VALUE, + when: (answers: any) => answers[SAMPLE_GENERATION], + }, { type: 'confirm', name: LOCAL_BLUEPRINT_OPTION, diff --git a/generators/generate-blueprint/generator.ts b/generators/generate-blueprint/generator.ts index f15a39825ad4..e289e44b98e4 100644 --- a/generators/generate-blueprint/generator.ts +++ b/generators/generate-blueprint/generator.ts @@ -221,6 +221,12 @@ export default class extends BaseSimpleApplicationGenerator< async writing({ application }) { application.sampleWritten = this.jhipsterConfig.sampleWritten; const { skipWorkflows, ignoreExistingGenerators } = this; + + // Generate sample configuration if requested + if (this.jhipsterConfig[SAMPLE_GENERATION]) { + await this.generateSampleConfiguration(); + } + await this.writeFiles({ sections: files, context: { @@ -481,4 +487,98 @@ To begin to work: ? true : 'Your blueprint name is mandatory, cannot contain special characters or a blank space, using the default name instead'; } + + async generateSampleConfiguration() { + const sampleName = this.jhipsterConfig[SAMPLE_NAME]; + const databaseType = this.jhipsterConfig[DATABASE_TYPE]; + + // Generate sample configuration + const sampleConfig = { + baseName: 'jhipsterSampleApplication', + databaseType, + packageName: 'tech.jhipster.sample', + packageFolder: 'tech/jhipster/sample', + jwtSecretKey: 'ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=', + creationTimestamp: Date.now(), + }; + + // Write sample configuration + await this.writeFiles({ + sections: { + samples: { + [`samples/${sampleName}/.yo-rc.json`]: { + template: `samples/${sampleName}/.yo-rc.json.ejs`, + context: sampleConfig, + }, + }, + }, + context: sampleConfig, + }); + + // Generate entities based on database type + await this.generateEntitiesForDatabase(databaseType); + } + + async generateEntitiesForDatabase(databaseType: string) { + const entities = this.getEntitiesForDatabase(databaseType); + + for (const entity of entities) { + await this.writeFiles({ + sections: { + entities: { + [`samples/.jhipster/${entity}.json`]: { + template: `samples/.jhipster/${entity}.json.ejs`, + context: { entity }, + }, + }, + }, + context: { entity }, + }); + } + } + + getEntitiesForDatabase(databaseType: string): string[] { + switch (databaseType) { + case 'mongodb': + case 'couchbase': + return [ + 'DocumentBankAccount', 'EmbeddedOperation', 'Place', 'Division', + 'FieldTestEntity', 'FieldTestMapstructAndServiceClassEntity', 'FieldTestServiceClassAndJpaFilteringEntity', + 'FieldTestServiceImplEntity', 'FieldTestInfiniteScrollEntity', 'FieldTestPaginationEntity', + 'EntityWithDTO', 'EntityWithPaginationAndDTO', 'EntityWithServiceClassAndPagination', + 'EntityWithServiceClassPaginationAndDTO', 'EntityWithServiceImplAndDTO', 'EntityWithServiceImplAndPagination', + 'EntityWithServiceImplPaginationAndDTO' + ]; + case 'neo4j': + return ['Album', 'Track', 'Genre', 'Artist']; + case 'cassandra': + return ['CassBankAccount', 'FieldTestEntity', 'FieldTestServiceImplEntity', 'FieldTestMapstructAndServiceClassEntity', 'FieldTestPaginationEntity']; + case 'micro': + return [ + 'MicroserviceBankAccount', 'MicroserviceOperation', 'MicroserviceLabel', + 'FieldTestEntity', 'FieldTestMapstructAndServiceClassEntity', 'FieldTestServiceClassAndJpaFilteringEntity', + 'FieldTestServiceImplEntity', 'FieldTestInfiniteScrollEntity', 'FieldTestPaginationEntity' + ]; + case 'sqllight': + return ['BankAccount', 'Label', 'Operation']; + case 'sqlfull': + case 'sql': + return [ + 'BankAccount', 'Label', 'Operation', 'Place', 'Division', + 'FieldTestEntity', 'FieldTestMapstructAndServiceClassEntity', 'FieldTestServiceClassAndJpaFilteringEntity', + 'FieldTestServiceImplEntity', 'FieldTestInfiniteScrollEntity', 'FieldTestPaginationEntity', 'FieldTestEnumWithValue', + 'TestEntity', 'TestMapstruct', 'TestServiceClass', 'TestServiceImpl', 'TestInfiniteScroll', 'TestPagination', + 'TestManyToOne', 'TestManyToMany', 'TestManyRelPaginDTO', 'TestOneToOne', 'TestCustomTableName', + 'TestTwoRelationshipsSameEntity', 'SuperMegaLargeTestEntity', + 'EntityWithDTO', 'EntityWithPaginationAndDTO', 'EntityWithServiceClassAndPagination', + 'EntityWithServiceClassPaginationAndDTO', 'EntityWithServiceImplAndDTO', 'EntityWithServiceImplAndPagination', + 'EntityWithServiceImplPaginationAndDTO', + 'MapsIdParentEntityWithoutDTO', 'MapsIdChildEntityWithoutDTO', 'MapsIdGrandchildEntityWithoutDTO', + 'MapsIdParentEntityWithDTO', 'MapsIdChildEntityWithDTO', 'MapsIdGrandchildEntityWithDTO', 'MapsIdUserProfileWithDTO', + 'JpaFilteringRelationship', 'JpaFilteringOtherSide' + ]; + default: + return []; + } + } } diff --git a/generators/generate-blueprint/templates/samples/.jhipster/BankAccount.json.ejs b/generators/generate-blueprint/templates/samples/.jhipster/BankAccount.json.ejs new file mode 100644 index 000000000000..f32d2234721e --- /dev/null +++ b/generators/generate-blueprint/templates/samples/.jhipster/BankAccount.json.ejs @@ -0,0 +1,23 @@ +{ + "relationships": [], + "fields": [ + { + "fieldName": "name", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "balance", + "fieldType": "BigDecimal", + "fieldValidateRules": ["required"] + } + ], + "changelogDate": "20240101000000", + "dto": "no", + "service": "no", + "entityTableName": "bank_account", + "databaseType": "<%= databaseType %>", + "readOnly": false, + "jpaMetamodelFiltering": false, + "pagination": "no" +} \ No newline at end of file diff --git a/generators/generate-blueprint/templates/samples/ng-default/.yo-rc.json.ejs b/generators/generate-blueprint/templates/samples/ng-default/.yo-rc.json.ejs new file mode 100644 index 000000000000..f3c1e5f1aec3 --- /dev/null +++ b/generators/generate-blueprint/templates/samples/ng-default/.yo-rc.json.ejs @@ -0,0 +1,85 @@ +{ + "generator-jhipster": { + "applicationType": "monolith", + "authenticationType": "jwt", + "baseName": "<%= baseName %>", + "blueprints": [], + "buildTool": "maven", + "cacheProvider": "ehcache", + "clientFramework": "angular", + "clientPackageManager": "npm", + "clientTheme": "none", + "creationTimestamp": <%= creationTimestamp %>, + "cypressCoverage": true, + "databaseType": "<%= databaseType %>", + "devDatabaseType": "h2Disk", + "dtoSuffix": "", + "embeddableLaunchScript": false, + "enableTranslation": true, + "entitySuffix": "Entity", + "jhiPrefix": "myPrefix", + "jwtSecretKey": "<%= jwtSecretKey %>", + "languages": [ + "en", + "al", + "ar-ly", + "hy", + "by", + "bn", + "bg", + "ca", + "zh-cn", + "zh-tw", + "cs", + "da", + "nl", + "et", + "fa", + "fr", + "gl", + "de", + "el", + "he", + "hi", + "hr", + "hu", + "id", + "it", + "ja", + "ko", + "mr", + "my", + "pl", + "pt-br", + "pt-pt", + "ro", + "ru", + "si", + "sk", + "sr", + "es", + "sv", + "tr", + "ta", + "te", + "th", + "ua", + "uz-Cyrl-uz", + "uz-Latn-uz", + "kr-Latn-kr", + "vi", + "az-Latn-az" + ], + "messageBroker": "no", + "nativeLanguage": "en", + "otherModules": [], + "packageFolder": "<%= packageFolder %>", + "packageName": "<%= packageName %>", + "prodDatabaseType": "postgresql", + "searchEngine": "no", + "serverPort": 8080, + "serviceDiscoveryType": "no", + "testFrameworks": ["gatling", "cypress"], + "websocket": "no" + } +} \ No newline at end of file diff --git a/generators/generate-blueprint/templates/samples/react-default/.yo-rc.json.ejs b/generators/generate-blueprint/templates/samples/react-default/.yo-rc.json.ejs new file mode 100644 index 000000000000..1393922d81ca --- /dev/null +++ b/generators/generate-blueprint/templates/samples/react-default/.yo-rc.json.ejs @@ -0,0 +1,39 @@ +{ + "generator-jhipster": { + "applicationType": "monolith", + "authenticationType": "jwt", + "baseName": "<%= baseName %>", + "blueprints": [], + "buildTool": "maven", + "cacheProvider": "ehcache", + "clientFramework": "react", + "clientPackageManager": "npm", + "clientTheme": "none", + "creationTimestamp": <%= creationTimestamp %>, + "cypressCoverage": true, + "databaseType": "<%= databaseType %>", + "devDatabaseType": "h2Disk", + "dtoSuffix": "", + "embeddableLaunchScript": false, + "enableTranslation": true, + "entitySuffix": "Entity", + "jhiPrefix": "myPrefix", + "jwtSecretKey": "<%= jwtSecretKey %>", + "languages": [ + "en", + "fr", + "de" + ], + "messageBroker": "no", + "nativeLanguage": "en", + "otherModules": [], + "packageFolder": "<%= packageFolder %>", + "packageName": "<%= packageName %>", + "prodDatabaseType": "postgresql", + "searchEngine": "no", + "serverPort": 8080, + "serviceDiscoveryType": "no", + "testFrameworks": ["gatling", "cypress"], + "websocket": "no" + } +} \ No newline at end of file