Skip to content

Commit

Permalink
angular: switch samples to esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Nov 27, 2024
1 parent fbdef6e commit 7211127
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion .blueprint/github-build-matrix/samples/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
13 changes: 13 additions & 0 deletions generators/angular/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
26 changes: 14 additions & 12 deletions generators/angular/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) });
Expand Down
16 changes: 0 additions & 16 deletions generators/angular/templates/build-plugins/i18n-middleware.mjs.ejs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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)),
};
};

Expand Down
3 changes: 3 additions & 0 deletions generators/app/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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": {},
Expand Down
1 change: 1 addition & 0 deletions test-integration/samples/ng-default/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"blueprints": [],
"buildTool": "maven",
"cacheProvider": "ehcache",
"clientBundler": "experimentalEsbuild",
"clientFramework": "angular",
"clientPackageManager": "npm",
"clientTheme": "none",
Expand Down
1 change: 1 addition & 0 deletions test-integration/samples/webflux-gateway-jwt/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"baseName": "reactiveGateway",
"buildTool": "maven",
"cacheProvider": "no",
"clientBundler": "experimentalEsbuild",
"creationTimestamp": 1596513172471,
"databaseType": "mongodb",
"devDatabaseType": "mongodb",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"baseName": "sampleWebfluxH2mem",
"buildTool": "gradle",
"cacheProvider": "no",
"clientBundler": "experimentalEsbuild",
"clientFramework": "angular",
"clientPackageManager": "npm",
"creationTimestamp": 1596513272473,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"blueprints": [],
"buildTool": "gradle",
"cacheProvider": "no",
"clientBundler": "experimentalEsbuild",
"clientFramework": "angular",
"clientPackageManager": "npm",
"clientTheme": "none",
Expand Down
1 change: 1 addition & 0 deletions test-integration/samples/webflux-psql/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"baseName": "sampleWebfluxPsql",
"buildTool": "maven",
"cacheProvider": "no",
"clientBundler": "experimentalEsbuild",
"clientFramework": "angular",
"clientPackageManager": "npm",
"creationTimestamp": 1596513172471,
Expand Down

0 comments on commit 7211127

Please sign in to comment.