diff --git a/.blueprint/github-build-matrix/__snapshots__/generator.spec.ts.snap b/.blueprint/github-build-matrix/__snapshots__/generator.spec.ts.snap index bc85bfe41659..4f3954b8781b 100644 --- a/.blueprint/github-build-matrix/__snapshots__/generator.spec.ts.snap +++ b/.blueprint/github-build-matrix/__snapshots__/generator.spec.ts.snap @@ -350,7 +350,7 @@ exports[`generator - github-build-matrix with devserver should match matrix valu "{ "include": [ { - "job-name": "ng-default", + "job-name": "ng-default-esbuild", "sample": "samples/ng-default", "os": "ubuntu-latest", "node-version": "NODE-VERSION", @@ -360,6 +360,17 @@ exports[`generator - github-build-matrix with devserver should match matrix valu "jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=", "args": "--sample-yorc-folder --entities-sample sqllight" }, + { + "job-name": "ng-default-webpack", + "sample": "samples/ng-default", + "os": "ubuntu-latest", + "node-version": "NODE-VERSION", + "java-version": "JAVA-VERSION", + "npm-version": "NPM-VERSION", + "default-environment": "prod", + "jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=", + "args": "--sample-yorc-folder --entities-sample sqllight --client-bundler webpack" + }, { "job-name": "react-default", "sample": "samples/react-default", diff --git a/.blueprint/github-build-matrix/samples/dev-server.ts b/.blueprint/github-build-matrix/samples/dev-server.ts index 35f6200db196..8349bbf24fce 100644 --- a/.blueprint/github-build-matrix/samples/dev-server.ts +++ b/.blueprint/github-build-matrix/samples/dev-server.ts @@ -2,10 +2,14 @@ import type { GitHubMatrixGroup } from '../../../lib/testing/index.js'; export const devServerMatrix = { angular: { - 'ng-default': { + 'ng-default-esbuild': { sample: 'samples/ng-default', args: '--sample-yorc-folder --entities-sample sqllight', }, + 'ng-default-webpack': { + sample: 'samples/ng-default', + args: '--sample-yorc-folder --entities-sample sqllight --client-bundler webpack', + }, }, react: { 'react-default': { diff --git a/generators/angular/__snapshots__/generator.spec.ts.snap b/generators/angular/__snapshots__/generator.spec.ts.snap index 56834692cdb8..6f12d4c26462 100644 --- a/generators/angular/__snapshots__/generator.spec.ts.snap +++ b/generators/angular/__snapshots__/generator.spec.ts.snap @@ -699,6 +699,7 @@ exports[`generator - angular gateway-jwt-skipUserManagement(true)-withAdminUi(fa ], "mergeClientPackageJson": [ { + "dependencies": {}, "devDependencies": { "@angular-builders/custom-webpack": null, "browser-sync-webpack-plugin": null, @@ -1639,6 +1640,9 @@ exports[`generator - angular gateway-oauth2-withAdminUi(true)-skipJhipsterDepend ], "mergeClientPackageJson": [ { + "dependencies": { + "@ngx-translate/http-loader": null, + }, "devDependencies": { "@angular-builders/custom-webpack": null, "browser-sync-webpack-plugin": null, @@ -2342,6 +2346,7 @@ exports[`generator - angular microservice-jwt-skipUserManagement(false)-withAdmi ], "mergeClientPackageJson": [ { + "dependencies": {}, "devDependencies": { "@angular-builders/custom-webpack": null, "browser-sync-webpack-plugin": null, @@ -3049,6 +3054,9 @@ exports[`generator - angular microservice-oauth2-withAdminUi(true)-skipJhipsterD ], "mergeClientPackageJson": [ { + "dependencies": { + "@ngx-translate/http-loader": null, + }, "devDependencies": { "@angular-builders/custom-webpack": null, "browser-sync-webpack-plugin": null, @@ -4159,6 +4167,9 @@ exports[`generator - angular monolith-jwt-skipUserManagement(false)-withAdminUi( ], "mergeClientPackageJson": [ { + "dependencies": { + "@ngx-translate/http-loader": null, + }, "devDependencies": { "@angular-builders/custom-webpack": null, "browser-sync-webpack-plugin": null, @@ -4848,6 +4859,7 @@ exports[`generator - angular monolith-oauth2-withAdminUi(false)-skipJhipsterDepe ], "mergeClientPackageJson": [ { + "dependencies": {}, "devDependencies": { "@angular-builders/custom-webpack": null, "browser-sync-webpack-plugin": null, @@ -5544,6 +5556,7 @@ exports[`generator - angular monolith-session-skipUserManagement(true)-withAdmin ], "mergeClientPackageJson": [ { + "dependencies": {}, "devDependencies": { "@angular-builders/custom-webpack": null, "browser-sync-webpack-plugin": null, diff --git a/generators/angular/generator.ts b/generators/angular/generator.ts index 30ac19c6fccf..1e97458c8a89 100644 --- a/generators/angular/generator.ts +++ b/generators/angular/generator.ts @@ -146,18 +146,20 @@ export default class AngularGenerator extends BaseApplicationGenerator { this.editFile(iconsPath, { ignoreNonExisting }, addIconImport(args)); }; - source.addWebpackConfig = args => { - const webpackPath = `${application.clientRootDir}webpack/webpack.custom.js`; - const ignoreNonExisting = this.sharedData.getControl().ignoreNeedlesError && 'Webpack configuration file not found'; - this.editFile( - webpackPath, - { ignoreNonExisting }, - createNeedleCallback({ - needle: 'jhipster-needle-add-webpack-config', - contentToAdd: `${args.config},`, - }), - ); - }; + if (application.clientBundlerWebpack) { + source.addWebpackConfig = args => { + const webpackPath = `${application.clientRootDir}webpack/webpack.custom.js`; + const ignoreNonExisting = this.sharedData.getControl().ignoreNeedlesError && 'Webpack configuration file not found'; + this.editFile( + webpackPath, + { ignoreNonExisting }, + createNeedleCallback({ + needle: 'jhipster-needle-add-webpack-config', + contentToAdd: `${args.config},`, + }), + ); + }; + } if (application.clientRootDir) { // Overrides only works if added in root package.json diff --git a/generators/angular/templates/build-plugins/i18n-esbuild.mjs.ejs b/generators/angular/templates/build-plugins/i18n-esbuild.mjs.ejs index f06e31837cc7..1966ee489900 100644 --- a/generators/angular/templates/build-plugins/i18n-esbuild.mjs.ejs +++ b/generators/angular/templates/build-plugins/i18n-esbuild.mjs.ejs @@ -6,7 +6,7 @@ import deepmerge from 'deepmerge'; import { hashElement } from 'folder-hash'; const __dirname = fileURLToPath(new URL('..', import.meta.url)); -const i18nSourceDir = join(__dirname, 'src/main/webapp/i18n'); +const i18nSourceDir = join(__dirname, '<%- clientSrcDir %>i18n'); export const prepareLanguage = async language => { const files = await globby('*.json', { cwd: join(i18nSourceDir, language) }); diff --git a/generators/angular/templates/build-plugins/i18n-middleware.mjs.ejs b/generators/angular/templates/build-plugins/i18n-middleware.mjs.ejs deleted file mode 100644 index 99dfe5ca7e74..000000000000 --- a/generators/angular/templates/build-plugins/i18n-middleware.mjs.ejs +++ /dev/null @@ -1,16 +0,0 @@ -import { prepareLanguage } from './i18n-esbuild.mjs'; - -const cache = new Map(); - -export default async (req, res, next) => { - const regexp = /^\/i18n\/(?\w*).json/.exec(req.url); - const lang = regexp?.groups?.lang; - if (lang) { - if (!cache.has(lang)) { - cache.set(lang, JSON.stringify(await prepareLanguage(lang))); - } - res.end(cache.get(lang)); - } else { - next(); - } -}; diff --git a/generators/angular/templates/build-plugins/swagger-esbuild.mjs.ejs b/generators/angular/templates/build-plugins/swagger-esbuild.mjs.ejs index 8117c8996506..934c0970942d 100644 --- a/generators/angular/templates/build-plugins/swagger-esbuild.mjs.ejs +++ b/generators/angular/templates/build-plugins/swagger-esbuild.mjs.ejs @@ -15,7 +15,7 @@ export const getSwaggerUiFileMap = async () => { return { [`${destDir}/axios.min.js`]: join(dirname(fileURLToPath(import.meta.resolve('axios/package.json'))), 'dist/axios.min.js'), ...(await lookup('*.{js,css,png}', getAbsoluteFSPath(), destDir)), - ...(await lookup('**/*.*', join(fileURLToPath(new URL('.', import.meta.url)), '../src/main/webapp/swagger-ui'), destDir)), + ...(await lookup('**/*.*', join(fileURLToPath(new URL('.', import.meta.url)), '../<%- clientSrcDir %>swagger-ui'), destDir)), }; }; diff --git a/generators/app/__snapshots__/generator.spec.ts.snap b/generators/app/__snapshots__/generator.spec.ts.snap index b708567f44a8..21027c530ddf 100644 --- a/generators/app/__snapshots__/generator.spec.ts.snap +++ b/generators/app/__snapshots__/generator.spec.ts.snap @@ -678,6 +678,7 @@ exports[`generator - app with default config should match snapshot 1`] = ` "cypress": "CYPRESS_VERSION", "cypress-audit": "CYPRESS_AUDIT_VERSION", "dayjs": "DAYJS_VERSION", + "deepmerge": "DEEPMERGE_VERSION", "eslint": "ESLINT_VERSION", "eslint-config-prettier": "ESLINT_CONFIG_PRETTIER_VERSION", "eslint-plugin-cypress": "ESLINT_PLUGIN_CYPRESS_VERSION", @@ -1341,6 +1342,7 @@ exports[`generator - app with gateway should match snapshot 1`] = ` "cypress": "CYPRESS_VERSION", "cypress-audit": "CYPRESS_AUDIT_VERSION", "dayjs": "DAYJS_VERSION", + "deepmerge": "DEEPMERGE_VERSION", "eslint": "ESLINT_VERSION", "eslint-config-prettier": "ESLINT_CONFIG_PRETTIER_VERSION", "eslint-plugin-cypress": "ESLINT_PLUGIN_CYPRESS_VERSION", @@ -1908,6 +1910,7 @@ exports[`generator - app with microservice should match snapshot 1`] = ` "xmemcached-provider": "'XMEMCACHED-PROVIDER-VERSION'", }, "javaManagedProperties": {}, + "javaNodeBuildPaths": [], "javaPackageSrcDir": "src/main/java/com/mycompany/myapp/", "javaPackageTestDir": "src/test/java/com/mycompany/myapp/", "javaProperties": {}, diff --git a/test-integration/samples/ng-default/.yo-rc.json b/test-integration/samples/ng-default/.yo-rc.json index 6a92c08025c3..c709c7b0ba31 100644 --- a/test-integration/samples/ng-default/.yo-rc.json +++ b/test-integration/samples/ng-default/.yo-rc.json @@ -6,6 +6,7 @@ "blueprints": [], "buildTool": "maven", "cacheProvider": "ehcache", + "clientBundler": "experimentalEsbuild", "clientFramework": "angular", "clientPackageManager": "npm", "clientTheme": "none", diff --git a/test-integration/samples/webflux-gateway-jwt/.yo-rc.json b/test-integration/samples/webflux-gateway-jwt/.yo-rc.json index c7f68a086b57..ea7ba4f3c8d7 100644 --- a/test-integration/samples/webflux-gateway-jwt/.yo-rc.json +++ b/test-integration/samples/webflux-gateway-jwt/.yo-rc.json @@ -5,6 +5,7 @@ "baseName": "reactiveGateway", "buildTool": "maven", "cacheProvider": "no", + "clientBundler": "experimentalEsbuild", "creationTimestamp": 1596513172471, "databaseType": "mongodb", "devDatabaseType": "mongodb", diff --git a/test-integration/samples/webflux-gradle-session-h2mem-es/.yo-rc.json b/test-integration/samples/webflux-gradle-session-h2mem-es/.yo-rc.json index 8488a00a76ec..c54bb13cb51e 100644 --- a/test-integration/samples/webflux-gradle-session-h2mem-es/.yo-rc.json +++ b/test-integration/samples/webflux-gradle-session-h2mem-es/.yo-rc.json @@ -5,6 +5,7 @@ "baseName": "sampleWebfluxH2mem", "buildTool": "gradle", "cacheProvider": "no", + "clientBundler": "experimentalEsbuild", "clientFramework": "angular", "clientPackageManager": "npm", "creationTimestamp": 1596513272473, diff --git a/test-integration/samples/webflux-mongodb-es-session/.yo-rc.json b/test-integration/samples/webflux-mongodb-es-session/.yo-rc.json index 1288eb380ea3..a17a02e8d989 100644 --- a/test-integration/samples/webflux-mongodb-es-session/.yo-rc.json +++ b/test-integration/samples/webflux-mongodb-es-session/.yo-rc.json @@ -5,13 +5,14 @@ "baseName": "sampleWebfluxMongodbEsSession", "buildTool": "maven", "cacheProvider": "no", + "clientBundler": "experimentalEsbuild", "clientFramework": "angular", "clientPackageManager": "npm", "creationTimestamp": 1596513172471, "databaseType": "mongodb", "devDatabaseType": "mongodb", "enableHibernateCache": false, - "enableTranslation": true, + "enableTranslation": false, "jhiPrefix": "jhi", "languages": ["en", "fr"], "nativeLanguage": "en", diff --git a/test-integration/samples/webflux-mongodb-oauth2/.yo-rc.json b/test-integration/samples/webflux-mongodb-oauth2/.yo-rc.json index 5d69d0f9a1dd..91f87c891667 100644 --- a/test-integration/samples/webflux-mongodb-oauth2/.yo-rc.json +++ b/test-integration/samples/webflux-mongodb-oauth2/.yo-rc.json @@ -6,6 +6,7 @@ "blueprints": [], "buildTool": "gradle", "cacheProvider": "no", + "clientBundler": "experimentalEsbuild", "clientFramework": "angular", "clientPackageManager": "npm", "clientTheme": "none", diff --git a/test-integration/samples/webflux-psql/.yo-rc.json b/test-integration/samples/webflux-psql/.yo-rc.json index 06a7204b5d9f..89874c105061 100644 --- a/test-integration/samples/webflux-psql/.yo-rc.json +++ b/test-integration/samples/webflux-psql/.yo-rc.json @@ -5,6 +5,7 @@ "baseName": "sampleWebfluxPsql", "buildTool": "maven", "cacheProvider": "no", + "clientBundler": "experimentalEsbuild", "clientFramework": "angular", "clientPackageManager": "npm", "creationTimestamp": 1596513172471,