Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions generators/angular/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exports[`generator - angular gateway-jwt-skipUserManagement(true)-withAdminUi(fa
"clientRoot/package.json": {
"stateCleared": "modified",
},
"clientRoot/proxy.config.mjs": {
"clientRoot/proxy.config.js": {
"stateCleared": "modified",
},
"clientRoot/src/404.html": {
Expand Down Expand Up @@ -763,7 +763,7 @@ exports[`generator - angular gateway-oauth2-withAdminUi(true)-skipJhipsterDepend
"clientRoot/package.json": {
"stateCleared": "modified",
},
"clientRoot/proxy.config.mjs": {
"clientRoot/proxy.config.js": {
"stateCleared": "modified",
},
"clientRoot/src/404.html": {
Expand Down Expand Up @@ -3176,7 +3176,7 @@ exports[`generator - angular monolith-jwt-skipUserManagement(false)-withAdminUi(
"package.json": {
"stateCleared": "modified",
},
"proxy.config.mjs": {
"proxy.config.js": {
"stateCleared": "modified",
},
"src/main/webapp/404.html": {
Expand Down Expand Up @@ -4298,7 +4298,7 @@ exports[`generator - angular monolith-oauth2-withAdminUi(false)-skipJhipsterDepe
"package.json": {
"stateCleared": "modified",
},
"proxy.config.mjs": {
"proxy.config.js": {
"stateCleared": "modified",
},
"src/main/webapp/404.html": {
Expand Down Expand Up @@ -4993,7 +4993,7 @@ exports[`generator - angular monolith-session-skipUserManagement(true)-withAdmin
"package.json": {
"stateCleared": "modified",
},
"proxy.config.mjs": {
"proxy.config.js": {
"stateCleared": "modified",
},
"src/main/webapp/404.html": {
Expand Down
2 changes: 1 addition & 1 deletion generators/angular/files-angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const files = asWriteFilesSection({
condition: ctx => ctx.clientBundlerEsbuild,
templates: [
{ sourceFile: 'angular.json.esbuild', destinationFile: 'angular.json' },
'proxy.config.mjs',
'proxy.config.js',
'build-plugins/define-esbuild.ts',
],
}),
Expand Down
1 change: 1 addition & 0 deletions generators/angular/resources/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"type": "module",
"dependencies": {
"@angular/common": "20.3.0",
"@fortawesome/angular-fontawesome": "3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion generators/angular/templates/angular.json.esbuild.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"options": {
"buildTarget": "<%= dasherizedBaseName %>:build:development",
"open": true,
"proxyConfig": "proxy.config.mjs",
"proxyConfig": "proxy.config.js",
"port": <%= devServerPort %>
},
"configurations": {
Expand Down
11 changes: 8 additions & 3 deletions generators/angular/templates/jest.conf.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
const { pathsToModuleNameMapper } = require('ts-jest');
import { pathsToModuleNameMapper } from 'ts-jest';
import { createRequire } from 'module';

const require = createRequire(import.meta.url);
const tsconfig = require('./tsconfig.json');

const {
compilerOptions: { paths = {}, baseUrl = './' },
} = require('./tsconfig.json');
} = tsconfig;


module.exports = {
export default {
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|dayjs/esm<% if (applicationTypeGateway && microfrontend) { %>|@angular-architects/module-federation-runtime<% } %>)'],
resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',
globals: {
Expand Down
1 change: 1 addition & 0 deletions generators/angular/templates/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"name": "<%= dasherizedBaseName %>",
"version": "0.0.1-SNAPSHOT",
"description": "<%= projectDescription %>",
"type": "module",
"private": true,
"license": "UNLICENSED",
"cacheDirectories": [
Expand Down
2 changes: 1 addition & 1 deletion generators/angular/templates/webpack/environment.js.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
I18N_HASH: 'generated_hash',
SERVER_API_URL: '',
__VERSION__: process.env.APP_VERSION || 'DEV',
Expand Down
2 changes: 1 addition & 1 deletion generators/angular/templates/webpack/proxy.conf.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ function setupProxy({ tls }) {
];
}

module.exports = setupProxy;
export default setupProxy;
27 changes: 16 additions & 11 deletions generators/angular/templates/webpack/webpack.custom.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const path = require('path');
import webpack from 'webpack';
import { merge } from 'webpack-merge';
import path, { dirname } from 'path';
import { fileURLToPath } from 'url';
<%_ if (enableTranslation) { _%>
const { hashElement } = require('folder-hash');
const MergeJsonWebpackPlugin = require('merge-jsons-webpack-plugin');
import { hashElement } from 'folder-hash';
import MergeJsonWebpackPlugin from 'merge-jsons-webpack-plugin';
<%_ } _%>
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
import BrowserSyncPlugin from 'browser-sync-webpack-plugin';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import environment from './environment.js';
import proxyConfig from './proxy.conf.js';
const WebpackNotifierPlugin = require('webpack-notifier');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const environment = require('./environment');
const proxyConfig = require('./proxy.conf');
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

module.exports = async (config, options, targetOptions) => {
export default async (config, options, targetOptions) => {
<%_ if (enableTranslation) { _%>
const languagesHash = await hashElement(path.resolve(__dirname, '<%= this.relativeDir(clientRootDir + 'webpack/', clientSrcDir) %>i18n'), {
algo: 'md5',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
const { withModuleFederationPlugin } = require('@angular-architects/module-federation/webpack');
const packageJson = require('../package.json');
import { withModuleFederationPlugin } from '@angular-architects/module-federation/webpack';
import packageJson from '../package.json' assert { type: 'json' };
// Microfrontend api, should match across gateway and microservices.
const apiVersion = '0.0.1';

Expand All @@ -39,7 +39,7 @@ sharedDependencies = {
};

// eslint-disable-next-line no-unused-vars
module.exports = (config, options, targetOptions) => {
export default (config, options, targetOptions) => {
return withModuleFederationPlugin({
name: '<%= lowercaseBaseName %>',
<%_ if (applicationTypeMicroservice) { _%>
Expand Down
24 changes: 12 additions & 12 deletions generators/generate-blueprint/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

exports[`generator - generate-blueprint with all option should match snapshot 1`] = `
{
".blueprint/cli/commands.mjs": {
".blueprint/cli/commands.js": {
"stateCleared": "modified",
},
".blueprint/generate-sample/command.mjs": {
".blueprint/generate-sample/command.js": {
"stateCleared": "modified",
},
".blueprint/generate-sample/generator.mjs": {
".blueprint/generate-sample/generator.js": {
"stateCleared": "modified",
},
".blueprint/generate-sample/index.mjs": {
".blueprint/generate-sample/index.js": {
"stateCleared": "modified",
},
".blueprint/generate-sample/templates/samples/sample.jdl": {
Expand All @@ -26,10 +26,10 @@ exports[`generator - generate-blueprint with all option should match snapshot 1`
"README.md": {
"stateCleared": "modified",
},
"cli/cli-customizations.cjs": {
"cli/cli-customizations.js": {
"stateCleared": "modified",
},
"cli/cli.cjs": {
"cli/cli.js": {
"stateCleared": "modified",
},
"generators/angular/command.js": {
Expand Down Expand Up @@ -1576,16 +1576,16 @@ exports[`generator - generate-blueprint with all option should match snapshot 1`

exports[`generator - generate-blueprint with default config should write files and match snapshot 1`] = `
{
".blueprint/cli/commands.mjs": {
".blueprint/cli/commands.js": {
"stateCleared": "modified",
},
".blueprint/generate-sample/command.mjs": {
".blueprint/generate-sample/command.js": {
"stateCleared": "modified",
},
".blueprint/generate-sample/generator.mjs": {
".blueprint/generate-sample/generator.js": {
"stateCleared": "modified",
},
".blueprint/generate-sample/index.mjs": {
".blueprint/generate-sample/index.js": {
"stateCleared": "modified",
},
".blueprint/generate-sample/templates/samples/sample.jdl": {
Expand All @@ -1600,10 +1600,10 @@ exports[`generator - generate-blueprint with default config should write files a
"README.md": {
"stateCleared": "modified",
},
"cli/cli-customizations.cjs": {
"cli/cli-customizations.js": {
"stateCleared": "modified",
},
"cli/cli.cjs": {
"cli/cli.js": {
"stateCleared": "modified",
},
"package.json": {
Expand Down
30 changes: 15 additions & 15 deletions generators/generate-blueprint/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ export const files = asWriteFilesSection<GenerateBlueprintApplication>({
'tsconfig.json',
'vitest.config.ts',
'vitest.test-setup.ts',
'.blueprint/cli/commands.mjs',
'.blueprint/generate-sample/command.mjs',
'.blueprint/generate-sample/generator.mjs',
'.blueprint/generate-sample/index.mjs',
'.blueprint/cli/commands.js',
'.blueprint/generate-sample/command.js',
'.blueprint/generate-sample/generator.js',
'.blueprint/generate-sample/index.js',
// Always write cli for devBlueprint usage
'cli/cli.cjs',
{ sourceFile: 'cli/cli-customizations.cjs', override: false },
'cli/cli.js',
{ sourceFile: 'cli/cli-customizations.js', override: false },
],
},
{
condition: ctx => !ctx[LOCAL_BLUEPRINT_OPTION] && ctx.githubWorkflows,
templates: [
'.blueprint/github-build-matrix/command.mjs',
'.blueprint/github-build-matrix/generator.mjs',
'.blueprint/github-build-matrix/generator.spec.mjs',
'.blueprint/github-build-matrix/index.mjs',
'.blueprint/github-build-matrix/command.js',
'.blueprint/github-build-matrix/generator.js',
'.blueprint/github-build-matrix/generator.spec.js',
'.blueprint/github-build-matrix/index.js',
],
},
{
Expand All @@ -62,7 +62,7 @@ export const files = asWriteFilesSection<GenerateBlueprintApplication>({
},
{
condition: ctx => ctx.commands.length > 0,
templates: ['cli/commands.cjs'],
templates: ['cli/commands.js'],
},
],
});
Expand All @@ -73,20 +73,20 @@ export const generatorFiles = asWriteFilesSection<TemplateData>({
path: 'generators/generator',
to: ctx => `${ctx.application.blueprintsPath}${ctx.generator.replaceAll(':', '/generators/')}`,
templates: [
{ sourceFile: 'index.mjs', destinationFile: ctx => `index.${ctx.blueprintMjsExtension}` },
{ sourceFile: 'index.js', destinationFile: ctx => `index.${ctx.blueprintMjsExtension}` },
{
sourceFile: 'command.mjs',
sourceFile: 'command.js',
destinationFile: ctx => `command.${ctx.blueprintMjsExtension}`,
override: data => !data.ignoreExistingGenerators,
},
{
sourceFile: 'generator.mjs.jhi',
sourceFile: 'generator.js.jhi',
destinationFile: ctx => `generator.${ctx.blueprintMjsExtension}.jhi`,
override: data => !data.ignoreExistingGenerators,
},
{
condition: data => !data.generator.startsWith('entity') && !data.application[LOCAL_BLUEPRINT_OPTION],
sourceFile: 'generator.spec.mjs',
sourceFile: 'generator.spec.js',
destinationFile: data => `generator.spec.${data.blueprintMjsExtension}`,
override: data => !data.ignoreExistingGenerators,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// This file will not be overwritten by generate-blueprint
module.exports = {};
export default {};
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/usr/bin/env node

const { dirname, basename, join } = require('path');
import { dirname, basename, join } from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'module';

const require = createRequire(import.meta.url);
const { version, bin } = require('../package.json');

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

// Get package name to use as namespace.
// Allows blueprints to be aliased.
const packagePath = dirname(__dirname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
module.exports = {
export default {
<% for (const command of commands) { %>
'<%= command %>': {
desc: 'Run <%= command %> sub-generator (<%= baseName %> blueprint)',
Expand Down
1 change: 1 addition & 0 deletions generators/react/resources/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"type": "module",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "7.0.1",
"@fortawesome/free-solid-svg-icons": "7.0.1",
Expand Down
Loading
Loading