generator-jhipster 7.3.1 → 7.4.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.
Files changed (154) hide show
  1. package/cli/jhipster-command.js +2 -2
  2. package/cli/program.js +31 -29
  3. package/generators/app/index.js +30 -25
  4. package/generators/aws/index.js +8 -8
  5. package/generators/aws/lib/eb.js +1 -1
  6. package/generators/azure-app-service/index.js +13 -9
  7. package/generators/azure-spring-cloud/index.js +13 -9
  8. package/generators/bootstrap/index.js +49 -59
  9. package/generators/ci-cd/index.js +10 -8
  10. package/generators/client/files-common.js +6 -2
  11. package/generators/client/files-react.js +10 -1
  12. package/generators/client/files-vue.js +40 -1
  13. package/generators/client/index.js +42 -31
  14. package/generators/client/needle-api/needle-client-vue.js +1 -1
  15. package/generators/client/templates/angular/.eslintrc.json.ejs +1 -0
  16. package/generators/client/templates/angular/package.json +14 -14
  17. package/generators/client/templates/angular/src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.html.ejs +2 -2
  18. package/generators/client/templates/common/package.json +3 -3
  19. package/generators/client/templates/common/webpack/webpack.microfrontend.js.jhi.ejs +56 -0
  20. package/generators/client/templates/react/.eslintrc.json.ejs +1 -0
  21. package/generators/client/templates/react/package.json +44 -43
  22. package/generators/client/templates/react/package.json.ejs +3 -0
  23. package/generators/client/templates/react/src/main/webapp/app/app.scss.ejs +0 -3
  24. package/generators/client/templates/react/src/main/webapp/app/modules/administration/configuration/configuration.tsx.ejs +2 -2
  25. package/generators/client/templates/react/src/main/webapp/app/modules/administration/gateway/gateway.tsx.ejs +2 -2
  26. package/generators/client/templates/react/src/main/webapp/app/modules/administration/metrics/metrics.tsx.ejs +6 -6
  27. package/generators/client/templates/react/src/main/webapp/app/modules/administration/user-management/user-management.tsx.ejs +8 -8
  28. package/generators/client/templates/react/src/main/webapp/app/modules/home/home.tsx.ejs +1 -1
  29. package/generators/client/templates/react/src/main/webapp/app/shared/layout/header/header.tsx.ejs +1 -1
  30. package/generators/client/templates/react/src/main/webapp/app/shared/layout/menus/account.tsx.ejs +3 -3
  31. package/generators/client/templates/react/src/main/webapp/app/shared/layout/menus/admin.tsx.ejs +7 -7
  32. package/generators/client/templates/react/src/main/webapp/app/shared/layout/menus/menu-components.tsx.ejs +1 -1
  33. package/generators/client/templates/react/webpack/webpack.dev.js.ejs +17 -1
  34. package/generators/client/templates/react/webpack/webpack.prod.js.ejs +13 -1
  35. package/generators/client/templates/vue/.eslintrc.js.ejs +8 -5
  36. package/generators/client/templates/vue/package.json +31 -38
  37. package/generators/client/templates/vue/package.json.ejs +8 -10
  38. package/generators/client/templates/vue/src/main/webapp/app/account/account.service.ts.ejs +1 -2
  39. package/generators/client/templates/vue/src/main/webapp/app/account/settings/settings.vue.ejs +7 -1
  40. package/generators/client/templates/vue/src/main/webapp/app/admin/configuration/configuration.vue.ejs +1 -1
  41. package/generators/client/templates/vue/src/main/webapp/app/admin/metrics/metrics.component.ts.ejs +1 -1
  42. package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +12 -1
  43. package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs +6 -0
  44. package/generators/client/templates/vue/src/main/webapp/app/declarations.d.ts.ejs +41 -0
  45. package/generators/client/templates/vue/src/main/webapp/app/entities/entities-menu.component.ts.ejs +34 -0
  46. package/generators/client/templates/vue/src/main/webapp/app/entities/entities-menu.vue.ejs +13 -0
  47. package/generators/client/templates/vue/src/main/webapp/app/entities/entities.component.ts.ejs +12 -0
  48. package/generators/client/templates/vue/src/main/webapp/app/entities/entities.vue.ejs +5 -0
  49. package/generators/client/templates/vue/src/main/webapp/app/index.ts.ejs +19 -0
  50. package/generators/client/templates/vue/src/main/webapp/app/locale/translation.service.ts.ejs +25 -8
  51. package/generators/client/templates/vue/src/main/webapp/app/main.ts.ejs +9 -4
  52. package/generators/client/templates/vue/src/main/webapp/app/router/entities.ts.ejs +44 -1
  53. package/generators/client/templates/vue/src/main/webapp/app/router/index.ts.ejs +11 -0
  54. package/generators/client/templates/vue/src/main/webapp/app/shims-vue.d.ts.ejs +0 -10
  55. package/generators/client/templates/vue/src/test/javascript/jest.conf.js.ejs +19 -8
  56. package/generators/client/templates/vue/src/test/javascript/spec/app/entities/entities-menu.spec.ts.ejs +52 -0
  57. package/generators/client/templates/vue/src/test/javascript/spec/app/microfrontends/entities-menu.component.ts.ejs +4 -0
  58. package/generators/client/templates/vue/src/test/javascript/spec/app/microfrontends/entities-menu.vue.ejs +7 -0
  59. package/generators/client/templates/vue/src/test/javascript/spec/app/microfrontends/entities-router.ts.ejs +1 -0
  60. package/generators/client/templates/vue/tsconfig.json.ejs +5 -9
  61. package/generators/client/templates/vue/tsconfig.spec.json.ejs +37 -0
  62. package/generators/client/templates/vue/webpack/config.js.ejs +2 -0
  63. package/generators/client/templates/vue/webpack/vue.utils.js.ejs +13 -12
  64. package/generators/client/templates/vue/webpack/webpack.common.js.ejs +64 -50
  65. package/generators/client/templates/vue/webpack/webpack.dev.js.ejs +17 -68
  66. package/generators/client/templates/vue/webpack/webpack.microfrontend.js.jhi.vue.ejs +77 -0
  67. package/generators/client/templates/vue/webpack/webpack.prod.js.ejs +1 -30
  68. package/generators/cloudfoundry/index.js +9 -9
  69. package/generators/common/index.js +12 -10
  70. package/generators/common/templates/package.json +4 -4
  71. package/generators/cypress/index.js +12 -9
  72. package/generators/cypress/templates/cypress.json.ejs +3 -0
  73. package/generators/cypress/templates/src/test/javascript/cypress/plugins/index.ts.ejs +3 -3
  74. package/generators/cypress/templates/src/test/javascript/cypress/support/entity.ts.ejs +2 -2
  75. package/generators/database-changelog/index.js +33 -22
  76. package/generators/database-changelog-liquibase/index.js +12 -8
  77. package/generators/docker-compose/index.js +11 -12
  78. package/generators/entities/index.js +35 -26
  79. package/generators/entities-client/index.js +10 -7
  80. package/generators/entity/index.js +25 -28
  81. package/generators/entity-client/files.js +6 -11
  82. package/generators/entity-client/index.js +9 -7
  83. package/generators/entity-client/templates/common/src/test/javascript/cypress/integration/entity/entity.spec.ts.ejs +4 -4
  84. package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs +1 -1
  85. package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity.tsx.ejs +7 -7
  86. package/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity.component.ts.ejs +2 -1
  87. package/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity.service.ts.ejs +2 -6
  88. package/generators/entity-i18n/index.js +7 -4
  89. package/generators/entity-server/index.js +11 -8
  90. package/generators/entity-server/templates/src/main/java/package/web/rest/EntityResource.java.ejs +39 -41
  91. package/generators/gae/index.js +10 -10
  92. package/generators/generator-base-blueprint.js +7 -44
  93. package/generators/generator-base.js +7 -0
  94. package/generators/generator-constants.js +20 -18
  95. package/generators/generator-transforms.js +27 -23
  96. package/generators/heroku/index.js +12 -10
  97. package/generators/init/constants.cjs +1 -1
  98. package/generators/kubernetes/files.js +3 -0
  99. package/generators/kubernetes/index.js +10 -10
  100. package/generators/kubernetes/templates/db/couchbase.yml.ejs +1 -1
  101. package/generators/kubernetes/templates/deployment.yml.ejs +8 -3
  102. package/generators/kubernetes/templates/istio/destination-rule.yml.ejs +1 -1
  103. package/generators/kubernetes/templates/istio/gateway/grafana-gateway.yml.ejs +5 -2
  104. package/generators/kubernetes/templates/istio/gateway/jhipster-grafana-gateway.yml.ejs +5 -2
  105. package/generators/kubernetes/templates/istio/gateway/kiali-gateway.yml.ejs +10 -8
  106. package/generators/kubernetes/templates/istio/gateway/zipkin-gateway.yml.ejs +5 -2
  107. package/generators/kubernetes/templates/istio/gateway.yml.ejs +7 -5
  108. package/generators/kubernetes/templates/secret/couchbase-secret.yml.ejs +9 -0
  109. package/generators/kubernetes-base.js +1 -0
  110. package/generators/kubernetes-helm/files.js +3 -8
  111. package/generators/kubernetes-helm/index.js +10 -10
  112. package/generators/kubernetes-helm/templates/README-KUBERNETES-HELM.md.ejs +0 -1
  113. package/generators/kubernetes-helm/templates/app/Chart.yml.ejs +5 -0
  114. package/generators/kubernetes-helm/templates/app/helpers.tpl.ejs +0 -11
  115. package/generators/kubernetes-helm/templates/app/requirements.yml.ejs +5 -0
  116. package/generators/kubernetes-helm/templates/app/values.yml.ejs +68 -5
  117. package/generators/kubernetes-helm/templates/csvc/Chart.yml.ejs +1 -1
  118. package/generators/kubernetes-helm/templates/csvc/requirements.yml.ejs +1 -1
  119. package/generators/kubernetes-knative/index.js +10 -10
  120. package/generators/kubernetes-knative/templates/istio/gateway.yml.ejs +6 -4
  121. package/generators/kubernetes-knative/templates/service.yml.ejs +1 -1
  122. package/generators/languages/index.js +13 -13
  123. package/generators/openapi-client/index.js +13 -10
  124. package/generators/openshift/index.js +10 -11
  125. package/generators/openshift/templates/deployment.yml.ejs +1 -1
  126. package/generators/page/index.js +12 -10
  127. package/generators/server/__snapshots__/generator.spec.mjs.snap +12 -0
  128. package/generators/server/files.js +12 -0
  129. package/generators/server/index.js +32 -18
  130. package/generators/server/templates/gradle.properties.ejs +10 -10
  131. package/generators/server/templates/pom.xml.ejs +6 -6
  132. package/generators/server/templates/src/main/docker/app.yml.ejs +1 -1
  133. package/generators/server/templates/src/main/java/package/config/SecurityConfiguration_reactive.java.ejs +2 -2
  134. package/generators/server/templates/src/main/java/package/config/WebConfigurer.java.ejs +0 -1
  135. package/generators/server/templates/src/main/java/package/management/SecurityMetersService.java.ejs +68 -0
  136. package/generators/server/templates/src/main/java/package/security/jwt/TokenProvider.java.ejs +29 -4
  137. package/generators/server/templates/src/main/java/package/security/oauth2/CustomClaimConverter.java.ejs +21 -9
  138. package/generators/server/templates/src/main/java/package/service/UserService.java.ejs +13 -5
  139. package/generators/server/templates/src/main/resources/static/microservices_index.html.ejs +1 -1
  140. package/generators/server/templates/src/test/java/package/management/SecurityMetersServiceTests.java.ejs +113 -0
  141. package/generators/server/templates/src/test/java/package/security/jwt/JWTFilterTest.java.ejs +6 -1
  142. package/generators/server/templates/src/test/java/package/security/jwt/TokenProviderSecurityMetersTests.java.ejs +198 -0
  143. package/generators/server/templates/src/test/java/package/security/jwt/TokenProviderTest.java.ejs +13 -3
  144. package/generators/server/templates/src/test/java/package/security/oauth2/AuthorizationHeaderUtilTest.java.ejs +16 -2
  145. package/generators/server/templates/src/test/java/package/security/oauth2/CustomClaimConverterIT.java.ejs +63 -0
  146. package/generators/spring-controller/index.js +9 -7
  147. package/generators/spring-service/index.js +10 -7
  148. package/generators/upgrade/index.js +3 -4
  149. package/generators/utils.js +2 -2
  150. package/generators/workspaces/index.js +16 -7
  151. package/jdl/jhipster/default-application-options.js +9 -7
  152. package/package.json +15 -15
  153. package/utils/entity.js +14 -0
  154. package/utils/multi-step-transform/index.js +8 -8
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "devDependencies": {
3
- "concurrently": "6.3.0",
4
- "husky": "7.0.2",
5
- "lint-staged": "11.2.3",
6
- "npm": "8.1.0",
3
+ "concurrently": "6.4.0",
4
+ "husky": "7.0.4",
5
+ "lint-staged": "12.0.2",
6
+ "npm": "8.1.4",
7
7
  "wait-on": "6.0.0"
8
8
  }
9
9
  }
@@ -23,7 +23,6 @@ const constants = require('../generator-constants');
23
23
  const { GENERATOR_CYPRESS } = require('../generator-list');
24
24
  const { CYPRESS } = require('../../jdl/jhipster/test-framework-types');
25
25
 
26
- let useBlueprints;
27
26
  /* eslint-disable consistent-return */
28
27
  module.exports = class extends BaseBlueprintGenerator {
29
28
  constructor(args, options, features) {
@@ -34,8 +33,12 @@ module.exports = class extends BaseBlueprintGenerator {
34
33
  }
35
34
 
36
35
  this.loadRuntimeOptions();
36
+ }
37
37
 
38
- useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_CYPRESS);
38
+ async _postConstruct() {
39
+ if (!this.fromBlueprint) {
40
+ await this.composeWithBlueprints(GENERATOR_CYPRESS);
41
+ }
39
42
  }
40
43
 
41
44
  // Public API method used by the getter and also by Blueprints
@@ -48,7 +51,7 @@ module.exports = class extends BaseBlueprintGenerator {
48
51
  }
49
52
 
50
53
  get initializing() {
51
- if (useBlueprints) return;
54
+ if (this.delegateToBlueprint) return {};
52
55
  return this._initializing();
53
56
  }
54
57
 
@@ -75,7 +78,7 @@ module.exports = class extends BaseBlueprintGenerator {
75
78
  }
76
79
 
77
80
  get prompting() {
78
- if (useBlueprints) return;
81
+ if (this.delegateToBlueprint) return {};
79
82
  return this._prompting();
80
83
  }
81
84
 
@@ -95,7 +98,7 @@ module.exports = class extends BaseBlueprintGenerator {
95
98
  }
96
99
 
97
100
  get loading() {
98
- if (useBlueprints) return;
101
+ if (this.delegateToBlueprint) return {};
99
102
  return this._loading();
100
103
  }
101
104
 
@@ -110,7 +113,7 @@ module.exports = class extends BaseBlueprintGenerator {
110
113
  }
111
114
 
112
115
  get preparing() {
113
- if (useBlueprints) return;
116
+ if (this.delegateToBlueprint) return {};
114
117
  return this._preparing();
115
118
  }
116
119
 
@@ -120,7 +123,7 @@ module.exports = class extends BaseBlueprintGenerator {
120
123
  }
121
124
 
122
125
  get default() {
123
- if (useBlueprints) return;
126
+ if (this.delegateToBlueprint) return {};
124
127
  return this._default();
125
128
  }
126
129
 
@@ -139,7 +142,7 @@ module.exports = class extends BaseBlueprintGenerator {
139
142
  }
140
143
 
141
144
  get writing() {
142
- if (useBlueprints) return;
145
+ if (this.delegateToBlueprint) return {};
143
146
  return this._writing();
144
147
  }
145
148
 
@@ -227,7 +230,7 @@ module.exports = class extends BaseBlueprintGenerator {
227
230
  }
228
231
 
229
232
  get postWriting() {
230
- if (useBlueprints) return;
233
+ if (this.delegateToBlueprint) return {};
231
234
  return this._postWriting();
232
235
  }
233
236
  };
@@ -26,6 +26,9 @@
26
26
  "pluginsFile": "<%= CLIENT_TEST_SRC_DIR %>cypress/plugins/index.ts",
27
27
  "screenshotsFolder": "<%= BUILD_DIR %>cypress/screenshots",
28
28
  "chromeWebSecurity": <% if(authenticationTypeOauth2) { %>false<% } else { %>true<% } %>,
29
+ <%_ if (clientFrameworkReact) { _%>
30
+ "scrollBehavior": "center",
31
+ <%_ } _%>
29
32
  "viewportWidth": 1200,
30
33
  "viewportHeight": 720,
31
34
  "retries": 2<%_ if (authenticationTypeJwt) { _%>,
@@ -28,15 +28,15 @@
28
28
 
29
29
  // This function is called when a project is opened or re-opened (e.g. due to
30
30
  // the project's config changing)
31
- import fs = require('fs');;
31
+ import fs = require('fs');
32
32
  import { lighthouse, pa11y, prepareAudit } from 'cypress-audit';
33
33
  import ReportGenerator = require('lighthouse/report/generator/report-generator');
34
34
  /**
35
35
  * @type {Cypress.PluginConfig}
36
36
  */
37
- module.exports = (on, config) => {
37
+ module.exports = (on<%_ if (cypressCoverage) { _%>, config<%_ } _%>) => {
38
38
  // `on` is used to hook into various events Cypress emits
39
- // `config` is the resolved Cypress config
39
+ <%_ if (cypressCoverage) { _%>// `config` is the resolved Cypress config<%_ } _%>
40
40
  on('before:browser:launch', (browser, launchOptions) => {
41
41
  prepareAudit(launchOptions);
42
42
  if (browser.name === 'chrome' && browser.isHeadless) {
@@ -75,8 +75,8 @@ Cypress.Commands.add('setFieldSelectToLastOfEntity', (fieldName: string) => {
75
75
  return cy.get(`[data-cy="${fieldName}"]`).then(select => {
76
76
  const selectSize = (select[0] as HTMLSelectElement)?.options?.length || Number(select.attr('size')) || 0;
77
77
  if (selectSize > 0) {
78
- return cy.get(`[data-cy="${fieldName}"] option`).then((options: any) => {
79
- const elements = [...options].map(o => o.label);
78
+ return cy.get(`[data-cy="${fieldName}"] option`).then((options: JQuery<HTMLElement>) => {
79
+ const elements = [...options].map((o: HTMLElement) => (o as HTMLOptionElement).label);
80
80
  const lastElement = elements.length - 1;
81
81
  cy.get(`[data-cy="${fieldName}"]`).select(lastElement).type('{downarrow}');
82
82
  });
@@ -28,7 +28,6 @@ const BASE_CHANGELOG = {
28
28
  removedRelationships: [],
29
29
  };
30
30
 
31
- let useBlueprints;
32
31
  /* eslint-disable consistent-return */
33
32
  module.exports = class extends BaseBlueprintGenerator {
34
33
  constructor(args, options, features) {
@@ -45,37 +44,49 @@ module.exports = class extends BaseBlueprintGenerator {
45
44
  }
46
45
  this.info(`Creating changelog for entities ${this.options.entities}`);
47
46
  this.configOptions.oldSharedEntities = this.configOptions.oldSharedEntities || [];
48
- useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_DATABASE_CHANGELOG);
47
+ }
48
+
49
+ async _postConstruct() {
50
+ if (!this.fromBlueprint) {
51
+ await this.composeWithBlueprints(GENERATOR_DATABASE_CHANGELOG);
52
+ }
49
53
  }
50
54
 
51
55
  _default() {
52
56
  return {
53
- calculateChangelogs() {
57
+ async calculateChangelogs() {
54
58
  const diff = this._generateChangelogFromFiles();
55
59
 
56
- diff.forEach(([fieldChanges, _relationshipChanges]) => {
57
- if (fieldChanges.type === 'entity-new') {
58
- this._composeWithIncrementalChangelogProvider(fieldChanges);
59
- } else if (fieldChanges.addedFields.length > 0 || fieldChanges.removedFields.length > 0) {
60
- this._composeWithIncrementalChangelogProvider(fieldChanges);
61
- }
62
- });
63
-
64
- diff.forEach(([_fieldChanges, relationshipChanges]) => {
65
- if (
66
- relationshipChanges &&
67
- relationshipChanges.incremental &&
68
- (relationshipChanges.addedRelationships.length > 0 || relationshipChanges.removedRelationships.length > 0)
69
- ) {
70
- this._composeWithIncrementalChangelogProvider(relationshipChanges);
71
- }
72
- });
60
+ await Promise.all(
61
+ diff.map(([fieldChanges, _relationshipChanges]) => {
62
+ if (fieldChanges.type === 'entity-new') {
63
+ return this._composeWithIncrementalChangelogProvider(fieldChanges);
64
+ }
65
+ if (fieldChanges.addedFields.length > 0 || fieldChanges.removedFields.length > 0) {
66
+ return this._composeWithIncrementalChangelogProvider(fieldChanges);
67
+ }
68
+ return undefined;
69
+ })
70
+ );
71
+
72
+ await Promise.all(
73
+ diff.map(([_fieldChanges, relationshipChanges]) => {
74
+ if (
75
+ relationshipChanges &&
76
+ relationshipChanges.incremental &&
77
+ (relationshipChanges.addedRelationships.length > 0 || relationshipChanges.removedRelationships.length > 0)
78
+ ) {
79
+ return this._composeWithIncrementalChangelogProvider(relationshipChanges);
80
+ }
81
+ return undefined;
82
+ })
83
+ );
73
84
  },
74
85
  };
75
86
  }
76
87
 
77
88
  get default() {
78
- if (useBlueprints) return;
89
+ if (this.delegateToBlueprint) return {};
79
90
  return this._default();
80
91
  }
81
92
 
@@ -85,7 +96,7 @@ module.exports = class extends BaseBlueprintGenerator {
85
96
 
86
97
  _composeWithIncrementalChangelogProvider(databaseChangelog) {
87
98
  const skipWriting = !this.options.entities.includes(databaseChangelog.entityName);
88
- this.composeWithJHipster(GENERATOR_DATABASE_CHANGELOG_LIQUIBASE, {
99
+ return this.composeWithJHipster(GENERATOR_DATABASE_CHANGELOG_LIQUIBASE, {
89
100
  databaseChangelog,
90
101
  skipWriting,
91
102
  configOptions: this.configOptions,
@@ -35,7 +35,6 @@ const { prepareFieldForTemplates } = require('../../utils/field');
35
35
  const { prepareRelationshipForTemplates } = require('../../utils/relationship');
36
36
  const { prepareFieldForLiquibaseTemplates } = require('../../utils/liquibase');
37
37
 
38
- let useBlueprints;
39
38
  /* eslint-disable consistent-return */
40
39
  module.exports = class extends BaseBlueprintGenerator {
41
40
  constructor(args, options, features) {
@@ -51,7 +50,12 @@ module.exports = class extends BaseBlueprintGenerator {
51
50
 
52
51
  // Set number of rows to be generated
53
52
  this.numberOfRows = 10;
54
- useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_DATABASE_CHANGELOG_LIQUIBASE);
53
+ }
54
+
55
+ async _postConstruct() {
56
+ if (!this.fromBlueprint) {
57
+ await this.composeWithBlueprints(GENERATOR_DATABASE_CHANGELOG_LIQUIBASE);
58
+ }
55
59
  }
56
60
 
57
61
  _loading() {
@@ -69,7 +73,7 @@ module.exports = class extends BaseBlueprintGenerator {
69
73
  }
70
74
 
71
75
  get loading() {
72
- if (useBlueprints) return;
76
+ if (this.delegateToBlueprint) return {};
73
77
  return this._loading();
74
78
  }
75
79
 
@@ -149,7 +153,7 @@ module.exports = class extends BaseBlueprintGenerator {
149
153
  }
150
154
 
151
155
  get preparing() {
152
- if (useBlueprints) return;
156
+ if (this.delegateToBlueprint) return {};
153
157
  return this._preparing();
154
158
  }
155
159
 
@@ -194,7 +198,7 @@ module.exports = class extends BaseBlueprintGenerator {
194
198
  }
195
199
 
196
200
  get preparingRelationships() {
197
- if (useBlueprints) return;
201
+ if (this.delegateToBlueprint) return {};
198
202
  return this._preparingRelationships();
199
203
  }
200
204
 
@@ -209,7 +213,7 @@ module.exports = class extends BaseBlueprintGenerator {
209
213
  }
210
214
 
211
215
  get default() {
212
- if (useBlueprints) return;
216
+ if (this.delegateToBlueprint) return {};
213
217
  return this._default();
214
218
  }
215
219
 
@@ -253,7 +257,7 @@ module.exports = class extends BaseBlueprintGenerator {
253
257
  }
254
258
 
255
259
  get writing() {
256
- if (useBlueprints) return;
260
+ if (this.delegateToBlueprint) return {};
257
261
  if (this.options.skipWriting) {
258
262
  return {};
259
263
  }
@@ -286,7 +290,7 @@ module.exports = class extends BaseBlueprintGenerator {
286
290
  }
287
291
 
288
292
  get postWriting() {
289
- if (useBlueprints) return;
293
+ if (this.delegateToBlueprint) return {};
290
294
  if (this.options.skipWriting) {
291
295
  return {};
292
296
  }
@@ -34,13 +34,12 @@ const { GENERATOR_DOCKER_COMPOSE } = require('../generator-list');
34
34
 
35
35
  const NO_DATABASE = databaseTypes.NO;
36
36
 
37
- let useBlueprints;
38
-
39
37
  /* eslint-disable consistent-return */
40
38
  module.exports = class extends BaseDockerGenerator {
41
- constructor(args, options, features) {
42
- super(args, options, features);
43
- useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_DOCKER_COMPOSE);
39
+ async _postConstruct() {
40
+ if (!this.fromBlueprint) {
41
+ await this.composeWithBlueprints(GENERATOR_DOCKER_COMPOSE);
42
+ }
44
43
  }
45
44
 
46
45
  _initializing() {
@@ -81,7 +80,7 @@ module.exports = class extends BaseDockerGenerator {
81
80
  }
82
81
 
83
82
  get initializing() {
84
- if (useBlueprints) return;
83
+ if (this.delegateToBlueprint) return {};
85
84
  return this._initializing();
86
85
  }
87
86
 
@@ -90,7 +89,7 @@ module.exports = class extends BaseDockerGenerator {
90
89
  }
91
90
 
92
91
  get prompting() {
93
- if (useBlueprints) return;
92
+ if (this.delegateToBlueprint) return {};
94
93
  return this._prompting();
95
94
  }
96
95
 
@@ -118,7 +117,7 @@ module.exports = class extends BaseDockerGenerator {
118
117
  }
119
118
 
120
119
  get configuring() {
121
- if (useBlueprints) return;
120
+ if (this.delegateToBlueprint) return {};
122
121
  return this._configuring();
123
122
  }
124
123
 
@@ -264,7 +263,7 @@ module.exports = class extends BaseDockerGenerator {
264
263
  }
265
264
 
266
265
  get preparing() {
267
- if (useBlueprints) return;
266
+ if (this.delegateToBlueprint) return {};
268
267
  return this._preparing();
269
268
  }
270
269
 
@@ -277,7 +276,7 @@ module.exports = class extends BaseDockerGenerator {
277
276
  }
278
277
 
279
278
  get loading() {
280
- if (useBlueprints) return;
279
+ if (this.delegateToBlueprint) return {};
281
280
  return this._loading();
282
281
  }
283
282
 
@@ -286,7 +285,7 @@ module.exports = class extends BaseDockerGenerator {
286
285
  }
287
286
 
288
287
  get writing() {
289
- if (useBlueprints) return;
288
+ if (this.delegateToBlueprint) return {};
290
289
  return this._writing();
291
290
  }
292
291
 
@@ -313,7 +312,7 @@ module.exports = class extends BaseDockerGenerator {
313
312
  }
314
313
 
315
314
  end() {
316
- if (useBlueprints) return;
315
+ if (this.delegateToBlueprint) return {};
317
316
  return this._end();
318
317
  }
319
318
  };
@@ -21,8 +21,6 @@ const { JHIPSTER_CONFIG_DIR } = require('../generator-constants');
21
21
  const { SQL } = require('../../jdl/jhipster/database-types');
22
22
  const { GENERATOR_ENTITIES, GENERATOR_ENTITIES_CLIENT, GENERATOR_ENTITY, GENERATOR_DATABASE_CHANGELOG } = require('../generator-list');
23
23
 
24
- let useBlueprints;
25
-
26
24
  module.exports = class extends BaseBlueprintGenerator {
27
25
  constructor(args, options, features) {
28
26
  super(args, options, { unique: 'namespace', ...features });
@@ -75,10 +73,12 @@ module.exports = class extends BaseBlueprintGenerator {
75
73
  defaults: true,
76
74
  hide: true,
77
75
  });
76
+ }
78
77
 
79
- if (this.options.help) return;
80
-
81
- useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_ENTITIES);
78
+ async _postConstruct() {
79
+ if (!this.fromBlueprint) {
80
+ await this.composeWithBlueprints(GENERATOR_ENTITIES);
81
+ }
82
82
 
83
83
  if (this.options.entitiesToImport) {
84
84
  const entities = this.jhipsterConfig.entities || [];
@@ -123,28 +123,31 @@ module.exports = class extends BaseBlueprintGenerator {
123
123
  }
124
124
 
125
125
  get initializing() {
126
- return useBlueprints ? undefined : this._initializing();
126
+ if (this.delegateToBlueprint) return {};
127
+ return this._initializing();
127
128
  }
128
129
 
129
130
  // Public API method used by the getter and also by Blueprints
130
131
  _composing() {
131
132
  return {
132
- composeEachEntity() {
133
- this.getExistingEntityNames().forEach(entityName => {
134
- if (this.options.composedEntities && this.options.composedEntities.includes(entityName)) return;
135
- const selectedEntity = this.options.entities.includes(entityName);
136
- const { regenerate = !selectedEntity } = this.options;
137
- this.composeWithJHipster(GENERATOR_ENTITY, [entityName], {
138
- skipWriting: !this.options.writeEveryEntity && !selectedEntity,
139
- regenerate,
140
- skipDbChangelog: this.jhipsterConfig.databaseType === SQL || this.options.skipDbChangelog,
141
- skipInstall: true,
142
- skipPrompts: this.options.skipPrompts,
143
- });
144
- });
133
+ async composeEachEntity() {
134
+ return Promise.all(
135
+ this.getExistingEntityNames().map(async entityName => {
136
+ if (this.options.composedEntities && this.options.composedEntities.includes(entityName)) return;
137
+ const selectedEntity = this.options.entities.includes(entityName);
138
+ const { regenerate = !selectedEntity } = this.options;
139
+ await this.composeWithJHipster(GENERATOR_ENTITY, [entityName], {
140
+ skipWriting: !this.options.writeEveryEntity && !selectedEntity,
141
+ regenerate,
142
+ skipDbChangelog: this.jhipsterConfig.databaseType === SQL || this.options.skipDbChangelog,
143
+ skipInstall: true,
144
+ skipPrompts: this.options.skipPrompts,
145
+ });
146
+ })
147
+ );
145
148
  },
146
149
 
147
- databaseChangelog() {
150
+ async databaseChangelog() {
148
151
  if (this.jhipsterConfig.skipServer || this.jhipsterConfig.databaseType !== SQL || this.options.skipDbChangelog) {
149
152
  return;
150
153
  }
@@ -153,19 +156,23 @@ module.exports = class extends BaseBlueprintGenerator {
153
156
  return;
154
157
  }
155
158
 
156
- this.composeWithJHipster(GENERATOR_DATABASE_CHANGELOG, this.options.writeEveryEntity ? existingEntities : this.options.entities);
159
+ await this.composeWithJHipster(
160
+ GENERATOR_DATABASE_CHANGELOG,
161
+ this.options.writeEveryEntity ? existingEntities : this.options.entities
162
+ );
157
163
  },
158
164
  };
159
165
  }
160
166
 
161
167
  get composing() {
162
- return useBlueprints ? undefined : this._composing();
168
+ if (this.delegateToBlueprint) return {};
169
+ return this._composing();
163
170
  }
164
171
 
165
172
  // Public API method used by the getter and also by Blueprints
166
173
  _default() {
167
174
  return {
168
- composeEntitiesClient() {
175
+ async composeEntitiesClient() {
169
176
  if (this.options.entities.length !== this.jhipsterConfig.entities.length) return;
170
177
  const clientEntities = this.getExistingEntityNames()
171
178
  .map(entityName => {
@@ -177,7 +184,7 @@ module.exports = class extends BaseBlueprintGenerator {
177
184
  })
178
185
  .filter(entity => !entity.skipClient);
179
186
  if (clientEntities.length === 0) return;
180
- this.composeWithJHipster(GENERATOR_ENTITIES_CLIENT, clientEntities, {
187
+ await this.composeWithJHipster(GENERATOR_ENTITIES_CLIENT, clientEntities, {
181
188
  skipInstall: this.options.skipInstall,
182
189
  });
183
190
  },
@@ -185,7 +192,8 @@ module.exports = class extends BaseBlueprintGenerator {
185
192
  }
186
193
 
187
194
  get default() {
188
- return useBlueprints ? undefined : this._default();
195
+ if (this.delegateToBlueprint) return {};
196
+ return this._default();
189
197
  }
190
198
 
191
199
  // Public API method used by the getter and also by Blueprints
@@ -194,6 +202,7 @@ module.exports = class extends BaseBlueprintGenerator {
194
202
  }
195
203
 
196
204
  get writing() {
197
- return useBlueprints ? undefined : this._writing();
205
+ if (this.delegateToBlueprint) return {};
206
+ return this._writing();
198
207
  }
199
208
  };
@@ -19,14 +19,17 @@
19
19
  const BaseBlueprintGenerator = require('../generator-base-blueprint');
20
20
  const { GENERATOR_ENTITIES_CLIENT } = require('../generator-list');
21
21
 
22
- let useBlueprints;
23
-
24
22
  module.exports = class extends BaseBlueprintGenerator {
25
23
  constructor(args, options, features) {
26
24
  super(args, options, features);
27
25
  if (this.options.help) return;
28
26
  this.clientEntities = this.options.clientEntities;
29
- useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_ENTITIES_CLIENT);
27
+ }
28
+
29
+ async _postConstruct() {
30
+ if (!this.fromBlueprint) {
31
+ await this.composeWithBlueprints(GENERATOR_ENTITIES_CLIENT);
32
+ }
30
33
  }
31
34
 
32
35
  // Public API method used by the getter and also by Blueprints
@@ -39,7 +42,7 @@ module.exports = class extends BaseBlueprintGenerator {
39
42
  }
40
43
 
41
44
  get initializing() {
42
- return useBlueprints ? undefined : this._initializing();
45
+ return this.delegateToBlueprint ? undefined : this._initializing();
43
46
  }
44
47
 
45
48
  // Public API method used by the getter and also by Blueprints
@@ -52,7 +55,7 @@ module.exports = class extends BaseBlueprintGenerator {
52
55
  }
53
56
 
54
57
  get loading() {
55
- return useBlueprints ? undefined : this._loading();
58
+ return this.delegateToBlueprint ? undefined : this._loading();
56
59
  }
57
60
 
58
61
  // Public API method used by the getter and also by Blueprints
@@ -67,7 +70,7 @@ module.exports = class extends BaseBlueprintGenerator {
67
70
  }
68
71
 
69
72
  get default() {
70
- return useBlueprints ? undefined : this._default();
73
+ return this.delegateToBlueprint ? undefined : this._default();
71
74
  }
72
75
 
73
76
  // Public API method used by the getter and also by Blueprints
@@ -82,6 +85,6 @@ module.exports = class extends BaseBlueprintGenerator {
82
85
  }
83
86
 
84
87
  get end() {
85
- return useBlueprints ? undefined : this._end();
88
+ return this.delegateToBlueprint ? undefined : this._end();
86
89
  }
87
90
  };