generator-jhipster 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -57
- package/dist/cli/environment-builder.mjs +11 -4
- package/dist/cli/program.mjs +1 -1
- package/dist/generators/angular/cleanup.mjs +7 -0
- package/dist/generators/angular/files-angular.mjs +3 -4
- package/dist/generators/angular/generator.mjs +2 -15
- package/dist/generators/angular/needle-api/needle-client-angular.mjs +2 -8
- package/dist/generators/angular/resources/package.json +23 -23
- package/dist/generators/angular/support/translate-angular.mjs +2 -2
- package/dist/generators/angular/templates/README.md.jhi.client.angular.ejs +1 -1
- package/dist/generators/angular/templates/angular.json.ejs +3 -7
- package/dist/generators/angular/templates/src/main/webapp/app/account/activate/activate.component.html.ejs +6 -4
- package/dist/generators/angular/templates/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/account/password/password.component.html.ejs +39 -33
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html.ejs +44 -36
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html.ejs +24 -23
- package/dist/generators/angular/templates/src/main/webapp/app/account/register/register.component.html.ejs +74 -62
- package/dist/generators/angular/templates/src/main/webapp/app/account/sessions/sessions.component.html.ejs +12 -4
- package/dist/generators/angular/templates/src/main/webapp/app/account/settings/settings.component.html.ejs +54 -48
- package/dist/generators/angular/templates/src/main/webapp/app/admin/admin.routes.ts.ejs +74 -0
- package/dist/generators/angular/templates/src/main/webapp/app/admin/configuration/configuration.component.html.ejs +15 -5
- package/dist/generators/angular/templates/src/main/webapp/app/admin/docs/docs.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/admin/gateway/gateway.component.html.ejs +20 -7
- package/dist/generators/angular/templates/src/main/webapp/app/admin/health/health.component.html.ejs +10 -7
- package/dist/generators/angular/templates/src/main/webapp/app/admin/health/modal/health-modal.component.html.ejs +9 -3
- package/dist/generators/angular/templates/src/main/webapp/app/admin/logs/logs.component.html.ejs +12 -4
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.html.ejs +13 -7
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-cache/metrics-cache.component.html.ejs +6 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-datasource/metrics-datasource.component.html.ejs +3 -1
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-endpoints-requests/metrics-endpoints-requests.component.html.ejs +13 -9
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.html.ejs +13 -5
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.html.ejs +21 -7
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-request/metrics-request.component.html.ejs +6 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-system/metrics-system.component.html.ejs +3 -1
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/metrics.component.html.ejs +16 -7
- package/dist/generators/angular/templates/src/main/webapp/app/admin/tracker/tracker.component.html.ejs +3 -1
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.html.ejs +3 -1
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.html.ejs +11 -4
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/list/user-management.component.html.ejs +20 -11
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/update/user-management-update.component.html.ejs +48 -34
- package/dist/generators/angular/templates/src/main/webapp/app/app.component.ts.ejs +73 -0
- package/dist/generators/angular/templates/src/main/webapp/app/app.config.ts.ejs +67 -0
- package/dist/generators/angular/templates/src/main/webapp/app/app.routes.ts.ejs +85 -0
- package/dist/generators/angular/templates/src/main/webapp/app/core/microfrontend/index.ts.ejs +5 -4
- package/dist/generators/angular/templates/src/main/webapp/app/core/util/alert.service.spec.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/core/util/data-util.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/core/util/event-manager.service.spec.ts.ejs +12 -12
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.model.ts.ejs +4 -4
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/delete/_entityFile_-delete-dialog.component.html.ejs +3 -1
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/detail/_entityFile_-detail.component.html.ejs +26 -14
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs +38 -25
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-form.service.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-form.service.ts.ejs +5 -12
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.html.ejs +55 -21
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.ts.ejs +10 -10
- package/dist/generators/angular/templates/src/main/webapp/app/entities/entity.routes.ts.ejs +25 -0
- package/dist/generators/angular/templates/src/main/webapp/app/home/home.component.html.ejs +21 -17
- package/dist/generators/angular/templates/src/main/webapp/app/home/home.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/error/error.component.html.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/main/main.component.spec.ts.ejs +5 -2
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/main/main.component.ts.ejs +5 -1
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/navbar/navbar.component.html.ejs +97 -78
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/navbar/navbar.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/profiles/page-ribbon.component.scss.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/profiles/page-ribbon.component.ts.ejs +6 -4
- package/dist/generators/angular/templates/src/main/webapp/app/login/login.component.html.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/shared/alert/alert-error.component.html.ejs +6 -2
- package/dist/generators/angular/templates/src/main/webapp/app/shared/alert/alert.component.html.ejs +6 -2
- package/dist/generators/angular/templates/src/main/webapp/app/shared/filter/filter.component.html.ejs +11 -7
- package/dist/generators/angular/templates/src/main/webapp/app/shared/filter/filter.model.spec.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/shared/sort/sort-by.directive.spec.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/bootstrap.ts.ejs +5 -5
- package/dist/generators/angular/templates/src/main/webapp/content/scss/global.scss.ejs +1 -1
- package/dist/generators/angular/templates/webpack/webpack.microfrontend.js.ejs +2 -2
- package/dist/generators/app/README.md +108 -0
- package/dist/generators/app/USAGE +3 -0
- package/dist/generators/app/command.mjs +3 -3
- package/dist/generators/app/generator.mjs +11 -0
- package/dist/generators/base/command.mjs +0 -11
- package/dist/generators/base-application/generator.mjs +5 -6
- package/dist/generators/base-application/support/entities.mjs +2 -2
- package/dist/generators/base-application/support/index.mjs +1 -0
- package/dist/generators/base-application/support/prepare-entity.mjs +0 -1
- package/dist/generators/base-application/support/prepare-relationship.mjs +4 -0
- package/dist/generators/base-application/support/update-application-entities-transform.mjs +52 -0
- package/dist/generators/base-core/generator.mjs +17 -4
- package/dist/generators/base-entity-changes/generator.mjs +1 -1
- package/dist/generators/bootstrap/command.mjs +6 -0
- package/dist/generators/bootstrap/generator.mjs +27 -9
- package/dist/generators/bootstrap-application/generator.mjs +1 -19
- package/dist/generators/bootstrap-application-base/command.mjs +30 -0
- package/dist/generators/bootstrap-application-base/generator.mjs +27 -5
- package/dist/generators/bootstrap-application-base/index.mjs +1 -0
- package/dist/generators/bootstrap-application-base/support/export-jdl-transform.mjs +61 -0
- package/dist/generators/bootstrap-application-base/support/import-jdl-transform.mjs +64 -0
- package/dist/generators/bootstrap-application-base/support/index.mjs +2 -0
- package/dist/generators/client/command.mjs +2 -0
- package/dist/generators/client/resources/package.json +4 -4
- package/dist/generators/client/support/entity-definition.mjs +3 -3
- package/dist/generators/client/templates/README.md.jhi.client.ejs +2 -2
- package/dist/generators/client/templates/src/main/webapp/index.html.ejs +2 -2
- package/dist/generators/common/command.mjs +2 -0
- package/dist/generators/common/resources/package.json +3 -3
- package/dist/generators/common/templates/sonar-project.properties.ejs +1 -1
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/entity/_entity_.cy.ts.ejs +0 -1
- package/dist/generators/docker/generator.mjs +1 -1
- package/dist/generators/docker/templates/docker/cassandra.yml.ejs +2 -2
- package/dist/generators/docker/templates/docker/keycloak.yml.ejs +1 -1
- package/dist/generators/docker/templates/docker/realm-config/jhipster-realm.json.ejs +4 -1
- package/dist/generators/docker-compose/generator.mjs +4 -11
- package/dist/generators/docker-compose/templates/docker-compose.yml.ejs +1 -1
- package/dist/generators/docker-compose/templates/realm-config/jhipster-realm.json.ejs +4 -1
- package/dist/generators/export-jdl/generator.mjs +1 -1
- package/dist/generators/feign-client/cleanup.mjs +12 -0
- package/dist/generators/feign-client/files.mjs +35 -0
- package/dist/generators/feign-client/generator.mjs +65 -0
- package/dist/generators/feign-client/index.mjs +19 -0
- package/dist/generators/feign-client/templates/src/main/java/_package_/client/AuthorizationHeaderUtil.java.ejs +174 -0
- package/dist/generators/feign-client/templates/src/main/java/_package_/client/AuthorizedFeignClient.java.ejs +72 -0
- package/dist/generators/feign-client/templates/src/main/java/_package_/client/OAuth2InterceptedFeignConfiguration.java.ejs +35 -0
- package/dist/generators/feign-client/templates/src/main/java/_package_/client/OAuthIdpTokenResponseDTO.java.ejs +161 -0
- package/dist/generators/feign-client/templates/src/main/java/_package_/client/TokenRelayRequestInterceptor.java.ejs +42 -0
- package/dist/generators/feign-client/templates/src/main/java/_package_/client/UserFeignClientInterceptor_jwt.java.ejs +36 -0
- package/dist/generators/feign-client/templates/src/main/java/_package_/config/FeignConfiguration.java.ejs +45 -0
- package/dist/generators/feign-client/templates/src/test/java/_package_/client/AuthorizationHeaderUtilTest.java.ejs +263 -0
- package/dist/generators/generate-blueprint/command.mjs +1 -1
- package/dist/generators/generate-blueprint/resources/package.json +1 -1
- package/dist/generators/generate-blueprint/templates/vitest.config.ts.ejs +1 -1
- package/dist/generators/generator-constants.mjs +9 -5
- package/dist/generators/generator-list.mjs +1 -0
- package/dist/generators/git/generator.mjs +3 -5
- package/dist/generators/gradle/constants.mjs +1 -1
- package/dist/generators/java/command.mjs +6 -0
- package/dist/generators/java/entity-files.mjs +4 -0
- package/dist/generators/java/generator.mjs +3 -2
- package/dist/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.jackson_identity_info.ejs +30 -0
- package/dist/generators/jdl/generator.mjs +18 -23
- package/dist/generators/kubernetes/templates/keycloak/keycloak-configmap.yml.ejs +4 -1
- package/dist/generators/kubernetes/templates/keycloak/keycloak.yml.ejs +1 -1
- package/dist/generators/languages/generator.mjs +24 -15
- package/dist/generators/languages/prompts.mjs +3 -1
- package/dist/generators/languages/support/translate.mjs +1 -1
- package/dist/generators/languages/templates/entity/i18n/entity_pt-br.json.ejs +1 -1
- package/dist/generators/liquibase/README.md +19 -0
- package/dist/generators/project-name/generator.mjs +14 -19
- package/dist/generators/project-name/support/name-resolver.mjs +35 -6
- package/dist/generators/react/resources/package.json +24 -24
- package/dist/generators/react/templates/src/main/webapp/app/config/notification-middleware.spec.ts.ejs +4 -4
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-detail.tsx.ejs +1 -2
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.tsx.ejs +12 -13
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.tsx.ejs +3 -8
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityModel_.model.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/header/header.scss.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/reducer.utils.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/shared/util/date-utils.ts.ejs +1 -1
- package/dist/generators/server/cleanup.mjs +5 -0
- package/dist/generators/server/command.mjs +13 -2
- package/dist/generators/server/entity-files.mjs +3 -3
- package/dist/generators/server/files.mjs +2 -38
- package/dist/generators/server/generator.mjs +35 -19
- package/dist/generators/server/jdl/application-definition.mjs +5 -2
- package/dist/generators/server/options/feign-client.mjs +24 -0
- package/dist/generators/server/options/index.mjs +1 -0
- package/dist/generators/server/resources/Dockerfile +16 -16
- package/dist/generators/server/resources/gradle/libs.versions.toml +4 -4
- package/dist/generators/server/resources/pom.xml +11 -11
- package/dist/generators/server/support/config.mjs +1 -0
- package/dist/generators/server/support/prepare-entity.mjs +4 -1
- package/dist/generators/server/templates/build.gradle.ejs +1 -2
- package/dist/generators/server/templates/gradle/profile_dev.gradle.ejs +3 -21
- package/dist/generators/server/templates/gradle/profile_prod.gradle.ejs +5 -15
- package/dist/generators/server/templates/pom.xml.ejs +1 -4
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/_partials_entity_/get_all_template.ejs +7 -7
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/_partials_entity_/search_template.ejs +4 -4
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/repository/_entityClass_Repository.java.ejs +1 -1
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/service/mapper/_entityClass_Mapper.java.ejs +2 -2
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/web/rest/_entityClass_Resource.java.ejs +3 -3
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_imperative.java.ejs +20 -2
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_reactive.java.ejs +4 -1
- package/dist/generators/server/templates/src/main/java/_package_/security/oauth2/CustomClaimConverter.java.ejs +1 -5
- package/dist/generators/server/templates/src/main/java/_package_/service/MailService.java.ejs +48 -12
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/AccountResource.java.ejs +1 -1
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/LogoutResource_imperative.java.ejs +4 -13
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/LogoutResource_reactive.java.ejs +5 -11
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/PublicUserResource.java.ejs +3 -3
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/UserResource.java.ejs +6 -6
- package/dist/generators/server/templates/src/main/resources/config/application.yml.ejs +8 -7
- package/dist/generators/server/templates/src/test/java/_package_/TechnicalStructureTest.java.ejs +1 -1
- package/dist/generators/server/templates/src/test/java/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.java.ejs +8 -8
- package/dist/generators/server/templates/src/test/java/_package_/web/rest/errors/ExceptionTranslatorTestController.java.ejs +2 -2
- package/dist/generators/spring-cache/internal/dependencies.mjs +1 -1
- package/dist/generators/spring-cache/templates/gradle/cache.gradle.ejs +1 -1
- package/dist/generators/spring-cache/templates/src/main/java/_package_/config/CacheFactoryConfiguration.java.ejs +1 -1
- package/dist/generators/spring-cloud-stream/templates/src/main/java/_package_/web/rest/KafkaResource_imperative.java.ejs +1 -1
- package/dist/generators/spring-cloud-stream/templates/src/main/java/_package_/web/rest/KafkaResource_reactive.java.ejs +1 -1
- package/dist/generators/spring-cloud-stream/templates/src/test/java/_package_/web/rest/KafkaResourceIT_reactive.java.ejs +3 -0
- package/dist/generators/spring-data-elasticsearch/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.elastic_search.ejs +1 -1
- package/dist/generators/spring-data-elasticsearch/templates/src/main/java/_package_/_entityPackage_/repository/search/_entityClass_SearchRepository.java.ejs +1 -1
- package/dist/generators/spring-data-elasticsearch/templates/src/main/java/_package_/repository/search/UserSearchRepository.java.ejs +4 -4
- package/dist/generators/spring-data-neo4j/generator.mjs +43 -1
- package/dist/generators/spring-data-neo4j/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.spring_data_neo4j.ejs +1 -1
- package/dist/generators/spring-data-relational/README.md +7 -0
- package/dist/generators/spring-data-relational/generator.mjs +2 -1
- package/dist/generators/spring-data-relational/internal/dependencies.mjs +29 -8
- package/dist/generators/spring-data-relational/support/database-data.mjs +4 -0
- package/dist/generators/spring-data-relational/templates/src/main/java/_package_/repository/EntityManager_reactive.java.ejs +49 -8
- package/dist/generators/spring-data-relational/templates/src/test/java/_package_/config/SqlTestContainersSpringContextCustomizerFactory.java.ejs +1 -1
- package/dist/generators/upgrade/generator.mjs +3 -3
- package/dist/generators/vue/resources/package.json +21 -21
- package/dist/generators/vue/templates/package.json.ejs +1 -0
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.vue.ejs +1 -2
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.spec.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.ts.ejs +3 -3
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.vue.ejs +2 -15
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs +2 -7
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-basic-entity-converter.js +1 -0
- package/dist/jdl/converters/json-to-jdl-converter.js +1 -1
- package/dist/jdl/converters/json-to-jdl-entity-converter.js +1 -0
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/entity-converter.js +5 -0
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.js +0 -27
- package/dist/jdl/exporters/jhipster-entity-exporter.js +3 -2
- package/dist/jdl/jhipster/default-application-options.js +1 -1
- package/dist/jdl/jhipster/field-types.js +1 -1
- package/dist/jdl/jhipster/json-entity.js +6 -0
- package/dist/jdl/models/jdl-entity.js +16 -1
- package/dist/jdl/models/jdl-field.js +13 -0
- package/dist/jdl/models/jdl-object.js +3 -3
- package/dist/jdl/models/jdl-relationship.js +23 -5
- package/dist/jdl/parsing/lexer/application-tokens.js +1 -1
- package/dist/testing/helpers.mjs +10 -3
- package/dist/types/cli/environment-builder.d.mts +2 -0
- package/dist/types/generators/angular/needle-api/needle-client-angular.d.mts +0 -1
- package/dist/types/generators/base/api.d.mts +12 -0
- package/dist/types/generators/base/support/needles.d.mts +1 -1
- package/dist/types/generators/base-application/generator.d.mts +2 -2
- package/dist/types/generators/base-application/support/index.d.mts +1 -0
- package/dist/types/generators/base-application/support/update-application-entities-transform.d.mts +4 -0
- package/dist/types/generators/base-application/types/relationship.d.mts +4 -0
- package/dist/types/generators/base-core/generator.d.mts +7 -1
- package/dist/types/generators/bootstrap-application-base/support/export-jdl-transform.d.mts +8 -0
- package/dist/types/generators/bootstrap-application-base/support/import-jdl-transform.d.mts +6 -0
- package/dist/types/generators/bootstrap-application-base/support/index.d.mts +2 -0
- package/dist/types/generators/client/support/entity-definition.d.mts +2 -2
- package/dist/types/generators/feign-client/types-export.d.ts +1 -0
- package/dist/types/generators/generator-constants.d.mts +52 -48
- package/dist/types/generators/generator-list.d.mts +1 -0
- package/dist/types/generators/project-name/support/name-resolver.d.mts +9 -1
- package/dist/types/generators/server/options/feign-client.d.mts +21 -0
- package/dist/types/generators/server/options/index.d.mts +1 -0
- package/dist/types/jdl/converters/json-to-jdl-converter.d.ts +1 -0
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/option-converter.d.ts +1 -1
- package/dist/types/jdl/jhipster/json-entity.d.ts +2 -0
- package/dist/types/jdl/models/jdl-entity.d.ts +1 -0
- package/dist/types/jdl/models/jdl-relationship.d.ts +0 -18
- package/dist/types/jdl/types/types.d.mts +2 -2
- package/package.json +27 -27
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { parseCreationTimestamp } from './support/timestamp.mjs';
|
|
2
1
|
const command = {
|
|
3
2
|
options: {
|
|
4
3
|
useVersionPlaceholders: {
|
|
@@ -25,16 +24,6 @@ const command = {
|
|
|
25
24
|
type: Boolean,
|
|
26
25
|
scope: 'generator',
|
|
27
26
|
},
|
|
28
|
-
skipJhipsterDependencies: {
|
|
29
|
-
description: "Don't write jhipster dependencies to package.json.",
|
|
30
|
-
type: Boolean,
|
|
31
|
-
scope: 'storage',
|
|
32
|
-
},
|
|
33
|
-
creationTimestamp: {
|
|
34
|
-
description: 'Project creation timestamp (used for reproducible builds)',
|
|
35
|
-
type: parseCreationTimestamp,
|
|
36
|
-
scope: 'storage',
|
|
37
|
-
},
|
|
38
27
|
reproducible: {
|
|
39
28
|
description: 'Try to reproduce changelog',
|
|
40
29
|
type: Boolean,
|
|
@@ -21,7 +21,6 @@ import BaseGenerator from '../base/index.mjs';
|
|
|
21
21
|
import { CUSTOM_PRIORITIES, PRIORITY_NAMES, QUEUES } from './priorities.mjs';
|
|
22
22
|
import { JHIPSTER_CONFIG_DIR } from '../generator-constants.mjs';
|
|
23
23
|
import { getEntitiesFromDir } from './support/index.mjs';
|
|
24
|
-
import command from './command.mjs';
|
|
25
24
|
import { mutateData } from '../base/support/config.mjs';
|
|
26
25
|
const { LOADING, PREPARING, POST_PREPARING, CONFIGURING_EACH_ENTITY, LOADING_ENTITIES, PREPARING_EACH_ENTITY, PREPARING_EACH_ENTITY_FIELD, PREPARING_EACH_ENTITY_RELATIONSHIP, POST_PREPARING_EACH_ENTITY, DEFAULT, WRITING, POST_WRITING, WRITING_ENTITIES, POST_WRITING_ENTITIES, PRE_CONFLICTS, INSTALL, END, } = PRIORITY_NAMES;
|
|
27
26
|
const { CONFIGURING_EACH_ENTITY_QUEUE, LOADING_ENTITIES_QUEUE, PREPARING_EACH_ENTITY_QUEUE, PREPARING_EACH_ENTITY_FIELD_QUEUE, PREPARING_EACH_ENTITY_RELATIONSHIP_QUEUE, POST_PREPARING_EACH_ENTITY_QUEUE, WRITING_ENTITIES_QUEUE, POST_WRITING_ENTITIES_QUEUE, } = QUEUES;
|
|
@@ -43,7 +42,6 @@ export default class BaseApplicationGenerator extends BaseGenerator {
|
|
|
43
42
|
if (this.options.help) {
|
|
44
43
|
return;
|
|
45
44
|
}
|
|
46
|
-
this.parseJHipsterOptions(command.options);
|
|
47
45
|
this.registerPriorities(CUSTOM_PRIORITIES);
|
|
48
46
|
/* Add tasks allowing entities priorities to match normal priorities pattern */
|
|
49
47
|
this.on('queueOwnTasks', () => {
|
|
@@ -51,6 +49,7 @@ export default class BaseApplicationGenerator extends BaseGenerator {
|
|
|
51
49
|
this.queueEntityTasks();
|
|
52
50
|
});
|
|
53
51
|
if (this.options.applicationWithEntities) {
|
|
52
|
+
this.log.warn('applicationWithEntities option is deprecated');
|
|
54
53
|
// Write new definitions to memfs
|
|
55
54
|
this.config.set({
|
|
56
55
|
...this.config.getAll(),
|
|
@@ -95,7 +94,7 @@ export default class BaseApplicationGenerator extends BaseGenerator {
|
|
|
95
94
|
return this.createStorage(entityPath);
|
|
96
95
|
}
|
|
97
96
|
/**
|
|
98
|
-
* get sorted list of
|
|
97
|
+
* get sorted list of entity names according to changelog date (i.e. the order in which they were added)
|
|
99
98
|
*/
|
|
100
99
|
getExistingEntityNames() {
|
|
101
100
|
return this.getExistingEntities().map(entity => entity.name);
|
|
@@ -105,7 +104,7 @@ export default class BaseApplicationGenerator extends BaseGenerator {
|
|
|
105
104
|
*/
|
|
106
105
|
getExistingEntities() {
|
|
107
106
|
function isBefore(e1, e2) {
|
|
108
|
-
return e1.definition.changelogDate - e2.definition.changelogDate;
|
|
107
|
+
return (e1.definition.annotations?.changelogDate ?? 0) - (e2.definition.annotations?.changelogDate ?? 0);
|
|
109
108
|
}
|
|
110
109
|
const configDir = this.getEntitiesConfigPath();
|
|
111
110
|
const entities = [];
|
|
@@ -214,7 +213,7 @@ export default class BaseApplicationGenerator extends BaseGenerator {
|
|
|
214
213
|
*/
|
|
215
214
|
resetEntitiesFakeData(seed) {
|
|
216
215
|
seed = `${this.sharedData.getApplication().baseName}-${seed}`;
|
|
217
|
-
this.log.debug(`
|
|
216
|
+
this.log.debug(`Resetting entities seed with '${seed}'`);
|
|
218
217
|
this.sharedData.getEntities().forEach(({ entity }) => {
|
|
219
218
|
entity.resetFakerSeed(seed);
|
|
220
219
|
});
|
|
@@ -304,7 +303,7 @@ export default class BaseApplicationGenerator extends BaseGenerator {
|
|
|
304
303
|
/**
|
|
305
304
|
* @private
|
|
306
305
|
* Get entities to load.
|
|
307
|
-
* This method doesn't filter entities. An filtered config can be changed at
|
|
306
|
+
* This method doesn't filter entities. An filtered config can be changed at this priority.
|
|
308
307
|
* @returns {string[]}
|
|
309
308
|
*/
|
|
310
309
|
getEntitiesDataToLoad() {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { existsSync,
|
|
19
|
+
import { existsSync, opendirSync } from 'fs';
|
|
20
20
|
import { extname, basename } from 'path';
|
|
21
21
|
// eslint-disable-next-line import/prefer-default-export
|
|
22
22
|
export function getEntitiesFromDir(configDir) {
|
|
23
23
|
if (!existsSync(configDir)) {
|
|
24
|
-
|
|
24
|
+
return [];
|
|
25
25
|
}
|
|
26
26
|
const dir = opendirSync(configDir);
|
|
27
27
|
const entityNames = [];
|
|
@@ -28,3 +28,4 @@ export { default as prepareField } from './prepare-field.mjs';
|
|
|
28
28
|
export * from './prepare-field.mjs';
|
|
29
29
|
export { default as prepareRelationship } from './prepare-relationship.mjs';
|
|
30
30
|
export * from './relationship.mjs';
|
|
31
|
+
export * from './update-application-entities-transform.mjs';
|
|
@@ -499,7 +499,6 @@ function preparePostEntityCommonDerivedPropertiesNotTyped(entity) {
|
|
|
499
499
|
entity.anyPropertyHasValidation =
|
|
500
500
|
entity.anyPropertyHasValidation || relationships.some(({ relationshipValidate }) => relationshipValidate);
|
|
501
501
|
const relationshipsByOtherEntity = relationships
|
|
502
|
-
.filter(rel => !rel.otherEntity.embedded)
|
|
503
502
|
.map(relationship => [relationship.otherEntity.entityNameCapitalized, relationship])
|
|
504
503
|
.reduce((relationshipsByOtherEntity, [type, relationship]) => {
|
|
505
504
|
if (!relationshipsByOtherEntity[type]) {
|
|
@@ -57,6 +57,7 @@ export default function prepareRelationship(entityWithConfig, relationship, gene
|
|
|
57
57
|
// let ownerSide true when type is 'many-to-one' for convenience.
|
|
58
58
|
// means that this side should control the reference.
|
|
59
59
|
ownerSide: ({ ownerSide, relationshipLeftSide, relationshipManyToOne, relationshipOneToMany }) => ownerSide ?? (relationshipManyToOne || (relationshipLeftSide && !relationshipOneToMany)),
|
|
60
|
+
persistableRelationship: ({ persistableRelationship, ownerSide }) => persistableRelationship ?? ownerSide,
|
|
60
61
|
relationshipUpdateBackReference: ({ relationshipUpdateBackReference, ownerSide, relationshipRightSide }) => relationshipUpdateBackReference ?? (entityWithConfig.databaseType === 'neo4j' ? relationshipRightSide : !ownerSide),
|
|
61
62
|
});
|
|
62
63
|
relationship.otherSideReferenceExists = false;
|
|
@@ -78,6 +79,9 @@ export default function prepareRelationship(entityWithConfig, relationship, gene
|
|
|
78
79
|
entityWithConfig.databaseType !== NEO4J &&
|
|
79
80
|
entityWithConfig.databaseType !== DATABASE_NO &&
|
|
80
81
|
(relationship.relationshipType === 'one-to-many' || relationship.ownerSide === false)) {
|
|
82
|
+
if (otherEntityData.builtInUser) {
|
|
83
|
+
throw new Error(`Error at entity ${entityName}: relationships with built-in User cannot have back reference`);
|
|
84
|
+
}
|
|
81
85
|
throw new Error(`Error at entity ${entityName}: could not find the other side of the relationship ${stringifyApplicationData(relationship)}`);
|
|
82
86
|
}
|
|
83
87
|
else {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { readdir } from 'fs/promises';
|
|
2
|
+
import { loadFile } from 'mem-fs';
|
|
3
|
+
import { Minimatch } from 'minimatch';
|
|
4
|
+
import { transform } from 'p-transform';
|
|
5
|
+
import { basename, join } from 'path';
|
|
6
|
+
import { GENERATOR_JHIPSTER } from '../../generator-constants.mjs';
|
|
7
|
+
export const updateApplicationEntitiesTransform = ({ destinationPath, throwOnMissingConfig = true, }) => {
|
|
8
|
+
let yoRcFileInMemory;
|
|
9
|
+
const entities = [];
|
|
10
|
+
const yoRcFilePath = join(destinationPath, '.yo-rc.json');
|
|
11
|
+
const entitiesMatcher = new Minimatch(`${destinationPath}/.jhipster/*.json`);
|
|
12
|
+
return transform(file => {
|
|
13
|
+
if (file.path === yoRcFilePath) {
|
|
14
|
+
yoRcFileInMemory = file;
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
if (entitiesMatcher.match(file.path)) {
|
|
18
|
+
entities.push(basename(file.path).replace('.json', ''));
|
|
19
|
+
}
|
|
20
|
+
return file;
|
|
21
|
+
}, async function () {
|
|
22
|
+
try {
|
|
23
|
+
entities.push(...(await readdir(join(destinationPath, '.jhipster'))).map(file => file.replace('.json', '')));
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Directory does not exist
|
|
27
|
+
}
|
|
28
|
+
if (entities.length > 0) {
|
|
29
|
+
// The mem-fs instance requires another file instance to emit a change event
|
|
30
|
+
const yoRcFile = loadFile(yoRcFilePath);
|
|
31
|
+
// Prefer in-memory file if it exists
|
|
32
|
+
const yoRcFileContents = yoRcFileInMemory?.contents ?? yoRcFile.contents;
|
|
33
|
+
if (yoRcFileContents) {
|
|
34
|
+
const contents = JSON.parse(yoRcFileContents.toString());
|
|
35
|
+
if (contents[GENERATOR_JHIPSTER]) {
|
|
36
|
+
contents[GENERATOR_JHIPSTER].entities = [...new Set([...(contents[GENERATOR_JHIPSTER].entities ?? []), ...entities])];
|
|
37
|
+
yoRcFile.contents = Buffer.from(JSON.stringify(contents, null, 2));
|
|
38
|
+
yoRcFileInMemory = yoRcFile;
|
|
39
|
+
}
|
|
40
|
+
else if (throwOnMissingConfig) {
|
|
41
|
+
throw new Error(`File ${yoRcFile.path} is not a valid JHipster configuration file`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (throwOnMissingConfig) {
|
|
45
|
+
throw new Error(`File ${yoRcFile.path} has no contents`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (yoRcFileInMemory) {
|
|
49
|
+
this.push(yoRcFileInMemory);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
@@ -116,7 +116,7 @@ export default class CoreGenerator extends YeomanGenerator {
|
|
|
116
116
|
}
|
|
117
117
|
this.registerPriorities(CUSTOM_PRIORITIES);
|
|
118
118
|
if (this.getFeatures().jhipsterBootstrap ?? true) {
|
|
119
|
-
// jhipster:bootstrap is always required. Run it once the
|
|
119
|
+
// jhipster:bootstrap is always required. Run it once the environment starts.
|
|
120
120
|
this.env.queueTask('environment:run', async () => this.composeWithJHipster(GENERATOR_BOOTSTRAP).then(), {
|
|
121
121
|
once: 'queueJhipsterBootstrap',
|
|
122
122
|
startQueue: false,
|
|
@@ -141,6 +141,19 @@ export default class CoreGenerator extends YeomanGenerator {
|
|
|
141
141
|
}
|
|
142
142
|
return this._needleApi;
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Warn or throws check failure based on current skipChecks option.
|
|
146
|
+
* @param message
|
|
147
|
+
*/
|
|
148
|
+
handleCheckFailure(message) {
|
|
149
|
+
if (this.skipChecks) {
|
|
150
|
+
this.log.warn(message);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
throw new Error(`${message}
|
|
154
|
+
You can ignore this error by passing '--skip-checks' to jhipster command.`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
144
157
|
/**
|
|
145
158
|
* Check if the JHipster version used to generate an existing project is less than the passed version argument
|
|
146
159
|
*
|
|
@@ -189,7 +202,7 @@ export default class CoreGenerator extends YeomanGenerator {
|
|
|
189
202
|
*/
|
|
190
203
|
getTaskNames() {
|
|
191
204
|
let priorities = super.getTaskNames();
|
|
192
|
-
if (this.options.skipPriorities) {
|
|
205
|
+
if (!this.features.disableSkipPriorities && this.options.skipPriorities) {
|
|
193
206
|
// Make sure yeoman-generator will not throw on empty tasks due to filtered priorities.
|
|
194
207
|
this.customLifecycle = priorities.length > 0;
|
|
195
208
|
priorities = priorities.filter(priorityName => !this.options.skipPriorities.includes(priorityName));
|
|
@@ -226,7 +239,7 @@ export default class CoreGenerator extends YeomanGenerator {
|
|
|
226
239
|
if (!optionDesc?.type || !optionDesc.scope || (common && optionDesc.scope === 'generator'))
|
|
227
240
|
return;
|
|
228
241
|
let optionValue;
|
|
229
|
-
// Hidden options are test options, which doesn't rely on
|
|
242
|
+
// Hidden options are test options, which doesn't rely on commander for options parsing.
|
|
230
243
|
// We must parse environment variables manually
|
|
231
244
|
if (this.options[optionDesc.name ?? optionName] === undefined && optionDesc.env && process.env[optionDesc.env]) {
|
|
232
245
|
optionValue = process.env[optionDesc.env];
|
|
@@ -413,7 +426,7 @@ export default class CoreGenerator extends YeomanGenerator {
|
|
|
413
426
|
generator = namespace;
|
|
414
427
|
}
|
|
415
428
|
else {
|
|
416
|
-
// Keep test
|
|
429
|
+
// Keep test compatibility were jhipster lookup does not run.
|
|
417
430
|
const found = ['/index.js', '/index.cjs', '/index.mjs', '/index.ts', '/index.cts', '/index.mts'].find(extension => {
|
|
418
431
|
const pathToLook = join(__dirname, `../${generator}${extension}`);
|
|
419
432
|
return existsSync(pathToLook) ? pathToLook : undefined;
|
|
@@ -64,7 +64,7 @@ export default class GeneratorBaseEntityChanges extends GeneratorBaseApplication
|
|
|
64
64
|
const { generateBuiltInUserEntity, incrementalChangelog } = this.sharedData.getApplication();
|
|
65
65
|
const entityNames = this.getExistingEntityNames();
|
|
66
66
|
const entitiesByName = Object.fromEntries(entityNames.map(entityName => [entityName, this.sharedData.getEntity(entityName)]));
|
|
67
|
-
const entitiesWithExistingChangelog = entityNames.filter(entityName => !this.isChangelogNew({ entityName, changelogDate: entitiesByName[entityName].changelogDate }));
|
|
67
|
+
const entitiesWithExistingChangelog = entityNames.filter(entityName => !this.isChangelogNew({ entityName, changelogDate: entitiesByName[entityName].annotations?.changelogDate }));
|
|
68
68
|
const previousEntitiesByName = Object.fromEntries(entityNames
|
|
69
69
|
.filter(entityName => existsSync(this.getEntityConfigPath(entityName)))
|
|
70
70
|
.map(entityName => [
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
+
import { Duplex } from 'stream';
|
|
19
20
|
import { forceYoFiles, createConflicterTransform, createYoResolveTransform } from '@yeoman/conflicter';
|
|
20
|
-
import { isFileStateModified } from 'mem-fs-editor/state';
|
|
21
|
+
import { isFileStateModified, isFilePending } from 'mem-fs-editor/state';
|
|
21
22
|
import { createCommitTransform } from 'mem-fs-editor/transform';
|
|
22
23
|
import BaseGenerator from '../base/index.mjs';
|
|
23
24
|
import { createMultiStepTransform, createPrettierTransform, createForceWriteConfigFilesTransform, autoCrlfTransform, isPrettierConfigFilePath, createSortConfigFilesTransform, createESLintTransform, createRemoveUnusedImportsTransform, } from './support/index.mjs';
|
|
@@ -37,8 +38,9 @@ export default class BootstrapGenerator extends BaseGenerator {
|
|
|
37
38
|
skipPrettier;
|
|
38
39
|
prettierExtensions = PRETTIER_EXTENSIONS.split(',');
|
|
39
40
|
prettierOptions = { plugins: [] };
|
|
41
|
+
refreshOnCommit = false;
|
|
40
42
|
constructor(args, options, features) {
|
|
41
|
-
super(args, options, { jhipsterBootstrap: false, uniqueGlobally: true, customCommitTask: () => this.
|
|
43
|
+
super(args, options, { jhipsterBootstrap: false, uniqueGlobally: true, customCommitTask: () => this.commitTask(), ...features });
|
|
42
44
|
}
|
|
43
45
|
async beforeQueue() {
|
|
44
46
|
loadStoredAppOptions.call(this);
|
|
@@ -55,7 +57,7 @@ export default class BootstrapGenerator extends BaseGenerator {
|
|
|
55
57
|
get initializing() {
|
|
56
58
|
return this.asInitializingTaskGroup({
|
|
57
59
|
loadOptions() {
|
|
58
|
-
this.parseJHipsterOptions(command.options);
|
|
60
|
+
this.parseJHipsterOptions(command.options, command.configs);
|
|
59
61
|
},
|
|
60
62
|
validateBlueprint() {
|
|
61
63
|
if (this.jhipsterConfig.blueprints && !this.skipChecks) {
|
|
@@ -135,16 +137,22 @@ export default class BootstrapGenerator extends BaseGenerator {
|
|
|
135
137
|
}
|
|
136
138
|
async commitPrettierConfig() {
|
|
137
139
|
await this.commitSharedFs({
|
|
138
|
-
log: 'prettier configuration files
|
|
140
|
+
log: 'prettier configuration files committed to disk',
|
|
139
141
|
filter: file => isPrettierConfigFilePath(file.path),
|
|
140
142
|
});
|
|
141
143
|
}
|
|
144
|
+
async commitTask() {
|
|
145
|
+
await this.commitSharedFs({ refresh: this.refreshOnCommit }, ...this.env
|
|
146
|
+
.findFeature('commitTransformFactory')
|
|
147
|
+
.map(({ feature }) => feature())
|
|
148
|
+
.flat());
|
|
149
|
+
}
|
|
142
150
|
/**
|
|
143
151
|
* Commits the MemFs to the disc.
|
|
144
152
|
*/
|
|
145
|
-
async commitSharedFs({ log, ...options } = {}) {
|
|
153
|
+
async commitSharedFs({ log, ...options } = {}, ...transforms) {
|
|
146
154
|
const skipYoResolveTransforms = [];
|
|
147
|
-
if (this.options.skipYoResolve) {
|
|
155
|
+
if (!this.options.skipYoResolve) {
|
|
148
156
|
skipYoResolveTransforms.push(createYoResolveTransform());
|
|
149
157
|
}
|
|
150
158
|
const prettierTransforms = [];
|
|
@@ -172,12 +180,22 @@ export default class BootstrapGenerator extends BaseGenerator {
|
|
|
172
180
|
createConflicterTransform(this.env.adapter, { ...this.env.conflicterOptions }),
|
|
173
181
|
createCommitTransform(),
|
|
174
182
|
];
|
|
175
|
-
// Disable progress since it blocks stdin.
|
|
176
183
|
await this.pipeline({
|
|
177
184
|
refresh: false,
|
|
185
|
+
// Let pending files pass through.
|
|
186
|
+
pendingFiles: false,
|
|
178
187
|
...options,
|
|
188
|
+
// Disable progress since it blocks stdin.
|
|
179
189
|
disabled: true,
|
|
180
|
-
}, ...
|
|
181
|
-
|
|
190
|
+
}, ...transforms,
|
|
191
|
+
// Filter out pending files.
|
|
192
|
+
Duplex.from(async function* (files) {
|
|
193
|
+
for await (const file of files) {
|
|
194
|
+
if (isFilePending(file)) {
|
|
195
|
+
yield file;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}), ...transformStreams);
|
|
199
|
+
this.log.ok(log ?? 'files committed to disk');
|
|
182
200
|
}
|
|
183
201
|
}
|
|
@@ -22,8 +22,6 @@ import { validations } from '../../jdl/jhipster/index.mjs';
|
|
|
22
22
|
import { stringifyApplicationData, derivedPrimaryKeyProperties, preparePostEntitiesCommonDerivedProperties, preparePostEntityCommonDerivedProperties, } from '../base-application/support/index.mjs';
|
|
23
23
|
import { GENERATOR_BOOTSTRAP_APPLICATION, GENERATOR_BOOTSTRAP_APPLICATION_CLIENT, GENERATOR_BOOTSTRAP_APPLICATION_SERVER, } from '../generator-list.mjs';
|
|
24
24
|
import { preparePostEntityServerDerivedProperties } from '../server/support/index.mjs';
|
|
25
|
-
import { getDefaultAppName } from '../project-name/support/index.mjs';
|
|
26
|
-
import { packageJson } from '../../lib/index.mjs';
|
|
27
25
|
import { loadStoredAppOptions } from '../app/support/index.mjs';
|
|
28
26
|
import { JHIPSTER_DOCUMENTATION_ARCHIVE_PATH, JHIPSTER_DOCUMENTATION_URL } from '../generator-constants.mjs';
|
|
29
27
|
const { Validations: { MAX, MIN, MAXLENGTH, MINLENGTH, MAXBYTES, MINBYTES, PATTERN }, SUPPORTED_VALIDATION_RULES, } = validations;
|
|
@@ -44,22 +42,6 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera
|
|
|
44
42
|
await this.dependsOnJHipster(GENERATOR_BOOTSTRAP_APPLICATION_CLIENT);
|
|
45
43
|
await this.dependsOnJHipster(GENERATOR_BOOTSTRAP_APPLICATION_SERVER);
|
|
46
44
|
}
|
|
47
|
-
get configuring() {
|
|
48
|
-
return this.asConfiguringTaskGroup({
|
|
49
|
-
defaults() {
|
|
50
|
-
if (!this.options.reproducible) {
|
|
51
|
-
this.config.defaults({
|
|
52
|
-
jhipsterVersion: packageJson.version,
|
|
53
|
-
baseName: getDefaultAppName(this),
|
|
54
|
-
creationTimestamp: new Date().getTime(),
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
get [BaseApplicationGenerator.CONFIGURING]() {
|
|
61
|
-
return this.configuring;
|
|
62
|
-
}
|
|
63
45
|
get preparing() {
|
|
64
46
|
return this.asPreparingTaskGroup({
|
|
65
47
|
preparing({ application, applicationDefaults }) {
|
|
@@ -152,7 +134,7 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera
|
|
|
152
134
|
if (new Set(properties).size !== properties.length) {
|
|
153
135
|
// Has duplicated properties.
|
|
154
136
|
const duplicated = [...new Set(properties.filter((v, i, a) => a.indexOf(v) !== i))];
|
|
155
|
-
throw new Error(`You have
|
|
137
|
+
throw new Error(`You have duplicate properties in entity ${entity.name}: ${duplicated.join(', ')}`);
|
|
156
138
|
}
|
|
157
139
|
}
|
|
158
140
|
},
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { parseCreationTimestamp } from '../base/support/timestamp.mjs';
|
|
2
|
+
const command = {
|
|
3
|
+
options: {
|
|
4
|
+
baseName: {
|
|
5
|
+
description: 'Application base name',
|
|
6
|
+
type: String,
|
|
7
|
+
scope: 'storage',
|
|
8
|
+
},
|
|
9
|
+
skipJhipsterDependencies: {
|
|
10
|
+
description: "Don't write jhipster dependencies to package.json.",
|
|
11
|
+
type: Boolean,
|
|
12
|
+
scope: 'storage',
|
|
13
|
+
},
|
|
14
|
+
creationTimestamp: {
|
|
15
|
+
description: 'Project creation timestamp (used for reproducible builds)',
|
|
16
|
+
type: parseCreationTimestamp,
|
|
17
|
+
scope: 'storage',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
configs: {
|
|
21
|
+
jdlStore: {
|
|
22
|
+
description: 'JDL store',
|
|
23
|
+
cli: {
|
|
24
|
+
type: String,
|
|
25
|
+
},
|
|
26
|
+
scope: 'storage',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export default command;
|
|
@@ -30,6 +30,8 @@ import { GENERATOR_BOOTSTRAP, GENERATOR_BOOTSTRAP_APPLICATION_BASE, GENERATOR_CO
|
|
|
30
30
|
import { packageJson } from '../../lib/index.mjs';
|
|
31
31
|
import { loadLanguagesConfig } from '../languages/support/index.mjs';
|
|
32
32
|
import { loadAppConfig, loadDerivedAppConfig, loadStoredAppOptions } from '../app/support/index.mjs';
|
|
33
|
+
import { exportJDLTransform, importJDLTransform } from './support/index.mjs';
|
|
34
|
+
import command from './command.mjs';
|
|
33
35
|
const isWin32 = os.platform() === 'win32';
|
|
34
36
|
const { lowerFirst } = _;
|
|
35
37
|
export default class BootstrapApplicationBase extends BaseApplicationGenerator {
|
|
@@ -46,7 +48,8 @@ export default class BootstrapApplicationBase extends BaseApplicationGenerator {
|
|
|
46
48
|
if (this.delegateToBlueprint) {
|
|
47
49
|
throw new Error('Only sbs blueprint is supported');
|
|
48
50
|
}
|
|
49
|
-
await this.dependsOnJHipster(GENERATOR_PROJECT_NAME);
|
|
51
|
+
const projectNameGenerator = (await this.dependsOnJHipster(GENERATOR_PROJECT_NAME));
|
|
52
|
+
projectNameGenerator.javaApplication = true;
|
|
50
53
|
await this.composeWithJHipster(GENERATOR_BOOTSTRAP);
|
|
51
54
|
}
|
|
52
55
|
get initializing() {
|
|
@@ -54,6 +57,19 @@ export default class BootstrapApplicationBase extends BaseApplicationGenerator {
|
|
|
54
57
|
displayLogo() {
|
|
55
58
|
this.printDestinationInfo();
|
|
56
59
|
},
|
|
60
|
+
parseOptions() {
|
|
61
|
+
this.parseJHipsterCommand(command);
|
|
62
|
+
},
|
|
63
|
+
async jdlStore() {
|
|
64
|
+
if (this.jhipsterConfig.jdlStore) {
|
|
65
|
+
this.logger.warn('Storing configuration inside a JDL file is experimental');
|
|
66
|
+
this.logger.info(`Using JDL store ${this.jhipsterConfig.jdlStore}`);
|
|
67
|
+
const destinationPath = this.destinationPath();
|
|
68
|
+
const jdlStorePath = this.destinationPath(this.jhipsterConfig.jdlStore);
|
|
69
|
+
this.features.commitTransformFactory = () => exportJDLTransform({ destinationPath, jdlStorePath });
|
|
70
|
+
await this.pipeline({ refresh: true, pendingFiles: false }, importJDLTransform({ destinationPath, jdlStorePath }));
|
|
71
|
+
}
|
|
72
|
+
},
|
|
57
73
|
});
|
|
58
74
|
}
|
|
59
75
|
get [BaseApplicationGenerator.INITIALIZING]() {
|
|
@@ -113,9 +129,14 @@ export default class BootstrapApplicationBase extends BaseApplicationGenerator {
|
|
|
113
129
|
get configuringEachEntity() {
|
|
114
130
|
return this.asConfiguringEachEntityTaskGroup({
|
|
115
131
|
configureEntity({ entityStorage, entityConfig }) {
|
|
116
|
-
entityStorage.defaults({ fields: [], relationships: [] });
|
|
117
|
-
if (entityConfig.changelogDate
|
|
118
|
-
entityConfig.changelogDate =
|
|
132
|
+
entityStorage.defaults({ fields: [], relationships: [], annotations: {} });
|
|
133
|
+
if (entityConfig.changelogDate) {
|
|
134
|
+
entityConfig.annotations.changelogDate = entityConfig.changelogDate;
|
|
135
|
+
delete entityConfig.changelogDate;
|
|
136
|
+
}
|
|
137
|
+
if (!entityConfig.annotations.changelogDate) {
|
|
138
|
+
entityConfig.annotations.changelogDate = this.dateFormatForLiquibase();
|
|
139
|
+
entityStorage.save();
|
|
119
140
|
}
|
|
120
141
|
},
|
|
121
142
|
configureRelationships({ entityName, entityStorage, entityConfig }) {
|
|
@@ -172,8 +193,9 @@ export default class BootstrapApplicationBase extends BaseApplicationGenerator {
|
|
|
172
193
|
}
|
|
173
194
|
}
|
|
174
195
|
else {
|
|
175
|
-
|
|
196
|
+
let entity = entityStorage.getAll();
|
|
176
197
|
entity.name = entity.name ?? entityName;
|
|
198
|
+
entity = { ...entity, ...entity.annotations };
|
|
177
199
|
this.sharedData.setEntity(entityName, entity);
|
|
178
200
|
}
|
|
179
201
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { basename, join } from 'path';
|
|
2
|
+
import { Duplex } from 'stream';
|
|
3
|
+
import { loadFile } from 'mem-fs';
|
|
4
|
+
import { Minimatch } from 'minimatch';
|
|
5
|
+
import { setModifiedFileState } from 'mem-fs-editor/state';
|
|
6
|
+
import { GENERATOR_JHIPSTER } from '../../generator-constants.mjs';
|
|
7
|
+
import { getJDLObjectFromSingleApplication } from '../../../jdl/converters/json-to-jdl-converter.js';
|
|
8
|
+
export const exportJDLTransform = ({ destinationPath, jdlStorePath, throwOnMissingConfig = true, keepEntitiesConfig, }) => Duplex.from(async function* (files) {
|
|
9
|
+
const yoRcFilePath = join(destinationPath, '.yo-rc.json');
|
|
10
|
+
const entitiesMatcher = new Minimatch(`${destinationPath}/.jhipster/*.json`);
|
|
11
|
+
const entitiesFiles = [];
|
|
12
|
+
const entitiesMap = new Map();
|
|
13
|
+
let yoRcFileInMemory;
|
|
14
|
+
let jdlStoreFileInMemory;
|
|
15
|
+
for await (const file of files) {
|
|
16
|
+
if (file.path === yoRcFilePath) {
|
|
17
|
+
yoRcFileInMemory = file;
|
|
18
|
+
}
|
|
19
|
+
else if (file.path === jdlStorePath) {
|
|
20
|
+
jdlStoreFileInMemory = file;
|
|
21
|
+
}
|
|
22
|
+
else if (file.contents && entitiesMatcher.match(file.path)) {
|
|
23
|
+
entitiesMap.set(basename(file.path).replace('.json', ''), JSON.parse(file.contents.toString()));
|
|
24
|
+
entitiesFiles.push(file);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
yield file;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const yoRcFile = loadFile(yoRcFilePath);
|
|
31
|
+
const yoRcContents = yoRcFileInMemory?.contents ?? yoRcFile.contents;
|
|
32
|
+
if (yoRcContents) {
|
|
33
|
+
const contents = JSON.parse(yoRcContents.toString());
|
|
34
|
+
if (contents[GENERATOR_JHIPSTER]?.jdlStore) {
|
|
35
|
+
const { jdlStore, jwtSecretKey, rememberMeKey, jhipsterVersion, creationTimestamp, incrementalChangelog, ...rest } = contents[GENERATOR_JHIPSTER];
|
|
36
|
+
const jdlObject = getJDLObjectFromSingleApplication({ ...contents, [GENERATOR_JHIPSTER]: { ...rest, incrementalChangelog } }, entitiesMap);
|
|
37
|
+
const jdlContents = jdlObject.toString();
|
|
38
|
+
const jdlStoreFile = jdlStoreFileInMemory ?? loadFile(jdlStorePath);
|
|
39
|
+
jdlStoreFile.contents = Buffer.from(jdlContents);
|
|
40
|
+
setModifiedFileState(jdlStoreFile);
|
|
41
|
+
jdlStoreFile.conflicter = 'force';
|
|
42
|
+
yield jdlStoreFile;
|
|
43
|
+
yoRcFile.contents = Buffer.from(JSON.stringify({ [GENERATOR_JHIPSTER]: { jdlStore, jwtSecretKey, rememberMeKey, jhipsterVersion, creationTimestamp } }, null, 2));
|
|
44
|
+
setModifiedFileState(yoRcFile);
|
|
45
|
+
yoRcFile.conflicter = 'force';
|
|
46
|
+
yield yoRcFile;
|
|
47
|
+
// Incremental changelog requires entities files to be kept for incremental change at next run
|
|
48
|
+
if (keepEntitiesConfig || incrementalChangelog) {
|
|
49
|
+
for (const file of entitiesFiles) {
|
|
50
|
+
yield file;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (throwOnMissingConfig) {
|
|
55
|
+
throw new Error(`File ${yoRcFilePath} is not a valid JHipster configuration file`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (throwOnMissingConfig) {
|
|
59
|
+
throw new Error(`File ${yoRcFilePath} has no contents`);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Duplex } from 'stream';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { loadFile } from 'mem-fs';
|
|
4
|
+
import { Minimatch } from 'minimatch';
|
|
5
|
+
import { upperFirst } from 'lodash-es';
|
|
6
|
+
import { GENERATOR_JHIPSTER } from '../../generator-constants.mjs';
|
|
7
|
+
import { createImporterFromContent } from '../../../jdl/jdl-importer.js';
|
|
8
|
+
import { mergeYoRcContent } from '../../../jdl/index.js';
|
|
9
|
+
export const importJDLTransform = ({ destinationPath, jdlStorePath }) => Duplex.from(async function* (files) {
|
|
10
|
+
const yoRcFilePath = join(destinationPath, '.yo-rc.json');
|
|
11
|
+
const entitiesFolder = join(destinationPath, '.jhipster');
|
|
12
|
+
const entitiesMatcher = new Minimatch(`${entitiesFolder}/*.json`);
|
|
13
|
+
const entityFields = [];
|
|
14
|
+
let jdlStoreFileInMemory;
|
|
15
|
+
let yoRcFileInMemory;
|
|
16
|
+
for await (const file of files) {
|
|
17
|
+
if (file.path === jdlStorePath) {
|
|
18
|
+
jdlStoreFileInMemory = file;
|
|
19
|
+
yield jdlStoreFileInMemory;
|
|
20
|
+
}
|
|
21
|
+
else if (file.path === yoRcFilePath) {
|
|
22
|
+
yoRcFileInMemory = file;
|
|
23
|
+
}
|
|
24
|
+
else if (entitiesMatcher.match(file.path)) {
|
|
25
|
+
entityFields.push(file);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
yield file;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const jdlStoreContents = jdlStoreFileInMemory?.contents ?? loadFile(jdlStorePath).contents;
|
|
32
|
+
if (!jdlStoreContents) {
|
|
33
|
+
if (yoRcFileInMemory) {
|
|
34
|
+
yield yoRcFileInMemory;
|
|
35
|
+
}
|
|
36
|
+
for (const file of entityFields) {
|
|
37
|
+
yield file;
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (entityFields.length > 0) {
|
|
42
|
+
throw new Error('Entities configuration files are not supported by jdlStore');
|
|
43
|
+
}
|
|
44
|
+
const importer = createImporterFromContent(jdlStoreContents.toString());
|
|
45
|
+
const importState = importer.import();
|
|
46
|
+
const applicationWithEntities = Object.values(importState.exportedApplicationsWithEntities);
|
|
47
|
+
if (applicationWithEntities.length !== 1) {
|
|
48
|
+
throw new Error(`JDL stores supports only jdls with 1 application, found ${applicationWithEntities.length}`);
|
|
49
|
+
}
|
|
50
|
+
const { config, namespaceConfigs, entities } = applicationWithEntities[0];
|
|
51
|
+
const yoRcFile = loadFile(yoRcFilePath);
|
|
52
|
+
const yoRcContents = yoRcFileInMemory?.contents ?? yoRcFile.contents;
|
|
53
|
+
yoRcFile.contents = Buffer.from(JSON.stringify(mergeYoRcContent(yoRcContents ? JSON.parse(yoRcContents.toString()) : {}, {
|
|
54
|
+
...namespaceConfigs,
|
|
55
|
+
[GENERATOR_JHIPSTER]: config,
|
|
56
|
+
}), null, 2));
|
|
57
|
+
yield yoRcFile;
|
|
58
|
+
for (const entity of entities) {
|
|
59
|
+
const configFile = join(entitiesFolder, `${upperFirst(entity.name)}.json`);
|
|
60
|
+
const file = loadFile(configFile);
|
|
61
|
+
file.contents = Buffer.from(JSON.stringify(entity, null, 2));
|
|
62
|
+
yield file;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
@@ -20,6 +20,7 @@ import chalk from 'chalk';
|
|
|
20
20
|
import * as _ from 'lodash-es';
|
|
21
21
|
import { testFrameworkTypes } from '../../jdl/jhipster/index.mjs';
|
|
22
22
|
import { APPLICATION_TYPE_GATEWAY, APPLICATION_TYPE_MICROSERVICE, clientFrameworkTypes } from '../../jdl/index.js';
|
|
23
|
+
import { GENERATOR_COMMON } from '../generator-list.mjs';
|
|
23
24
|
const { CYPRESS } = testFrameworkTypes;
|
|
24
25
|
const { intersection } = _;
|
|
25
26
|
const { ANGULAR, REACT, VUE, NO: CLIENT_FRAMEWORK_NO } = clientFrameworkTypes;
|
|
@@ -116,5 +117,6 @@ const command = {
|
|
|
116
117
|
},
|
|
117
118
|
},
|
|
118
119
|
},
|
|
120
|
+
import: [GENERATOR_COMMON],
|
|
119
121
|
};
|
|
120
122
|
export default command;
|