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
@@ -0,0 +1,37 @@
1
+ <%#
2
+ Copyright 2013-2021 the original author or authors from the JHipster project.
3
+
4
+ This file is part of the JHipster project, see https://www.jhipster.tech/
5
+ for more information.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ https://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+ -%>
19
+ {
20
+ "extends": "./tsconfig",
21
+ "compilerOptions": {
22
+ "outDir": "<%= BUILD_DIR %>out-tsc/spec",
23
+ <%_ if (microfrontend && applicationTypeGateway) { _%>
24
+ "paths": {
25
+ <%_ for (const remote of remotes) { _%>
26
+ "@<%= remote.lowercaseBaseName %>/*": ["<%= CLIENT_TEST_SRC_DIR %>spec/app/microfrontends/*"],
27
+ <%_ } _%>
28
+ "@/*": ["*"]
29
+ },
30
+ <%_ } _%>
31
+ "types": ["jest", "node"]
32
+ },
33
+ "include": [
34
+ "<%= CLIENT_MAIN_SRC_DIR %>app/**/*",
35
+ "<%= CLIENT_TEST_SRC_DIR %>spec/**/*"
36
+ ]
37
+ }
@@ -16,6 +16,8 @@ module.exports = {
16
16
  <%_ } _%>
17
17
 
18
18
  dev: {
19
+ hotReload: <%= !microfrontend %>,
20
+
19
21
  // https://webpack.js.org/configuration/devtool/#development
20
22
  devtool: 'cheap-module-source-map',
21
23
 
@@ -6,7 +6,7 @@ const sass = require('sass');
6
6
  const packageConfig = require('../package.json');
7
7
  const config = require('./config');
8
8
 
9
- const sourceMapEnabled = production => production ? config.build.productionSourceMap : config.dev.cssSourceMap;
9
+ const sourceMapEnabled = production => (production ? config.build.productionSourceMap : config.dev.cssSourceMap);
10
10
 
11
11
  const cssLoaders = options => {
12
12
  options = options || {};
@@ -16,14 +16,14 @@ const cssLoaders = options => {
16
16
  options: {
17
17
  sourceMap: options.sourceMap,
18
18
  esModule: false,
19
- }
19
+ },
20
20
  };
21
21
 
22
22
  const postcssLoader = {
23
23
  loader: 'postcss-loader',
24
24
  options: {
25
- sourceMap: options.sourceMap
26
- }
25
+ sourceMap: options.sourceMap,
26
+ },
27
27
  };
28
28
 
29
29
  // generate loader string to be used with extract text plugin
@@ -34,8 +34,8 @@ const cssLoaders = options => {
34
34
  loaders.push({
35
35
  loader: loader + '-loader',
36
36
  options: Object.assign({}, loaderOptions, {
37
- sourceMap: options.sourceMap
38
- })
37
+ sourceMap: options.sourceMap,
38
+ }),
39
39
  });
40
40
  }
41
41
 
@@ -52,7 +52,7 @@ const cssLoaders = options => {
52
52
  sass: generateLoaders('sass', { indentedSyntax: true, implementation: sass }),
53
53
  scss: generateLoaders('sass', { implementation: sass }),
54
54
  stylus: generateLoaders('stylus'),
55
- styl: generateLoaders('stylus')
55
+ styl: generateLoaders('stylus'),
56
56
  };
57
57
  };
58
58
 
@@ -65,7 +65,7 @@ const styleLoaders = options => {
65
65
  const loader = loaders[extension];
66
66
  output.push({
67
67
  test: new RegExp('\\.' + extension + '$'),
68
- use: loader
68
+ use: loader,
69
69
  });
70
70
  }
71
71
 
@@ -75,7 +75,7 @@ const styleLoaders = options => {
75
75
  const vueLoaderConfig = production => ({
76
76
  loaders: cssLoaders({
77
77
  sourceMap: sourceMapEnabled(production),
78
- extract: production
78
+ extract: production,
79
79
  }),
80
80
  cssSourceMap: sourceMapEnabled(production),
81
81
  cacheBusting: config.dev.cacheBusting,
@@ -83,12 +83,13 @@ const vueLoaderConfig = production => ({
83
83
  video: ['src', 'poster'],
84
84
  source: 'src',
85
85
  img: 'src',
86
- image: 'xlink:href'
87
- }
86
+ image: 'xlink:href',
87
+ },
88
+ hotReload: config.dev.hotReload,
88
89
  });
89
90
 
90
91
  module.exports = {
91
92
  cssLoaders,
92
93
  styleLoaders,
93
94
  vueLoaderConfig,
94
- }
95
+ };
@@ -3,6 +3,7 @@ const path = require('path');
3
3
  const { merge } = require('webpack-merge');
4
4
  const { VueLoaderPlugin } = require('vue-loader');
5
5
  const CopyWebpackPlugin = require('copy-webpack-plugin');
6
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
6
7
  <%_ if (enableTranslation) { _%>
7
8
  const { hashElement } = require('folder-hash');
8
9
  const MergeJsonWebpackPlugin = require('merge-jsons-webpack-plugin');
@@ -30,8 +31,13 @@ module.exports = async (env, options) => {
30
31
  {
31
32
  mode: options.mode,
32
33
  context: resolve(),
34
+ <%_ if (applicationTypeGateway && microfrontend) { _%>
35
+ experiments: {
36
+ topLevelAwait: true,
37
+ },
38
+ <%_ } _%>
33
39
  entry: {
34
- app: './<%= CLIENT_MAIN_SRC_DIR %>app/main.ts'
40
+ app: './<%= CLIENT_MAIN_SRC_DIR %>app/<%= microfrontend ? 'index' : 'main' %>.ts',
35
41
  },
36
42
  output: {
37
43
  path: resolve('<%= DIST_DIR %>'),
@@ -40,20 +46,47 @@ module.exports = async (env, options) => {
40
46
  extensions: ['.ts', '.js', '.vue', '.json'],
41
47
  alias: {
42
48
  vue$: 'vue/dist/vue.esm.js',
43
- '@': resolve('<%= CLIENT_MAIN_SRC_DIR %>app')
49
+ '@': resolve('<%= CLIENT_MAIN_SRC_DIR %>app'),
44
50
  },
45
- fallback: {
46
- // prevent webpack from injecting useless setImmediate polyfill because Vue
47
- // source contains it (although only uses it if it's native).
48
- setImmediate: false,
49
- // prevent webpack from injecting mocks to Node native modules
50
- // that does not make sense for the client
51
- dgram: 'empty',
52
- fs: 'empty',
53
- net: 'empty',
54
- tls: 'empty',
55
- child_process: 'empty',
51
+ },
52
+ devServer: {
53
+ <%_ if (microfrontend) { _%>
54
+ hot: config.dev.hotReload,
55
+ <%_ } _%>
56
+ static: {
57
+ directory: './<%= DIST_DIR %>',
56
58
  },
59
+ port: <%= devServerPort %>,
60
+ proxy: [
61
+ {
62
+ context: [
63
+ '/api',
64
+ '/services',
65
+ '/management',
66
+ '/swagger-resources',
67
+ '/v2/api-docs',
68
+ '/v3/api-docs',
69
+ '/h2-console',
70
+ <%_ if (authenticationTypeOauth2) { _%>
71
+ '/oauth2',
72
+ '/login',
73
+ <%_ } _%>
74
+ '/auth'
75
+ ],
76
+ target: 'http://localhost:<%= this.applicationTypeMicroservice ? gatewayServerPort : serverPort %>',
77
+ secure: false,
78
+ },
79
+ <%_ if (communicationSpringWebsocket) { _%>
80
+ {
81
+ context: [
82
+ '/websocket'
83
+ ],
84
+ target: 'ws://localhost:<%= this.applicationTypeMicroservice ? gatewayServerPort : serverPort %>',
85
+ ws: true
86
+ }
87
+ <%_ } _%>
88
+ ],
89
+ historyApiFallback: true
57
90
  },
58
91
  cache: {
59
92
  // 1. Set cache type to filesystem
@@ -67,7 +100,7 @@ module.exports = async (env, options) => {
67
100
  path.resolve(__dirname, 'vue.utils.js'),
68
101
  path.resolve(__dirname, `webpack.${development ? 'dev' : 'prod'}.js`),
69
102
  path.resolve(__dirname, '../.postcssrc.js'),
70
- path.resolve(__dirname, '../tsconfig.json')
103
+ path.resolve(__dirname, '../tsconfig.json'),
71
104
  ],
72
105
  },
73
106
  },
@@ -76,7 +109,7 @@ module.exports = async (env, options) => {
76
109
  {
77
110
  test: /\.vue$/,
78
111
  loader: 'vue-loader',
79
- options: vueLoaderConfig(!development)
112
+ options: vueLoaderConfig(!development),
80
113
  },
81
114
  {
82
115
  test: /\.ts$/,
@@ -86,40 +119,17 @@ module.exports = async (env, options) => {
86
119
  options: {
87
120
  appendTsSuffixTo: ['\\.vue$'],
88
121
  happyPackMode: true,
89
- transpileOnly: true
90
- }
91
- }
122
+ transpileOnly: true,
123
+ },
124
+ },
92
125
  ],
93
- include: [resolve('src'), resolve('test')]
94
- },
95
- {
96
- test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
97
- loader: 'url-loader',
98
- options: {
99
- limit: 10000,
100
- name: 'content/[hash].[ext]',
101
- publicPath: "../"
102
- }
126
+ include: [resolve('src'), resolve('test')],
103
127
  },
104
128
  {
105
- test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
106
- loader: 'url-loader',
107
- options: {
108
- limit: 10000,
109
- name: 'content/[hash].[ext]',
110
- publicPath: "../"
111
- }
129
+ test: /\.(png|jpe?g|gif|svg|mp4|webm|ogg|mp3|wav|flac|aac|woff2?|eot|ttf|otf)/,
130
+ type: 'asset/resource',
112
131
  },
113
- {
114
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
115
- loader: 'url-loader',
116
- options: {
117
- limit: 10000,
118
- name: 'content/[hash].[ext]',
119
- publicPath: "../"
120
- }
121
- }
122
- ]
132
+ ],
123
133
  },
124
134
  plugins: [
125
135
  new EnvironmentPlugin({
@@ -133,6 +143,10 @@ module.exports = async (env, options) => {
133
143
  VERSION: JSON.stringify(config.version),
134
144
  SERVER_API_URL: JSON.stringify(config.serverApiUrl),
135
145
  }),
146
+ new HtmlWebpackPlugin({
147
+ base: '/',
148
+ template: './<%= MAIN_SRC_DIR %>index.html',
149
+ }),
136
150
  new VueLoaderPlugin(),
137
151
  new CopyWebpackPlugin({
138
152
  patterns: [
@@ -152,16 +166,16 @@ module.exports = async (env, options) => {
152
166
  },
153
167
  // jhipster-needle-add-assets-to-webpack - JHipster will add/remove third-party resources in this array
154
168
  { from: './<%= CLIENT_MAIN_SRC_DIR %>robots.txt', to: 'robots.txt' },
155
- ]
169
+ ],
156
170
  })<% if (enableTranslation) { %>,
157
171
  new MergeJsonWebpackPlugin({
158
172
  output: {
159
173
  groupBy: [
160
174
  // jhipster-needle-i18n-language-webpack - JHipster will add/remove languages in this array
161
- ]
162
- }
163
- })<% } %>
164
- ]
175
+ ],
176
+ },
177
+ }),<% } %>
178
+ ],
165
179
  },
166
180
  await require(`./webpack.${development ? 'dev' : 'prod'}`)(env, options)
167
181
  // jhipster-needle-add-webpack-config - JHipster will add custom config
@@ -18,83 +18,31 @@
18
18
  -%>
19
19
  'use strict';
20
20
  const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
21
- const path = require('path');
22
21
  const webpack = require('webpack');
23
- const HtmlWebpackPlugin = require('html-webpack-plugin');
24
22
 
25
23
  const { styleLoaders } = require('./vue.utils');
26
24
  const config = require('./config');
27
25
 
28
- module.exports = (env, options) => ({
29
- module: {
30
- rules: styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
31
- },
32
- // cheap-module-eval-source-map is faster for development
33
- devtool: config.dev.devtool,
34
- entry: {
35
- global: './<%= MAIN_SRC_DIR %>content/scss/global.scss',
36
- main: './<%= MAIN_SRC_DIR %>app/main'
37
- },
38
- output: {
39
- filename: 'app/[contenthash].bundle.js',
40
- chunkFilename: 'app/[id].chunk.js'
41
- },
42
- optimization: {
43
- moduleIds: 'named',
44
- },
45
- devServer: {
46
- static: {
47
- directory: './<%= DIST_DIR %>',
26
+ module.exports = (env, options) => {
27
+ const devConfig = {
28
+ module: {
29
+ rules: styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
48
30
  },
49
- port: <%= devServerPort %>,
50
- proxy: [
51
- {
52
- context: [
53
- '/api',
54
- '/services',
55
- '/management',
56
- '/swagger-resources',
57
- '/v2/api-docs',
58
- '/v3/api-docs',
59
- '/h2-console',
60
- <%_ if (authenticationTypeOauth2) { _%>
61
- '/oauth2',
62
- '/login',
63
- <%_ } _%>
64
- '/auth'
65
- ],
66
- target: 'http://127.0.0.1:<%= serverPort %>',
67
- secure: false,
68
- headers: { host: 'localhost:9000' }
69
- },
70
- <%_ if (communicationSpringWebsocket) { _%>
71
- {
72
- context: [
73
- '/websocket'
74
- ],
75
- target: 'ws://127.0.0.1:<%= serverPort %>',
76
- ws: true
77
- }
78
- <%_ } _%>
79
- ],
80
- historyApiFallback: true
81
- },
82
- plugins: [
83
- new webpack.HotModuleReplacementPlugin(),
84
- new webpack.NoEmitOnErrorsPlugin(),
85
- new HtmlWebpackPlugin({
86
- base: '/',
87
- template: './<%= MAIN_SRC_DIR %>index.html',
88
- chunks: ['vendors', 'main', 'global'],
89
- chunksSortMode: 'manual',
90
- inject: true
91
- }),
31
+ // cheap-module-eval-source-map is faster for development
32
+ devtool: config.dev.devtool,
33
+ optimization: {
34
+ moduleIds: 'named',
35
+ },
36
+ plugins: [],
37
+ };
38
+ if (!options.env.WEBPACK_SERVE) return devConfig;
39
+ devConfig.plugins.push(
92
40
  new BrowserSyncPlugin(
93
41
  {
94
42
  host: 'localhost',
95
43
  port: 9000,
96
44
  proxy: {
97
- target: 'http://localhost:<%= devServerPort %>',
45
+ target: `http://localhost:${options.watch ? '<%= this.applicationTypeMicroservice ? gatewayServerPort : serverPort %>' : '<%= devServerPort %>'}`,
98
46
  <%_ if (communicationSpringWebsocket) { _%>
99
47
  ws: true,
100
48
  <%_ } _%>
@@ -116,5 +64,6 @@ module.exports = (env, options) => ({
116
64
  reload: true
117
65
  }
118
66
  )
119
- ]
120
- });
67
+ );
68
+ return devConfig;
69
+ };
@@ -0,0 +1,77 @@
1
+ <%#
2
+ Copyright 2013-2021 the original author or authors from the JHipster project.
3
+
4
+ This file is part of the JHipster project, see https://www.jhipster.tech/
5
+ for more information.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ https://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+ -%>
19
+ <&_ if (fragment.importsSection) { -&>
20
+ <%_ if (applicationTypeMicroservice) { _%>
21
+ const { DefinePlugin } = require('webpack');
22
+ <%_ } _%>
23
+ <&_ } -&>
24
+ <&_ if (fragment.moduleFederationSection) { -&>
25
+ <%_ if (applicationTypeGateway) { _%>
26
+ remotes: {
27
+ <%_ for (const remote of remotes) { _%>
28
+ '@<%= remote.lowercaseBaseName %>': `<%= remote.lowercaseBaseName %>@/<%= remote.endpointPrefix %>/remoteEntry.js`,
29
+ <%_ } _%>
30
+ },
31
+ <%_ } _%>
32
+ <%_ if (applicationTypeMicroservice) { _%>
33
+ exposes: {
34
+ './entities-router': './<%= CLIENT_MAIN_SRC_DIR %>app/router/entities',
35
+ './entities-menu': './<%= CLIENT_MAIN_SRC_DIR %>app/entities/entities-menu',
36
+ },
37
+ <%_ } _%>
38
+ shared: {
39
+ axios: { singleton: true, shareScope: 'default' },
40
+ 'vue-loader': { eager: true, singleton: false, shareScope: 'default' },
41
+ 'bootstrap-vue': { singleton: true, shareScope: 'default' },
42
+ vue: { singleton: true, shareScope: 'default' },
43
+ vuelidate: { singleton: true, shareScope: 'default' },
44
+ 'vue-class-component': { singleton: true, shareScope: 'default' },
45
+ 'vue-i18n': { singleton: true, shareScope: 'default' },
46
+ 'vue-router': { singleton: true, shareScope: 'default' },
47
+ 'vue2-filters': { singleton: true, shareScope: 'default' },
48
+ vuex: { singleton: true, shareScope: 'default' },
49
+ 'vue-property-decorator': { singleton: true, shareScope: 'default' },
50
+ '@/shared/security/authority': {
51
+ singleton: true,
52
+ shareScope: 'default',
53
+ import: '@/shared/security/authority',
54
+ requiredVersion: appVersion,
55
+ },
56
+ '@/shared/alert/alert.service': {
57
+ singleton: true,
58
+ shareScope: 'default',
59
+ import: '@/shared/alert/alert.service',
60
+ requiredVersion: appVersion,
61
+ },
62
+ '@/locale/translation.service': {
63
+ singleton: true,
64
+ shareScope: 'default',
65
+ import: '@/locale/translation.service',
66
+ requiredVersion: appVersion,
67
+ },
68
+ },
69
+ <&_ } -&>
70
+ <&_ if (fragment.pluginsSection) { -&>
71
+ <%_ if (applicationTypeMicroservice) { _%>
72
+ new DefinePlugin({
73
+ <%= _.upperCase(baseName) %>_I18N_RESOURCES_PREFIX: JSON.stringify(''),
74
+ }),
75
+ <%_ } _%>
76
+ <&_ } -&>
77
+
@@ -18,7 +18,6 @@
18
18
  -%>
19
19
  'use strict';
20
20
  const webpack = require('webpack');
21
- const HtmlWebpackPlugin = require('html-webpack-plugin');
22
21
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
23
22
  const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
24
23
  const WorkboxPlugin = require('workbox-webpack-plugin');
@@ -37,14 +36,6 @@ const webpackConfig = {
37
36
  })
38
37
  },
39
38
  devtool: config.build.productionSourceMap ? config.build.devtool : false,
40
- entry: {
41
- global: './<%= MAIN_SRC_DIR %>content/scss/global.scss',
42
- main: './<%= MAIN_SRC_DIR %>app/main'
43
- },
44
- output: {
45
- filename: 'app/[name].[contenthash].bundle.js',
46
- chunkFilename: 'app/[id].[chunkhash].chunk.js'
47
- },
48
39
  optimization: {
49
40
  moduleIds: 'deterministic',
50
41
  minimizer: [
@@ -99,27 +90,7 @@ const webpackConfig = {
99
90
  extractComments: false,
100
91
  }),
101
92
  // extract css into its own file
102
- new MiniCssExtractPlugin({
103
- filename: 'content/[name].[contenthash].css',
104
- chunkFilename: 'content/[id].css'
105
- }),
106
- // generate dist index.html with correct asset hash for caching.
107
- // you can customize output by editing /index.html
108
- // see https://github.com/ampedandwired/html-webpack-plugin
109
- new HtmlWebpackPlugin({
110
- base: '/',
111
- template: './<%= MAIN_SRC_DIR %>index.html',
112
- chunks: ['vendors', 'main', 'global'],
113
- chunksSortMode: 'manual',
114
- inject: true,
115
- minify: {
116
- removeComments: true,
117
- collapseWhitespace: true,
118
- removeAttributeQuotes: true
119
- // more options:
120
- // https://github.com/kangax/html-minifier#options-quick-reference
121
- },
122
- }),
93
+ new MiniCssExtractPlugin(),
123
94
  // keep module.id stable when vendor modules does not change
124
95
  new ForkTsCheckerWebpackPlugin(
125
96
  {
@@ -35,12 +35,12 @@ const NO_DATABASE_TYPE = databaseTypes.NO;
35
35
 
36
36
  const exec = childProcess.exec;
37
37
 
38
- let useBlueprints;
39
38
  /* eslint-disable consistent-return */
40
39
  module.exports = class extends BaseBlueprintGenerator {
41
- constructor(args, options, features) {
42
- super(args, options, features);
43
- useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_CLOUDFOUNDRY);
40
+ async _postConstruct() {
41
+ if (!this.fromBlueprint) {
42
+ await this.composeWithBlueprints(GENERATOR_CLOUDFOUNDRY);
43
+ }
44
44
  }
45
45
 
46
46
  _initializing() {
@@ -66,7 +66,7 @@ module.exports = class extends BaseBlueprintGenerator {
66
66
  }
67
67
 
68
68
  get initializing() {
69
- if (useBlueprints) return;
69
+ if (this.delegateToBlueprint) return {};
70
70
  return this._initializing();
71
71
  }
72
72
 
@@ -75,7 +75,7 @@ module.exports = class extends BaseBlueprintGenerator {
75
75
  }
76
76
 
77
77
  get prompting() {
78
- if (useBlueprints) return;
78
+ if (this.delegateToBlueprint) return {};
79
79
  return this._prompting();
80
80
  }
81
81
 
@@ -115,7 +115,7 @@ module.exports = class extends BaseBlueprintGenerator {
115
115
  }
116
116
 
117
117
  get configuring() {
118
- if (useBlueprints) return;
118
+ if (this.delegateToBlueprint) return {};
119
119
  return this._configuring();
120
120
  }
121
121
 
@@ -182,7 +182,7 @@ module.exports = class extends BaseBlueprintGenerator {
182
182
  }
183
183
 
184
184
  get default() {
185
- if (useBlueprints) return;
185
+ if (this.delegateToBlueprint) return {};
186
186
  return this._default();
187
187
  }
188
188
 
@@ -232,7 +232,7 @@ module.exports = class extends BaseBlueprintGenerator {
232
232
  }
233
233
 
234
234
  get end() {
235
- if (useBlueprints) return;
235
+ if (this.delegateToBlueprint) return {};
236
236
  return this._end();
237
237
  }
238
238
  };
@@ -25,8 +25,6 @@ const prettierConfigFiles = require('./files').prettierConfigFiles;
25
25
  const constants = require('../generator-constants');
26
26
  const packageJson = require('../../package.json');
27
27
 
28
- let useBlueprints;
29
-
30
28
  module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
31
29
  constructor(args, options, features) {
32
30
  super(args, options, { unique: 'namespace', ...features });
@@ -37,8 +35,12 @@ module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
37
35
 
38
36
  this.loadStoredAppOptions();
39
37
  this.loadRuntimeOptions();
38
+ }
40
39
 
41
- useBlueprints = !this.fromBlueprint && this.instantiateBlueprints('common');
40
+ async _postConstruct() {
41
+ if (!this.fromBlueprint) {
42
+ await this.composeWithBlueprints('common');
43
+ }
42
44
  }
43
45
 
44
46
  // Public API method used by the getter and also by Blueprints
@@ -64,7 +66,7 @@ module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
64
66
  }
65
67
 
66
68
  get initializing() {
67
- if (useBlueprints) return;
69
+ if (this.delegateToBlueprint) return {};
68
70
  return this._initializing();
69
71
  }
70
72
 
@@ -88,7 +90,7 @@ module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
88
90
  }
89
91
 
90
92
  get configuring() {
91
- if (useBlueprints) return;
93
+ if (this.delegateToBlueprint) return {};
92
94
  return this._configuring();
93
95
  }
94
96
 
@@ -122,7 +124,7 @@ module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
122
124
  }
123
125
 
124
126
  get loading() {
125
- if (useBlueprints) return;
127
+ if (this.delegateToBlueprint) return {};
126
128
  return this._loading();
127
129
  }
128
130
 
@@ -137,7 +139,7 @@ module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
137
139
  }
138
140
 
139
141
  get preparing() {
140
- if (useBlueprints) return;
142
+ if (this.delegateToBlueprint) return {};
141
143
  return this._preparing();
142
144
  }
143
145
 
@@ -149,7 +151,7 @@ module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
149
151
  }
150
152
 
151
153
  get default() {
152
- if (useBlueprints) return;
154
+ if (this.delegateToBlueprint) return {};
153
155
  return this._default();
154
156
  }
155
157
 
@@ -173,7 +175,7 @@ module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
173
175
  }
174
176
 
175
177
  get writing() {
176
- if (useBlueprints) return;
178
+ if (this.delegateToBlueprint) return {};
177
179
  return this._writing();
178
180
  }
179
181
 
@@ -195,7 +197,7 @@ module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
195
197
  }
196
198
 
197
199
  get postWriting() {
198
- if (useBlueprints) return;
200
+ if (this.delegateToBlueprint) return {};
199
201
  return this._postWriting();
200
202
  }
201
203
  };