diff --git a/generators/client/files-vue.js b/.blueprint/cli/commands.mjs similarity index 61% rename from generators/client/files-vue.js rename to .blueprint/cli/commands.mjs index 1f6b3d9e4..6ff7b4e13 100644 --- a/generators/client/files-vue.js +++ b/.blueprint/cli/commands.mjs @@ -8,7 +8,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,20 +17,11 @@ * limitations under the License. */ -const constants = require('../generator-dotnetcore-constants.cjs'); - -/* Constants use throughout */ -const SERVER_SRC_DIR = constants.SERVER_SRC_DIR; - - -function updateHomeTitle() { - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientAppDir}/app/core/home/home.vue`, 'Java', '.Net Core', false); -} - -function writeFiles() { - updateHomeTitle.call(this); -} - -module.exports = { - writeFiles, +const defaultCommands = { + 'generate-sample': { + desc: 'Generate a test sample', + blueprint: '@jhipster/jhipster-dev', + }, }; + +export default defaultCommands; diff --git a/.blueprint/generate-sample/command.mjs b/.blueprint/generate-sample/command.mjs new file mode 100644 index 000000000..4906cad62 --- /dev/null +++ b/.blueprint/generate-sample/command.mjs @@ -0,0 +1,42 @@ +/** + * Copyright 2013-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { GENERATOR_APP } from 'generator-jhipster/generators'; +/** + * @type {import('generator-jhipster').JHipsterCommandDefinition} + */ +const command = { + arguments: { + sampleName: { + type: String, + }, + }, + options: { + withEntities: { + type: Boolean, + scope: 'generator', + }, + configOnly: { + type: Boolean, + scope: 'generator', + }, + }, + import: [GENERATOR_APP], +}; + +export default command; diff --git a/.blueprint/generate-sample/generator.mjs b/.blueprint/generate-sample/generator.mjs new file mode 100644 index 000000000..349df8716 --- /dev/null +++ b/.blueprint/generate-sample/generator.mjs @@ -0,0 +1,109 @@ +import { readdir, stat } from 'node:fs/promises'; +import BaseGenerator from 'generator-jhipster/generators/base'; +import command from './command.mjs'; +import { statSync } from 'node:fs'; + +export default class extends BaseGenerator { + sampleName; + jdlSample; + withEntities; + configOnly; + + get [BaseGenerator.INITIALIZING]() { + return this.asInitializingTaskGroup({ + async initializeOptions() { + this.parseJHipsterCommand(command); + }, + }); + } + + get [BaseGenerator.PROMPTING]() { + return this.asPromptingTaskGroup({ + async askForSample() { + if (!this.sampleName) { + const answers = await this.prompt({ + type: 'list', + name: 'sampleName', + message: 'which sample do you want to generate?', + choices: async () => readdir(this.templatePath('samples')), + }); + this.sampleName = answers.sampleName; + } + }, + }); + } + + get [BaseGenerator.WRITING]() { + return this.asWritingTaskGroup({ + async copySample() { + let isDir = false; + let jdlFile = false; + try { + const pathStat = await stat(this.templatePath(`samples/${this.sampleName}`)); + isDir = pathStat.isDirectory(); + jdlFile = pathStat.isFile(); + } catch (error) { + try { + this.sampleName += '.jdl'; + jdlFile = (await stat(this.templatePath(`samples/${this.sampleName}`))).isFile(); + } catch { + throw error; + } + } + + if (jdlFile) { + this.jdlSample = this.sampleName; + this.copyTemplate(`samples/${this.sampleName}`, this.sampleName, { noGlob: true }); + } else if (isDir) { + this.copyTemplate(`samples/${this.sampleName}/.yo-rc.json`, '.yo-rc.json', { noGlob: true }); + } else { + throw new Error(`Sample ${this.sampleName} was not identified`); + } + }, + async jdlEntities() { + if (this.withEntities) { + if (this.sampleName.includes('-mongo-')) { + this.jdlSample = 'app_mongo.jdl'; + } else if (this.sampleName.includes('-react-')) { + this.jdlSample = 'app-react.jdl'; + } else { + this.jdlSample = 'app.jdl'; + } + this.copyTemplate(`samples/jdl-default/${this.jdlSample}`, this.jdlSample, { noGlob: true }); + } + }, + }); + } + + get [BaseGenerator.END]() { + return this.asEndTaskGroup({ + async generateSample() { + if (this.jdlSample && !this.configOnly) { + await this.composeWithJHipster('jdl', { + generatorArgs: [this.jdlSample], + generatorOptions: { + jsonOnly: true, + }, + }); + } + }, + async generateApp() { + if (this.configOnly) { + return; + } + + await this.composeWithJHipster('app', { + generatorOptions: { + skipJhipsterDependencies: true, + insight: false, + skipChecks: true, + skipInstall: true, + }, + }); + }, + async jhipsterInfo() { + await this.composeWithJHipster('info'); + }, + }); + } +} diff --git a/.blueprint/generate-sample/index.mjs b/.blueprint/generate-sample/index.mjs new file mode 100644 index 000000000..3dd0513e5 --- /dev/null +++ b/.blueprint/generate-sample/index.mjs @@ -0,0 +1,2 @@ +export { default } from './generator.mjs'; +export { default as command } from './command.mjs'; diff --git a/test-integration/samples/csharp-di-test/CountryExtendedService.cs b/.blueprint/generate-sample/templates/samples/csharp-di-test/CountryExtendedService.cs similarity index 100% rename from test-integration/samples/csharp-di-test/CountryExtendedService.cs rename to .blueprint/generate-sample/templates/samples/csharp-di-test/CountryExtendedService.cs diff --git a/test-integration/samples/csharp-di-test/ExtendedServiceRegistrationTest.cs b/.blueprint/generate-sample/templates/samples/csharp-di-test/ExtendedServiceRegistrationTest.cs similarity index 100% rename from test-integration/samples/csharp-di-test/ExtendedServiceRegistrationTest.cs rename to .blueprint/generate-sample/templates/samples/csharp-di-test/ExtendedServiceRegistrationTest.cs diff --git a/test-integration/samples/gateway-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/gateway-app/.yo-rc.json similarity index 79% rename from test-integration/samples/gateway-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/gateway-app/.yo-rc.json index 832f23f3f..888e93465 100644 --- a/test-integration/samples/gateway-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/gateway-app/.yo-rc.json @@ -19,16 +19,9 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/.blueprint/generate-sample/templates/samples/jdl-default/app-react.jdl b/.blueprint/generate-sample/templates/samples/jdl-default/app-react.jdl new file mode 100644 index 000000000..b97331a39 --- /dev/null +++ b/.blueprint/generate-sample/templates/samples/jdl-default/app-react.jdl @@ -0,0 +1,117 @@ +entity Region { + regionName String +} + +entity Country { + countryName String +} + +// an ignored comment +/** not an ignored comment */ +entity Location { + streetAddress String, + postalCode String, + city String, + stateProvince String +} + +entity Department { + departmentName String required +} + +/** + * PieceOfWork entity. + * @author The JHipster team. + */ +entity PieceOfWork { + title String, + description String +} + +/** + * The Employee entity. + */ +entity Employee { + /** + * The firstname attribute. + */ + firstName String, + lastName String, + email String, + phoneNumber String, + hireDate Instant, + salary Long, + commissionPct Long +} + +entity Job { + jobTitle String, + minSalary Long, + maxSalary Long +} + +entity JobHistory { + startDate Instant, + endDate Instant, + language Language +} + +enum Language { + FRENCH, ENGLISH, SPANISH +} + + + +relationship OneToOne { + Country{region} to Region +} + +relationship OneToOne { + Location{country} to Country +} + +relationship OneToOne { + Department{location} to Location +} + +// defining multiple OneToMany relationships with comments +relationship OneToMany { + Employee to Job{employee}, + /** + * A relationship + */ + Department to + /** + * Another side of the same relationship + */ + Employee{department} +} + +relationship ManyToOne { + Employee{manager} to Employee +} + +// defining multiple oneToOne relationships +relationship OneToOne { + JobHistory{job} to Job, + JobHistory{department} to Department, + JobHistory{employee} to Employee +} + +relationship ManyToMany { + Job{chore(title)} to PieceOfWork{job} +} + +// Set pagination options +// .Net does not generates link header for pagination. +// paginate JobHistory, Employee with infinite-scroll +// paginate Job with pagination + +// Use Data Transfert Objects (DTO) +dto * with mapstruct + +// Set service options to all except few +service all with serviceImpl except Employee, Job + +// Set an angular suffix +// angularSuffix * with mySuffix diff --git a/test-integration/samples/jdl-default/app.jdl b/.blueprint/generate-sample/templates/samples/jdl-default/app.jdl similarity index 100% rename from test-integration/samples/jdl-default/app.jdl rename to .blueprint/generate-sample/templates/samples/jdl-default/app.jdl diff --git a/test-integration/samples/jdl-default/app_mongo.jdl b/.blueprint/generate-sample/templates/samples/jdl-default/app_mongo.jdl similarity index 100% rename from test-integration/samples/jdl-default/app_mongo.jdl rename to .blueprint/generate-sample/templates/samples/jdl-default/app_mongo.jdl diff --git a/test-integration/samples/jwt-with-angular-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-angular-app/.yo-rc.json similarity index 79% rename from test-integration/samples/jwt-with-angular-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-angular-app/.yo-rc.json index 6fac971dd..e50bebb02 100644 --- a/test-integration/samples/jwt-with-angular-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-angular-app/.yo-rc.json @@ -19,16 +19,9 @@ "entitySuffix": "", "dtoSuffix": "DTO", "testFrameworks": ["cypress"], - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/jwt-with-postgres-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-angular-cqrs-app/.yo-rc.json similarity index 76% rename from test-integration/samples/jwt-with-postgres-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-angular-cqrs-app/.yo-rc.json index 140f71ec2..d0a3f35ae 100644 --- a/test-integration/samples/jwt-with-postgres-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-angular-cqrs-app/.yo-rc.json @@ -5,8 +5,9 @@ "packageName": "JhipsterSampleApplication", "authenticationType": "jwt", "serverPort": "5000", - "databaseType": "postgres", + "databaseType": "sqllite", "prodDatabaseType": "mysql", + "cqrsEnabled": true, "enableTranslation": false, "namespace": "JhipsterSampleApplication", "jhipsterVersion": "7.9.3", @@ -19,16 +20,9 @@ "entitySuffix": "", "dtoSuffix": "DTO", "testFrameworks": ["cypress"], - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/jwt-with-blazor-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-blazor-app/.yo-rc.json similarity index 78% rename from test-integration/samples/jwt-with-blazor-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-blazor-app/.yo-rc.json index 51c0486da..39e421c6e 100644 --- a/test-integration/samples/jwt-with-blazor-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-blazor-app/.yo-rc.json @@ -18,16 +18,9 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/jwt-with-blazor-cqrs-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-blazor-cqrs-app/.yo-rc.json similarity index 79% rename from test-integration/samples/jwt-with-blazor-cqrs-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-blazor-cqrs-app/.yo-rc.json index 6f05401af..be984fd5c 100644 --- a/test-integration/samples/jwt-with-blazor-cqrs-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-blazor-cqrs-app/.yo-rc.json @@ -19,16 +19,9 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/jwt-with-mongo-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-mongo-app/.yo-rc.json similarity index 79% rename from test-integration/samples/jwt-with-mongo-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-mongo-app/.yo-rc.json index 4876f2a7c..9f1d7e2be 100644 --- a/test-integration/samples/jwt-with-mongo-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-mongo-app/.yo-rc.json @@ -19,16 +19,9 @@ "entitySuffix": "", "dtoSuffix": "DTO", "testFrameworks": ["cypress"], - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/jwt-with-mongo-cqrs-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-mongo-cqrs-app/.yo-rc.json similarity index 77% rename from test-integration/samples/jwt-with-mongo-cqrs-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-mongo-cqrs-app/.yo-rc.json index 4d62bc0e9..756d08c00 100644 --- a/test-integration/samples/jwt-with-mongo-cqrs-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-mongo-cqrs-app/.yo-rc.json @@ -7,7 +7,7 @@ "serverPort": "5000", "databaseType": "mongodb", "prodDatabaseType": "mongodb", - "cqrsEnabled": true, + "cqrsEnabled": true, "enableTranslation": false, "namespace": "JhipsterSampleApplication", "jhipsterVersion": "7.9.3", @@ -20,16 +20,9 @@ "entitySuffix": "", "dtoSuffix": "DTO", "testFrameworks": ["cypress"], - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/jwt-with-mssql-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-mssql-app/.yo-rc.json similarity index 79% rename from test-integration/samples/jwt-with-mssql-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-mssql-app/.yo-rc.json index b87911e5c..ffd6c3270 100644 --- a/test-integration/samples/jwt-with-mssql-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-mssql-app/.yo-rc.json @@ -19,16 +19,9 @@ "entitySuffix": "", "dtoSuffix": "DTO", "testFrameworks": ["cypress"], - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/jwt-with-mysql-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-mysql-app/.yo-rc.json similarity index 79% rename from test-integration/samples/jwt-with-mysql-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-mysql-app/.yo-rc.json index b23cf6944..91884ae26 100644 --- a/test-integration/samples/jwt-with-mysql-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-mysql-app/.yo-rc.json @@ -19,16 +19,9 @@ "entitySuffix": "", "dtoSuffix": "DTO", "testFrameworks": ["cypress"], - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/jwt-with-oracle-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-oracle-app/.yo-rc.json similarity index 78% rename from test-integration/samples/jwt-with-oracle-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-oracle-app/.yo-rc.json index 0b7b2053f..7d8a63e84 100644 --- a/test-integration/samples/jwt-with-oracle-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-oracle-app/.yo-rc.json @@ -18,16 +18,9 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/.blueprint/generate-sample/templates/samples/jwt-with-postgres-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-postgres-app/.yo-rc.json new file mode 100644 index 000000000..0fbc8c262 --- /dev/null +++ b/.blueprint/generate-sample/templates/samples/jwt-with-postgres-app/.yo-rc.json @@ -0,0 +1,31 @@ +{ + "generator-jhipster": { + "applicationType": "monolith", + "baseName": "JhipsterSampleApplication", + "packageName": "JhipsterSampleApplication", + "authenticationType": "jwt", + "serverPort": "5000", + "databaseType": "postgresql", + "prodDatabaseType": "mysql", + "enableTranslation": false, + "namespace": "JhipsterSampleApplication", + "jhipsterVersion": "7.9.3", + "useSass": true, + "clientPackageManager": "npm", + "clientFramework": "angularX", + "clientTheme": "none", + "creationTimestamp": 1585496278113, + "jhiPrefix": "jhi", + "entitySuffix": "", + "dtoSuffix": "DTO", + "testFrameworks": ["cypress"], + "blueprints": [ + { + "name": "generator-jhipster-dotnetcore" + } + ] + }, + "generator-jhipster-dotnetcore": { + "ciType": "Github" + } +} diff --git a/test-integration/samples/jwt-with-react-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-react-app/.yo-rc.json similarity index 79% rename from test-integration/samples/jwt-with-react-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-react-app/.yo-rc.json index ba22eb962..d4ff10a0a 100644 --- a/test-integration/samples/jwt-with-react-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-react-app/.yo-rc.json @@ -19,17 +19,10 @@ "entitySuffix": "", "dtoSuffix": "DTO", "testFrameworks": ["cypress"], - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "enableTranslation": false, "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/jwt-with-vue-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/jwt-with-vue-app/.yo-rc.json similarity index 87% rename from test-integration/samples/jwt-with-vue-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/jwt-with-vue-app/.yo-rc.json index fb99946e0..a8951f1c8 100644 --- a/test-integration/samples/jwt-with-vue-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/jwt-with-vue-app/.yo-rc.json @@ -18,12 +18,6 @@ "entitySuffix": "", "dtoSuffix": "DTO", "testFrameworks": ["cypress"], - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "enableTranslation": false, "blueprints": [ { diff --git a/test-integration/samples/microservice-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/microservice-app/.yo-rc.json similarity index 76% rename from test-integration/samples/microservice-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/microservice-app/.yo-rc.json index 719ff44b4..c9162754b 100644 --- a/test-integration/samples/microservice-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/microservice-app/.yo-rc.json @@ -13,22 +13,14 @@ "jhipsterVersion": "7.9.3", "useSass": true, "clientPackageManager": "npm", - "clientFramework": "angularX", "clientTheme": "none", "creationTimestamp": 1585496278113, "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/oauth-with-angular-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-angular-app/.yo-rc.json similarity index 79% rename from test-integration/samples/oauth-with-angular-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-angular-app/.yo-rc.json index 56baa3b3b..baf488fa5 100644 --- a/test-integration/samples/oauth-with-angular-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-angular-app/.yo-rc.json @@ -18,17 +18,10 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "enableTranslation": false, "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/oauth-with-angular-cqrs-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-angular-cqrs-app/.yo-rc.json similarity index 77% rename from test-integration/samples/oauth-with-angular-cqrs-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-angular-cqrs-app/.yo-rc.json index a56cd5aa4..550842177 100644 --- a/test-integration/samples/oauth-with-angular-cqrs-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-angular-cqrs-app/.yo-rc.json @@ -5,7 +5,7 @@ "prodDatabaseType": "mysql", "authenticationType": "oauth2", "serverPort": "5000", - "cqrsEnabled": true, + "cqrsEnabled": true, "jhipsterVersion": "7.9.3", "applicationType": "monolith", "baseName": "JhipsterSampleApplication", @@ -19,17 +19,10 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "enableTranslation": false, "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/oauth-with-mongo-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-mongo-app/.yo-rc.json similarity index 78% rename from test-integration/samples/oauth-with-mongo-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-mongo-app/.yo-rc.json index 88dad6a3a..41431afc6 100644 --- a/test-integration/samples/oauth-with-mongo-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-mongo-app/.yo-rc.json @@ -18,16 +18,9 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/oauth-with-mongo-cqrs-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-mongo-cqrs-app/.yo-rc.json similarity index 76% rename from test-integration/samples/oauth-with-mongo-cqrs-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-mongo-cqrs-app/.yo-rc.json index 49554741f..232001204 100644 --- a/test-integration/samples/oauth-with-mongo-cqrs-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-mongo-cqrs-app/.yo-rc.json @@ -7,7 +7,7 @@ "serverPort": "5000", "databaseType": "mongodb", "prodDatabaseType": "mongodb", - "cqrsEnabled": true, + "cqrsEnabled": true, "enableTranslation": false, "namespace": "JhipsterSampleApplication", "jhipsterVersion": "7.9.3", @@ -19,16 +19,9 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/oauth-with-mssql-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-mssql-app/.yo-rc.json similarity index 78% rename from test-integration/samples/oauth-with-mssql-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-mssql-app/.yo-rc.json index e15ffd190..262a7c836 100644 --- a/test-integration/samples/oauth-with-mssql-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-mssql-app/.yo-rc.json @@ -18,17 +18,10 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "enableTranslation": false, "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/oauth-with-mysql-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-mysql-app/.yo-rc.json similarity index 78% rename from test-integration/samples/oauth-with-mysql-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-mysql-app/.yo-rc.json index ce54d36b0..93be1c32f 100644 --- a/test-integration/samples/oauth-with-mysql-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-mysql-app/.yo-rc.json @@ -18,17 +18,10 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "enableTranslation": false, "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/oauth-with-oracle-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-oracle-app/.yo-rc.json similarity index 79% rename from test-integration/samples/oauth-with-oracle-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-oracle-app/.yo-rc.json index 684b5f94d..65de776ea 100644 --- a/test-integration/samples/oauth-with-oracle-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-oracle-app/.yo-rc.json @@ -18,17 +18,10 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "enableTranslation": false, "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/.blueprint/generate-sample/templates/samples/oauth-with-postgres-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-postgres-app/.yo-rc.json new file mode 100644 index 000000000..dbf066bdc --- /dev/null +++ b/.blueprint/generate-sample/templates/samples/oauth-with-postgres-app/.yo-rc.json @@ -0,0 +1,31 @@ +{ + "generator-jhipster": { + "namespace": "JhipsterSampleApplication", + "databaseType": "postgresql", + "prodDatabaseType": "mysql", + "authenticationType": "oauth2", + "serverPort": "5000", + "jhipsterVersion": "7.9.3", + "applicationType": "monolith", + "baseName": "JhipsterSampleApplication", + "useSass": true, + "clientPackageManager": "npm", + "clientFramework": "angularX", + "clientTheme": "none", + "clientThemeVariant": "", + "creationTimestamp": 1587112984699, + "testFrameworks": [], + "jhiPrefix": "jhi", + "entitySuffix": "", + "dtoSuffix": "DTO", + "enableTranslation": false, + "blueprints": [ + { + "name": "generator-jhipster-dotnetcore" + } + ] + }, + "generator-jhipster-dotnetcore": { + "ciType": "Github" + } +} diff --git a/test-integration/samples/oauth-with-react-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-react-app/.yo-rc.json similarity index 78% rename from test-integration/samples/oauth-with-react-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-react-app/.yo-rc.json index e88a2d78e..e9ef58aa2 100644 --- a/test-integration/samples/oauth-with-react-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-react-app/.yo-rc.json @@ -18,17 +18,10 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "enableTranslation": false, "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/oauth-with-sqllite-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-sqllite-app/.yo-rc.json similarity index 78% rename from test-integration/samples/oauth-with-sqllite-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-sqllite-app/.yo-rc.json index 8bff65776..47e22e129 100644 --- a/test-integration/samples/oauth-with-sqllite-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-sqllite-app/.yo-rc.json @@ -18,16 +18,9 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "blueprints": [ { - "name": "generator-jhipster-dotnetcore", - "version": "2.0.0" + "name": "generator-jhipster-dotnetcore" } ] }, diff --git a/test-integration/samples/oauth-with-vue-app/.yo-rc.json b/.blueprint/generate-sample/templates/samples/oauth-with-vue-app/.yo-rc.json similarity index 87% rename from test-integration/samples/oauth-with-vue-app/.yo-rc.json rename to .blueprint/generate-sample/templates/samples/oauth-with-vue-app/.yo-rc.json index ddedcdfc9..d6d68446b 100644 --- a/test-integration/samples/oauth-with-vue-app/.yo-rc.json +++ b/.blueprint/generate-sample/templates/samples/oauth-with-vue-app/.yo-rc.json @@ -18,12 +18,6 @@ "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", - "otherModules": [ - { - "name": "generator-jhipster-dotnetcore", - "version": "3.9.1" - } - ], "enableTranslation": false, "blueprints": [ { diff --git a/.editorconfig b/.editorconfig index ce53ec385..4d13f069f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,17 +1,20 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs # editorconfig.org + root = true [*] -indent_style = space -indent_size = 4 + +# We recommend you to keep these unchanged end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -[*.md] -trim_trailing_whitespace = false - -[{package,bower}.json] +# Change these settings to your own preference indent_style = space indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.eslintignore b/.eslintignore index 2dbb56c98..e5bcf8fb0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,5 @@ -coverage -generators/**/templates -node_modules -travis -docs -generators/client/** +*.back.js +**/heroku/** +**/entity/** +**/ci-cd/** +**/client/*.cjs diff --git a/.eslintrc.json b/.eslintrc.json index 4992429dc..93fe8eecc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,44 +1,45 @@ { - "env": { - "node": true, - "es6": true - }, - "extends": ["airbnb-base", "plugin:prettier/recommended"], - "rules": { - "default-param-last": "off", - "prettier/prettier": "error", - "prefer-regex-literals": "off", - "linebreak-style": 0, - "eol-last": 2, - "quotes": [2, "single", { "avoidEscape": true }], - "semi": [2, "always"], - "eqeqeq": [2, "smart"], - "no-restricted-globals": ["off"], - "no-use-before-define": [2, "nofunc"], - "no-confusing-arrow": "off", - "no-unused-vars": [2, { "vars": "local", "args": "none" }], - "no-multi-str": 2, - "no-irregular-whitespace": 2, - "no-restricted-exports": "off", - "comma-dangle": "off", - "max-len": "off", - "func-names": "off", - "class-methods-use-this": "off", - "no-underscore-dangle": "off", - "no-plusplus": "off", - "no-unused-expressions": [2, { "allowShortCircuit": true, "allowTernary": true }], - "prefer-destructuring": "off", - "no-console": "off", - "no-multi-assign": "off", - "no-param-reassign": "off", - "no-shadow": "off", - "no-promise-executor-return": "off", - "import/extensions": [0, { "pattern": { "{c,m,}js": "always" } }] - }, - "overrides": [ - { - "files": ["test/**/*.js"], - "env": { "mocha": true } - } - ] + "env": { + "node": true, + "es2022": true + }, + "extends": ["eslint:recommended", "airbnb-base", "plugin:prettier/recommended"], + "parserOptions": { + "ecmaVersion": 13, + "sourceType": "module" + }, + "overrides": [ + { + "files": ["**/*.spec.{c,m,}js", "test/**/*.{c,m,}js"] + } + ], + "rules": { + "func-names": "off", + "import/prefer-default-export": "off", + "no-param-reassign": [ + "error", + { "props": true, "ignorePropertyModificationsFor": ["application", "source", "entity", "field", "relationship"] } + ], + "import/no-extraneous-dependencies": ["error", { "devDependencies": true }], + "import/no-unresolved": "off", + "import/extensions": "off", + "no-restricted-exports": ["error", { "restrictDefaultExports": { "defaultFrom": false } }], + "no-await-in-loop": "off", + "no-restricted-syntax": [ + "error", + { + "selector": "ForInStatement", + "message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array." + }, + { + "selector": "LabeledStatement", + "message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand." + }, + { + "selector": "WithStatement", + "message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize." + } + ], + "no-shadow": "off" + } } diff --git a/.gitattributes b/.gitattributes index ff453f8b8..ca61722de 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,35 +1,150 @@ -# All text files should have the "lf" (Unix) line endings -* text eol=lf - -# Explicitly declare text files you want to always be normalized and converted -# to native line endings on checkout. -*.java text -*.js text -*.css text -*.html text -*.cs text - -# Denote all files that are truly binary and should not be modified. -*.png binary -*.jpg binary -*.jar binary -*.pdf binary -*.eot binary -*.ttf binary -*.gzip binary -*.gz binary -*.ai binary -*.eps binary - -# Precise which language is used -*.ts.ejs linguist-language=TypeScript -*.tsx.ejs linguist-language=TypeScript -*.js.ejs linguist-language=JavaScript -*.cs.ejs linguist-language=CSharp -*.ps1.ejs linguist-language=PowerShell -*.css.ejs linguist-language=CSS -*.scss.ejs linguist-language=SCSS -*.yaml.ejs linguist-language=YAML -*.yml.ejs linguist-language=YAML -*.json.ejs linguist-language=JSON -*.xml.ejs linguist-language=XML \ No newline at end of file +# This file is inspired by https://github.com/alexkaratarakis/gitattributes +# +# Auto detect text files and perform LF normalization +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +* text=auto + +# The above will handle all files NOT found below +# These files are text and should be normalized (Convert crlf => lf) + +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf +*.coffee text +*.css text +*.cql text +*.df text +*.ejs text +*.html text +*.java text +*.js text +*.json text +*.less text +*.properties text +*.sass text +*.scss text +*.sh text eol=lf +*.sql text +*.txt text +*.ts text +*.xml text +*.yaml text +*.yml text + +# Documents +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain +*.markdown text +*.md text +*.adoc text +*.textile text +*.mustache text +*.csv text +*.tab text +*.tsv text +*.txt text +AUTHORS text +CHANGELOG text +CHANGES text +CONTRIBUTING text +COPYING text +copyright text +*COPYRIGHT* text +INSTALL text +license text +LICENSE text +NEWS text +readme text +*README* text +TODO text + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as an asset (binary) by default. If you want to treat it as text, +# comment-out the following line and uncomment the line after. +*.svg binary +#*.svg text +*.eps binary + +# These files are binary and should be left untouched +# (binary is a macro for -text -diff) +*.class binary +*.jar binary +*.war binary + +## LINTERS +.csslintrc text +.eslintrc text +.jscsrc text +.jshintrc text +.jshintignore text +.stylelintrc text + +## CONFIGS +*.conf text +*.config text +.editorconfig text +.gitattributes text +.gitconfig text +.gitignore text +.htaccess text +*.npmignore text + +## HEROKU +Procfile text +.slugignore text + +## AUDIO +*.kar binary +*.m4a binary +*.mid binary +*.midi binary +*.mp3 binary +*.ogg binary +*.ra binary + +## VIDEO +*.3gpp binary +*.3gp binary +*.as binary +*.asf binary +*.asx binary +*.fla binary +*.flv binary +*.m4v binary +*.mng binary +*.mov binary +*.mp4 binary +*.mpeg binary +*.mpg binary +*.swc binary +*.swf binary +*.webm binary + +## ARCHIVES +*.7z binary +*.gz binary +*.rar binary +*.tar binary +*.zip binary + +## FONTS +*.ttf binary +*.eot binary +*.otf binary +*.woff binary +*.woff2 binary diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 3663880aa..3a18c8c16 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -52,7 +52,7 @@ If you are using JDL, please share that configuration as well. -- [ ] Checking this box is mandatory (this is just to show you read everything) +- [ ] Checking this box is mandatory (this is just to show you read everything) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md index 0b1d32328..ace6d8aad 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.md +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -65,7 +65,7 @@ If you are using JDL, please share that configuration as well. -- [ ] Checking this box is mandatory (this is just to show you read everything) +- [ ] Checking this box is mandatory (this is just to show you read everything) diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md index e45a67828..cb59fcf9d 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -15,7 +15,7 @@ about: Suggest an improvement. -- [ ] Checking this box is mandatory (this is just to show you read everything) +- [ ] Checking this box is mandatory (this is just to show you read everything) diff --git a/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md b/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md index a4e0136cc..cfe174ac6 100644 --- a/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md +++ b/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md @@ -8,6 +8,6 @@ about: If you have a question, please use StackOverflow! We primarily use GitHub as an issue tracker, if your issue is not a **bug** or **feature request** then sorry you are not in the right place :wink:. **If you have a question** please use Stack Overflow, and tag the question with [jhipster](http://stackoverflow.com/questions/tagged/jhipster). This will help the project to keep a clean issue tracker. Also, Stack Overflow will give your question a larger audience: -- This will increase your chances to get an answer -- Answers will be of higher quality, as there is a voting system -- This will also help other users who might have the same issue, as questions are tagged and easily searchable +- This will increase your chances to get an answer +- Answers will be of higher quality, as there is a voting system +- This will also help other users who might have the same issue, as questions are tagged and easily searchable diff --git a/.github/MAINTAINERS_REPLY_TEMPLATES/DONT_COMMENT_ON_OLD_ISSUE.md b/.github/MAINTAINERS_REPLY_TEMPLATES/DONT_COMMENT_ON_OLD_ISSUE.md index 02e5447e3..97a9f695d 100644 --- a/.github/MAINTAINERS_REPLY_TEMPLATES/DONT_COMMENT_ON_OLD_ISSUE.md +++ b/.github/MAINTAINERS_REPLY_TEMPLATES/DONT_COMMENT_ON_OLD_ISSUE.md @@ -3,8 +3,8 @@ If you think this issue still applies, please [create a new ticket](https://gith **If you have a question** please use Stack Overflow, and tag the question with [jhipster](http://stackoverflow.com/questions/tagged/jhipster). This helps the project to keep the issue tracker clean. Also, Stack Overflow will give your question a larger audience: -- This will increase your chances to get an answer -- Answers will be of higher quality, as there is a voting system -- This will also help other users who might have the same issue, as questions are tagged and easily searchable +- This will increase your chances to get an answer +- Answers will be of higher quality, as there is a voting system +- This will also help other users who might have the same issue, as questions are tagged and easily searchable Finally, you can also use [our chat room on gitter](https://gitter.im/jhipster/generator-jhipster). diff --git a/.github/MAINTAINERS_REPLY_TEMPLATES/GUIDELINES_NOT_FOLLOWED.md b/.github/MAINTAINERS_REPLY_TEMPLATES/GUIDELINES_NOT_FOLLOWED.md index 3bcd8d6e2..e63a2e9a3 100644 --- a/.github/MAINTAINERS_REPLY_TEMPLATES/GUIDELINES_NOT_FOLLOWED.md +++ b/.github/MAINTAINERS_REPLY_TEMPLATES/GUIDELINES_NOT_FOLLOWED.md @@ -13,8 +13,8 @@ Issues opened without proper details will be closed without explanation. **If you have a question** please use Stack Overflow, and tag the question with [jhipster](http://stackoverflow.com/questions/tagged/jhipster). This helps the project to keep the issue tracker clean. Also, Stack Overflow will give your question a larger audience: -- This will increase your chances to get an answer -- Answers will be of higher quality, as there is a voting system -- This will also help other users who might have the same issue, as questions are tagged and easily searchable +- This will increase your chances to get an answer +- Answers will be of higher quality, as there is a voting system +- This will also help other users who might have the same issue, as questions are tagged and easily searchable Finally, you can also use [our chat room on gitter](https://gitter.im/jhipster/generator-jhipster). diff --git a/.github/MAINTAINERS_REPLY_TEMPLATES/README.md b/.github/MAINTAINERS_REPLY_TEMPLATES/README.md index cc202f00f..7769fb33f 100644 --- a/.github/MAINTAINERS_REPLY_TEMPLATES/README.md +++ b/.github/MAINTAINERS_REPLY_TEMPLATES/README.md @@ -4,7 +4,7 @@ Here is a list of common **reply messages** shared by core team members to help You can add those to your [Github saved replies settings](https://github.com/settings/replies). -- [Guidelines are not followed](GUIDELINES_NOT_FOLLOWED.md) -- [Use Stack Overflow](USE_STACK_OVERFLOW.md) -- [Don't comment on an old issue](DONT_COMMENT_ON_OLD_ISSUE.md) -- [Build as a module](BUILD_AS_MODULE.md) +- [Guidelines are not followed](GUIDELINES_NOT_FOLLOWED.md) +- [Use Stack Overflow](USE_STACK_OVERFLOW.md) +- [Don't comment on an old issue](DONT_COMMENT_ON_OLD_ISSUE.md) +- [Build as a module](BUILD_AS_MODULE.md) diff --git a/.github/MAINTAINERS_REPLY_TEMPLATES/USE_STACK_OVERFLOW.md b/.github/MAINTAINERS_REPLY_TEMPLATES/USE_STACK_OVERFLOW.md index fefa301c9..e66c44530 100644 --- a/.github/MAINTAINERS_REPLY_TEMPLATES/USE_STACK_OVERFLOW.md +++ b/.github/MAINTAINERS_REPLY_TEMPLATES/USE_STACK_OVERFLOW.md @@ -1,8 +1,8 @@ This is not a **bug** or **feature request** and hence this is not the correct forum for this. **If you have a question** please use Stack Overflow, and tag the question with [jhipster](http://stackoverflow.com/questions/tagged/jhipster). This will help the project to keep a clean issue tracker. Also, Stack Overflow will give your question a larger audience: -- This will increase your chances to get an answer -- Answers will be of higher quality, as there is a voting system -- This will also help other users who might have the same issue, as questions are tagged and easily searchable +- This will increase your chances to get an answer +- Answers will be of higher quality, as there is a voting system +- This will also help other users who might have the same issue, as questions are tagged and easily searchable Finally, you can also use [our chat room on gitter](https://gitter.im/jhipster/generator-jhipster). diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 987e55075..7a20d15bb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,9 +1,9 @@ -- Please make sure the below checklist is followed for Pull Requests. +- Please make sure the below checklist is followed for Pull Requests. -- [ ] [All continuous integration tests](https://github.com/jhipster/generator-jhipster/actions) are green -- [ ] Tests are added where necessary -- [ ] Documentation is added/updated where necessary -- [ ] Coding Rules & Commit Guidelines as per our [CONTRIBUTING.md document](https://github.com/jhipster/generator-jhipster/blob/main/CONTRIBUTING.md) are followed +- [ ] [All continuous integration tests](https://github.com/jhipster/generator-jhipster/actions) are green +- [ ] Tests are added where necessary +- [ ] Documentation is added/updated where necessary +- [ ] Coding Rules & Commit Guidelines as per our [CONTRIBUTING.md document](https://github.com/jhipster/generator-jhipster/blob/main/CONTRIBUTING.md) are followed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/Dockerfile b/Dockerfile similarity index 80% rename from docker/Dockerfile rename to Dockerfile index 4672da525..fc2aa823c 100644 --- a/docker/Dockerfile +++ b/Dockerfile @@ -1,4 +1,8 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 + +# copy sources +COPY . /home/jhipster/jhipster-dotnetcore + RUN \ # configure the "jhipster" user groupadd jhipster && \ @@ -15,12 +19,14 @@ RUN \ sudo \ git && \ # install node.js - wget https://nodejs.org/dist/v14.17.3/node-v14.17.3-linux-x64.tar.gz -O /tmp/node.tar.gz && \ + wget https://nodejs.org/dist/v18.17.1/node-v18.17.1-linux-x64.tar.gz -O /tmp/node.tar.gz && \ tar -C /usr/local --strip-components 1 -xzf /tmp/node.tar.gz && \ # upgrade npm npm install -g npm && \ # install yeoman npm install -g yo && \ + #install dotnet + apt-get install -y dotnet-sdk-7.0 && \ # cleanup apt-get clean && \ rm -rf \ @@ -30,10 +36,8 @@ RUN \ /var/tmp/* RUN \ - # install jhipster - npm install -g generator-jhipster && \ # install the blueprint - npm install -g generator-jhipster-dotnetcore && \ + npm install -g /home/jhipster/jhipster-dotnetcore && \ # fix jhipster user permissions chown -R jhipster:jhipster \ /home/jhipster \ @@ -50,4 +54,4 @@ USER jhipster ENV PATH $PATH:/usr/bin WORKDIR "/home/jhipster/app" VOLUME ["/home/jhipster/app"] -CMD ["jhipster", "--blueprints", "dotnetcore"] \ No newline at end of file +CMD ["jhipster-dotnetcore"] \ No newline at end of file diff --git a/Project1.csproj b/Project1.csproj new file mode 100644 index 000000000..1d1dc1087 --- /dev/null +++ b/Project1.csproj @@ -0,0 +1,20 @@ + + + + + + + net8.0 + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 6176ac258..28c26fdb0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # generator-jhipster-dotnetcore -[![NPM version][npm-image]][npm-url] + +[![NPM version][npm-image]][npm-url] [![Documentation Status](https://readthedocs.org/projects/jhipsternet/badge/?version=latest)](https://jhipsternet.readthedocs.io/en/latest/?badge=latest) [![Generator Build Status][github-actions-generator-image]][github-actions-url] [![Integration JWT Build Status][github-actions-integ-jwt-image]][github-actions-url] [![Integration OAUTH Build Status][github-actions-integ-oauth-image]][github-actions-url] -[![Dependency Status][daviddm-image]][daviddm-url] +[![Dependency Status][daviddm-image]][daviddm-url] [![Sonar Cloud Quality Gate][sonar-gate-image]][sonar-url] [![Sonar Cloud Reliability Rate][sonar-reliability-image]][sonar-url] [![Sonar Cloud Security Rate][sonar-security-image]][sonar-url] @@ -13,12 +14,12 @@ > JHipster blueprint -# Big Picture +# Big Picture JHipster is a well-known platform for generating modern application in java world. -JHipster provides a blueprints system that allows to override the default behavior of the generator +JHipster provides a blueprints system that allows to override the default behavior of the generator -JHipster.NET is a blueprint that overrides the back-end part, originally generated in spring boot, by back-end in asp.net core. For the front-end all the common language can be used (angular, react, vue.js). +JHipster.NET is a blueprint that overrides the back-end part, originally generated in spring boot, by back-end in asp.net core. For the front-end all the common language can be used (angular, react, vue.js). In alpha version we also have the possibility to choose either [Blazor](https://github.com/jhipster/jhipster-dotnetcore/issues/165) or [Xamarin](https://github.com/jhipster/jhipster-dotnetcore/issues/488) for the front. @@ -26,11 +27,12 @@ This blueprint is an official blueprint of JHipster [official-blueprints](https: # Docs -Documentation and information about `JHipster.NET` are available [here](https://jhipsternet.readthedocs.io/en/latest/) +Documentation and information about `JHipster.NET` are available [here](https://jhipsternet.readthedocs.io/en/latest/) Full documentation and information about JHipster are available [here](https://www.jhipster.tech/) -# Analysis of the sample project +# Analysis of the sample project + https://github.com/jhipster/jhipster-sample-app-dotnetcore [![Sonar Cloud Quality Gate][sonar-sample-gate-image]][sonar-sample-url] @@ -48,10 +50,6 @@ This is a [JHipster](https://www.jhipster.tech/) blueprint, that is meant to be https://gitter.im/JHipster-NET/jhipster-dotnetcore -# Prerequisites - -npm install -g generator-jhipster - # Installation ## With NPM @@ -87,19 +85,11 @@ yarn global upgrade generator-jhipster-dotnetcore To use this blueprint, run the below command ```bash -jhipster --blueprints dotnetcore +jhipster-dotnetcore ``` ## Using Docker -Download the Dockerfile: - -```bash -mkdir docker -cd docker -wget https://github.com/jhipster/jhipster-dotnetcore/raw/main/docker/Dockerfile -``` - Build the Docker images: ```bash @@ -123,17 +113,17 @@ docker run -it --rm -v $PWD:/home/jhipster/app jhipster-generator-dotnetcore ✅ General App generation -- `jhipster --blueprints dotnetcore` - - JWT : ✅ - - Oauth2 : ✅ - +- `jhipster-dotnetcore` + - JWT : ✅ + - Oauth2 : ✅ + ✅ Entity generation -- `jhipster entity ` +- `jhipster-dotnetcore ` ✅ JDL Entity model support generation -- `jhipster import-jdl my_file.jdl` +- `jhipster-dotnetcore import-jdl my_file.jdl` ## Running the generated app in a Docker container @@ -149,18 +139,18 @@ docker build -f "[Dockerfile path]" -t [An image name]:[A tag] "[Application roo docker run -d -p [A host port]:80 [Image name]:[Image tag] ``` -3. Open your favorite browser at ```localhost:[Chosen host port]``` and enjoy ! :whale: +3. Open your favorite browser at `localhost:[Chosen host port]` and enjoy ! :whale: Docker compose file can be used to start the application with database as a service. To build images, run ```bash -docker-compose -f docker/app.yml build +docker compose -f docker/app.yml build ``` To start services, use ```bash -docker-compose -f docker/app.yml up +docker compose -f docker/app.yml up ``` In case of Oracle database, see [official documentation](https://github.com/oracle/docker-images/blob/main/OracleDatabase/SingleInstance/README.md) @@ -169,7 +159,6 @@ In case of Oracle database, see [official documentation](https://github.com/orac Apache-2.0 © [JHipster.NET]() - [npm-image]: https://img.shields.io/npm/v/generator-jhipster-dotnetcore.svg [npm-url]: https://npmjs.org/package/generator-jhipster-dotnetcore [daviddm-image]: https://david-dm.org/jhipster/jhipster-dotnetcore.svg?theme=shields.io @@ -186,7 +175,6 @@ Apache-2.0 © [JHipster.NET]() [sonar-security-image]: https://sonarcloud.io/api/project_badges/measure?branch=main&project=jhipster_jhipster-dotnetcore&metric=security_rating [sonar-maintainability-image]: https://sonarcloud.io/api/project_badges/measure?branch=main&project=jhipster_jhipster-dotnetcore&metric=sqale_rating [sonar-duplication-image]: https://sonarcloud.io/api/project_badges/measure?branch=main&project=jhipster_jhipster-dotnetcore&metric=duplicated_lines_density - [sonar-sample-url]: https://sonarcloud.io/dashboard?branch=main&id=jhipster_jhipster-sample-app-dotnetcore [sonar-sample-coverage-url]: https://sonarcloud.io/component_measures?branch=main&id=jhipster_jhipster-sample-app-dotnetcore&metric=coverage&view=list [sonar-sample-gate-image]: https://sonarcloud.io/api/project_badges/measure?branch=main&project=jhipster_jhipster-sample-app-dotnetcore&metric=alert_status diff --git a/cli/cli.cjs b/cli/cli.cjs new file mode 100755 index 000000000..b7101a66b --- /dev/null +++ b/cli/cli.cjs @@ -0,0 +1,37 @@ +#!/usr/bin/env node + +const { dirname, basename, join } = require('path'); +const { version, bin } = require('../package.json'); + +// Get package name to use as namespace. +// Allows blueprints to be aliased. +const packagePath = dirname(__dirname); +const packageFolderName = basename(packagePath); +const devBlueprintPath = join(packagePath, '.blueprint'); +const blueprint = packageFolderName.startsWith('jhipster-') ? `generator-${packageFolderName}` : packageFolderName; + +(async () => { + const { runJHipster, done, logger } = await import('generator-jhipster/cli'); + const executableName = Object.keys(bin)[0]; + const { getLogo } = await import('./logo.js'); + + runJHipster({ + executableName, + executableVersion: version, + defaultCommand: 'app', + devBlueprintPath, + blueprints: { + [blueprint]: version, + }, + printLogo: () => {}, + printBlueprintLogo: () => { + console.log(getLogo(version)); + }, + lookups: [{ packagePaths: [packagePath], lookups: ['generators'] }], + }).catch(done); + + process.on('unhandledRejection', up => { + logger.error('Unhandled promise rejection at:'); + logger.fatal(up); + }); +})(); diff --git a/cli/logo.js b/cli/logo.js new file mode 100644 index 000000000..aee027a90 --- /dev/null +++ b/cli/logo.js @@ -0,0 +1,22 @@ +import chalk from 'chalk'; + +const { green: g, red, white, magenta: m, yellow } = chalk; + +export const getLogo = version => ` +${g(' ██╗')}${red(' ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗')}${m(' ███╗ ██╗███████╗████████╗')} +${g(' ██║')}${red(' ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗')}${m(' ████╗ ██║██╔════╝╚══██╔══╝')} +${g(' ██║')}${red(' ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝')}${m(' ██╔██╗ ██║█████╗ ██║')} +${g(' ██╗ ██║')}${red(' ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║')}${m(' ██║╚██╗██║██╔══╝ ██║')} +${g(' ╚██████╔╝')}${red(' ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗')}${m('██╗██║ ╚████║███████╗ ██║')} +${g(' ╚═════╝ ')}${red(' ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝')}${m('╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝')} + +${white.bold(' https://www.jhipster.tech')} + +${white('Welcome to JHipster.NET ') + yellow(`v${version}`)} +${white(`Application files will be generated in folder: ${yellow(process.cwd())}`)} +${g(' _______________________________________________________________________________________________________________')} + +${white(` Documentation for creating an application is at ${yellow('https://www.jhipster.tech/creating-an-app/')}`)} +${white(` If you find JHipster useful, consider sponsoring the project at ${yellow('https://opencollective.com/generator-jhipster')}`)} +${g(' _______________________________________________________________________________________________________________')} +`; diff --git a/docs/Architecture/microservices.md b/docs/Architecture/microservices.md index af1cec3dd..7039a1417 100644 --- a/docs/Architecture/microservices.md +++ b/docs/Architecture/microservices.md @@ -2,6 +2,6 @@ You can also take a look at https://www.jhipster.tech/microservices-architecture/ -## Microservices Artictecture +## Microservices Artictecture ![microservices](../assets/Microservices.png) diff --git a/docs/Architecture/monolith.md b/docs/Architecture/monolith.md index 13318ad1e..0b26ba446 100644 --- a/docs/Architecture/monolith.md +++ b/docs/Architecture/monolith.md @@ -1,6 +1,6 @@ # Monolith -## Monolith Artictecture +## Monolith Artictecture ### With JWT @@ -10,14 +10,14 @@ ![monolith-jwt](../assets/Monolith-with-identity-server.png) -## Monolith structure +## Monolith structure ``` AppFolder ├───docker -> all docker related files ├───src │ ├───MyApp -│ │ └───ClientApp -> all client related files +│ │ └───ClientApp -> all client related files │ │ ├───src │ │ ├───test │ │ └───webpack @@ -27,4 +27,4 @@ AppFolder │ ├───MyApp.Dto │ └───MyApp.Infrastructure └───tests -> Server tests -``` \ No newline at end of file +``` diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index a8b77d9a7..26f3b9d45 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,11 +1,9 @@ - - # Generate Documentation ## Prerequisites - [Python and pip](https://www.python.org/downloads/)
-or + or - [Chocolatey](https://chocolatey.org/install) ## Install Python and pip with Chocolatey @@ -17,21 +15,24 @@ choco install python3 --pre ## Prerequisites Install Sphinx + ```bash py -m pip install sphinx ``` Install Theme + ```bash py -m pip install sphinx_rtd_theme ``` Install Recommark + ```bash py -m pip install Recommonmark ``` -## Generate the documentation HTML files +## Generate the documentation HTML files ```bash cd ./docs/ @@ -61,4 +62,4 @@ cd ./docs/ .\autobuild.bat ``` -Your documentation is now auto-generated on `http://127.0.0.1:8000` \ No newline at end of file +Your documentation is now auto-generated on `http://127.0.0.1:8000` diff --git a/docs/Development/RunLocal.md b/docs/Development/RunLocal.md index 0740034ac..665e194b9 100644 --- a/docs/Development/RunLocal.md +++ b/docs/Development/RunLocal.md @@ -1,6 +1,6 @@ # Running local Blueprint version for development -1. Link your blueprint globally +1. Link your blueprint globally ```bash cd jhipster-dotnetcore diff --git a/docs/Features/azure.md b/docs/Features/azure.md index 283fc1c6a..c2042bdaf 100644 --- a/docs/Features/azure.md +++ b/docs/Features/azure.md @@ -1,53 +1,67 @@ # Azure ## Deploy using Terraform + Currently supports only monolithic app with SQL Server as database (support for other databases are WIP). Terraform scripts will create Azure App Service, Azure SQL Server ### Prerequisites -1. [Docker](https://www.docker.com/products/docker-desktop) installed with docker-compose and have push access to any of the docker repository like docker hub or Azure container registry. -2. [Azure CLI](https://docs.microsoft.com/fr-fr/cli/azure/install-azure-cli) installed on your system. Terraform will require it to authenticate in Azure subscription. + +1. [Docker](https://www.docker.com/products/docker-desktop) installed with docker compose and have push access to any of the docker repository like docker hub or Azure container registry. +2. [Azure CLI](https://docs.microsoft.com/fr-fr/cli/azure/install-azure-cli) installed on your system. Terraform will require it to authenticate in Azure subscription. 3. [Terraform CLI](https://www.terraform.io/downloads.html) installed on your system. ### Steps to follow + 1. Execute generate app command and select app as Monolithic with Microsoft SQL server as database. Select **yes** to generate Terraform scripts. (_default:_ is _No_) -![use-azure](../assets/use-azure.png) + ![use-azure](../assets/use-azure.png) + +2. Use docker compose command to first build the docker image. -2. Use docker-compose command to first build the docker image. ```bash -docker-compose -f docker/app.yml build +docker compose -f docker/app.yml build ``` + 3. Tag the image built during the previous step to push to docker repository by using + ```bash docker tag :version/tag ``` + 4. Push the image to docker hub or any docker service provider by using + ```bash docker push :version/tag ``` -_Note:_ The docker image link and its tag will use as input to Terraform variables. -5. In the generated app folder, change directory to the Terraform folder. + +_Note:_ The docker image link and its tag will use as input to Terraform variables. 5. In the generated app folder, change directory to the Terraform folder. + ```bash cd terraform ``` + 6. Login into your Azure CLI by using + ```bash az login ``` + _Note:_ Terraform plan command will work only if the user is authenticated using Azure CLI. 7. Create a file (_**terraform.tfvars**_) in the Terraform folder to provide input to the Terraform main script using below content: + ``` location = "Central US" subscription_id = "" mssql_admin_user = "dbUser" -mssql_admin_password = "Password!12" +mssql_admin_password = "yourStrong(!)Password" docker_image = "a5ingh/jhipster-dotnetcore-sampleapp" docker_image_tag = "0.1" ``` 8. Execute below terraform commands (one by one) to create resources (Azure app service, Azure SQL) and deploy as a docker image to app service: - 1. `terraform init` # to initialize terraform. - 1. `terraform plan -out "MyAppPlan"` # can choose any name instead of MyAppPlan. - 1. `terraform apply "MyAppPlan"` # it will create the resources and then provide you the link to your deployed app as output variable. + + 1. `terraform init` # to initialize terraform. + 1. `terraform plan -out "MyAppPlan"` # can choose any name instead of MyAppPlan. + 1. `terraform apply "MyAppPlan"` # it will create the resources and then provide you the link to your deployed app as output variable. 9. You can use `terraform destroy` to delete/remove all the created resources once you are done using it. diff --git a/docs/Features/code-analysis.md b/docs/Features/code-analysis.md index 63bf144e4..76f04df0f 100644 --- a/docs/Features/code-analysis.md +++ b/docs/Features/code-analysis.md @@ -1,26 +1,26 @@ # Code Analysis -## Running SonarQube by script +## Running SonarQube by script -1. Run Sonar in container : ```docker-compose -f ./docker/sonar.yml up -d``` - -2. Wait container was up Run ```SonarAnalysis.ps1``` and go to http://localhost:9001 +1. Run Sonar in container : `docker compose -f ./docker/sonar.yml up -d` +2. Wait container was up Run `SonarAnalysis.ps1` and go to http://localhost:9001 -## Running SonarQube manually +## Running SonarQube manually -1. Run Sonar in container : ```docker-compose -f ./docker/sonar.yml up -d``` +1. Run Sonar in container : `docker compose -f ./docker/sonar.yml up -d` 2. Install sonar scanner for .net : - - ```dotnet tool install --global dotnet-sonarscanner``` -3. Run +`dotnet tool install --global dotnet-sonarscanner` + +3. Run + ```bash dotnet sonarscanner begin /d:sonar.login=admin /d:sonar.password=admin /k:"YourProject" /d:sonar.host.url="http://localhost:9001" /s:"`pwd`/SonarQube.Analysis.xml" ``` -4. Build your application : ```dotnet build``` +4. Build your application : `dotnet build` -5. Publish sonar results : ```dotnet sonarscanner end /d:sonar.login=admin /d:sonar.password=admin``` +5. Publish sonar results : `dotnet sonarscanner end /d:sonar.login=admin /d:sonar.password=admin` -6. Go to http://localhost:9001 \ No newline at end of file +6. Go to http://localhost:9001 diff --git a/docs/Features/cqrs.md b/docs/Features/cqrs.md index 980356633..044828d5b 100644 --- a/docs/Features/cqrs.md +++ b/docs/Features/cqrs.md @@ -1,4 +1,3 @@ - # CQRS ## Introduction @@ -27,6 +26,7 @@ When generating your application, you can choose to use CQRS. Enabling it will g ## Create your own Queries or Commands In order to create your own commands and/or queries you have to create two classes : + - A command/query - An handler for it @@ -40,8 +40,10 @@ public class MyEntityGetQuery : IRequest public long Id { get; set; } } ``` + This Query should have an Id and returns a MyEntity object. Here's the handler `MyEntityGetQueryHandler.cs` : + ```csharp namespace MyCompany.Application.Queries; @@ -62,7 +64,9 @@ public class MyEntityGetQueryHandler : IRequestHandler GetMyEntity([FromRoute] long id) diff --git a/docs/Features/cypress.md b/docs/Features/cypress.md index a53c32df8..22709402a 100644 --- a/docs/Features/cypress.md +++ b/docs/Features/cypress.md @@ -15,15 +15,21 @@ When generating your application, make sure to check "Cypress" in your optional ## How to use it Once your application is generated, you can optionally add some entities, it will automatically generate the corresponding tests for your entities. To begin, go to your ClientApp folder: + ```bash cd src/YourApplication/ClientApp ``` + Then execute one of the following commands: + ```bash npx cypress open ``` + or + ```bash ./node_modules/.bin/cypress open ``` -For futher information you can visit [Cypress wiki](https://docs.cypress.io/guides/guides/command-line#How-to-run-commands). \ No newline at end of file + +For futher information you can visit [Cypress wiki](https://docs.cypress.io/guides/guides/command-line#How-to-run-commands). diff --git a/docs/Features/database-migrations.md b/docs/Features/database-migrations.md index ee0f5addb..44c321728 100644 --- a/docs/Features/database-migrations.md +++ b/docs/Features/database-migrations.md @@ -2,16 +2,16 @@ ## Using database migrations -If you had already run the application before creating your first migration, some database tables might be already +If you had already run the application before creating your first migration, some database tables might be already created automatically on application startup. So you have the options of removing conflicting database tables or editing the migration you just created. -If you wish to automatically apply database migrations when the application is started replace method +If you wish to automatically apply database migrations when the application is started replace method EnsureCreated() by Migrate() at DatabaseStartup.cs file. Be aware of the implications of doing so, such as potential data loss. Currently it is up to the user to create migrations. 1. Add EF Core cli tools -Since .Net Core 3.0 the cli tool for entity framework was removed from the core sdk so you need to install it globally. +Since .Net Core 3.0 the cli tool for entity framework was removed from the core sdk so you need to install it globally. You only need to do this once. See [Breaking changes included in EF Core 3.0](https://docs.microsoft.com/pt-br/ef/core/what-is-new/ef-core-3.0/breaking-changes#dotnet-ef) for reference. ```bash @@ -32,7 +32,7 @@ dotnet ef migrations add InitialCreate --project YourProject.Infrastructure.cspr dotnet ef database update --project YourProject.Infrastructure.csproj --startup-project YourProject.csproj ``` -Tips: +Tips: + - Remember to change the connection string to point to your database at appsettings.json. - It is a good practice to check your migration files and backup your database before running migrations. - diff --git a/docs/Features/dependencies-management.md b/docs/Features/dependencies-management.md index e7936e0e7..62aab4fcd 100644 --- a/docs/Features/dependencies-management.md +++ b/docs/Features/dependencies-management.md @@ -8,16 +8,18 @@ To do this we use a Directory.Packages.props file (you can find it in root folde This file contains all nuget dependencies with for each one their version. -To add a dependency, you need to add it in csproj without the version and add it in Directory.Packages.props with the version +To add a dependency, you need to add it in csproj without the version and add it in Directory.Packages.props with the version -example: +example: in csproj + ```xml ``` in Directory.Packages.props + ```xml ``` diff --git a/docs/Features/dto.md b/docs/Features/dto.md index 5be4126e5..7e17ea2c5 100644 --- a/docs/Features/dto.md +++ b/docs/Features/dto.md @@ -6,6 +6,6 @@ Notice that this blueprint uses [AutoMapper](https://automapper.org/) to handle Example using JDL: - ```dto * with mapstruct``` +`dto * with mapstruct` - See [JHispter's documentation](https://www.jhipster.tech/using-dtos/) for more details about using DTOs. \ No newline at end of file +See [JHispter's documentation](https://www.jhipster.tech/using-dtos/) for more details about using DTOs. diff --git a/docs/Features/entity-auditing.md b/docs/Features/entity-auditing.md index db7802493..2e9e0e283 100644 --- a/docs/Features/entity-auditing.md +++ b/docs/Features/entity-auditing.md @@ -4,7 +4,7 @@ JHipster.Net implement basic Auditing on all the entities you save in the databa ## Audit properties -This blueprint introduce a new base class named ```AuditedEntityBase``` that every generated entity will inherit from when we need to add the audit functionality. The properties use to audit entities are : +This blueprint introduce a new base class named `AuditedEntityBase` that every generated entity will inherit from when we need to add the audit functionality. The properties use to audit entities are : 1. CreateBy : The user who created the initial entry. 2. CreatedDate : The datetime of creation of initial entry. @@ -20,9 +20,11 @@ public abstract class AuditedEntityBase public DateTime LastModifiedDate { get; set; } } ``` + ## Audit of generated Entities -For example, if we have a ```Task``` entity and we want to add audit functionality we would inherit from our ```AuditedEntityBase``` like that: +For example, if we have a `Task` entity and we want to add audit functionality we would inherit from our `AuditedEntityBase` like that: + ```csharp public class Task : AuditedEntityBase { @@ -31,11 +33,11 @@ public class Task : AuditedEntityBase } ``` -Our ```Task``` class will have all the audit properties. +Our `Task` class will have all the audit properties. ## Automatically set properties audit -To automatically set the audit properties, we override the ```SaveChangesAsync``` method in our ```ApplicationDatabaseContext``` class: +To automatically set the audit properties, we override the `SaveChangesAsync` method in our `ApplicationDatabaseContext` class: ```csharp public override async Task SaveChangesAsync(CancellationToken cancellationToken = default(CancellationToken)) @@ -67,11 +69,12 @@ public override async Task SaveChangesAsync(CancellationToken cancellationT } ``` -In our implementation, we use the ```HttpContextAccessor``` to get the ```user name``` of current user. To have ```HttpContextAccessor``` available we just inject it into our ```ApplicationDatabaseContext class```. +In our implementation, we use the `HttpContextAccessor` to get the `user name` of current user. To have `HttpContextAccessor` available we just inject it into our `ApplicationDatabaseContext class`. + ```csharp private readonly IHttpContextAccessor _httpContextAccessor; public ApplicationDatabaseContext(DbContextOptions options, IHttpContextAccessor httpContextAccessor) : base(options) { _httpContextAccessor = httpContextAccessor; } -``` \ No newline at end of file +``` diff --git a/docs/Features/fronts.md b/docs/Features/fronts.md index 330867035..2f5d3d1de 100644 --- a/docs/Features/fronts.md +++ b/docs/Features/fronts.md @@ -1,6 +1,6 @@ # Fronts -When generating an application, you are able to choose between multiple fronts. +When generating an application, you are able to choose between multiple fronts. ## Angular @@ -80,7 +80,7 @@ With a C#-shared codebase, developers can use Xamarin tools to write native Andr Xamarin allows to take advantage of this blueprint. Indeed, it enables to generate a modern cross platform application with both front-end and back-end in C#. -### Generate your application +### Generate your application Call the generator @@ -95,6 +95,7 @@ and choose Xamarin ### Structure Any generated Xamarin application is structured as follows + ``` client ├── Namespace.Client.Xamarin.Core - Your core application @@ -107,33 +108,33 @@ client │ ├── Views │ │ ├── Entities - Generated views ├── Namespace.Client.Xamarin.Android - Your Android application -│ ├── Resources +│ ├── Resources │ │ ├── drawable - Contains your images │ │ ├── Layout - Contains your layouts │ ├── Properties -├── Namespace.Client.Xamarin.iOS - Your iOS application +├── Namespace.Client.Xamarin.iOS - Your iOS application │ ├── Resources - Contains your images │ ├── Properties ├── Namespace.Client.Xamarin.Shared - Shared code │ ├── Constants - Contains shared constants ``` -### Limitations +### Limitations -For the moment, the Xamarin generation has certain limitations : +For the moment, the Xamarin generation has certain limitations : - No Offline mode - No User managment - No validation on entity fields -- No translation +- No translation - No Tests -- Only JWT security is implemented +- Only JWT security is implemented ## Alpha - Blazor Blazor is a free and open-source web framework that enables developers to create web apps using C# and HTML. -### Why Blazor ? +### Why Blazor ? Blazor can run your client-side C# code directly in the browser, using WebAssembly. Because it's real .NET running on WebAssembly, you can re-use code and libraries from server-side parts of your application. (https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor) @@ -141,7 +142,7 @@ Blazor can run your client-side C# code directly in the browser, using WebAssemb - [dotnet 6.0](https://dotnet.microsoft.com/download/dotnet/6.0) -### Generate your application +### Generate your application Call the generator @@ -172,54 +173,59 @@ dotnet run --verbosity normal --project ./src/client/YourAppName.Client/YourAppN #### Start your application with Hot Reload ##### Run the Backend + ```bash dotnet watch --project ./src/YourAppName/YourAppName.csproj run --verbosity normal - ``` +``` + ##### Run the Frontend + ```bash dotnet watch --project ./src/client/YourAppName.Client/YourAppName.Client.csproj run --verbosity normal - ``` +``` -### Generate entities +### Generate entities Like the others front technologies you can generate entities for Blazor. #### With CLI + ```bash jhipster entity ``` #### With [JDL](https://start.jhipster.tech/jdl-studio/) + ```bash jhipster import-jdl my_file.jdl ``` -### Tools +### Tools -As the project used SASS, to install and consume SCSS third parties libraries like Bootstrap we use Microsoft Library Manager (aka [libman](https://github.com/aspnet/LibraryManager)) +As the project used SASS, to install and consume SCSS third parties libraries like Bootstrap we use Microsoft Library Manager (aka [libman](https://github.com/aspnet/LibraryManager)) You can find libman configuration in the same directory than the client solution (./src/client/YourAppName.Client) To minify CSS we use Excubo.WebCompiler (aka [webcompiler](https://github.com/excubo-ag/WebCompiler)) These two tools are installed during JHipster client generation, and you can find the execution in Client.csproj (./src/client/YourAppName.Client/YourAppName.Client.csproj) -### UI components +### UI components -To speed up our development we use [Blazored](https://github.com/Blazored) components like Blazored.Modal or Blazored.SessionStorage. +To speed up our development we use [Blazored](https://github.com/Blazored) components like Blazored.Modal or Blazored.SessionStorage. We also use [Blazorise](https://github.com/stsrki/Blazorise) which has really interesting components. -### UT +### UT For unit test we use the awesome library [bUnit](https://github.com/egil/bUnit). You can find client unit test in ./test/YourAppName.Client.Test -### Limitations +### Limitations -For the moment, the Blazor generation has certain limitations : +For the moment, the Blazor generation has certain limitations : -- Only support DTO you can't use application without DTO +- Only support DTO you can't use application without DTO - No validation on entity fields (The validation is only on user management part) -- No translation -- Only JWT security is implemented +- No translation +- Only JWT security is implemented diff --git a/docs/Features/heroku.md b/docs/Features/heroku.md index b421477ba..98f07c541 100644 --- a/docs/Features/heroku.md +++ b/docs/Features/heroku.md @@ -2,7 +2,7 @@ This sub-generator allows the deployment of your JHipster .Net application to Heroku cloud. -The Heroku sub-generator would have no resources and dynos available hence a paid plan of Heroku is required. +The Heroku sub-generator would have no resources and dynos available hence a paid plan of Heroku is required. Therefore to avoid any unexpected build failures, we would recommend verifying your Heroku account before starting this sub-generator. @@ -11,6 +11,7 @@ Therefore to avoid any unexpected build failures, we would recommend verifying y Before running the sub-generator, you must install the [Heroku CLI](https://cli.heroku.com/). Make sure that you are logged into Heroku. + ```bash heroku login ``` @@ -30,14 +31,15 @@ jhipster heroku ## Databases - Mysql ✔ -- Postgres ✔ +- Postgres ✔ - MSSQL ✔ (requires a manual step described below) -The MySql and PostgreSQL database addons are not free of cost and won't be automatically added by the sub-generator when deploying to Heroku. A paid plan is required to use the resources and addons. +The MySql and PostgreSQL database addons are not free of cost and won't be automatically added by the sub-generator when deploying to Heroku. A paid plan is required to use the resources and addons. Likewise, Heroku's [MSSQL addon](https://elements.heroku.com/addons/mssql) is not free of cost and to avoid unexpected costs It will not be provisioned automatically when deploying to Heroku. Please visit [the MSSQL addon page](https://elements.heroku.com/addons/mssql), review the pricing and add the MSSQL addon to your account with the following command: + ```bash heroku addons:create mssql:REPLACE_PLAN_NAME --as DATABASE --app REPLACE_YOUR_APP_NAME ``` @@ -52,7 +54,6 @@ For applications that use Oauth2 the following manual steps are required: 4. Click on `okta` to open the addon's Dashboard. 5. To configure it follow the documentation (here)[https://jhipsternet.readthedocs.io/en/latest/Features/security.html#okta] - ## Limitations Only monolithic deploys are supported at the moment. diff --git a/docs/Features/mongodb.md b/docs/Features/mongodb.md index 4c623579e..8f2f8eb62 100644 --- a/docs/Features/mongodb.md +++ b/docs/Features/mongodb.md @@ -17,6 +17,7 @@ When generating your application, make sure to choose "MongoDB" as your database The main difference with the other SQL databases is that your IDs are handled as string and are stored in ObjectID instead of long. Also, some classes are replaced in order to support MongoDB : + ``` BaseEntity => MongoBaseEntity GenericRepository => MongoGenericRepository diff --git a/docs/Features/monitoring.md b/docs/Features/monitoring.md index 4396e0185..702a8de87 100644 --- a/docs/Features/monitoring.md +++ b/docs/Features/monitoring.md @@ -1,11 +1,9 @@ # Monitoring -1. Run container (uncomment chronograf and kapacitor if you would use it): ```docker-compose -f ./docker/monitoring.yml up -d``` +1. Run container (uncomment chronograf and kapacitor if you would use it): `docker compose -f ./docker/monitoring.yml up -d` 2. Go to http://localhost:3000 (or http://localhost:8888 if you use chronograf) - -3. (Only for chronograf) Change influxdb connection string by ```YourApp-influxdb``` +3. (Only for chronograf) Change influxdb connection string by `YourApp-influxdb` -4. (Only for chronograf) Change kapacitor connection string by ```YourApp-kapacitor``` - -5. (Only for chronograf) You can now add dashboard (like docker), see your app log in Cronograf Log viewer and send alert with kapacitor \ No newline at end of file +4. (Only for chronograf) Change kapacitor connection string by `YourApp-kapacitor` +5. (Only for chronograf) You can now add dashboard (like docker), see your app log in Cronograf Log viewer and send alert with kapacitor diff --git a/docs/Features/repository.md b/docs/Features/repository.md index a4078cd26..e1948f900 100644 --- a/docs/Features/repository.md +++ b/docs/Features/repository.md @@ -18,5 +18,5 @@ var page = await _countryRepository.QueryHelper() ## Add, AddRange, Attach, Update and UpdateRange -Add, AddRange, Attach, Update and UpdateRange are repository's utility methods for the DbSet's methods and can be used by the developers when doing multiple database operations. +Add, AddRange, Attach, Update and UpdateRange are repository's utility methods for the DbSet's methods and can be used by the developers when doing multiple database operations. Those methods manipulate the change tracker and sets the state of the entitities to Added/Modified/Deleted/Unchanged and do not produce queries if SaveChangesAsync method is not called. Those methods are **not** async. AddAsync should only be used on special cases. See Microsoft's documentation [here](https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.addasync?view=efcore-3.1). diff --git a/docs/Features/security.md b/docs/Features/security.md index 2b071a708..95c7c21f1 100644 --- a/docs/Features/security.md +++ b/docs/Features/security.md @@ -1,6 +1,6 @@ # Security -## JWT +## JWT You can find the jwt configuration in `appsettings.json` @@ -18,7 +18,7 @@ You can find the jwt configuration in `appsettings.json` ## Enforce HTTPS -You can enforce HTTPS by setting `"EnforceHttps": true` in `appsettings.Development.json` or `appsettings.Production.json`. +You can enforce HTTPS by setting `"EnforceHttps": true` in `appsettings.Development.json` or `appsettings.Production.json`. ```json "Security": { @@ -28,7 +28,6 @@ You can enforce HTTPS by setting `"EnforceHttps": true` in `appsettings.Devel For more details, please see [Enforce HTTPS in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-2.1&tabs=visual-studio#http-strict-transport-security-protocol-hsts) - ## OAuth2 and OpenID Connect OAuth is a stateful security mechanism, like HTTP Session. Spring Security provides excellent OAuth 2.0 and OIDC support, and this is leveraged by JHipster. If you're not sure what OAuth and OpenID Connect (OIDC) are, please see [What the Heck is OAuth?](https://developer.okta.com/blog/2017/06/21/what-the-heck-is-oauth) @@ -40,7 +39,7 @@ OAuth is a stateful security mechanism, like HTTP Session. Spring Security provi To log into your application, you'll need to have [Keycloak](https://keycloak.org) up and running. The JHipster Team has created a Docker container for you that has the default users and roles. Start Keycloak using the following command. ``` -docker-compose -f ./docker/keycloak.yml up +docker compose -f ./docker/keycloak.yml up ``` The security settings in `appsettings.json` are configured for this image. @@ -56,7 +55,7 @@ appsettings.json: "LogOutUri": "http://localhost:9080/auth/realms/jhipster/protocol/openid-connect/logout", "ClientId": "web_app", "ClientSecret": "web_app" - } + } ``` Keycloak uses an embedded H2 database by default, so you will lose the created users if you restart your Docker container. To keep your data, please read the [Keycloak Docker documentation](https://hub.docker.com/r/jboss/keycloak/). One solution, with keeping the H2 database, is to do the following: diff --git a/docs/Features/services.md b/docs/Features/services.md index 5a1cceeb5..4f91a5df8 100644 --- a/docs/Features/services.md +++ b/docs/Features/services.md @@ -10,7 +10,7 @@ You can generate services using the entity generator: Or by using JDL: - `service all with serviceImpl except Employee, Job` +`service all with serviceImpl except Employee, Job` Notice that only the service with interface option (serviceImpl) is enabled on this generator. @@ -47,11 +47,12 @@ Currently the automatic registration strategy for class/interface is used only f ## Automatic Service Registration In DI Container -Under the hood this project uses reflection for assembly scanning to automatically register service classes/interfaces with dotnet's dependency injection container. Implementation details can be found at `ServiceStartup.cs` file located at `src/ProjectName/Configuration/` folder. +Under the hood this project uses reflection for assembly scanning to automatically register service classes/interfaces with dotnet's dependency injection container. Implementation details can be found at `ServiceStartup.cs` file located at `src/ProjectName/Configuration/` folder. The following steps are used to automatically register service classes and interfaces: + - Scan `ProjectName.Domain.Services.Interfaces` namespace (at `ProjectName.Domain` assembly) for service interfaces and `ProjectName.Domain.Services` namespace (at `ProjectName.Domain.Services` assembly) for service classes. - Find matching classes and its interfaces using the "I" prefix convention for interface name. This step registers the generated service classes/interfaces since they use "I" interface prefix convention, but user-defined services and interfaces can also be automatically registered using this convention. -For example: JobService class matches IJobService interface, EmployeeService class matches IEmployeeService interface, MyNewService class matches IMyNewService interface, etc... + For example: JobService class matches IJobService interface, EmployeeService class matches IEmployeeService interface, MyNewService class matches IMyNewService interface, etc... - Service class names ending with 'ExtendedService' have higher priority for registration on the DI container. This is useful to make sure that the class will be registered and will replace any existing DI registrations. -For example: if JobExtendedService class is present and implements IJobService, then replace existing registrations. + For example: if JobExtendedService class is present and implements IJobService, then replace existing registrations. diff --git a/docs/Introduction/big-picture.md b/docs/Introduction/big-picture.md index a203e96b6..72b5ca8ab 100644 --- a/docs/Introduction/big-picture.md +++ b/docs/Introduction/big-picture.md @@ -1,10 +1,10 @@ -# Big Picture +# Big Picture JHipster is a well-known platform for generating modern application in java world. -JHipster provides a blueprints system that allows to override the default behavior of the generator +JHipster provides a blueprints system that allows to override the default behavior of the generator -JHipster.NET is a blueprint that overrides the back-end part, originally generated in spring boot, by back-end in asp.net core. For the front-end all the common language can be used (angular, react, vue.js). +JHipster.NET is a blueprint that overrides the back-end part, originally generated in spring boot, by back-end in asp.net core. For the front-end all the common language can be used (angular, react, vue.js). In alpha version we also have the possibility to choose either [Blazor](https://github.com/jhipster/jhipster-dotnetcore/issues/165) or [Xamarin](https://github.com/jhipster/jhipster-dotnetcore/issues/488) for the front. -This blueprint is an official blueprint of JHipster [official-blueprints](https://www.jhipster.tech/modules/official-blueprints/) \ No newline at end of file +This blueprint is an official blueprint of JHipster [official-blueprints](https://www.jhipster.tech/modules/official-blueprints/) diff --git a/docs/Introduction/getting-started.md b/docs/Introduction/getting-started.md index d2baa7295..48e96f32f 100644 --- a/docs/Introduction/getting-started.md +++ b/docs/Introduction/getting-started.md @@ -1,9 +1,5 @@ # Getting Started -## Prerequisites - -npm install -g generator-jhipster - ## Installation of the blueprint Run the following command to install jhipster-dotnetcore @@ -17,10 +13,10 @@ npm install -g generator-jhipster-dotnetcore Call the generator ```bash -jhipster --blueprints dotnetcore +jhipster-dotnetcore ``` -After running this command you have few questions to answer, as Application name, authentication mode, client framework etc +After running this command you have few questions to answer, as Application name, authentication mode, client framework etc Once it's done, you can build and run your application. ```bash @@ -29,19 +25,20 @@ dotnet run --verbosity normal --project ./src/YourAppName/YourAppName.csproj Your first application is ready and you can now use it with default user like JHipster (admin admin or user user) -Ok now you have an application but without entity. +Ok now you have an application but without entity. JHipster allow you to add entity with cli or with jdl file (add link) JHipster.NET have the same behavior. ```bash -jhipster entity +jhipster-dotnetcore entity ``` -Or with jdl +Or with jdl ```bash -jhipster import-jdl my_file.jdl +jhipster-dotnetcore import-jdl my_file.jdl ``` + You can edit jdl with https://start.jhipster.tech/jdl-studio/ You have now an application with CRUD operations on each new entities with potentially link between entities (one-to-one, many-to-one or many-to-many) diff --git a/generators/app/index.js b/generators/app/index.js deleted file mode 100644 index c64195a0e..000000000 --- a/generators/app/index.js +++ /dev/null @@ -1,151 +0,0 @@ -/* eslint-disable consistent-return */ -const chalk = require('chalk'); -const AppGenerator = require('generator-jhipster/generators/app'); -const packagejs = require('../../package.json'); -const prompts = require('./prompts'); - -module.exports = class extends AppGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - } - - get initializing() { - const initPhaseFromJHipster = this._initializing(); - - const dotnetInitAppPhaseSteps = { - /* eslint-disable */ - displayLogo() { - this.log('\n'); - this.log( - `${chalk.green(' ██╗')}${chalk.red( - ' ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗' - )}${chalk.magenta(' ███╗ ██╗███████╗████████╗')}` - ); - this.log( - `${chalk.green(' ██║')}${chalk.red( - ' ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗' - )}${chalk.magenta(' ████╗ ██║██╔════╝╚══██╔══╝')}` - ); - this.log( - `${chalk.green(' ██║')}${chalk.red( - ' ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝' - )}${chalk.magenta(' ██╔██╗ ██║█████╗ ██║')}` - ); - this.log( - `${chalk.green(' ██╗ ██║')}${chalk.red( - ' ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║' - )}${chalk.magenta(' ██║╚██╗██║██╔══╝ ██║')}` - ); - this.log( - `${chalk.green(' ╚██████╔╝')}${chalk.red( - ' ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗' - )}${chalk.magenta('██╗██║ ╚████║███████╗ ██║')}` - ); - this.log( - `${chalk.green(' ╚═════╝ ')}${chalk.red( - ' ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝' - )}${chalk.magenta('╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝')}\n` - ); - this.log(chalk.white.bold(' https://www.jhipster.tech\n')); - this.log(chalk.white('Welcome to JHipster.NET ') + chalk.yellow(`v${packagejs.version}`)); - this.log(chalk.white(`Application files will be generated in folder: ${chalk.yellow(process.cwd())}`)); - if (process.cwd() === this.getUserHome()) { - this.log(chalk.red.bold('\n️⚠️ WARNING ⚠️ You are in your HOME folder!')); - this.log( - chalk.red('This can cause problems, you should always create a new directory and run the jhipster command from here.') - ); - this.log(chalk.white(`See the troubleshooting section at ${chalk.yellow('https://www.jhipster.tech/installation/')}`)); - } - this.log( - chalk.green( - ' _______________________________________________________________________________________________________________\n' - ) - ); - this.log( - chalk.white(` Documentation for creating an application is at ${chalk.yellow('https://www.jhipster.tech/creating-an-app/')}`) - ); - this.log( - chalk.white( - ` If you find JHipster useful, consider sponsoring the project at ${chalk.yellow( - 'https://opencollective.com/generator-jhipster' - )}` - ) - ); - this.log( - chalk.green( - ' _______________________________________________________________________________________________________________\n' - ) - ); - }, - getConfig() { - this.baseName = this.jhipsterConfig.baseName; - this.namespace = this.jhipsterConfig.namespace; - this.applicationType = this.jhipsterConfig.applicationType; - this.serviceDiscoveryType = this.jhipsterConfig.serviceDiscoveryType; - const serverConfigFound = this.namespace !== undefined ; - - if (this.baseName !== undefined && serverConfigFound) { - this.log( - chalk.green( - 'This is an existing project, using the configuration from your .yo-rc.json file \n' + - 'to re-generate the project...\n' - ) - ); - this.existingProject = true; - } - } - }; - return Object.assign(initPhaseFromJHipster, dotnetInitAppPhaseSteps); - } - - get prompting() { - return { - askForModuleName: prompts.askForModuleName, - askForApplicationType: prompts.askForApplicationType, - - setSharedConfigOptions() { - this.configOptions.baseName = this.baseName; - this.configOptions.namespace = this.namespace; - this.configOptions.applicationType = this.applicationType; - this.configOptions.serviceDiscoveryType = this.serviceDiscoveryType; - }, - }; - } - - get configuring() { - return super._configuring(); - } - - get composing() { - return super._composing(); - } - - get loading() { - return super._loading(); - } - - get preparing() { - return super._preparing(); - } - - get default() { - return super._default(); - } - - get writing() { - return super._writing(); - } - - get postWriting() { - return super._postWriting(); - } - - get install() { - return super._install(); - } - - get end() { - // Here we are not overriding this phase and hence its being handled by JHipster - return super._end(); - } -}; diff --git a/generators/app/prompts.js b/generators/app/prompts.js deleted file mode 100644 index 616a2e36f..000000000 --- a/generators/app/prompts.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const toPascalCase = require('to-pascal-case'); -const chalk = require('chalk'); - -function askForModuleName() { - if (this.existingProject) return; - const done = this.async(); - const defaultAppBaseName = toPascalCase(this.getDefaultAppName()); - const prompts = [ - { - type: 'input', - name: 'baseName', - validate: input => { - if (!/^([a-zA-Z0-9_]*)$/.test(input)) { - return 'Your base name cannot contain special characters or a blank space'; - } - return true; - }, - message: 'What is the base name of your application?', - default: defaultAppBaseName, - }, - { - type: 'input', - name: 'namespace', - validate: input => - /^([a-z_A-Z]\w+(?:\.[a-z_A-Z]\w+)*)$/.test(input) ? true : 'The namespace you have provided is not a valid C# namespace', - message: 'What is your default C# namespace?', - default: defaultAppBaseName, - }, - ]; - this.prompt(prompts).then(prompt => { - this.baseName = this.jhipsterConfig.baseName = prompt.baseName; - this.namespace = this.jhipsterConfig.namespace = prompt.namespace; - done(); - }); -} - -async function askForApplicationType() { - if (this.existingProject) return; - - const applicationTypeChoices = [ - { - value: 'monolith', - name: 'Monolithic application (recommended for simple projects)', - }, - { - value: 'microservice', - name: 'Microservice application', - }, - { - value: 'gateway', - name: 'Microservice gateway', - }, - ]; - - const answers = await this.prompt([ - { - type: 'list', - name: 'applicationType', - message: `Which ${chalk.yellow('*type*')} of application would you like to create?`, - choices: applicationTypeChoices, - default: 'monolith', - }, - ]); - this.applicationType = this.jhipsterConfig.applicationType = answers.applicationType; - - if (this.applicationType !== 'monolith') { - this.serviceDiscoveryType = this.jhipsterConfig.serviceDiscoveryType = 'consul'; - } -} - -module.exports = { - askForModuleName, - askForApplicationType, -}; diff --git a/generators/blazor/__snapshots__/generator.spec.js.snap b/generators/blazor/__snapshots__/generator.spec.js.snap new file mode 100644 index 000000000..b3cd16957 --- /dev/null +++ b/generators/blazor/__snapshots__/generator.spec.js.snap @@ -0,0 +1,635 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SubGenerator blazor of dotnetcore JHipster blueprint > generating dto > should succeed 1`] = ` +{ + ".jhipster/Person.json": { + "stateCleared": "modified", + }, + ".yo-rc.json": { + "stateCleared": "modified", + }, + "package.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client.Shared/Constants/ErrorConst.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client.Shared/Constants/TypeAlert.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client.Shared/Jhipster.Client.Shared.csproj": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client.Shared/Models/JhiAlert.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/App.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/App.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/AutoMapper/AutoMapperProfile.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Jhipster.Client.csproj": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/BaseModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/ConfigurationModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/JwtToken.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/LoginModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/PersonModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/Register/RegisterModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/Register/RegisterResultRequest.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/Register/UserSaveModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/UserModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Account/Register.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Account/Register.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserDetail.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserDetail.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserManagement.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserManagement.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserUpdate.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserUpdate.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Entities/Person/Person.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Entities/Person/Person.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Entities/Person/PersonDetail.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Entities/Person/PersonDetail.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Entities/Person/PersonUpdate.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Entities/Person/PersonUpdate.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Index.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Index.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Login.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Login.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Utils/INavigationService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Utils/NavigationService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Program.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Properties/launchSettings.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/AccountServices/IRegisterService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/AccountServices/RegisterService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/AuthenticationService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/EntityServices/AbstractEntityService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/EntityServices/Person/IPersonService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/EntityServices/Person/PersonService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/EntityServices/User/IUserService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/EntityServices/User/UserService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/IAuthenticationService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/Components/AlertError.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/Components/AlertError.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/Components/DynInputText.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/DeleteModal.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/DeleteModal.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/MainLayout.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/NavMenu.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/NavMenu.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/_Imports.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/libman.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/appsettings.Development.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/appsettings.Production.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/appsettings.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/css/loading.css": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0.svg": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0_head-192.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0_head-384.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0_head-512.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1.svg": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1_head-192.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1_head-256.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1_head-384.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1_head-512.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2.svg": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2_head-192.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2_head-256.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2_head-384.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2_head-512.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_3.svg": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_3_head-192.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_3_head-384.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_3_head-512.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/logo-jhipster.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/scss/_bootstrap-variables.scss": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/scss/global.scss": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/scss/vendor.scss": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/favicon.ico": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/index.html": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/manifest.webapp": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/robots.txt": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/AlertErrorTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/AuthorizationHelper.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/MockAuthenticationService.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/MockAuthorizationPolicyProvider.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/MockAuthorizationService.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/MockRegisterService.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/TestPolicyRequirement.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/IndexTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Jhipster.Client.Test.csproj": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/LoginTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Pages/Admin/UserManagement/UserDetailTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Pages/Entities/Person/PersonDetailTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Pages/Entities/Person/PersonTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Pages/Entities/Person/PersonUpdateTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Pages/TestPages/TestAlertError.razor": { + "stateCleared": "modified", + }, +} +`; + +exports[`SubGenerator blazor of dotnetcore JHipster blueprint > run > execute commands 1`] = ` +[ + [ + "spawnCommand", + "dotnet new sln --name Jhipster", + ], + [ + "spawnCommand", + "dotnet sln Jhipster.sln add src/client/Jhipster.Client/Jhipster.Client.csproj src/client/Jhipster.Client.Shared/Jhipster.Client.Shared.csproj test/Jhipster.Client.Test/Jhipster.Client.Test.csproj", + ], + [ + "spawnCommand", + "libman", + ], + [ + "spawnCommand", + "webcompiler", + ], +] +`; + +exports[`SubGenerator blazor of dotnetcore JHipster blueprint > run > should succeed 1`] = ` +{ + ".yo-rc.json": { + "stateCleared": "modified", + }, + "package.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client.Shared/Constants/ErrorConst.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client.Shared/Constants/TypeAlert.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client.Shared/Jhipster.Client.Shared.csproj": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client.Shared/Models/JhiAlert.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/App.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/App.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/AutoMapper/AutoMapperProfile.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Jhipster.Client.csproj": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/BaseModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/ConfigurationModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/JwtToken.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/LoginModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/Register/RegisterModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/Register/RegisterResultRequest.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/Register/UserSaveModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Models/UserModel.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Account/Register.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Account/Register.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserDetail.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserDetail.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserManagement.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserManagement.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserUpdate.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Admin/UserManagement/UserUpdate.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Index.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Index.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Login.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Login.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Utils/INavigationService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Pages/Utils/NavigationService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Program.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Properties/launchSettings.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/AccountServices/IRegisterService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/AccountServices/RegisterService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/AuthenticationService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/EntityServices/AbstractEntityService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/EntityServices/User/IUserService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/EntityServices/User/UserService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Services/IAuthenticationService.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/Components/AlertError.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/Components/AlertError.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/Components/DynInputText.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/DeleteModal.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/DeleteModal.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/MainLayout.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/NavMenu.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/Shared/NavMenu.razor.cs": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/_Imports.razor": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/libman.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/appsettings.Development.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/appsettings.Production.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/appsettings.json": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/css/loading.css": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0.svg": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0_head-192.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0_head-384.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_0_head-512.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1.svg": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1_head-192.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1_head-256.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1_head-384.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_1_head-512.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2.svg": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2_head-192.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2_head-256.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2_head-384.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_2_head-512.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_3.svg": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_3_head-192.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_3_head-384.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/jhipster_family_member_3_head-512.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/images/logo-jhipster.png": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/scss/_bootstrap-variables.scss": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/scss/global.scss": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/content/scss/vendor.scss": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/favicon.ico": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/index.html": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/manifest.webapp": { + "stateCleared": "modified", + }, + "src/client/Jhipster.Client/wwwroot/robots.txt": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/AlertErrorTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/AuthorizationHelper.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/MockAuthenticationService.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/MockAuthorizationPolicyProvider.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/MockAuthorizationService.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/MockRegisterService.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Helpers/TestPolicyRequirement.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/IndexTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Jhipster.Client.Test.csproj": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/LoginTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Pages/Admin/UserManagement/UserDetailTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Client.Test/Pages/TestPages/TestAlertError.razor": { + "stateCleared": "modified", + }, +} +`; diff --git a/generators/blazor/entities-blazor.js b/generators/blazor/entities-blazor.js new file mode 100644 index 000000000..081a3cac2 --- /dev/null +++ b/generators/blazor/entities-blazor.js @@ -0,0 +1,52 @@ +/** + * Copyright 2019-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { CLIENT_SRC_DIR, CLIENT_TEST_DIR, renameDotNetCore } from '../generator-dotnetcore-constants.js'; + +/** + * The default is to use a file path string. It implies use of the template method. + * For any other config an object { file:.., method:.., template:.. } can be used + */ +export const entityFiles = { + blazorAppModels: [ + { + path: `${CLIENT_SRC_DIR}client/`, + renameTo: renameDotNetCore(`${CLIENT_SRC_DIR}client/`), + templates: [ + 'Project.Client/Models/_dotnetEntityModel_.cs', + 'Project.Client/Services/EntityServices/_entityClass_/_entityClass_Service.cs', + 'Project.Client/Services/EntityServices/_entityClass_/I_entityClass_Service.cs', + 'Project.Client/Pages/Entities/_entityClass_/_entityClass_.razor.cs', + 'Project.Client/Pages/Entities/_entityClass_/_entityClass_.razor', + 'Project.Client/Pages/Entities/_entityClass_/_entityClass_Detail.razor.cs', + 'Project.Client/Pages/Entities/_entityClass_/_entityClass_Detail.razor', + 'Project.Client/Pages/Entities/_entityClass_/_entityClass_Update.razor.cs', + 'Project.Client/Pages/Entities/_entityClass_/_entityClass_Update.razor', + ], + }, + { + path: CLIENT_TEST_DIR, + renameTo: renameDotNetCore(CLIENT_TEST_DIR), + templates: [ + 'Project.Client.Test/Pages/Entities/_entityClass_/_entityClass_Test.cs', + 'Project.Client.Test/Pages/Entities/_entityClass_/_entityClass_UpdateTest.cs', + 'Project.Client.Test/Pages/Entities/_entityClass_/_entityClass_DetailTest.cs', + ], + }, + ], +}; diff --git a/generators/blazor/files-blazor.js b/generators/blazor/files-blazor.js new file mode 100644 index 000000000..5dc5642ea --- /dev/null +++ b/generators/blazor/files-blazor.js @@ -0,0 +1,147 @@ +/** + * Copyright 2019-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CLIENT_SRC_DIR, CLIENT_TEST_DIR, renameDotNetCore } from '../generator-dotnetcore-constants.js'; + +/* Constants use throughout */ + +/** + * The default is to use a file path string. It implies use of the template method. + * For any other config an object { file:.., method:.., template:.. } can be used + */ +export const files = { + blazorAutoMapperProfiles: [ + { + path: `${CLIENT_SRC_DIR}client/`, + renameTo: renameDotNetCore(`${CLIENT_SRC_DIR}client/`), + templates: [ + 'Project.Client/AutoMapper/AutoMapperProfile.cs', + 'Project.Client/Models/BaseModel.cs', + 'Project.Client/Models/Register/RegisterModel.cs', + 'Project.Client/Models/Register/RegisterResultRequest.cs', + 'Project.Client/Models/Register/UserSaveModel.cs', + 'Project.Client/Models/ConfigurationModel.cs', + 'Project.Client/Models/JwtToken.cs', + 'Project.Client/Models/LoginModel.cs', + 'Project.Client/Models/UserModel.cs', + 'Project.Client/Pages/Account/Register.razor.cs', + 'Project.Client/Pages/Account/Register.razor', + 'Project.Client/Pages/Admin/UserManagement/UserDetail.razor', + 'Project.Client/Pages/Admin/UserManagement/UserDetail.razor.cs', + 'Project.Client/Pages/Admin/UserManagement/UserManagement.razor.cs', + 'Project.Client/Pages/Admin/UserManagement/UserManagement.razor', + 'Project.Client/Pages/Admin/UserManagement/UserUpdate.razor', + 'Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.cs', + 'Project.Client/Pages/Utils/INavigationService.cs', + 'Project.Client/Pages/Utils/NavigationService.cs', + 'Project.Client/Pages/Index.razor.cs', + 'Project.Client/Pages/Index.razor', + 'Project.Client/Pages/Login.razor', + 'Project.Client/Pages/Login.razor.cs', + 'Project.Client/Properties/launchSettings.json', + 'Project.Client/Services/AccountServices/IRegisterService.cs', + 'Project.Client/Services/AccountServices/RegisterService.cs', + 'Project.Client/Services/EntityServices/User/IUserService.cs', + 'Project.Client/Services/EntityServices/User/UserService.cs', + 'Project.Client/Services/EntityServices/AbstractEntityService.cs', + 'Project.Client/Services/IAuthenticationService.cs', + 'Project.Client/Services/AuthenticationService.cs', + 'Project.Client/Shared/MainLayout.razor', + 'Project.Client/Shared/NavMenu.razor', + 'Project.Client/Shared/NavMenu.razor.cs', + 'Project.Client/Shared/DeleteModal.razor.cs', + 'Project.Client/Shared/DeleteModal.razor', + 'Project.Client/Shared/Components/AlertError.razor', + 'Project.Client/Shared/Components/AlertError.razor.cs', + 'Project.Client/Shared/Components/DynInputText.razor', + 'Project.Client/wwwroot/content/scss/global.scss', + 'Project.Client/wwwroot/robots.txt', + 'Project.Client/wwwroot/manifest.webapp', + 'Project.Client/wwwroot/appsettings.json', + 'Project.Client/wwwroot/appsettings.Development.json', + 'Project.Client/wwwroot/appsettings.Production.json', + 'Project.Client/wwwroot/content/css/loading.css', + 'Project.Client/wwwroot/content/scss/_bootstrap-variables.scss', + 'Project.Client/wwwroot/content/scss/vendor.scss', + 'Project.Client/wwwroot/index.html', + 'Project.Client.Shared/Constants/ErrorConst.cs', + 'Project.Client.Shared/Constants/TypeAlert.cs', + 'Project.Client.Shared/Models/JhiAlert.cs', + 'Project.Client.Shared/Project.Client.Shared.csproj', + 'Project.Client/_Imports.razor', + 'Project.Client/App.razor', + 'Project.Client/App.razor.cs', + 'Project.Client/libman.json', + 'Project.Client/Program.cs', + 'Project.Client/Project.Client.csproj', + ], + }, + ], + blazorAppWeb: [ + { + path: `${CLIENT_SRC_DIR}client/`, + transform: false, + renameTo: renameDotNetCore(`${CLIENT_SRC_DIR}client/`), + templates: [ + 'Project.Client/wwwroot/content/images/jhipster_family_member_0.svg', + 'Project.Client/wwwroot/content/images/jhipster_family_member_1.svg', + 'Project.Client/wwwroot/content/images/jhipster_family_member_2.svg', + 'Project.Client/wwwroot/content/images/jhipster_family_member_3.svg', + 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-192.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_1_head-192.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_2_head-192.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_3_head-192.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_1_head-256.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_2_head-256.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-384.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_1_head-384.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_2_head-384.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_3_head-384.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-512.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_1_head-512.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_2_head-512.png', + 'Project.Client/wwwroot/content/images/jhipster_family_member_3_head-512.png', + 'Project.Client/wwwroot/content/images/logo-jhipster.png', + 'Project.Client/wwwroot/favicon.ico', + ], + }, + ], + blazorTestHelpers: [ + { + path: CLIENT_TEST_DIR, + renameTo: renameDotNetCore(CLIENT_TEST_DIR), + templates: [ + 'Project.Client.Test/Helpers/AuthorizationHelper.cs', + 'Project.Client.Test/Helpers/MockAuthenticationService.cs', + 'Project.Client.Test/Helpers/MockAuthorizationPolicyProvider.cs', + 'Project.Client.Test/Helpers/MockAuthorizationService.cs', + 'Project.Client.Test/Helpers/MockRegisterService.cs', + 'Project.Client.Test/Helpers/TestPolicyRequirement.cs', + 'Project.Client.Test/Pages/Admin/UserManagement/UserDetailTest.cs', + 'Project.Client.Test/Pages/TestPages/TestAlertError.razor', + 'Project.Client.Test/AlertErrorTest.cs', + 'Project.Client.Test/IndexTest.cs', + 'Project.Client.Test/LoginTest.cs', + 'Project.Client.Test/Project.Client.Test.csproj', + ], + }, + ], +}; diff --git a/generators/blazor/generator.js b/generators/blazor/generator.js new file mode 100644 index 000000000..935c7084d --- /dev/null +++ b/generators/blazor/generator.js @@ -0,0 +1,180 @@ +import BaseApplicationGenerator from 'generator-jhipster/generators/base-application'; +import chalk from 'chalk'; +import { access } from 'fs/promises'; +import { createNeedleCallback } from 'generator-jhipster/generators/base/support'; +import { CLIENT_SRC_DIR, CLIENT_TEST_DIR } from '../generator-dotnetcore-constants.js'; +import { files } from './files-blazor.js'; +import { entityFiles } from './entities-blazor.js'; + +export default class extends BaseApplicationGenerator { + constructor(args, opts, features) { + super(args, opts, { ...features, sbsBlueprint: true, jhipster7Migration: true }); + } + + async beforeQueue() { + await this.dependsOnJHipster('bootstrap-application'); + await this.dependsOnJHipster('jhipster-dotnetcore:bootstrap-dotnetcore'); + } + + get [BaseApplicationGenerator.PREPARING]() { + return this.asPreparingTaskGroup({ + async preparingTemplateTask({ application, source }) { + source.addEntityToMenu = ({ entityName }) => { + const entityMenuPath = `src/${application.mainClientDir}/Shared/NavMenu.razor`; + const lowerCasedEntityName = this._.toLower(entityName); + this.editFile( + entityMenuPath, + createNeedleCallback({ + needle: 'jhipster-needle-add-entity-to-menu', + contentToAdd: ` + + + ${entityName} + `, + contentToCheck: `To="${lowerCasedEntityName}"`, + autoIndent: true, + }), + ); + }; + + source.addServiceInDI = ({ entityName }) => + this.editFile( + `src/${application.mainClientDir}/Program.cs`, + createNeedleCallback({ + needle: 'jhipster-needle-add-services-in-di', + contentToAdd: `builder.Services.AddScoped();`, + autoIndent: true, + }), + ); + + source.addUsingForService = ({ entityName, namespace }) => + this.editFile( + `src/${application.mainClientDir}/Program.cs`, + createNeedleCallback({ + needle: 'jhipster-needle-add-using-for-services', + contentToAdd: `using ${namespace}.Client.Services.EntityServices.${entityName};`, + autoIndent: true, + }), + ); + + source.addDtoMapping = ({ entityName }) => + this.editFile( + `src/${application.mainClientDir}/AutoMapper/AutoMapperProfile.cs`, + createNeedleCallback({ + needle: 'jhipster-needle-add-dto-model-mapping', + contentToAdd: `CreateMap<${entityName}Model, ${entityName}Dto>().ReverseMap();`, + autoIndent: true, + }), + ); + }, + }); + } + + get [BaseApplicationGenerator.WRITING]() { + return this.asWritingTaskGroup({ + async writingTemplateTask({ application }) { + await this.writeFiles({ + sections: files, + context: application, + }); + }, + }); + } + + get [BaseApplicationGenerator.WRITING_ENTITIES]() { + return this.asWritingEntitiesTaskGroup({ + async writingEntitiesTemplateTask({ application, entities }) { + for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipClient)) { + await this.writeFiles({ + sections: entityFiles, + context: { + ...application, + ...entity, + asDto: str => `${str}${application.dtoSuffix}`, + asModel: str => `${str}${application.modelSuffix}`, + }, + }); + } + }, + }); + } + + get [BaseApplicationGenerator.POST_WRITING]() { + return this.asPostWritingTaskGroup({ + async postWritingTemplateTask({ application }) { + this.packageJson.merge({ + scripts: { + test: `cd test/${application.clientTestProject} && dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover`, + }, + }); + }, + }); + } + + get [BaseApplicationGenerator.POST_WRITING_ENTITIES]() { + return this.asPostWritingEntitiesTaskGroup({ + async postWritingEntitiesTemplateTask({ application, source, entities }) { + for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipClient)) { + source.addEntityToMenu({ entityName: entity.entityClass }); + source.addServiceInDI({ entityName: entity.entityClass }); + source.addUsingForService({ entityName: entity.entityClass, namespace: application.namespace }); + source.addDtoMapping({ entityName: entity.entityClass }); + } + }, + }); + } + + get [BaseApplicationGenerator.END]() { + return this.asEndTaskGroup({ + async end({ application }) { + this.log(chalk.green.bold(`\nCreating ${application.solutionName} .Net Core solution if it does not already exist.\n`)); + try { + try { + await access(`${application.solutionName}.sln`); + } catch (error) { + await this.spawnCommand(`dotnet new sln --name ${application.solutionName}`); + } + } catch (err) { + this.log.warn(`Failed to create ${application.solutionName} .Net Core solution: ${err}`); + } + const projects = [ + `${CLIENT_SRC_DIR}${application.mainClientDir}${application.pascalizedBaseName}.Client.csproj`, + `${CLIENT_SRC_DIR}${application.sharedClientDir}${application.pascalizedBaseName}.Client.Shared.csproj`, + `${CLIENT_TEST_DIR}${application.clientTestProject}${application.pascalizedBaseName}.Client.Test.csproj`, + ]; + + await this.spawnCommand(`dotnet sln ${application.solutionName}.sln add ${projects.join(' ')}`); + this.log(chalk.green.bold('Client application generated successfully.\n')); + this.log( + chalk.green( + `Run your blazor application:\n${chalk.yellow.bold( + `dotnet run --verbosity normal --project ./${CLIENT_SRC_DIR}${application.mainClientDir}/${application.pascalizedBaseName}.Client.csproj`, + )}`, + ), + ); + + try { + await this.spawnCommand('libman'); + } catch (error) { + try { + await this.spawnCommand('dotnet tool install -g Microsoft.Web.LibraryManager.Cli'); + } catch (error) { + throw new Error('Could not install Microsoft.Web.LibraryManager.Cli'); + } + this.log(chalk.green.bold('Microsoft.Web.LibraryManager.Cli successfully installed.\n')); + } + + try { + await this.spawnCommand('webcompiler'); + } catch (error) { + try { + await this.spawnCommand('dotnet tool install Excubo.WebCompiler --global'); + } catch (error) { + throw new Error('Could not install Excubo.WebCompiler'); + } + this.log(chalk.green.bold('Excubo.WebCompiler successfully installed.\n')); + } + }, + }); + } +} diff --git a/generators/blazor/generator.spec.js b/generators/blazor/generator.spec.js new file mode 100644 index 000000000..3cd97f853 --- /dev/null +++ b/generators/blazor/generator.spec.js @@ -0,0 +1,59 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'blazor'; +const SUB_GENERATOR_NAMESPACE = `jhipster-dotnetcore:${SUB_GENERATOR}`; + +describe('SubGenerator blazor of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig({ + clientFramework: 'Blazor', + }) + .withOptions({ + ignoreNeedlesError: true, + }) + .withJHipsterLookup() + .withSpawnMock() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + it('execute commands', () => { + expect(result.getSpawnArgsUsingDefaultImplementation()).toMatchSnapshot(); + }); + }); + + describe('generating dto', () => { + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig( + { + clientFramework: 'Blazor', + }, + [ + { + name: 'Person', + dto: 'mapstruct', + }, + ], + ) + .withOptions({ + ignoreNeedlesError: true, + }) + .withJHipsterLookup() + .withSpawnMock() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/blazor/index.js b/generators/blazor/index.js new file mode 100644 index 000000000..01e9dc34d --- /dev/null +++ b/generators/blazor/index.js @@ -0,0 +1 @@ +export { default } from './generator.js'; diff --git a/generators/client/templates/blazor/src/Project.Client.Shared/Constants/ErrorConst.cs.ejs b/generators/blazor/templates/src/client/Project.Client.Shared/Constants/ErrorConst.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client.Shared/Constants/ErrorConst.cs.ejs rename to generators/blazor/templates/src/client/Project.Client.Shared/Constants/ErrorConst.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client.Shared/Constants/TypeAlert.cs.ejs b/generators/blazor/templates/src/client/Project.Client.Shared/Constants/TypeAlert.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client.Shared/Constants/TypeAlert.cs.ejs rename to generators/blazor/templates/src/client/Project.Client.Shared/Constants/TypeAlert.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client.Shared/Models/JhiAlert.cs.ejs b/generators/blazor/templates/src/client/Project.Client.Shared/Models/JhiAlert.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client.Shared/Models/JhiAlert.cs.ejs rename to generators/blazor/templates/src/client/Project.Client.Shared/Models/JhiAlert.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client.Shared/Project.Client.Shared.csproj.ejs b/generators/blazor/templates/src/client/Project.Client.Shared/Project.Client.Shared.csproj.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client.Shared/Project.Client.Shared.csproj.ejs rename to generators/blazor/templates/src/client/Project.Client.Shared/Project.Client.Shared.csproj.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/App.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/App.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/App.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/App.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/App.razor.ejs b/generators/blazor/templates/src/client/Project.Client/App.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/App.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/App.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/AutoMapper/AutoMapperProfile.cs.ejs b/generators/blazor/templates/src/client/Project.Client/AutoMapper/AutoMapperProfile.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/AutoMapper/AutoMapperProfile.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/AutoMapper/AutoMapperProfile.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Models/BaseModel.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Models/BaseModel.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Models/BaseModel.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Models/BaseModel.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Models/ConfigurationModel.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Models/ConfigurationModel.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Models/ConfigurationModel.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Models/ConfigurationModel.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Models/JwtToken.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Models/JwtToken.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Models/JwtToken.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Models/JwtToken.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Models/LoginModel.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Models/LoginModel.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Models/LoginModel.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Models/LoginModel.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Models/Register/RegisterModel.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Models/Register/RegisterModel.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Models/Register/RegisterModel.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Models/Register/RegisterModel.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Models/Register/RegisterResultRequest.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Models/Register/RegisterResultRequest.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Models/Register/RegisterResultRequest.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Models/Register/RegisterResultRequest.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Models/Register/UserSaveModel.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Models/Register/UserSaveModel.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Models/Register/UserSaveModel.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Models/Register/UserSaveModel.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Models/UserModel.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Models/UserModel.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Models/UserModel.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Models/UserModel.cs.ejs diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Models/Model.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Models/_dotnetEntityModel_.cs.ejs similarity index 98% rename from generators/entity-client/templates/blazor/src/Project.Client/Models/Model.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Models/_dotnetEntityModel_.cs.ejs index f730aa616..7a3f13bf2 100644 --- a/generators/entity-client/templates/blazor/src/Project.Client/Models/Model.cs.ejs +++ b/generators/blazor/templates/src/client/Project.Client/Models/_dotnetEntityModel_.cs.ejs @@ -41,7 +41,7 @@ public class <%= asModel(entityClassName) %> : BaseModel<<%= primaryKeyType %>> let required = false; const fieldValidate = fields[idx].fieldValidate; const fieldValidateRules = fields[idx].fieldValidateRules; - const fieldType = equivalentCSharpType(fields[idx].fieldType); + const fieldType = fields[idx].cSharpType; const fieldNamePascalized = fields[idx].fieldNamePascalized; if (fieldValidate === true) { if (fieldValidateRules.includes('required')) { diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Account/Register.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Account/Register.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Account/Register.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Account/Register.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Account/Register.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Account/Register.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Account/Register.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Account/Register.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserDetail.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserDetail.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserDetail.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserDetail.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserDetail.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserDetail.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserDetail.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserDetail.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserManagement.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserManagement.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserManagement.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserManagement.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserManagement.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserManagement.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserManagement.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserManagement.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.ejs diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/Entity.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_.razor.cs.ejs similarity index 100% rename from generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/Entity.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_.razor.cs.ejs diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/Entity.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_.razor.ejs similarity index 100% rename from generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/Entity.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_.razor.ejs diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/EntityDetail.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_Detail.razor.cs.ejs similarity index 100% rename from generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/EntityDetail.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_Detail.razor.cs.ejs diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/EntityDetail.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_Detail.razor.ejs similarity index 100% rename from generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/EntityDetail.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_Detail.razor.ejs diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/EntityUpdate.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_Update.razor.cs.ejs similarity index 100% rename from generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/EntityUpdate.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_Update.razor.cs.ejs diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/EntityUpdate.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_Update.razor.ejs similarity index 100% rename from generators/entity-client/templates/blazor/src/Project.Client/Pages/Entities/Entity/EntityUpdate.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Entities/_entityClass_/_entityClass_Update.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Index.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Index.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Index.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Index.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Index.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Index.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Index.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Index.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Login.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Login.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Login.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Login.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Login.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Login.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Login.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Login.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Utils/INavigationService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Utils/INavigationService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Utils/INavigationService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Utils/INavigationService.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Pages/Utils/NavigationService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Pages/Utils/NavigationService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Pages/Utils/NavigationService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Pages/Utils/NavigationService.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Program.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Program.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Program.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Program.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Project.Client.csproj.ejs b/generators/blazor/templates/src/client/Project.Client/Project.Client.csproj.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Project.Client.csproj.ejs rename to generators/blazor/templates/src/client/Project.Client/Project.Client.csproj.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Properties/launchSettings.json.ejs b/generators/blazor/templates/src/client/Project.Client/Properties/launchSettings.json.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Properties/launchSettings.json.ejs rename to generators/blazor/templates/src/client/Project.Client/Properties/launchSettings.json.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Services/AccountServices/IRegisterService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Services/AccountServices/IRegisterService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Services/AccountServices/IRegisterService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Services/AccountServices/IRegisterService.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Services/AccountServices/RegisterService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Services/AccountServices/RegisterService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Services/AccountServices/RegisterService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Services/AccountServices/RegisterService.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Services/AuthenticationService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Services/AuthenticationService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Services/AuthenticationService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Services/AuthenticationService.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Services/EntityServices/AbstractEntityService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Services/EntityServices/AbstractEntityService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Services/EntityServices/AbstractEntityService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Services/EntityServices/AbstractEntityService.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Services/EntityServices/User/IUserService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Services/EntityServices/User/IUserService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Services/EntityServices/User/IUserService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Services/EntityServices/User/IUserService.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Services/EntityServices/User/UserService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Services/EntityServices/User/UserService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Services/EntityServices/User/UserService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Services/EntityServices/User/UserService.cs.ejs diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Services/EntityServices/EntityService/IEntityService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Services/EntityServices/_entityClass_/I_entityClass_Service.cs.ejs similarity index 100% rename from generators/entity-client/templates/blazor/src/Project.Client/Services/EntityServices/EntityService/IEntityService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Services/EntityServices/_entityClass_/I_entityClass_Service.cs.ejs diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Services/EntityServices/EntityService/EntityService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Services/EntityServices/_entityClass_/_entityClass_Service.cs.ejs similarity index 100% rename from generators/entity-client/templates/blazor/src/Project.Client/Services/EntityServices/EntityService/EntityService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Services/EntityServices/_entityClass_/_entityClass_Service.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Services/IAuthenticationService.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Services/IAuthenticationService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Services/IAuthenticationService.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Services/IAuthenticationService.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Shared/Components/AlertError.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Shared/Components/AlertError.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Shared/Components/AlertError.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Shared/Components/AlertError.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Shared/Components/AlertError.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Shared/Components/AlertError.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Shared/Components/AlertError.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Shared/Components/AlertError.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Shared/Components/DynInputText.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Shared/Components/DynInputText.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Shared/Components/DynInputText.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Shared/Components/DynInputText.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Shared/DeleteModal.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Shared/DeleteModal.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Shared/DeleteModal.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Shared/DeleteModal.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Shared/DeleteModal.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Shared/DeleteModal.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Shared/DeleteModal.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Shared/DeleteModal.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Shared/MainLayout.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Shared/MainLayout.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Shared/MainLayout.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Shared/MainLayout.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Shared/NavMenu.razor.cs.ejs b/generators/blazor/templates/src/client/Project.Client/Shared/NavMenu.razor.cs.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Shared/NavMenu.razor.cs.ejs rename to generators/blazor/templates/src/client/Project.Client/Shared/NavMenu.razor.cs.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/Shared/NavMenu.razor.ejs b/generators/blazor/templates/src/client/Project.Client/Shared/NavMenu.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/Shared/NavMenu.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/Shared/NavMenu.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/_Imports.razor.ejs b/generators/blazor/templates/src/client/Project.Client/_Imports.razor.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/_Imports.razor.ejs rename to generators/blazor/templates/src/client/Project.Client/_Imports.razor.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/libman.json.ejs b/generators/blazor/templates/src/client/Project.Client/libman.json.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/libman.json.ejs rename to generators/blazor/templates/src/client/Project.Client/libman.json.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/appsettings.Development.json.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/appsettings.Development.json.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/appsettings.Development.json.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/appsettings.Development.json.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/appsettings.Production.json.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/appsettings.Production.json.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/appsettings.Production.json.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/appsettings.Production.json.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/appsettings.json.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/appsettings.json.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/appsettings.json.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/appsettings.json.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/css/loading.css.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/css/loading.css.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/css/loading.css.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/css/loading.css.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0.svg b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0.svg similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0.svg rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0.svg diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-192.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-192.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-192.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-192.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-384.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-384.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-384.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-384.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-512.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-512.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-512.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_0_head-512.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1.svg b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1.svg similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1.svg rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1.svg diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-192.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-192.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-192.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-192.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-256.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-256.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-256.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-256.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-384.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-384.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-384.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-384.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-512.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-512.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-512.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_1_head-512.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2.svg b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2.svg similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2.svg rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2.svg diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-192.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-192.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-192.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-192.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-256.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-256.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-256.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-256.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-384.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-384.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-384.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-384.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-512.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-512.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-512.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_2_head-512.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3.svg b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3.svg similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3.svg rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3.svg diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-192.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-192.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-192.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-192.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-256.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-256.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-256.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-256.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-384.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-384.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-384.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-384.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-512.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-512.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-512.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/jhipster_family_member_3_head-512.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/logo-jhipster.png b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/logo-jhipster.png similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/images/logo-jhipster.png rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/images/logo-jhipster.png diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/scss/_bootstrap-variables.scss.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/scss/_bootstrap-variables.scss.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/scss/_bootstrap-variables.scss.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/scss/_bootstrap-variables.scss.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/scss/global.scss.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/scss/global.scss.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/scss/global.scss.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/scss/global.scss.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/content/scss/vendor.scss.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/content/scss/vendor.scss.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/content/scss/vendor.scss.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/content/scss/vendor.scss.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/favicon.ico b/generators/blazor/templates/src/client/Project.Client/wwwroot/favicon.ico similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/favicon.ico rename to generators/blazor/templates/src/client/Project.Client/wwwroot/favicon.ico diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/index.html.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/index.html.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/index.html.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/index.html.ejs diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/manifest.webapp.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/manifest.webapp.ejs similarity index 86% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/manifest.webapp.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/manifest.webapp.ejs index cca4500af..9982da90a 100644 --- a/generators/client/templates/blazor/src/Project.Client/wwwroot/manifest.webapp.ejs +++ b/generators/blazor/templates/src/client/Project.Client/wwwroot/manifest.webapp.ejs @@ -1,6 +1,6 @@ { - "name": "<%= upperFirstCamelCase(baseName) %>", - "short_name": "<%= upperFirstCamelCase(baseName) %>", + "name": "<%= upperFirstCamelCaseBaseName %>", + "short_name": "<%= upperFirstCamelCaseBaseName %>", "icons": [ { "src": "./content/images/<%= hipster %>_head-192.png", diff --git a/generators/client/templates/blazor/src/Project.Client/wwwroot/robots.txt.ejs b/generators/blazor/templates/src/client/Project.Client/wwwroot/robots.txt.ejs similarity index 100% rename from generators/client/templates/blazor/src/Project.Client/wwwroot/robots.txt.ejs rename to generators/blazor/templates/src/client/Project.Client/wwwroot/robots.txt.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/AlertErrorTest.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/AlertErrorTest.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/AlertErrorTest.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/AlertErrorTest.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/Helpers/AuthorizationHelper.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Helpers/AuthorizationHelper.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/Helpers/AuthorizationHelper.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Helpers/AuthorizationHelper.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/Helpers/MockAuthenticationService.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Helpers/MockAuthenticationService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/Helpers/MockAuthenticationService.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Helpers/MockAuthenticationService.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/Helpers/MockAuthorizationPolicyProvider.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Helpers/MockAuthorizationPolicyProvider.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/Helpers/MockAuthorizationPolicyProvider.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Helpers/MockAuthorizationPolicyProvider.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/Helpers/MockAuthorizationService.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Helpers/MockAuthorizationService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/Helpers/MockAuthorizationService.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Helpers/MockAuthorizationService.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/Helpers/MockRegisterService.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Helpers/MockRegisterService.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/Helpers/MockRegisterService.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Helpers/MockRegisterService.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/Helpers/TestPolicyRequirement.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Helpers/TestPolicyRequirement.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/Helpers/TestPolicyRequirement.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Helpers/TestPolicyRequirement.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/IndexTest.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/IndexTest.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/IndexTest.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/IndexTest.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/LoginTest.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/LoginTest.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/LoginTest.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/LoginTest.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/Pages/Admin/UserManagement/UserDetailTest.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Pages/Admin/UserManagement/UserDetailTest.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/Pages/Admin/UserManagement/UserDetailTest.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Pages/Admin/UserManagement/UserDetailTest.cs.ejs diff --git a/generators/entity-client/templates/blazor/test/Project.Client.Test/Pages/Entities/Entity/EntityDetailTest.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Pages/Entities/_entityClass_/_entityClass_DetailTest.cs.ejs similarity index 100% rename from generators/entity-client/templates/blazor/test/Project.Client.Test/Pages/Entities/Entity/EntityDetailTest.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Pages/Entities/_entityClass_/_entityClass_DetailTest.cs.ejs diff --git a/generators/entity-client/templates/blazor/test/Project.Client.Test/Pages/Entities/Entity/EntityTest.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Pages/Entities/_entityClass_/_entityClass_Test.cs.ejs similarity index 100% rename from generators/entity-client/templates/blazor/test/Project.Client.Test/Pages/Entities/Entity/EntityTest.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Pages/Entities/_entityClass_/_entityClass_Test.cs.ejs diff --git a/generators/entity-client/templates/blazor/test/Project.Client.Test/Pages/Entities/Entity/EntityUpdateTest.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/Pages/Entities/_entityClass_/_entityClass_UpdateTest.cs.ejs similarity index 100% rename from generators/entity-client/templates/blazor/test/Project.Client.Test/Pages/Entities/Entity/EntityUpdateTest.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/Pages/Entities/_entityClass_/_entityClass_UpdateTest.cs.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/Pages/TestPages/TestAlertError.razor.ejs b/generators/blazor/templates/test/Project.Client.Test/Pages/TestPages/TestAlertError.razor.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/Pages/TestPages/TestAlertError.razor.ejs rename to generators/blazor/templates/test/Project.Client.Test/Pages/TestPages/TestAlertError.razor.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/Project.Client.Test.csproj.ejs b/generators/blazor/templates/test/Project.Client.Test/Project.Client.Test.csproj.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/Project.Client.Test.csproj.ejs rename to generators/blazor/templates/test/Project.Client.Test/Project.Client.Test.csproj.ejs diff --git a/generators/client/templates/blazor/test/Project.Client.Test/RegisterTest.cs.ejs b/generators/blazor/templates/test/Project.Client.Test/RegisterTest.cs.ejs similarity index 100% rename from generators/client/templates/blazor/test/Project.Client.Test/RegisterTest.cs.ejs rename to generators/blazor/templates/test/Project.Client.Test/RegisterTest.cs.ejs diff --git a/generators/bootstrap-dotnetcore/__snapshots__/generator.spec.js.snap b/generators/bootstrap-dotnetcore/__snapshots__/generator.spec.js.snap new file mode 100644 index 000000000..be042c98b --- /dev/null +++ b/generators/bootstrap-dotnetcore/__snapshots__/generator.spec.js.snap @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SubGenerator bootstrap-dotnetcore of dotnetcore JHipster blueprint > run > should succeed 1`] = ` +{ + ".yo-rc.json": { + "stateCleared": "modified", + }, +} +`; diff --git a/generators/bootstrap-dotnetcore/generator.js b/generators/bootstrap-dotnetcore/generator.js new file mode 100644 index 000000000..1a313a6de --- /dev/null +++ b/generators/bootstrap-dotnetcore/generator.js @@ -0,0 +1,243 @@ +import { readFile } from 'fs/promises'; +import { fileURLToPath } from 'url'; +import { join, dirname } from 'node:path'; +import BaseApplicationGenerator from 'generator-jhipster/generators/base-application'; +import { addOtherRelationship } from 'generator-jhipster/generators/base-application/support'; +import { getDatabaseData } from 'generator-jhipster/generators/spring-data-relational/support'; +import toPascalCase from 'to-pascal-case'; +import pluralize from 'pluralize'; +import { equivalentCSharpType } from './support/utils.js'; +import { BLAZOR, PROJECT_TEST_SUFFIX, SERVER_SRC_DIR, SERVER_TEST_DIR, XAMARIN } from '../generator-dotnetcore-constants.js'; + +const packagejs = JSON.parse((await readFile(join(dirname(fileURLToPath(import.meta.url)), '../../package.json'))).toString()).version; +export default class extends BaseApplicationGenerator { + async beforeQueue() { + await this.dependsOnJHipster('bootstrap-application'); + } + + get [BaseApplicationGenerator.INITIALIZING]() { + return this.asInitializingTaskGroup({ + async checks() { + if (!this.skipChecks) { + try { + await this.spawnCommand('dotnet --info'); + } catch (error) { + throw new Error(`dotnet was not found. Check the installation. ${error}`); + } + } + }, + }); + } + + get [BaseApplicationGenerator.CONFIGURING]() { + return this.asConfiguringTaskGroup({ + async configuring() { + if (!this.jhipsterConfig.namespace) { + this.jhipsterConfig.namespace = toPascalCase(this.jhipsterConfig.baseName); + } + }, + }); + } + + get [BaseApplicationGenerator.LOADING]() { + return this.asLoadingTaskGroup({ + async loadingTemplateTask({ application }) { + application.cqrsEnabled = this.jhipsterConfig.cqrsEnabled; + application.databaseType = this.jhipsterConfig.databaseType ?? 'sqllite'; + application.namespace = this.jhipsterConfig.namespace; + application.withTerraformAzureScripts = this.jhipsterConfig.withTerraformAzureScripts; + if (['postgresql', 'mysql', 'mariadb', 'mssql', 'oracle'].includes(application.databaseType)) { + application.prodDatabaseType = application.databaseType; + } + + application.SERVER_SRC_DIR = SERVER_SRC_DIR; + application.SERVER_TEST_DIR = SERVER_TEST_DIR; + + if (this.jhipsterConfig.dtoSuffix === undefined || application.dtoSuffix === 'DTO') { + application.dtoSuffix = 'Dto'; + } + application.pascalizedBaseName = toPascalCase(application.baseName); + application.solutionName = application.pascalizedBaseName; + application.mainProjectDir = `${application.pascalizedBaseName}/`; + + application.temporaryDir = 'tmp/'; + application.clientRootDir = `src/${application.mainProjectDir}ClientApp/`; + application.clientSrcDir = `src/${application.mainProjectDir}ClientApp/src/`; + application.clientTestDir = `src/${application.mainProjectDir}ClientApp/test/`; + application.clientDistDir = `src/${application.mainProjectDir}ClientApp/dist/`; + application.backendType = '.Net'; + + application.jhipsterDotnetVersion = this.useVersionPlaceholders ? 'JHIPSTER_DOTNET_VERSION' : packagejs.version; + }, + }); + } + + get [BaseApplicationGenerator.PREPARING]() { + return this.asPreparingTaskGroup({ + async preparingTemplateTask({ application }) { + application.withAdminUi = false; + application.serverPortSecured = parseInt(application.serverPort, 10) + 1; + application.dockerServicesDir = 'docker/'; + + application[`databaseType${this._.upperFirst(application.databaseType)}`] = true; + if (['postgresql', 'mysql', 'mariadb', 'mssql', 'oracle'].includes(application.databaseType)) { + application.databaseTypeSql = true; + application[`prodDatabaseType${this._.upperFirst(application.databaseType)}`] = true; + application.databaseData = getDatabaseData(application.databaseType); + } + + application.camelizedBaseName = this._.camelCase(application.baseName); + application.dasherizedBaseName = this._.kebabCase(application.baseName); + application.lowercaseBaseName = application.baseName.toLowerCase(); + application.humanizedBaseName = this._.startCase(application.baseName); + application.mainClientDir = `${application.mainProjectDir}ClientApp/`; + application.mainClientAppDir = `${application.mainProjectDir}ClientApp/src/`; + application.relativeMainClientDir = 'ClientApp/'; + application.relativeMainAppDir = `${application.relativeMainClientDir}src/`; + application.relativeMainTestDir = `${application.relativeMainClientDir}test/`; + application.testProjectDir = `${application.pascalizedBaseName}${PROJECT_TEST_SUFFIX}/`; + application.clientTestProject = `${application.mainClientDir}test/`; + application.kebabCasedBaseName = this._.kebabCase(application.baseName); + application.modelSuffix = 'Model'; + application.backendName = '.Net'; + + application.primaryKeyType = application.databaseType === 'mongodb' ? 'string' : 'long'; + + if (application.clientFramework === BLAZOR) { + application.mainClientDir = `client/${application.pascalizedBaseName}.Client/`; + application.sharedClientDir = `client/${application.pascalizedBaseName}.Client.Shared/`; + application.clientTestProject = `${application.pascalizedBaseName}.Client${PROJECT_TEST_SUFFIX}/`; + } + if (application.clientFramework === XAMARIN) { + application.mainClientDir = `client/${application.pascalizedBaseName}.Client.Xamarin.Core/`; + application.sharedClientDir = `client/${application.pascalizedBaseName}.Client.Xamarin.Shared/`; + application.androidClientDir = `client/${application.pascalizedBaseName}.Client.Xamarin.Android/`; + application.iOSClientDir = `client/${application.pascalizedBaseName}.Client.Xamarin.iOS/`; + application.clientTestProject = `${application.pascalizedBaseName}.Client.Xamarin${PROJECT_TEST_SUFFIX}/`; + } + }, + }); + } + + get [BaseApplicationGenerator.PREPARING_EACH_ENTITY]() { + return this.asPreparingEachEntityTaskGroup({ + async preparingTemplateTask({ application, entity }) { + entity.primaryKeyType = entity.databaseType === 'mongodb' ? 'string' : 'long'; + + entity.dotnetEntityModel = `${entity.entityClass}${application.modelSuffix}`; + entity.pascalizedEntityClass = toPascalCase(entity.entityClass); + entity.pascalizedEntityClassPlural = toPascalCase(entity.entityClassPlural); + entity.snakeCasedEntityClass = this._.snakeCase(entity.entityClass); + entity.snakeCasedEntityClassPlural = this._.snakeCase(entity.entityClassPlural); + entity.camelCasedEntityClass = this._.camelCase(entity.entityClass); + entity.camelCasedEntityClassPlural = this._.camelCase(entity.entityClassPlural); + entity.kebabCasedEntityClass = this._.kebabCase(entity.entityClass); + entity.kebabCasedEntityClassPlural = this._.kebabCase(entity.entityClassPlural); + entity.lowerCasedEntityClass = this._.toLower(entity.entityClass); + entity.lowerCasedEntityClassPlural = this._.toLower(entity.entityClassPlural); + entity.entityClassHasManyToMany = false; + entity.entities = this.getExistingEntities(); + + // Embed functions to use in EJS templates + entity.toPascalCase = toPascalCase; + entity.pluralize = pluralize; + entity._ = this._; + + for (const relationship of entity.relationships ?? []) { + if ( + !relationship.otherRelationship && + entity.databaseType !== 'mongodb' && + (relationship.relationshipType === 'many-to-many' || + relationship.relationshipType === 'one-to-many' || + relationship.relationshipType === 'one-to-one') + ) { + // TODO remove this condition + if (relationship.relationshipType !== 'one-to-one') { + relationship.otherRelationship = addOtherRelationship(entity, relationship.otherEntity, relationship); + } + } + } + }, + }); + } + + get [BaseApplicationGenerator.PREPARING_EACH_ENTITY_FIELD]() { + return this.asPreparingEachEntityFieldTaskGroup({ + async preparingTemplateTask({ field }) { + field.cSharpType = equivalentCSharpType(field.fieldType); + field.fieldNamePascalized = toPascalCase(field.fieldName); + field.fieldNameCamelCased = this._.camelCase(field.fieldName); + + const { fieldType } = field; + + field.fieldIsEnum = ![ + 'String', + 'Integer', + 'Long', + 'Float', + 'Double', + 'BigDecimal', + 'LocalDate', + 'Instant', + 'ZonedDateTime', + 'Duration', + 'UUID', + 'Boolean', + 'byte[]', + 'ByteBuffer', + ].includes(fieldType); + }, + }); + } + + get [BaseApplicationGenerator.PREPARING_EACH_ENTITY_RELATIONSHIP]() { + return this.asPreparingEachEntityRelationshipTaskGroup({ + async preparingTemplateTask({ entity, relationship }) { + relationship.relationshipNamePascalized = toPascalCase(relationship.relationshipName); + relationship.relationshipNamePascalizedPlural = pluralize(relationship.relationshipNamePascalized); + relationship.relationshipFieldNamePascalized = toPascalCase(relationship.relationshipFieldName); + relationship.relationshipFieldNameLowerCased = this._.toLower(relationship.relationshipFieldName); + relationship.relationshipFieldNamePascalizedPlural = pluralize(relationship.relationshipFieldNamePascalized); + relationship.otherEntityNamePascalized = toPascalCase(relationship.otherEntityName); + relationship.otherEntityNamePascalizedPlural = toPascalCase(relationship.otherEntityNamePlural); + relationship.otherEntityNameCamelCased = this._.camelCase(relationship.otherEntityName); + relationship.otherEntityNameLowerCased = this._.toLower(relationship.otherEntityName); + relationship.otherEntityNameLowerCasedPlural = this._.toLower(relationship.otherEntityNamePlural); + + if ( + relationship.relationshipType === 'one-to-many' || + relationship.relationshipType === 'many-to-many' || + relationship.relationshipType === 'one-to-one' || + relationship.otherEntityName.toLowerCase() === 'user' + ) { + relationship.otherEntityRelationshipName = relationship.otherEntityRelationshipName ?? entity.entityInstance; + relationship.otherEntityRelationshipNamePascalized = toPascalCase(relationship.otherEntityRelationshipName); + relationship.otherEntityRelationshipFieldName = this._.lowerFirst(relationship.otherEntityRelationshipName); + relationship.otherEntityRelationshipFieldNamePascalized = toPascalCase(relationship.otherEntityRelationshipFieldName); + relationship.otherEntityRelationshipFieldNamePascalizedPlural = pluralize( + relationship.otherEntityRelationshipFieldNamePascalized, + ); + } + + if (relationship.relationshipType === 'many-to-many') { + if (relationship.ownerSide) { + relationship.otherEntityRelationshipNamePascalizedPlural = pluralize(relationship.otherEntityRelationshipNamePascalized); + relationship.joinEntityName = relationship.otherEntityRelationshipName + this._.upperFirst(relationship.relationshipName); + relationship.joinEntityNamePascalized = + relationship.otherEntityRelationshipNamePascalized + relationship.relationshipNamePascalized; + } else { + relationship.joinEntityName = relationship.relationshipName + this._.upperFirst(relationship.otherEntityRelationshipName); + relationship.joinEntityNamePascalized = + relationship.relationshipNamePascalized + relationship.otherEntityRelationshipNamePascalized; + } + relationship.joinEntityNameSnakeCased = this._.snakeCase(relationship.joinEntityName); + relationship.joinEntityNameCamelCased = this._.camelCase(relationship.joinEntityName); + relationship.joinEntityFieldNamePascalizedPlural = pluralize(relationship.joinEntityNamePascalized); + entity.entityClassHasManyToMany = true; + } + + relationship.joinEntityGenerated = false; + }, + }); + } +} diff --git a/generators/bootstrap-dotnetcore/generator.spec.js b/generators/bootstrap-dotnetcore/generator.spec.js new file mode 100644 index 000000000..ce9f10651 --- /dev/null +++ b/generators/bootstrap-dotnetcore/generator.spec.js @@ -0,0 +1,25 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'bootstrap-dotnetcore'; +const SUB_GENERATOR_NAMESPACE = `jhipster-dotnetcore:${SUB_GENERATOR}`; + +describe('SubGenerator bootstrap-dotnetcore of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig() + .withOptions({ + ignoreNeedlesError: true, + }) + .withJHipsterLookup() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/bootstrap-dotnetcore/index.js b/generators/bootstrap-dotnetcore/index.js new file mode 100644 index 000000000..01e9dc34d --- /dev/null +++ b/generators/bootstrap-dotnetcore/index.js @@ -0,0 +1 @@ +export { default } from './generator.js'; diff --git a/generators/bootstrap-dotnetcore/support/utils.js b/generators/bootstrap-dotnetcore/support/utils.js new file mode 100644 index 000000000..80ea89793 --- /dev/null +++ b/generators/bootstrap-dotnetcore/support/utils.js @@ -0,0 +1,68 @@ +/** + * Copyright 2019-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export function equivalentCSharpType(javaType) { + let cSharpType; + + switch (javaType) { + case 'String': + cSharpType = 'string'; + break; + case 'Integer': + cSharpType = 'int?'; + break; + case 'Long': + cSharpType = 'long?'; + break; + case 'Float': + cSharpType = 'float?'; + break; + case 'Double': + cSharpType = 'double?'; + break; + case 'BigDecimal': + cSharpType = 'decimal?'; + break; + case 'LocalDate': + cSharpType = 'DateTime?'; + break; + case 'Instant': + cSharpType = 'DateTime'; + break; + case 'ZonedDateTime': + cSharpType = 'DateTime'; + break; + case 'Duration': + cSharpType = 'TimeSpan'; + break; + case 'Boolean': + cSharpType = 'bool?'; + break; + case 'enum': + cSharpType = 'LOOK_FOR_AN_EQUIVALENT'; + break; + case 'byte[]': + cSharpType = 'LOOK_FOR_AN_EQUIVALENT'; + break; + default: + cSharpType = 'UNKNOWN_TYPE'; + } + + return cSharpType; +} diff --git a/generators/ci-cd/command.js b/generators/ci-cd/command.js new file mode 100644 index 000000000..b5a045029 --- /dev/null +++ b/generators/ci-cd/command.js @@ -0,0 +1,8 @@ +/** + * @type {import('generator-jhipster').JHipsterCommandDefinition} + */ +const command = { + options: {}, +}; + +export default command; diff --git a/generators/ci-cd/generator.js b/generators/ci-cd/generator.js new file mode 100644 index 000000000..b516d6563 --- /dev/null +++ b/generators/ci-cd/generator.js @@ -0,0 +1,103 @@ +import CiCdGenerator from 'generator-jhipster/generators/ci-cd'; +import command from './command.mjs'; + +export default class extends CiCdGenerator { + constructor(args, opts, features) { + super(args, opts, { + ...features, + checkBlueprint: true, + // Dropped it once migration is done. + jhipster7Migration: true, + }); + } + + get [CiCdGenerator.INITIALIZING]() { + return this.asInitializingTaskGroup({ + async initializingTemplateTask() { + this.parseJHipsterArguments(command.arguments); + this.parseJHipsterOptions(command.options); + }, + async initializingCiConfig() { + this.ciType = this.blueprintConfig.ciType; + }, + }); + } + + get [CiCdGenerator.PROMPTING]() { + return this.asPromptingTaskGroup({ + async promptingCiChoices() { + if (this.existingProject) return; + if (this.ciType) return; + + const ciTypeChoices = [ + { value: GITHUB, name: 'Github Action' }, + { value: GITLAB, name: 'Gitlab CI' }, + { value: 'noci', name: 'No CI' }, + ]; + + const answers = await this.prompt([ + { + type: 'list', + name: 'ciType', + message: `What CI/CD pipeline do you want to generate ?`, + choices: ciTypeChoices, + default: GITHUB, + }, + ]); + this.ciType = this.blueprintConfig.ciType = answers.ciType; + }, + }); + } + + get [CiCdGenerator.CONFIGURING]() { + return this.asConfiguringTaskGroup({ + async configuringTemplateTask() {}, + }); + } + + get [CiCdGenerator.COMPOSING]() { + return this.asComposingTaskGroup({ + async composingTemplateTask() {}, + }); + } + + get [CiCdGenerator.LOADING]() { + return this.asLoadingTaskGroup({ + async loadingTemplateTask() {}, + }); + } + + get [CiCdGenerator.PREPARING]() { + return this.asPreparingTaskGroup({ + async preparingTemplateTask() {}, + }); + } + + get [CiCdGenerator.DEFAULT]() { + return this.asDefaultTaskGroup({ + async defaultTemplateTask() {}, + }); + } + + get [CiCdGenerator.WRITING]() { + return this.asWritingTaskGroup({ + async writingCiFiles() { + await this.writeFiles({ + sections: { + files: [ + { + condition: ctx => ctx.ciType === GITHUB, + templates: ['.github/workflows/dotnet.yml'], + }, + { + condition: ctx => ctx.ciType === GITLAB, + templates: ['.gitlab-ci.yml'], + }, + ], + }, + context: this, + }); + }, + }); + } +} diff --git a/generators/ci-cd/generator.mjs b/generators/ci-cd/generator.mjs deleted file mode 100644 index 03f4a4bc0..000000000 --- a/generators/ci-cd/generator.mjs +++ /dev/null @@ -1,84 +0,0 @@ -import chalk from 'chalk'; -import CiCdGenerator from 'generator-jhipster/esm/generators/ci-cd'; -import { GITHUB, GITLAB } from '../generator-dotnetcore-constants.mjs'; -import { - PRIORITY_PREFIX, - PROMPTING_PRIORITY, - CONFIGURING_PRIORITY, - INITIALIZING_PRIORITY, - WRITING_PRIORITY -} from 'generator-jhipster/esm/priorities'; - -export default class extends CiCdGenerator { - constructor(args, opts, features) { - super(args, opts, { taskPrefix: PRIORITY_PREFIX, ...features }); - - if (this.options.help) return; - - if (!this.options.jhipsterContext) { - throw new Error(`This is a JHipster blueprint and should be used only like ${chalk.yellow('jhipster --blueprints TestFolder2')}`); - } - - } - - get [PROMPTING_PRIORITY]() { - return { - async promptingCiChoices() { - - if (this.existingProject) return; - if (this.ciType) return; - - const ciTypeChoices = [ - { value: GITHUB , name: 'Github Action', }, - { value: GITLAB, name: 'Gitlab CI', }, - { value: 'noci' , name: 'No CI', }, - ]; - - const answers = await this.prompt([ - { - type: 'list', - name: 'ciType', - message: `What CI/CD pipeline do you want to generate ?`, - choices: ciTypeChoices, - default: GITHUB, - }, - ]); - this.ciType = this.blueprintConfig.ciType = answers.ciType; - }, - }; - } - - get [INITIALIZING_PRIORITY]() { - return { - async initializingCiConfig() { - this.ciType = this.blueprintConfig.ciType; - }, - }; - } - - get [CONFIGURING_PRIORITY]() { - return {}; - } - - get [WRITING_PRIORITY]() { - return { - async writingCiFiles() { - await this.writeFiles({ - sections: { - files: [ - { - condition: ctx => ctx.ciType === GITHUB, - templates: ['.github/workflows/dotnet.yml'] - }, - { - condition: ctx => ctx.ciType === GITLAB, - templates: ['.gitlab-ci.yml'] - }, - ], - }, - context: this, - }); - }, - }; - } -} diff --git a/generators/ci-cd/generator.spec.js b/generators/ci-cd/generator.spec.js new file mode 100644 index 000000000..78e80c8be --- /dev/null +++ b/generators/ci-cd/generator.spec.js @@ -0,0 +1,26 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'ci-cd'; +const BLUEPRINT_NAMESPACE = `jhipster:${SUB_GENERATOR}`; + +describe.skip('SubGenerator ci-cd of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(BLUEPRINT_NAMESPACE) + .withJHipsterConfig() + .withOptions({ + ignoreNeedlesError: true, + blueprint: 'dotnetcore', + }) + .withJHipsterLookup() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/ci-cd/index.js b/generators/ci-cd/index.js new file mode 100644 index 000000000..3eccd6e86 --- /dev/null +++ b/generators/ci-cd/index.js @@ -0,0 +1,2 @@ +export { default } from './generator.js'; +export { default as command } from './command.js'; diff --git a/generators/ci-cd/index.mjs b/generators/ci-cd/index.mjs deleted file mode 100644 index adaf4ca2e..000000000 --- a/generators/ci-cd/index.mjs +++ /dev/null @@ -1 +0,0 @@ -export { default } from './generator.mjs'; diff --git a/generators/client/__snapshots__/generator.spec.js.snap b/generators/client/__snapshots__/generator.spec.js.snap new file mode 100644 index 000000000..d875bab0d --- /dev/null +++ b/generators/client/__snapshots__/generator.spec.js.snap @@ -0,0 +1,774 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SubGenerator client of dotnetcore JHipster blueprint > run > should succeed 1`] = ` +{ + ".devcontainer/devcontainer.json": { + "stateCleared": "modified", + }, + ".dockerignore": { + "stateCleared": "modified", + }, + ".editorconfig": { + "stateCleared": "modified", + }, + ".gitattributes": { + "stateCleared": "modified", + }, + ".gitignore": { + "stateCleared": "modified", + }, + ".husky/pre-commit": { + "stateCleared": "modified", + }, + ".lintstagedrc.js": { + "stateCleared": "modified", + }, + ".prettierignore": { + "stateCleared": "modified", + }, + ".prettierrc": { + "stateCleared": "modified", + }, + ".yo-rc.json": { + "stateCleared": "modified", + }, + "Dockerfile-Back": { + "stateCleared": "modified", + }, + "README.md": { + "stateCleared": "modified", + }, + "docker-entrypoint-back.sh": { + "stateCleared": "modified", + }, + "package.json": { + "stateCleared": "modified", + }, + "sonar-project.properties": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/.eslintignore": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/.eslintrc.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/angular.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/jest.conf.js": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/ngsw-config.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/package.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/404.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/WEB-INF/web.xml": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/account.route.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/activate/activate.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/activate/activate.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/activate/activate.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/activate/activate.route.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/activate/activate.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/activate/activate.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/finish/password-reset-finish.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/finish/password-reset-finish.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/finish/password-reset-finish.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/finish/password-reset-finish.route.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/finish/password-reset-finish.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/finish/password-reset-finish.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/init/password-reset-init.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/init/password-reset-init.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/init/password-reset-init.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/init/password-reset-init.route.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/init/password-reset-init.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password-reset/init/password-reset-init.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password-strength-bar/password-strength-bar.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password-strength-bar/password-strength-bar.component.scss": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password-strength-bar/password-strength-bar.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password-strength-bar/password-strength-bar.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password.route.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/password/password.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/register/register.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/register/register.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/register/register.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/register/register.model.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/register/register.route.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/register/register.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/register/register.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/settings/settings.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/settings/settings.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/settings/settings.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/account/settings/settings.route.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/admin-routing.module.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/docs/docs.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/docs/docs.component.scss": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/docs/docs.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/delete/user-management-delete-dialog.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/delete/user-management-delete-dialog.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/delete/user-management-delete-dialog.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/detail/user-management-detail.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/detail/user-management-detail.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/detail/user-management-detail.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/list/user-management.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/list/user-management.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/list/user-management.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/service/user-management.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/service/user-management.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/update/user-management-update.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/update/user-management-update.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/update/user-management-update.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/user-management.model.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/admin/user-management/user-management.route.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/app-page-title-strategy.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/app-routing.module.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/app.constants.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/app.module.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/authority.constants.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/datepicker-adapter.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/dayjs.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/error.constants.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/font-awesome-icons.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/input.constants.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/language.constants.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/navigation.constants.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/pagination.constants.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/translation.config.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/config/uib-pagination.config.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/auth/account.model.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/auth/account.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/auth/account.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/auth/auth-jwt.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/auth/auth-jwt.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/auth/state-storage.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/auth/user-route-access.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/config/application-config.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/config/application-config.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/interceptor/auth-expired.interceptor.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/interceptor/auth.interceptor.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/interceptor/error-handler.interceptor.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/interceptor/index.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/interceptor/notification.interceptor.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/request/request-util.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/request/request.model.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/alert.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/alert.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/data-util.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/data-util.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/event-manager.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/event-manager.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/operators.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/operators.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/parse-links.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/core/util/parse-links.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/entities/entity-navbar-items.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/entities/entity-routing.module.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/entities/user/user.model.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/entities/user/user.service.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/entities/user/user.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/home/home.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/home/home.component.scss": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/home/home.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/home/home.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/error/error.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/error/error.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/error/error.route.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/footer/footer.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/footer/footer.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/main/main.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/main/main.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/main/main.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/main/main.module.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/navbar/active-menu.directive.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/navbar/navbar-item.model.d.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/navbar/navbar.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/navbar/navbar.component.scss": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/navbar/navbar.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/navbar/navbar.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/profiles/page-ribbon.component.scss": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/profiles/page-ribbon.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/profiles/page-ribbon.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/profiles/profile-info.model.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/layouts/profiles/profile.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/login/login.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/login/login.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/login/login.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/login/login.model.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/login/login.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/alert/alert-error.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/alert/alert-error.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/alert/alert-error.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/alert/alert-error.model.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/alert/alert.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/alert/alert.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/alert/alert.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/auth/has-any-authority.directive.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/auth/has-any-authority.directive.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/date/duration.pipe.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/date/format-medium-date.pipe.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/date/format-medium-date.pipe.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/date/format-medium-datetime.pipe.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/date/format-medium-datetime.pipe.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/date/index.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/filter/filter.component.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/filter/filter.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/filter/filter.model.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/filter/filter.model.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/filter/index.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/language/find-language-from-key.pipe.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/language/index.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/language/translate.directive.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/language/translate.directive.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/language/translation.module.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/pagination/index.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/pagination/item-count.component.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/pagination/item-count.component.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/shared.module.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/sort/index.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/sort/sort-by.directive.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/sort/sort-by.directive.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/sort/sort.directive.spec.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/sort/sort.directive.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/app/shared/sort/sort.service.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/bootstrap.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/css/loading.css": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_0.svg": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_0_head-192.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_0_head-256.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_0_head-384.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_0_head-512.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_1.svg": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_1_head-192.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_1_head-256.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_1_head-384.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_1_head-512.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_2.svg": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_2_head-192.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_2_head-256.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_2_head-384.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_2_head-512.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_3.svg": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_3_head-192.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_3_head-256.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_3_head-384.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/jhipster_family_member_3_head-512.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/images/logo-jhipster.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/scss/_bootstrap-variables.scss": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/scss/global.scss": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/content/scss/vendor.scss": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/declarations.d.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/favicon.ico": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/activate.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/error.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/global.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/home.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/login.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/password.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/register.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/reset.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/sessions.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/settings.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/en/user-management.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/activate.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/error.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/global.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/home.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/login.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/password.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/register.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/reset.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/sessions.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/settings.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/i18n/fr/user-management.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/index.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/main.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/manifest.webapp": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/robots.txt": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/swagger-ui/dist/images/throbber.gif": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/src/swagger-ui/index.html": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/tsconfig.app.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/tsconfig.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/tsconfig.spec.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/webpack/environment.js": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/webpack/logo-jhipster.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/webpack/proxy.conf.js": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/webpack/webpack.custom.js": { + "stateCleared": "modified", + }, +} +`; diff --git a/generators/client/command.js b/generators/client/command.js new file mode 100644 index 000000000..5a7d0aa42 --- /dev/null +++ b/generators/client/command.js @@ -0,0 +1,24 @@ +import { command as clientCommand } from 'generator-jhipster/generators/client'; +import { BLAZOR, XAMARIN } from '../generator-dotnetcore-constants.js'; + +/** + * @type {import('generator-jhipster').JHipsterCommandDefinition} + */ +const command = { + ...clientCommand, + configs: { + ...clientCommand.configs, + clientFramework: { + ...clientCommand.configs.clientFramework, + choices: [ + ...clientCommand.configs.clientFramework.choices.filter(({ value }) => value !== 'no'), + { value: BLAZOR, name: '[Alpha] - Blazor (WebAssembly)' }, + { value: XAMARIN, name: '[Alpha] - Xamarin' }, + { value: 'no', name: 'No client' }, + ], + }, + }, + override: true, +}; + +export default command; diff --git a/generators/client/files-angular.js b/generators/client/files-angular.js deleted file mode 100644 index f91aaa0a4..000000000 --- a/generators/client/files-angular.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const constants = require('../generator-dotnetcore-constants.cjs'); - -/* Constants use throughout */ -const SERVER_SRC_DIR = constants.SERVER_SRC_DIR; - -function angularJson() { - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientDir}/angular.json`, `${SERVER_SRC_DIR}${this.mainClientDir}/`, "", true); - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientDir}/angular.json`, `target/classes/static/`, "dist/", true); -} - -function updateHomeTitle() { - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientAppDir}/app/home/home.component.html`, 'Java', '.Net Core', false); -} - -function updateWebpackCustomJs() { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.custom.js`, - `${SERVER_SRC_DIR}${this.mainClientDir}/`, - "", - true - ); -} - -function writeFiles() { - angularJson.call(this); - updateHomeTitle.call(this); - updateWebpackCustomJs.call(this); -} - -module.exports = { - writeFiles, -}; diff --git a/generators/client/files-blazor.js b/generators/client/files-blazor.js deleted file mode 100644 index f2bf7d71e..000000000 --- a/generators/client/files-blazor.js +++ /dev/null @@ -1,927 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const constants = require('../generator-dotnetcore-constants.cjs'); - -/* Constants use throughout */ -const CLIENT_SRC_DIR = constants.CLIENT_SRC_DIR; -const CLIENT_TEST_DIR = constants.CLIENT_TEST_DIR; - -/** - * The default is to use a file path string. It implies use of the template method. - * For any other config an object { file:.., method:.., template:.. } can be used - */ -const files = { - blazorAutoMapperProfiles: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/AutoMapper/AutoMapperProfile.cs', - renameTo: generator => `${generator.mainClientDir}/AutoMapper/AutoMapperProfile.cs`, - }, - ], - }, - ], - blazorAppModels: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/BaseModel.cs', - renameTo: generator => `${generator.mainClientDir}/Models/BaseModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/Register/RegisterModel.cs', - renameTo: generator => `${generator.mainClientDir}/Models/Register/RegisterModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/Register/RegisterResultRequest.cs', - renameTo: generator => `${generator.mainClientDir}/Models/Register/RegisterResultRequest.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/Register/UserSaveModel.cs', - renameTo: generator => `${generator.mainClientDir}/Models/Register/UserSaveModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/ConfigurationModel.cs', - renameTo: generator => `${generator.mainClientDir}/Models/ConfigurationModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/JwtToken.cs', - renameTo: generator => `${generator.mainClientDir}/Models/JwtToken.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/LoginModel.cs', - renameTo: generator => `${generator.mainClientDir}/Models/LoginModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/UserModel.cs', - renameTo: generator => `${generator.mainClientDir}/Models/UserModel.cs`, - }, - ], - }, - ], - blazorAppPages: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Account/Register.razor.cs', - renameTo: generator => `${generator.mainClientDir}/Pages/Account/Register.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Account/Register.razor', - renameTo: generator => `${generator.mainClientDir}/Pages/Account/Register.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Admin/UserManagement/UserDetail.razor', - renameTo: generator => `${generator.mainClientDir}/Pages/Admin/UserManagement/UserDetail.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Admin/UserManagement/UserDetail.razor.cs', - renameTo: generator => `${generator.mainClientDir}/Pages/Admin/UserManagement/UserDetail.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Admin/UserManagement/UserManagement.razor.cs', - renameTo: generator => `${generator.mainClientDir}/Pages/Admin/UserManagement/UserManagement.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Admin/UserManagement/UserManagement.razor', - renameTo: generator => `${generator.mainClientDir}/Pages/Admin/UserManagement/UserManagement.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Admin/UserManagement/UserUpdate.razor', - renameTo: generator => `${generator.mainClientDir}/Pages/Admin/UserManagement/UserUpdate.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Admin/UserManagement/UserUpdate.razor.cs', - renameTo: generator => `${generator.mainClientDir}/Pages/Admin/UserManagement/UserUpdate.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Utils/INavigationService.cs', - renameTo: generator => `${generator.mainClientDir}/Pages/Utils/INavigationService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Utils/NavigationService.cs', - renameTo: generator => `${generator.mainClientDir}/Pages/Utils/NavigationService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Index.razor.cs', - renameTo: generator => `${generator.mainClientDir}/Pages/Index.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Index.razor', - renameTo: generator => `${generator.mainClientDir}/Pages/Index.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Login.razor', - renameTo: generator => `${generator.mainClientDir}/Pages/Login.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Login.razor.cs', - renameTo: generator => `${generator.mainClientDir}/Pages/Login.razor.cs`, - }, - ], - } - ], - blazorAppProperties: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Properties/launchSettings.json', - renameTo: generator => `${generator.mainClientDir}/Properties/launchSettings.json`, - }, - ], - }, - ], - blazorAppServices: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/AccountServices/IRegisterService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/AccountServices/IRegisterService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/AccountServices/RegisterService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/AccountServices/RegisterService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/EntityServices/User/IUserService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/EntityServices/User/IUserService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/EntityServices/User/UserService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/EntityServices/User/UserService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/EntityServices/AbstractEntityService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/EntityServices/AbstractEntityService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/IAuthenticationService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/IAuthenticationService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/AuthenticationService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/AuthenticationService.cs`, - }, - ], - }, - ], - blazorAppShared: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Shared/MainLayout.razor', - renameTo: generator => `${generator.mainClientDir}/Shared/MainLayout.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Shared/NavMenu.razor', - renameTo: generator => `${generator.mainClientDir}/Shared/NavMenu.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Shared/NavMenu.razor.cs', - renameTo: generator => `${generator.mainClientDir}/Shared/NavMenu.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Shared/DeleteModal.razor.cs', - renameTo: generator => `${generator.mainClientDir}/Shared/DeleteModal.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Shared/DeleteModal.razor', - renameTo: generator => `${generator.mainClientDir}/Shared/DeleteModal.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Shared/Components/AlertError.razor', - renameTo: generator => `${generator.mainClientDir}/Shared/Components/AlertError.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Shared/Components/AlertError.razor.cs', - renameTo: generator => `${generator.mainClientDir}/Shared/Components/AlertError.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Shared/Components/DynInputText.razor', - renameTo: generator => `${generator.mainClientDir}/Shared/Components/DynInputText.razor`, - }, - ], - }, - ], - blazorAppWeb: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_0.svg', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_0.svg`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_1.svg', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_1.svg`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_2.svg', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_2.svg`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_3.svg', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_3.svg`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-192.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_0_head-192.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_1_head-192.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_1_head-192.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_2_head-192.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_2_head-192.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_3_head-192.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_3_head-192.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_0_head-256.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_1_head-256.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_1_head-256.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_2_head-256.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_2_head-256.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-256.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_0_head-256.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-384.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_0_head-384.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_1_head-384.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_1_head-384.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_2_head-384.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_2_head-384.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_3_head-384.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_3_head-384.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_0_head-512.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_0_head-512.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_1_head-512.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_1_head-512.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_2_head-512.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_2_head-512.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/jhipster_family_member_3_head-512.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/jhipster_family_member_3_head-512.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/images/logo-jhipster.png', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/images/logo-jhipster.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/css/loading.css', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/css/loading.css`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/scss/_bootstrap-variables.scss', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/scss/_bootstrap-variables.scss`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/scss/global.scss', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/scss/global.scss`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/content/scss/vendor.scss', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/content/scss/vendor.scss`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/favicon.ico', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/favicon.ico`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/index.html', - method: 'copy', - renameTo: generator => `${generator.mainClientDir}/wwwroot/index.html`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/robots.txt', - renameTo: generator => `${generator.mainClientDir}/wwwroot/robots.txt`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/manifest.webapp', - renameTo: generator => `${generator.mainClientDir}/wwwroot/manifest.webapp`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/appsettings.json', - renameTo: generator => `${generator.mainClientDir}/wwwroot/appsettings.json`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/appsettings.Development.json', - renameTo: generator => `${generator.mainClientDir}/wwwroot/appsettings.Development.json`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/wwwroot/appsettings.Production.json', - renameTo: generator => `${generator.mainClientDir}/wwwroot/appsettings.Production.json`, - }, - ], - }, - ], - blazorAppRoot: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/_Imports.razor', - renameTo: generator => `${generator.mainClientDir}/_Imports.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/App.razor', - renameTo: generator => `${generator.mainClientDir}/App.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/App.razor.cs', - renameTo: generator => `${generator.mainClientDir}/App.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/libman.json', - renameTo: generator => `${generator.mainClientDir}/libman.json`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Program.cs', - renameTo: generator => `${generator.mainClientDir}/Program.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Project.Client.csproj', - renameTo: generator => `${generator.mainClientDir}/${generator.pascalizedBaseName}.Client.csproj`, - }, - ], - }, - ], - blazorTestHelpers: [ - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Helpers/AuthorizationHelper.cs', - renameTo: generator => `${generator.clientTestProject}/Helpers/AuthorizationHelper.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Helpers/MockAuthenticationService.cs', - renameTo: generator => `${generator.clientTestProject}/Helpers/MockAuthenticationService.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Helpers/MockAuthorizationPolicyProvider.cs', - renameTo: generator => `${generator.clientTestProject}/Helpers/MockAuthorizationPolicyProvider.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Helpers/MockAuthorizationService.cs', - renameTo: generator => `${generator.clientTestProject}/Helpers/MockAuthorizationService.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Helpers/MockRegisterService.cs', - renameTo: generator => `${generator.clientTestProject}/Helpers/MockRegisterService.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Helpers/TestPolicyRequirement.cs', - renameTo: generator => `${generator.clientTestProject}/Helpers/TestPolicyRequirement.cs`, - }, - ], - } - ], - blazorTestPages: [ - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Pages/Admin/UserManagement/UserDetailTest.cs', - renameTo: generator => `${generator.clientTestProject}/Pages/Admin/UserManagement/UserDetailTest.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Pages/TestPages/TestAlertError.razor', - renameTo: generator => `${generator.clientTestProject}/Pages/TestPages/TestAlertError.razor`, - }, - ], - }, - ], - blazorTestRoot: [ - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/AlertErrorTest.cs', - renameTo: generator => `${generator.clientTestProject}/AlertErrorTest.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/IndexTest.cs', - renameTo: generator => `${generator.clientTestProject}/IndexTest.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/LoginTest.cs', - renameTo: generator => `${generator.clientTestProject}/LoginTest.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Project.Client.Test.csproj', - renameTo: generator => `${generator.clientTestProject}/${generator.pascalizedBaseName}.Client.Test.csproj`, - }, - ], - }, - ], - blazorShared: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Shared/Constants/ErrorConst.cs', - renameTo: generator => `${generator.sharedClientDir}/Constants/ErrorConst.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Shared/Constants/TypeAlert.cs', - renameTo: generator => `${generator.sharedClientDir}/Constants/TypeAlert.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Shared/Models/JhiAlert.cs', - renameTo: generator => `${generator.sharedClientDir}/Models/JhiAlert.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Shared/Project.Client.Shared.csproj', - renameTo: generator => `${generator.sharedClientDir}/${generator.pascalizedBaseName}.Client.Shared.csproj`, - }, - ], - }, - ], -}; - -module.exports = { - writeFiles, - files, -}; - -function writeFiles() { - this.writeFilesToDisk(files, this, false, 'blazor'); -} - diff --git a/generators/client/files-common.js b/generators/client/files-common.js deleted file mode 100644 index cc209163a..000000000 --- a/generators/client/files-common.js +++ /dev/null @@ -1,292 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const constants = require('../generator-dotnetcore-constants.cjs'); -const baseConstants = require('generator-jhipster/generators/generator-constants'); -const { ANGULAR, REACT, VUE } = baseConstants.SUPPORTED_CLIENT_FRAMEWORKS; - -/* Constants use throughout */ -const SERVER_SRC_DIR = constants.SERVER_SRC_DIR; - -function updateWebpackCommonJs() { - if (this.clientFramework === VUE || this.clientFramework === REACT) { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.common.js`, - `${SERVER_SRC_DIR}${this.mainClientDir}/`, - "", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.common.js`, - `src\\/`, - "", - false - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.common.js`, - "utils.root('src/main/webapp/index.html')", - "utils.root('src/index.html')", - false - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.common.js`, - `main/webapp/`, - "", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.common.js`, - "target/classes/static/", - "dist", - true - ); - } -} - -function updateWebpackDevJs() { - if (this.clientFramework === VUE || this.clientFramework === REACT) { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.dev.js`, - `${SERVER_SRC_DIR}${this.mainClientDir}/`, - "", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.dev.js`, - 'path: utils.root(.*),', - "path: utils.root('dist'),", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.dev.js`, - "target/classes/static/", - "dist", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.dev.js`, - "contentBase: '.*'", - "contentBase: './dist'", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.dev.js`, - 'cacheDirectory: path.resolve(.*)', - "cacheDirectory: path.resolve('bin/cache-loader')", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.dev.js`, - "target: `http${options.tls ? 's' : ''}://localhost:8080`", - `target: \`http\${options.tls ? 's' : ''}://localhost:${this.serverPort}\``, - false - ); - } -} - -function updateWebpackProdJs() { - if (this.clientFramework === VUE || this.clientFramework === REACT) { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.prod.js`, - `${SERVER_SRC_DIR}${this.mainClientDir}/`, - "", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.prod.js`, - 'path: utils.root(.*),', - "path: utils.root('dist'),", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.dev.js`, - "target/classes/static/", - "dist", - true - ); - } -} - -function updateTsConfigJson() { - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientDir}/tsconfig.json`, '"outDir": ".*"', '"outDir": "dist/src/app"', true); - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientDir}/tsconfig.json`, `${SERVER_SRC_DIR}${this.mainClientDir}/`, "", true); - if (this.clientFramework === ANGULAR) { - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientDir}/tsconfig.app.json`, `${SERVER_SRC_DIR}${this.mainClientDir}/`, "", true); - } -} - -function updateTsConfigSpecJson() { - if (this.clientFramework === ANGULAR || this.clientFramework === VUE) { - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientDir}/tsconfig.spec.json`, `${SERVER_SRC_DIR}${this.mainClientDir}/`, "", true); - } -} - -function updatePackageJson() { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/package.json`, - '"cleanup": ".*"', - '"cleanup": "rimraf bin/aot && rimraf dist/*"', - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/package.json`, - '"clean-www": ".*"', - '"clean-www": "rimraf dist/{src,target/}"', - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/package.json`, - 'src/test/javascript', - 'test', - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/package.json`, - `${SERVER_SRC_DIR}${this.mainClientDir}/`, - '', - true - ); -} - -function updateJestConf() { - if (this.clientFramework === ANGULAR || this.clientFramework === REACT) { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/jest.conf.js`, - '/src/test/javascript', - `/test`, - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/jest.conf.js`, - `/${SERVER_SRC_DIR}${this.mainClientDir}`, - "", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/jest.conf.js`, - '\\.\\./\\.\\./\\.\\.', - '..', - true - ); - } else if (this.clientFramework === VUE) { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/test/jest.conf.js`, - '/src/test/javascript', - `/test`, - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/test/jest.conf.js`, - `/${SERVER_SRC_DIR}${this.mainClientDir}`, - "", - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/test/jest.conf.js`, - '\\.\\./\\.\\./\\.\\.', - '..', - true - ); - } -} - -function updateEsLinIgnore() { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/.eslintignore`, - 'src/test/javascript', - `/test`, - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/.eslintignore`, - 'target/', - `dist/`, - true - ); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/.eslintignore`, - `${SERVER_SRC_DIR}${this.mainClientDir}`, - "", - true - ); - this.rewriteFile( - `${SERVER_SRC_DIR}${this.mainClientDir}/.eslintignore`, - 'dist/', - 'test/cypress/' - ); - if (this.protractorTests) { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/tsconfig.e2e.json`, - `/${SERVER_SRC_DIR}${this.mainClientDir}`, - "", - true - ); - } -} - -function updateEsLintrcJs() { - if (this.clientFramework === VUE) { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/.eslintrc.js`, - 'target/', - `dist/`, - true - ); - } -} - -function updateTestFramework() { - if (this.protractorTests) { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/test/protractor.conf.js`, - 'http://localhost:8080', - `http://localhost:${this.serverPort}`, - false - ); - } -} - -function updateVendor() { - if (this.clientFramework === ANGULAR || this.clientFramework === VUE) { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientAppDir}/content/scss/vendor.scss`, - `${SERVER_SRC_DIR}${this.mainClientDir}/src/content`, - "..", - true - ); - } -} - -function writeFiles() { - updateWebpackCommonJs.call(this); - updateWebpackDevJs.call(this); - updateWebpackProdJs.call(this); - updateTsConfigJson.call(this); - updateTsConfigSpecJson.call(this); - updatePackageJson.call(this); - updateJestConf.call(this); - updateEsLinIgnore.call(this); - updateEsLintrcJs.call(this); - updateTestFramework.call(this); - updateVendor.call(this); -} - -module.exports = { - writeFiles, -}; diff --git a/generators/client/files-react.js b/generators/client/files-react.js deleted file mode 100644 index c82ab088d..000000000 --- a/generators/client/files-react.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const constants = require('../generator-dotnetcore-constants.cjs'); - -/* Constants use throughout */ -const SERVER_SRC_DIR = constants.SERVER_SRC_DIR; - -function updateHomeTitle() { - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientAppDir}/app/modules/home/home.tsx`, 'Java', '.Net Core', false); -} - -function updateTsConfigTestJson() { - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientDir}/tsconfig.test.json`, `${SERVER_SRC_DIR}${this.mainClientDir}/`, "", true); -} - -function writeFiles() { - updateHomeTitle.call(this); - updateTsConfigTestJson.call(this); -} - -module.exports = { - writeFiles, -}; diff --git a/generators/client/files-xamarin.js b/generators/client/files-xamarin.js deleted file mode 100644 index 1f33fcccd..000000000 --- a/generators/client/files-xamarin.js +++ /dev/null @@ -1,792 +0,0 @@ -/** - * Copyright 2013-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const constants = require('../generator-dotnetcore-constants.cjs'); - -/* Constants use throughout */ -const CLIENT_SRC_DIR = constants.CLIENT_SRC_DIR; -const CLIENT_TEST_DIR = constants.CLIENT_TEST_DIR; - -/** - * The default is to use a file path string. It implies use of the template method. - * For any other config an object { file:.., method:.., template:.. } can be used - */ -const files = { - xamarinAppModels: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Models/RegisterResultRequest.cs', - renameTo: generator => `${generator.mainClientDir}/Models/RegisterResultRequest.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Models/UserSaveModel.cs', - renameTo: generator => `${generator.mainClientDir}/Models/UserSaveModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Models/JwtToken.cs', - renameTo: generator => `${generator.mainClientDir}/Models/JwtToken.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Models/LoginModel.cs', - renameTo: generator => `${generator.mainClientDir}/Models/LoginModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Models/UserModel.cs', - renameTo: generator => `${generator.mainClientDir}/Models/UserModel.cs`, - }, - ], - }, - ], - xamarinAppViews: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/HomeView.xaml.cs', - renameTo: generator => `${generator.mainClientDir}/Views/HomeView.xaml.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/HomeView.xaml', - renameTo: generator => `${generator.mainClientDir}/Views/HomeView.xaml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/LoginView.xaml.cs', - renameTo: generator => `${generator.mainClientDir}/Views/LoginView.xaml.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/LoginView.xaml', - renameTo: generator => `${generator.mainClientDir}/Views/LoginView.xaml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/MenuPage.xaml.cs', - renameTo: generator => `${generator.mainClientDir}/Views/MenuPage.xaml.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/MenuPage.xaml', - renameTo: generator => `${generator.mainClientDir}/Views/MenuPage.xaml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/RegisterView.xaml.cs', - renameTo: generator => `${generator.mainClientDir}/Views/RegisterView.xaml.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/RegisterView.xaml', - renameTo: generator => `${generator.mainClientDir}/Views/RegisterView.xaml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/WelcomeView.xaml.cs', - renameTo: generator => `${generator.mainClientDir}/Views/WelcomeView.xaml.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Views/WelcomeView.xaml', - renameTo: generator => `${generator.mainClientDir}/Views/WelcomeView.xaml`, - }, - ], - } - ], - xamarinAppViewModels: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/ViewModels/BaseViewModel.cs', - renameTo: generator => `${generator.mainClientDir}/ViewModels/BaseViewModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/ViewModels/HomeViewModel.cs', - renameTo: generator => `${generator.mainClientDir}/ViewModels/HomeViewModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/ViewModels/LoginViewModel.cs', - renameTo: generator => `${generator.mainClientDir}/ViewModels/LoginViewModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/ViewModels/MenuViewModel.cs', - renameTo: generator => `${generator.mainClientDir}/ViewModels/MenuViewModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/ViewModels/RegisterViewModel.cs', - renameTo: generator => `${generator.mainClientDir}/ViewModels/RegisterViewModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/ViewModels/WelcomeViewModel.cs', - renameTo: generator => `${generator.mainClientDir}/ViewModels/WelcomeViewModel.cs`, - }, - ], - } - ], - xamarinAppServices: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Services/Configuration.cs', - renameTo: generator => `${generator.mainClientDir}/Services/Configuration.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Services/IAuthenticationService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/IAuthenticationService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Services/AuthenticationService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/AuthenticationService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Services/IAbstractEntityService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/IAbstractEntityService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Services/AbstractEntityService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/AbstractEntityService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Services/IRegisterService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/IRegisterService.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Services/RegisterService.cs', - renameTo: generator => `${generator.mainClientDir}/Services/RegisterService.cs`, - }, - ], - } - ], - xamarinAppResources: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Resources/Strings.Designer.cs', - renameTo: generator => `${generator.mainClientDir}/Resources/Strings.Designer.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Resources/Strings.resx', - renameTo: generator => `${generator.mainClientDir}/Resources/Strings.resx`, - }, - ], - } - ], - xamarinAppBase: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/App.cs', - renameTo: generator => `${generator.mainClientDir}/App.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/AssemblyInfo.cs', - renameTo: generator => `${generator.mainClientDir}/AssemblyInfo.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/FormsApp.xaml.cs', - renameTo: generator => `${generator.mainClientDir}/FormsApp.xaml.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/FormsApp.xaml', - renameTo: generator => `${generator.mainClientDir}/FormsApp.xaml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/LinkerPreserve.cs', - renameTo: generator => `${generator.mainClientDir}/LinkerPreserve.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Core/Project.Client.Xamarin.Core.csproj', - renameTo: generator => `${generator.mainClientDir}/${generator.pascalizedBaseName}.Client.Xamarin.Core.csproj`, - }, - ], - } - ], - xamarinAppShared: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Shared/Constants/ErrorConst.cs', - renameTo: generator => `${generator.sharedClientDir}/Constants/ErrorConst.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Shared/Project.Client.Xamarin.Shared.csproj', - renameTo: generator => `${generator.sharedClientDir}/${generator.pascalizedBaseName}.Client.Xamarin.Shared.csproj`, - }, - ], - } - ], - xamarinAppAndroid: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj', - renameTo: generator => `${generator.androidClientDir}/${generator.pascalizedBaseName}.Client.Xamarin.Android.csproj`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/MainActivity.cs', - renameTo: generator => `${generator.androidClientDir}/MainActivity.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/SplashScreenActivity.cs', - renameTo: generator => `${generator.androidClientDir}/SplashScreenActivity.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.user', - renameTo: generator => `${generator.androidClientDir}/${generator.pascalizedBaseName}.Client.Xamarin.Android.csproj.user`, - }, - ], - } - ], - xamarinAppAndroidResourcesValues: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/values/colors.xml', - renameTo: generator => `${generator.androidClientDir}/Resources/values/colors.xml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/values/styles.xml', - renameTo: generator => `${generator.androidClientDir}/Resources/values/styles.xml`, - }, - ], - } - ], - xamarinAppAndroidResourcesLayout: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/Layout/Tabbar.xml', - renameTo: generator => `${generator.androidClientDir}/Resources/Layout/Tabbar.xml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/Layout/Toolbar.xml', - renameTo: generator => `${generator.androidClientDir}/Resources/Layout/Toolbar.xml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/Layout/SplashScreen.xml', - renameTo: generator => `${generator.androidClientDir}/Resources/Layout/SplashScreen.xml`, - }, - ], - }, - ], - xamarinAppAndroidResourcesImage: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/drawable/splashscreen.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/drawable/splashscreen.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/drawable/menu.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/drawable/menu.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon.xml', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-anydpi-v26/icon.xml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon_round.xml', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-anydpi-v26/icon_round.xml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-hdpi/icon.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-hdpi/icon.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-hdpi/launcher_foreground.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-mdpi/icon.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-mdpi/icon.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-mdpi/launcher_foreground.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/icon.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-xhdpi/icon.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-xhdpi/launcher_foreground.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/icon.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-xxhdpi/icon.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-xxhdpi/launcher_foreground.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/icon.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-xxxhdpi/icon.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png', - method: 'copy', - renameTo: generator => `${generator.androidClientDir}/Resources/mipmap-xxxhdpi/launcher_foreground.png`, - }, - ], - }, - ], - xamarinAppAndroidProperties: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Properties/AndroidManifest.xml', - renameTo: generator => `${generator.androidClientDir}/Properties/AndroidManifest.xml`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.Android/Properties/AssemblyInfo.cs', - renameTo: generator => `${generator.androidClientDir}/Properties/AssemblyInfo.cs`, - }, - ], - } - ], - xamarinAppiOS: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj', - renameTo: generator => `${generator.iOSClientDir}/${generator.pascalizedBaseName}.Client.Xamarin.iOS.csproj`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.user', - renameTo: generator => `${generator.iOSClientDir}/${generator.pascalizedBaseName}.Client.Xamarin.iOS.csproj.user`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Main.cs', - renameTo: generator => `${generator.iOSClientDir}/Main.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Info.plist', - renameTo: generator => `${generator.iOSClientDir}/Info.plist`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Entitlements.plist', - method: 'copy', - renameTo: generator => `${generator.iOSClientDir}/Entitlements.plist`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/AppDelegate.cs', - renameTo: generator => `${generator.iOSClientDir}/AppDelegate.cs`, - }, - ], - } - ], - xamarinAppiOSProperties: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Properties/AssemblyInfo.cs', - renameTo: generator => `${generator.iOSClientDir}/Properties/AssemblyInfo.cs`, - }, - ], - } - ], - xamarinAppiOSResources: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Resources/LaunchScreen.storyboard', - renameTo: generator => `${generator.iOSClientDir}/Resources/LaunchScreen.storyboard`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Resources/Default.png', - method: 'copy', - renameTo: generator => `${generator.iOSClientDir}/Resources/Default.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Resources/Default@2x.png', - method: 'copy', - renameTo: generator => `${generator.iOSClientDir}/Resources/Default@2x.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Resources/Default-568h@2x.png', - method: 'copy', - renameTo: generator => `${generator.iOSClientDir}/Resources/Default.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Resources/Default-Portrait@2x.png', - method: 'copy', - renameTo: generator => `${generator.iOSClientDir}/Resources/Default-Portrait@2x.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Resources/Default-Portrait.png', - method: 'copy', - renameTo: generator => `${generator.iOSClientDir}/Resources/Default-Portrait.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Resources/menu.png', - method: 'copy', - renameTo: generator => `${generator.iOSClientDir}/Resources/menu.png`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client.Xamarin.iOS/Resources/splashscreen.png', - method: 'copy', - renameTo: generator => `${generator.iOSClientDir}/Resources/splashscreen.png`, - }, - ], - }, - ], -}; - -module.exports = { - writeFiles, - files, -}; - -function writeFiles() { - this.writeFilesToDisk(files, this, false, 'xamarin'); -} - diff --git a/generators/client/generator.js b/generators/client/generator.js new file mode 100644 index 000000000..08b33b7ad --- /dev/null +++ b/generators/client/generator.js @@ -0,0 +1,38 @@ +import BaseApplicationGenerator from 'generator-jhipster/generators/base-application'; +import command from './command.js'; +import { BLAZOR, XAMARIN } from '../generator-dotnetcore-constants.js'; + +export default class extends BaseApplicationGenerator { + constructor(args, opts, features) { + super(args, opts, { ...features, sbsBlueprint: true }); + + this.jhipsterContext.command = command; + } + + get [BaseApplicationGenerator.COMPOSING]() { + return this.asComposingTaskGroup({ + async composingTemplateTask() { + if (this.jhipsterConfig.clientFramework === BLAZOR) { + await this.composeWithJHipster('jhipster-dotnetcore:blazor'); + } + if (this.jhipsterConfig.clientFramework === XAMARIN) { + await this.composeWithJHipster('jhipster-dotnetcore:xamarin'); + } + }, + }); + } + + get [BaseApplicationGenerator.POST_WRITING]() { + return this.asPostWritingTaskGroup({ + async postWritingTemplateTask({ application }) { + if (application.clientFramework !== BLAZOR && application.clientRootDir) { + this.packageJson.merge({ + scripts: { + test: `npm test --prefix ${application.clientRootDir}`, + }, + }); + } + }, + }); + } +} diff --git a/generators/client/generator.spec.js b/generators/client/generator.spec.js new file mode 100644 index 000000000..4b455c221 --- /dev/null +++ b/generators/client/generator.spec.js @@ -0,0 +1,26 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'client'; +const BLUEPRINT_NAMESPACE = `jhipster:${SUB_GENERATOR}`; + +describe('SubGenerator client of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(BLUEPRINT_NAMESPACE) + .withJHipsterConfig() + .withOptions({ + ignoreNeedlesError: true, + blueprint: 'dotnetcore', + }) + .withJHipsterLookup() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/client/index.js b/generators/client/index.js index b26a57fb2..3eccd6e86 100644 --- a/generators/client/index.js +++ b/generators/client/index.js @@ -1,234 +1,2 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-disable consistent-return */ -const chalk = require('chalk'); -const ClientGenerator = require('generator-jhipster/generators/client'); -// eslint-disable-next-line import/no-extraneous-dependencies -const constants = require('../generator-dotnetcore-constants.cjs'); -const baseConstants = require('generator-jhipster/generators/generator-constants'); -const basePrompts = require('generator-jhipster/generators/client/prompts'); -const baseWriteAngularFiles = require('generator-jhipster/generators/client/files-angular').writeFiles; -const baseWriteReactFiles = require('generator-jhipster/generators/client/files-react').writeFiles; -const baseWriteVueFiles = require('generator-jhipster/generators/client/files-vue').writeFiles; -const baseWriteCommonFiles = require('generator-jhipster/generators/client/files-common').writeFiles; -const customizeDotnetPaths = require('../utils').customizeDotnetPaths; -const dotnet = require('../dotnet'); -const prompts = require('./prompts'); - -const writeAngularFiles = require('./files-angular').writeFiles; -const writeReactFiles = require('./files-react').writeFiles; -const writeVueFiles = require('./files-vue').writeFiles; -const writeCommonFiles = require('./files-common').writeFiles; -const writeBlazorFiles = require('./files-blazor').writeFiles; -const writeXamarinFiles = require('./files-xamarin').writeFiles; - -const { ANGULAR, REACT, VUE } = baseConstants.SUPPORTED_CLIENT_FRAMEWORKS; -const BLAZOR = constants.BLAZOR; -const XAMARIN = constants.XAMARIN; - -module.exports = class extends ClientGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - - if (this.configOptions.baseName) { - this.baseName = this.configOptions.baseName; - } - } - - get initializing() { - return { - customizeDotnetPaths, - ...super._initializing(), - initializingDotnet () { - this.namespace = this.jhipsterConfig.namespace; - this.clientFramework = this.jhipsterConfig.clientFramework; - } - } - } - - get prompting() { - return { - askForModuleName: basePrompts.askForModuleName, - askForClient: prompts.askForClient, - askFori18n: basePrompts.askForI18n, - askForClientTheme: basePrompts.askForClientTheme, - askForClientThemeVariant: basePrompts.askForClientThemeVariant - }; - } - - get configuring() { - return { - customizeDotnetPaths, - ...super._configuring() - }; - } - - get default() { - return super._default(); - } - - get composing() { - return super._composing(); - } - - get loading() { - return { - ...super._loading(), - loadingDotnet () { - this.serverPort = this.jhipsterConfig.serverPort; - this.serverPortSecured = parseInt(this.serverPort, 10) + 1; - this.withAdminUi = false; - } - } - } - - get preparing() { - return super._preparing(); - } - - get writing() { - // The writing phase is being overriden so that we can write our own templates as well. - // If the templates doesnt need to be overrriden then just return `super._writing()` here - return { - writeFilesDotnetcore() { - if (this.skipClient) return; - switch (this.clientFramework) { - case BLAZOR: - return writeBlazorFiles.call(this); - case XAMARIN: - return writeXamarinFiles.call(this); - case REACT: - baseWriteReactFiles.call(this); - return baseWriteCommonFiles.call(this); - case ANGULAR: - baseWriteAngularFiles.call(this); - return baseWriteCommonFiles.call(this); - case VUE: - baseWriteVueFiles.call(this); - return baseWriteCommonFiles.call(this); - default: - // do nothing by default - } - } - }; - } - - get postWriting() { - return { - postWritingDotnet(){ - if (this.clientFramework === BLAZOR) { - this.skipClient = true; - } - }, - ... super._postWriting(), - postWriteFilesDotnetcore() { - if (this.skipClient) return; - switch (this.clientFramework) { - case REACT: - writeCommonFiles.call(this); - return writeReactFiles.call(this); - case ANGULAR: - writeCommonFiles.call(this); - return writeAngularFiles.call(this); - case VUE: - writeCommonFiles.call(this); - return writeVueFiles.call(this); - default: - // do nothing by default - } - } - } - } - - get install() { - // Override default yeoman installDependencies - const customPhase = { - installDependencies() { - if (this.clientFramework !== BLAZOR && !this.options.skipInstall) { - this.log( - `\n\nI'm all done. Running ${chalk.green.bold( - `npm install ` - )}for you to install the required dependencies. If this fails, try running the command yourself.` - ); - this.spawnCommandSync('npm', ['install'], { cwd: `${constants.SERVER_SRC_DIR}${this.mainClientDir}` }); - } - } - }; - return customPhase; - } - - get end() { - return { - async end() { - if (this.clientFramework === BLAZOR) { - this.log(chalk.green.bold(`\nCreating ${this.solutionName} .Net Core solution if it does not already exist.\n`)); - try { - await dotnet.newSln(this.solutionName); - } catch (err) { - this.warning(`Failed to create ${this.solutionName} .Net Core solution: ${err}`); - } - await dotnet.slnAdd(`${this.solutionName}.sln`, [ - `${constants.CLIENT_SRC_DIR}${this.mainClientDir}/${this.pascalizedBaseName}.Client.csproj`, - `${constants.CLIENT_SRC_DIR}${this.sharedClientDir}/${this.pascalizedBaseName}.Client.Shared.csproj`, - `${constants.CLIENT_TEST_DIR}${this.clientTestProject}/${this.pascalizedBaseName}.Client.Test.csproj`, - ]); - this.log(chalk.green.bold('\Client application generated successfully.\n')); - this.log( - chalk.green( - `Run your blazor application:\n${chalk.yellow.bold( - `dotnet run --verbosity normal --project ./${constants.CLIENT_SRC_DIR}${this.mainClientDir}/${this.pascalizedBaseName}.Client.csproj` - )}` - ) - ); - dotnet.installBlazorDependencies(); - } else if (this.clientFramework === XAMARIN) { - this.log(chalk.green.bold(`\nCreating ${this.solutionName} .Net Core solution if it does not already exist.\n`)); - try { - await dotnet.newSln(this.solutionName); - } catch (err) { - this.warning(`Failed to create ${this.solutionName} .Net Core solution: ${err}`); - } - await dotnet.slnAdd(`${this.solutionName}.sln`, [ - `${constants.CLIENT_SRC_DIR}${this.mainClientDir}/${this.pascalizedBaseName}.Client.Xamarin.Core.csproj`, - `${constants.CLIENT_SRC_DIR}${this.sharedClientDir}/${this.pascalizedBaseName}.Client.Xamarin.Shared.csproj`, - ]); - await dotnet.newSlnAddProj(this.solutionName, [ - { - 'path': `${constants.CLIENT_SRC_DIR}${this.androidClientDir}/${this.pascalizedBaseName}.Client.Xamarin.Android.csproj`, - 'name' : `${this.pascalizedBaseName}.Client.Xamarin.Android` - }, - { - 'path': `${constants.CLIENT_SRC_DIR}${this.iOSClientDir}/${this.pascalizedBaseName}.Client.Xamarin.iOS.csproj`, - 'name' : `${this.pascalizedBaseName}.Client.Xamarin.iOS` - } - ]); - this.log(chalk.green.bold('\Client application generated successfully.\n')); - - } else { - if (this.skipClient) return; - this.log(chalk.green.bold('\nClient application generated successfully.\n')); - - if (!this.options.skipInstall) { - this.spawnCommandSync('npm', ['--prefix', `${constants.SERVER_SRC_DIR}${this.mainClientDir}`, 'run', 'cleanup']); - } - } - }, - } - } -}; +export { default } from './generator.js'; +export { default as command } from './command.js'; diff --git a/generators/client/needle-api/needle-client-blazor.js b/generators/client/needle-api/needle-client-blazor.js deleted file mode 100644 index e74e3d7e4..000000000 --- a/generators/client/needle-api/needle-client-blazor.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const needleBase = require('generator-jhipster/generators/needle-base'); -const chalk = require('chalk'); -const _ = require('lodash'); - -module.exports = class extends needleBase { - constructor(generator) { - super(generator); - - this.mainClientDir = generator.mainClientDir; - - if (!this.mainClientDir) { - generator.error('Client destination folder is missing'); - } - } - - addEntityToMenu(entityName) { - const lowerCasedEntityName = _.toLower(entityName); - const errorMessage = `${chalk.yellow('Reference to ') + entityName} ${chalk.yellow('not added to menu.\n')}`; - const entityMenuPath = `src/${this.mainClientDir}/Shared/NavMenu.razor`; - const entityEntry = - // prettier-ignore - this.generator.stripMargin( - `| - | - | ${entityName} - | `); - const rewriteFileModel = this.generateFileModel(entityMenuPath, 'jhipster-needle-add-entity-to-menu', entityEntry); - - this.addBlockContentToFile(rewriteFileModel, errorMessage); - } - - addServiceInDI(entityName) { - const errorMessage = `${chalk.yellow('Reference to ') + entityName} ${chalk.yellow('not added to Program.\n')}`; - const programPath = `src/${this.mainClientDir}/Program.cs`; - const serviceEntry = - // prettier-ignore - this.generator.stripMargin(`|builder.Services.AddScoped();`); - const rewriteFileModel = this.generateFileModel(programPath, 'jhipster-needle-add-services-in-di', serviceEntry); - - this.addBlockContentToFile(rewriteFileModel, errorMessage); - } - - addUsingForService(namespace,entityName) { - const errorMessage = `${chalk.yellow('Reference to ') + entityName} ${chalk.yellow('not added to Program.\n')}`; - const programPath = `src/${this.mainClientDir}/Program.cs`; - const usingEntry = - // prettier-ignore - this.generator.stripMargin(`|using ${namespace}.Client.Services.EntityServices.${entityName};`); - const rewriteFileModel = this.generateFileModel(programPath, 'jhipster-needle-add-using-for-services', usingEntry); - - this.addBlockContentToFile(rewriteFileModel, errorMessage); - } - - addDtoMapping(entityName) { - const errorMessage = `${chalk.yellow('Reference to ') + entityName} ${chalk.yellow('not added to AutoMapper.\n')}`; - const autoMapperProfilePath = `src/${this.mainClientDir}/AutoMapper/AutoMapperProfile.cs`; - const mappingEntry = - // prettier-ignore - this.generator.stripMargin(`|CreateMap<${entityName}Model, ${entityName}Dto>().ReverseMap();`); - const rewriteFileModel = this.generateFileModel(autoMapperProfilePath, 'jhipster-needle-add-dto-model-mapping', mappingEntry); - - this.addBlockContentToFile(rewriteFileModel, errorMessage); - } -}; diff --git a/generators/client/needle-api/needle-client-xamarin.js b/generators/client/needle-api/needle-client-xamarin.js deleted file mode 100644 index 49af8a1fc..000000000 --- a/generators/client/needle-api/needle-client-xamarin.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright 2013-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const needleBase = require('generator-jhipster/generators/needle-base'); -const chalk = require('chalk'); -const _ = require('lodash'); - -module.exports = class extends needleBase { - constructor(generator) { - super(generator); - - this.mainClientDir = generator.mainClientDir; - - if (!this.mainClientDir) { - generator.error('Client destination folder is missing'); - } - } - - addEntityToMenu(entityName) { - const errorMessage = `${chalk.yellow('Reference to ') + entityName} ${chalk.yellow('not added to menu.\n')}`; - const entityMenuPath = `src/${this.mainClientDir}/Views/MenuPage.xaml`; - const entityEntry = - // prettier-ignore - this.generator.stripMargin( - `| - | - |`); - - const rewriteFileModel = this.generateFileModel(entityMenuPath, 'jhipster-needle-add-entity-to-menu', entityEntry); - - this.addBlockContentToFile(rewriteFileModel, errorMessage); - } - - declareCommandToMenu(entityName) { - const errorMessage = `${chalk.yellow('Reference to ') + entityName} ${chalk.yellow('not added to menu.\n')}`; - const entityMenuPath = `src/${this.mainClientDir}/ViewModels/MenuViewModel.cs`; - const entityEntry = - // prettier-ignore - this.generator.stripMargin( - `|public IMvxCommand Show${entityName}Command => new MvxAsyncCommand(${entityName}CommandClicked);`); - - const rewriteFileModel = this.generateFileModel(entityMenuPath, 'jhipster-needle-declare-entity-command', entityEntry); - - this.addBlockContentToFile(rewriteFileModel, errorMessage); - } - - addCommandToMenu(entityName) { - const errorMessage = `${chalk.yellow('Reference to ') + entityName} ${chalk.yellow('not added to menu.\n')}`; - const entityMenuPath = `src/${this.mainClientDir}/ViewModels/MenuViewModel.cs`; - const entityEntry = - // prettier-ignore - this.generator.stripMargin( - `|private async Task ${entityName}CommandClicked() - | { - | await _navigationService.Navigate<${entityName}ViewModel>(); - | } - `); - - const rewriteFileModel = this.generateFileModel(entityMenuPath, 'jhipster-needle-add-entity-command', entityEntry); - - this.addBlockContentToFile(rewriteFileModel, errorMessage); - } - - addServiceInDI(entityName) { - const lowerEntityName = _.toLower(entityName); - const errorMessage = `${chalk.yellow('Reference to ') + entityName} ${chalk.yellow('not added to Program.\n')}`; - const programPath = `src/${this.mainClientDir}/App.cs`; - const serviceEntry = - // prettier-ignore - this.generator.stripMargin( - `|var ${lowerEntityName}Service = new ${entityName}Service(httpClient); - | Mvx.IoCProvider.RegisterSingleton(${lowerEntityName}Service);`); - - const rewriteFileModel = this.generateFileModel(programPath, 'jhipster-needle-add-services-in-di', serviceEntry); - - this.addBlockContentToFile(rewriteFileModel, errorMessage); - } -}; \ No newline at end of file diff --git a/generators/client/prompts.js b/generators/client/prompts.js deleted file mode 100644 index c05dc088f..000000000 --- a/generators/client/prompts.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const chalk = require('chalk'); -const baseConstants = require('generator-jhipster/generators/generator-constants'); -const constants = require('../generator-dotnetcore-constants.cjs'); - -const { ANGULAR, REACT, VUE } = baseConstants.SUPPORTED_CLIENT_FRAMEWORKS; -const BLAZOR = constants.BLAZOR; -const XAMARIN = constants.XAMARIN; - -module.exports = { - askForClient, -}; - -function askForClient() { - if (this.existingProject) return; - - const choices = [ - { - value: ANGULAR, - name: 'Angular', - }, - { - value: REACT, - name: 'React', - }, - { - value: VUE, - name: 'Vue', - }, - { - value: BLAZOR, - name: '[Alpha] - Blazor (WebAssembly)', - }, - { - value: 'no', - name: 'No client', - }, - ]; - - if (this.configOptions.isDebugEnabled) { - choices.push( - { - value: XAMARIN, - name: '[Alpha] - Xamarin', - }, - ) - } - - const PROMPT = { - type: 'list', - name: 'clientFramework', - message: `Which ${chalk.yellow('*Framework*')} would you like to use for the client?`, - choices, - default: ANGULAR, - }; - const done = this.async(); - - this.prompt(PROMPT).then(prompt => { - this.clientFramework = this.jhipsterConfig.clientFramework = prompt.clientFramework; - if (this.clientFramework === 'no') { - this.skipClient = true; - } - done(); - }); -} diff --git a/generators/common/__snapshots__/generator.spec.js.snap b/generators/common/__snapshots__/generator.spec.js.snap new file mode 100644 index 000000000..951aebfe2 --- /dev/null +++ b/generators/common/__snapshots__/generator.spec.js.snap @@ -0,0 +1,51 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SubGenerator common of dotnetcore JHipster blueprint > run > should succeed 1`] = ` +{ + ".devcontainer/devcontainer.json": { + "stateCleared": "modified", + }, + ".dockerignore": { + "stateCleared": "modified", + }, + ".editorconfig": { + "stateCleared": "modified", + }, + ".gitattributes": { + "stateCleared": "modified", + }, + ".gitignore": { + "stateCleared": "modified", + }, + ".husky/pre-commit": { + "stateCleared": "modified", + }, + ".lintstagedrc.js": { + "stateCleared": "modified", + }, + ".prettierignore": { + "stateCleared": "modified", + }, + ".prettierrc": { + "stateCleared": "modified", + }, + ".yo-rc.json": { + "stateCleared": "modified", + }, + "Dockerfile-Back": { + "stateCleared": "modified", + }, + "README.md": { + "stateCleared": "modified", + }, + "docker-entrypoint-back.sh": { + "stateCleared": "modified", + }, + "package.json": { + "stateCleared": "modified", + }, + "sonar-project.properties": { + "stateCleared": "modified", + }, +} +`; diff --git a/generators/common/files.js b/generators/common/files.js index 9e5a4f3b2..2924804b1 100644 --- a/generators/common/files.js +++ b/generators/common/files.js @@ -16,67 +16,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -const constants = require('../generator-dotnetcore-constants.cjs'); +import { BLAZOR } from '../generator-dotnetcore-constants.js'; -const files = { - docker: [ - { - templates: [{ file: 'Dockerfile-Back', renameTo: () => 'Dockerfile-Back' }], - }, - { - templates: [{ file: 'docker-entrypoint-back.sh', renameTo: () => 'docker-entrypoint-back.sh' }], - }, - { - condition: generator => generator.clientFramework === constants.BLAZOR, - templates: [{ file: 'Dockerfile-Front', renameTo: () => 'Dockerfile-Front' }], - }, - { - condition: generator => generator.clientFramework === constants.BLAZOR, - templates: [{ file: 'docker-entrypoint-front.sh', renameTo: () => 'docker-entrypoint-front.sh' }], - }, - { - condition: generator => generator.clientFramework === constants.BLAZOR, - templates: [{ file: 'nginx.conf', renameTo: () => 'nginx.conf' }], - }, - { - condition: generator => generator.clientFramework === constants.BLAZOR, - templates: [{ file: 'default.conf', renameTo: () => 'default.conf' }], - }, - { - templates: [{ file: 'dockerignore', renameTo: () => '.dockerignore', method: 'copy' }], - }, - ], - general: [ - { - templates: [{ file: 'README.md' }], - }, - { - templates: [ - { file: 'gitignore', renameTo: () => '.gitignore', method: 'copy' }, - { file: 'editorconfig', renameTo: () => '.editorconfig', method: 'copy' }, - ], - }, - ], -}; - -const jhipsterCommonFiles = { - global: [ - { - templates: [{ file: 'gitattributes', renameTo: () => '.gitattributes', method: 'copy' }], - }, - ], -}; - -function writeFiles() { - return { - writeFiles() { - this.writeFilesToDisk(files, this, false, 'dotnetcore'); - }, - }; -} - -module.exports = { - writeFiles, - files, - jhipsterCommonFiles, +export const files = { + general: [ + { + templates: ['.gitignore.jhi.dotnetcore-common', '.devcontainer/devcontainer.json'], + }, + ], + docker: [ + { + templates: ['Dockerfile-Back', 'docker-entrypoint-back.sh', '.dockerignore'], + }, + { + condition: generator => generator.clientFramework === BLAZOR, + templates: ['Dockerfile-Front', 'docker-entrypoint-front.sh', 'nginx.conf', 'default.conf'], + }, + ], }; diff --git a/generators/common/generator.js b/generators/common/generator.js new file mode 100644 index 000000000..ee4b15d2f --- /dev/null +++ b/generators/common/generator.js @@ -0,0 +1,23 @@ +import BaseApplicationGenerator from 'generator-jhipster/generators/base-application'; +import { files } from './files.js'; + +export default class extends BaseApplicationGenerator { + constructor(args, opts, features) { + super(args, opts, { ...features, sbsBlueprint: true }); + } + + async beforeQueue() { + await this.dependsOnJHipster('jhipster-dotnetcore:bootstrap-dotnetcore'); + } + + get [BaseApplicationGenerator.WRITING]() { + return this.asWritingTaskGroup({ + async writingDotNetFiles({ application }) { + await this.writeFiles({ + sections: files, + context: application, + }); + }, + }); + } +} diff --git a/generators/common/generator.spec.js b/generators/common/generator.spec.js new file mode 100644 index 000000000..cdae86f0e --- /dev/null +++ b/generators/common/generator.spec.js @@ -0,0 +1,26 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'common'; +const BLUEPRINT_NAMESPACE = `jhipster:${SUB_GENERATOR}`; + +describe('SubGenerator common of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(BLUEPRINT_NAMESPACE) + .withJHipsterConfig() + .withOptions({ + ignoreNeedlesError: true, + blueprint: 'dotnetcore', + }) + .withJHipsterLookup() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/common/index.js b/generators/common/index.js index 3cc668c9c..01e9dc34d 100644 --- a/generators/common/index.js +++ b/generators/common/index.js @@ -1,90 +1 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const chalk = require('chalk'); -const _ = require('lodash'); -const toPascalCase = require('to-pascal-case'); -const CommonGenerator = require('generator-jhipster/generators/common'); -const packagejs = require('../../package.json'); -// eslint-disable-next-line import/no-extraneous-dependencies,import/order -const writeFiles = require('./files').writeFiles; -const jhipsterCommonFiles = require('./files').jhipsterCommonFiles; - -module.exports = class extends CommonGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - - const jhContext = (this.jhipsterContext = this.options.jhipsterContext); - - if (!jhContext) { - this.error(`This is a JHipster blueprint and should be used only like ${chalk.yellow('jhipster --blueprint dotnetcore')}`); - } - - if (this.configOptions.baseName) { - this.baseName = this.configOptions.baseName; - } - } - - get initializing() { - return { - ...super._initializing(), - configureGlobal() { - this.kebabCasedBaseName = _.kebabCase(this.baseName); - this.pascalizedBaseName = toPascalCase(this.baseName); - this.mainProjectDir = this.pascalizedBaseName; - this.mainClientDir = `${this.mainProjectDir}/ClientApp`; - this.jhipsterDotnetVersion = packagejs.version; - this.options.outputPathCustomizer = [ - paths => (paths ? paths.replace(/^(\.prettierignore)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(\.prettierrc)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(package.json)$/, `src/${this.mainClientDir}/$1`) : paths), - ]; - }, - }; - } - - get configuring() { - return super._configuring(); - } - - get composing() { - return super._composing(); - } - - get loading() { - return super._loading(); - } - - get preparing() { - return super._preparing(); - } - - get default() { - return {}; - } - - get writing() { - return { - writeJhipsterCommonFile() { - // Prettier configuration needs to be the first written files - all subgenerators considered - for prettier transform to work - return this.writeFilesToDisk(jhipsterCommonFiles); - }, - ...writeFiles(), - }; - } -}; +export { default } from './generator.js'; diff --git a/generators/common/templates/.devcontainer/devcontainer.json.ejs b/generators/common/templates/.devcontainer/devcontainer.json.ejs new file mode 100644 index 000000000..b9bc771a0 --- /dev/null +++ b/generators/common/templates/.devcontainer/devcontainer.json.ejs @@ -0,0 +1,34 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet +{ + "name": "C# (.NET)", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/dotnet:0-7.0", + "features": { + "ghcr.io/devcontainers/features/node:1": {} + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [5000, 5001], + // "portsAttributes": { + // "5001": { + // "protocol": "https" + // } + // } + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "dotnet restore", + + // Configure tool-specific properties. + // "customizations": {}, + + // "remoteUser": "root", + // "mounts": [ + // "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", + // "source=${localWorkspaceFolderBasename}-client-node_modules,target=${containerWorkspaceFolder}/src/<%- mainClientDir %>/node_modules,type=volume", + // ], + // "postCreateCommand": "sudo chown node node_modules", +} diff --git a/generators/common/templates/dotnetcore/dockerignore.ejs b/generators/common/templates/.dockerignore.ejs similarity index 100% rename from generators/common/templates/dotnetcore/dockerignore.ejs rename to generators/common/templates/.dockerignore.ejs diff --git a/generators/common/templates/dotnetcore/editorconfig.ejs b/generators/common/templates/.editorconfig.ejs similarity index 100% rename from generators/common/templates/dotnetcore/editorconfig.ejs rename to generators/common/templates/.editorconfig.ejs diff --git a/generators/common/templates/dotnetcore/gitignore.ejs b/generators/common/templates/.gitignore.jhi.dotnetcore-common.ejs similarity index 85% rename from generators/common/templates/dotnetcore/gitignore.ejs rename to generators/common/templates/.gitignore.jhi.dotnetcore-common.ejs index 4b651dbe6..75a3afaeb 100644 --- a/generators/common/templates/dotnetcore/gitignore.ejs +++ b/generators/common/templates/.gitignore.jhi.dotnetcore-common.ejs @@ -1,3 +1,23 @@ +<%# + Copyright 2013-2023 the original author or authors from the JHipster project. + + This file is part of the JHipster project, see https://www.jhipster.tech/ + for more information. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +-%> +<&_ if (!fragment.section) { -&> +# Generated by jhipster-dotnetcore:common # Local .terraform directories **/.terraform/* *.lock.* @@ -317,3 +337,4 @@ _Pvt_Extensions #IntelliJ .idea/ **/ClientApp/target/ +<&_ } -&> diff --git a/generators/common/templates/dotnetcore/Dockerfile-Back.ejs b/generators/common/templates/Dockerfile-Back.ejs similarity index 97% rename from generators/common/templates/dotnetcore/Dockerfile-Back.ejs rename to generators/common/templates/Dockerfile-Back.ejs index 437b7d141..ef113abe5 100644 --- a/generators/common/templates/dotnetcore/Dockerfile-Back.ejs +++ b/generators/common/templates/Dockerfile-Back.ejs @@ -38,7 +38,7 @@ RUN for file in $(ls src/*.csproj); do mkdir -p ${file%.*} && mv $file ${file%.* COPY src/client/*/*.csproj ./src/client/ RUN for file in $(ls src/client/*.csproj); do mkdir -p ${file%.*} && mv $file ${file%.*}; done <%_ } _%> -RUN dotnet restore "src/<%= mainProjectDir %>/<%= pascalizedBaseName %>.csproj" +RUN dotnet restore "src/<%= mainProjectDir %><%= pascalizedBaseName %>.csproj" # Copy everything else and build app COPY . ./ diff --git a/generators/common/templates/dotnetcore/Dockerfile-Front.ejs b/generators/common/templates/Dockerfile-Front.ejs similarity index 100% rename from generators/common/templates/dotnetcore/Dockerfile-Front.ejs rename to generators/common/templates/Dockerfile-Front.ejs diff --git a/generators/common/templates/dotnetcore/default.conf.ejs b/generators/common/templates/default.conf.ejs similarity index 100% rename from generators/common/templates/dotnetcore/default.conf.ejs rename to generators/common/templates/default.conf.ejs diff --git a/generators/common/templates/dotnetcore/docker-entrypoint-back.sh.ejs b/generators/common/templates/docker-entrypoint-back.sh.ejs similarity index 100% rename from generators/common/templates/dotnetcore/docker-entrypoint-back.sh.ejs rename to generators/common/templates/docker-entrypoint-back.sh.ejs diff --git a/generators/common/templates/dotnetcore/docker-entrypoint-front.sh.ejs b/generators/common/templates/docker-entrypoint-front.sh.ejs similarity index 100% rename from generators/common/templates/dotnetcore/docker-entrypoint-front.sh.ejs rename to generators/common/templates/docker-entrypoint-front.sh.ejs diff --git a/generators/common/templates/dotnetcore/nginx.conf.ejs b/generators/common/templates/nginx.conf.ejs similarity index 100% rename from generators/common/templates/dotnetcore/nginx.conf.ejs rename to generators/common/templates/nginx.conf.ejs diff --git a/generators/cypress/__snapshots__/generator.spec.js.snap b/generators/cypress/__snapshots__/generator.spec.js.snap new file mode 100644 index 000000000..5830ddb5d --- /dev/null +++ b/generators/cypress/__snapshots__/generator.spec.js.snap @@ -0,0 +1,69 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SubGenerator cypress of dotnetcore JHipster blueprint > run > should succeed 1`] = ` +{ + ".yo-rc.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/cypress-audits.config.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/cypress.config.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/package.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/.eslintrc.json": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/e2e/account/login-page.cy.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/e2e/account/password-page.cy.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/e2e/account/register-page.cy.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/e2e/account/reset-password-page.cy.ts": { + "state": "deleted", + }, + "src/Jhipster/ClientApp/test/cypress/e2e/account/settings-page.cy.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/e2e/administration/administration.cy.ts": { + "state": "deleted", + }, + "src/Jhipster/ClientApp/test/cypress/e2e/lighthouse.audits.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/fixtures/integration-test.png": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/plugins/index.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/support/account.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/support/commands.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/support/entity.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/support/index.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/support/management.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/support/navbar.ts": { + "stateCleared": "modified", + }, + "src/Jhipster/ClientApp/test/cypress/tsconfig.json": { + "stateCleared": "modified", + }, +} +`; diff --git a/generators/cypress/files-cypress.js b/generators/cypress/files-cypress.js deleted file mode 100644 index 165986b61..000000000 --- a/generators/cypress/files-cypress.js +++ /dev/null @@ -1,33 +0,0 @@ -const constants = require('../generator-dotnetcore-constants.cjs'); - -const SERVER_SRC_DIR = constants.SERVER_SRC_DIR; - -function removeNotImplementedFeatureInCypress() { - this.fs.delete(`${SERVER_SRC_DIR}${this.clientTestProject}/cypress/integration/account/reset-password-page.spec.ts`); - this.fs.delete(`${SERVER_SRC_DIR}${this.clientTestProject}/cypress/integration/administration/administration.spec.ts`); -} - -function updateTsConfigCypress() { - this.replaceContent(`${SERVER_SRC_DIR}${this.clientTestProject}/cypress/tsconfig.json`, './../../../../', './../../', true); -} - -function updateCypressJson() { - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientDir}/cypress.json`, `${SERVER_SRC_DIR}${this.mainClientDir}/`, '', true); - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/cypress.json`, - `http://localhost:${this.serverPort}`, - `https://localhost:${this.serverPortSecured}`, - true - ); - this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientDir}/cypress.json`, 'target', 'dist', true); -} - -function writeFiles() { - removeNotImplementedFeatureInCypress.call(this); - updateTsConfigCypress.call(this); - updateCypressJson.call(this); -} - -module.exports = { - writeFiles, -}; diff --git a/generators/cypress/generator.js b/generators/cypress/generator.js new file mode 100644 index 000000000..0fc0c5c17 --- /dev/null +++ b/generators/cypress/generator.js @@ -0,0 +1,33 @@ +import BaseApplicationGenerator from 'generator-jhipster/generators/base-application'; + +export default class extends BaseApplicationGenerator { + constructor(args, opts, features) { + super(args, opts, { ...features, sbsBlueprint: true }); + } + + async beforeQueue() { + await this.dependsOnJHipster('jhipster-dotnetcore:bootstrap-dotnetcore'); + } + + get [BaseApplicationGenerator.POST_WRITING]() { + return this.asPostWritingTaskGroup({ + removeNotImplementedFeatureInCypress({ application }) { + this.deleteDestination(`${application.cypressDir}e2e/account/reset-password-page.cy.ts`); + this.deleteDestination(`${application.cypressDir}e2e/administration/administration.cy.ts`); + + this.editFile(`${application.cypressDir}e2e/account/settings-page.cy.ts`, content => + content + .replace( + `it("should not be able to change 'user' email to same value"`, + `it.skip("should not be able to change 'user' email to same value"`, + ) + .replace( + `it("should be able to change 'user' lastname settings"`, + `it.skip("should be able to change 'user' lastname settings"`, + ) + .replace(`it("should be able to change 'user' email settings"`, `it.skip("should be able to change 'user' email settings"`), + ); + }, + }); + } +} diff --git a/generators/cypress/generator.spec.js b/generators/cypress/generator.spec.js new file mode 100644 index 000000000..af21bc0ad --- /dev/null +++ b/generators/cypress/generator.spec.js @@ -0,0 +1,26 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'cypress'; +const BLUEPRINT_NAMESPACE = `jhipster:${SUB_GENERATOR}`; + +describe('SubGenerator cypress of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(BLUEPRINT_NAMESPACE) + .withJHipsterConfig() + .withOptions({ + ignoreNeedlesError: true, + blueprint: 'dotnetcore', + }) + .withJHipsterLookup() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/cypress/index.js b/generators/cypress/index.js index dce905b89..01e9dc34d 100644 --- a/generators/cypress/index.js +++ b/generators/cypress/index.js @@ -1,66 +1 @@ -const chalk = require('chalk'); -const CypressGenerator = require('generator-jhipster/generators/cypress'); -const writeCypressFiles = require('./files-cypress').writeFiles; -const customizeDotnetPaths = require('../utils').customizeDotnetPaths; - -module.exports = class extends CypressGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - - const jhContext = (this.jhipsterContext = this.options.jhipsterContext); - - if (!jhContext) { - this.error(`This is a JHipster blueprint and should be used only like ${chalk.yellow('jhipster --blueprint dotnetcore')}`); - } - - if (this.configOptions.baseName) { - this.baseName = this.configOptions.baseName; - } - } - - get initializing() { - return super._initializing(); - } - - get configuring() { - return { - customizeDotnetPaths, - ...super._configuring(), - }; - } - - get composing() { - return super._composing(); - } - - get loading() { - return { - ...super._loading(), - loadingDotnet() { - this.serverPort = this.jhipsterConfig.serverPort; - this.serverPortSecured = parseInt(this.serverPort, 10) + 1; - }, - }; - } - - get preparing() { - return super._preparing(); - } - - get default() { - return super._default(); - } - - get writing() { - return super._writing(); - } - - get postWriting() { - return { - ...super._postWriting(), - postWriteFilesDotnetcore() { - return writeCypressFiles.call(this); - }, - }; - } -}; +export { default } from './generator.js'; diff --git a/generators/docker/__snapshots__/generator.spec.js.snap b/generators/docker/__snapshots__/generator.spec.js.snap new file mode 100644 index 000000000..b1af9e787 --- /dev/null +++ b/generators/docker/__snapshots__/generator.spec.js.snap @@ -0,0 +1,48 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SubGenerator docker of dotnetcore JHipster blueprint > run > should succeed 1`] = ` +{ + ".yo-rc.json": { + "stateCleared": "modified", + }, + "SonarAnalysis.ps1": { + "stateCleared": "modified", + }, + "SonarQube.Analysis.xml": { + "stateCleared": "modified", + }, + "docker/app.yml": { + "stateCleared": "modified", + }, + "docker/grafana/data/dashboard/Docker Monitoring.json": { + "stateCleared": "modified", + }, + "docker/grafana/data/dashboard/default-dashboard.yaml": { + "stateCleared": "modified", + }, + "docker/grafana/data/provisioning/influxdb.yml": { + "stateCleared": "modified", + }, + "docker/influxdb/config/influxdb.conf": { + "stateCleared": "modified", + }, + "docker/kapacitor/config/kapacitor.conf": { + "stateCleared": "modified", + }, + "docker/monitoring.yml": { + "stateCleared": "modified", + }, + "docker/prometheus/prometheus.yml": { + "stateCleared": "modified", + }, + "docker/sonar.yml": { + "stateCleared": "modified", + }, + "docker/telegraf/telegraf.conf": { + "stateCleared": "modified", + }, + "package.json": { + "stateCleared": "modified", + }, +} +`; diff --git a/generators/docker/command.js b/generators/docker/command.js new file mode 100644 index 000000000..b5a045029 --- /dev/null +++ b/generators/docker/command.js @@ -0,0 +1,8 @@ +/** + * @type {import('generator-jhipster').JHipsterCommandDefinition} + */ +const command = { + options: {}, +}; + +export default command; diff --git a/generators/generator-dotnetcore-constants.mjs b/generators/docker/files.js similarity index 55% rename from generators/generator-dotnetcore-constants.mjs rename to generators/docker/files.js index e6efa35b4..9039d58c1 100644 --- a/generators/generator-dotnetcore-constants.mjs +++ b/generators/docker/files.js @@ -16,25 +16,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { DOCKER_DIR } from '../generator-dotnetcore-constants.js'; -export { - SERVER_SRC_DIR, - CLIENT_SRC_DIR, - CLIENT_TEST_DIR, - SERVER_TEST_DIR, - PROJECT_DTO_SUFFIX, - PROJECT_DOMAIN_SUFFIX, - PROJECT_APPLICATION_SUFFIX, - PROJECT_TEST_SUFFIX, - DOCKER_DIR, - PROJECT_CROSSCUTTING_SUFFIX, - PROJECT_INFRASTRUCTURE_SUFFIX, - PROJECT_SERVICE_SUFFIX, - BLAZOR, - XAMARIN, - TERRAFORM_DIR, - NODE_VERSION, - NPM_VERSION, - GITHUB, - GITLAB -} from "./generator-dotnetcore-constants.cjs"; +export const dockerFiles = { + sonar: [ + { + templates: ['SonarAnalysis.ps1', 'SonarQube.Analysis.xml'], + }, + ], + docker: [ + { + path: DOCKER_DIR, + templates: [ + 'app.yml', + 'monitoring.yml', + 'telegraf/telegraf.conf', + 'kapacitor/config/kapacitor.conf', + 'influxdb/config/influxdb.conf', + 'grafana/data/dashboard/default-dashboard.yaml', + 'grafana/data/dashboard/Docker Monitoring.json', + 'grafana/data/provisioning/influxdb.yml', + ], + }, + ], +}; diff --git a/generators/docker/generator.js b/generators/docker/generator.js new file mode 100644 index 000000000..3ba772dd4 --- /dev/null +++ b/generators/docker/generator.js @@ -0,0 +1,33 @@ +import DockerGenerator from 'generator-jhipster/generators/docker'; +import command from './command.js'; +import { dockerFiles } from './files.js'; + +export default class extends DockerGenerator { + constructor(args, opts, features) { + super(args, opts, { ...features, sbsBlueprint: true }); + } + + async beforeQueue() { + await this.dependsOnJHipster('jhipster-dotnetcore:bootstrap-dotnetcore'); + } + + get [DockerGenerator.INITIALIZING]() { + return this.asInitializingTaskGroup({ + async initializingTemplateTask() { + this.parseJHipsterArguments(command.arguments); + this.parseJHipsterOptions(command.options); + }, + }); + } + + get [DockerGenerator.WRITING]() { + return this.asWritingTaskGroup({ + async writingTemplateTask({ application }) { + await this.writeFiles({ + sections: dockerFiles, + context: application, + }); + }, + }); + } +} diff --git a/generators/docker/generator.spec.js b/generators/docker/generator.spec.js new file mode 100644 index 000000000..e6f65bbc3 --- /dev/null +++ b/generators/docker/generator.spec.js @@ -0,0 +1,26 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'docker'; +const BLUEPRINT_NAMESPACE = `jhipster:${SUB_GENERATOR}`; + +describe('SubGenerator docker of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(BLUEPRINT_NAMESPACE) + .withJHipsterConfig() + .withOptions({ + ignoreNeedlesError: true, + blueprint: 'dotnetcore', + }) + .withJHipsterLookup() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/docker/index.js b/generators/docker/index.js new file mode 100644 index 000000000..3eccd6e86 --- /dev/null +++ b/generators/docker/index.js @@ -0,0 +1,2 @@ +export { default } from './generator.js'; +export { default as command } from './command.js'; diff --git a/generators/server/templates/dotnetcore/SonarAnalysis.ps1.ejs b/generators/docker/templates/SonarAnalysis.ps1.ejs similarity index 100% rename from generators/server/templates/dotnetcore/SonarAnalysis.ps1.ejs rename to generators/docker/templates/SonarAnalysis.ps1.ejs diff --git a/generators/server/templates/dotnetcore/SonarQube.Analysis.xml.ejs b/generators/docker/templates/SonarQube.Analysis.xml.ejs similarity index 100% rename from generators/server/templates/dotnetcore/SonarQube.Analysis.xml.ejs rename to generators/docker/templates/SonarQube.Analysis.xml.ejs diff --git a/generators/docker/templates/docker/app.yml.ejs b/generators/docker/templates/docker/app.yml.ejs new file mode 100644 index 000000000..806265e62 --- /dev/null +++ b/generators/docker/templates/docker/app.yml.ejs @@ -0,0 +1,46 @@ +<%# + Copyright 2013-2023 the original author or authors from the JHipster project. + + This file is part of the JHipster project, see https://www.jhipster.tech/ + for more information. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +-%> +# This configuration is intended for development purpose, it's **your** responsibility to harden it for production +name: <%= baseName.toLowerCase() %> +services: + app: + build: + context: ../ + dockerfile: Dockerfile-Back +<%_ if (applicationTypeMonolith || applicationTypeGateway) { _%> + # If you want to expose these ports outside your dev PC, + # remove the "127.0.0.1:" prefix + ports: + - 127.0.0.1:<%= serverPort %>:80 +<%_ } _%> + # healthcheck: + # test: ['CMD', 'curl', '-f', 'http://127.0.0.1:80/health'] + # interval: 5s + # timeout: 5s + # retries: 40 +<%_ if (!skipClient && clientFramework === "Blazor") { _%> + front: + build: + context: ../ + dockerfile: Dockerfile-Front + ports: + - 8081:80 + environment: + - ServerUrl=http://localhost:8080 +<%_ } _%> diff --git a/generators/server/templates/dotnetcore/docker/grafana/data/dashboard/Docker Monitoring.json.ejs b/generators/docker/templates/docker/grafana/data/dashboard/Docker Monitoring.json.ejs similarity index 100% rename from generators/server/templates/dotnetcore/docker/grafana/data/dashboard/Docker Monitoring.json.ejs rename to generators/docker/templates/docker/grafana/data/dashboard/Docker Monitoring.json.ejs diff --git a/generators/server/templates/dotnetcore/docker/grafana/data/dashboard/default-dashboard.yaml.ejs b/generators/docker/templates/docker/grafana/data/dashboard/default-dashboard.yaml.ejs similarity index 100% rename from generators/server/templates/dotnetcore/docker/grafana/data/dashboard/default-dashboard.yaml.ejs rename to generators/docker/templates/docker/grafana/data/dashboard/default-dashboard.yaml.ejs diff --git a/generators/server/templates/dotnetcore/docker/grafana/data/provisioning/influxdb.yml.ejs b/generators/docker/templates/docker/grafana/data/provisioning/influxdb.yml.ejs similarity index 100% rename from generators/server/templates/dotnetcore/docker/grafana/data/provisioning/influxdb.yml.ejs rename to generators/docker/templates/docker/grafana/data/provisioning/influxdb.yml.ejs diff --git a/generators/server/templates/dotnetcore/docker/influxdb/config/influxdb.conf.ejs b/generators/docker/templates/docker/influxdb/config/influxdb.conf.ejs similarity index 100% rename from generators/server/templates/dotnetcore/docker/influxdb/config/influxdb.conf.ejs rename to generators/docker/templates/docker/influxdb/config/influxdb.conf.ejs diff --git a/generators/server/templates/dotnetcore/docker/kapacitor/config/kapacitor.conf.ejs b/generators/docker/templates/docker/kapacitor/config/kapacitor.conf.ejs similarity index 100% rename from generators/server/templates/dotnetcore/docker/kapacitor/config/kapacitor.conf.ejs rename to generators/docker/templates/docker/kapacitor/config/kapacitor.conf.ejs diff --git a/generators/server/templates/dotnetcore/docker/monitoring.yml.ejs b/generators/docker/templates/docker/monitoring.yml.ejs similarity index 98% rename from generators/server/templates/dotnetcore/docker/monitoring.yml.ejs rename to generators/docker/templates/docker/monitoring.yml.ejs index 83d69af07..104afc6a8 100644 --- a/generators/server/templates/dotnetcore/docker/monitoring.yml.ejs +++ b/generators/docker/templates/docker/monitoring.yml.ejs @@ -12,7 +12,7 @@ See the License for the specific language governing permissions and limitations under the License. -%> -version: '<%= DOCKER_COMPOSE_FORMAT_VERSION %>' +version: '3.8' services: <%= baseName.toLowerCase() %>-influxdb: # Full tag list: https://hub.docker.com/r/library/influxdb/tags/ diff --git a/generators/server/templates/dotnetcore/docker/telegraf/telegraf.conf.ejs b/generators/docker/templates/docker/telegraf/telegraf.conf.ejs similarity index 100% rename from generators/server/templates/dotnetcore/docker/telegraf/telegraf.conf.ejs rename to generators/docker/templates/docker/telegraf/telegraf.conf.ejs diff --git a/generators/dotnet.js b/generators/dotnet.js deleted file mode 100644 index d86e27c62..000000000 --- a/generators/dotnet.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const shelljs = require('shelljs'); -const fs = require('fs'); -const { Guid } = require('js-guid'); -const _ = require('lodash'); -const chalk = require('chalk'); - -function exec(cmd, opts = {}) { - return new Promise((resolve, reject) => { - shelljs.exec(cmd, opts, (code, stdout, stderr) => { - if (code !== 0) { - return reject(Error(stderr)); - } - return resolve(stdout); - }); - }); -} - -function hasDotnet() { - return new Promise((resolve, reject) => { - if (!shelljs.exec('dotnet', { silent: true })) { - return reject(Error("'dotnet' not found in the PATH.")); - } - return resolve(); - }); -} - -async function newSln(solutionName) { - await hasDotnet(); - try { - await fs.promises.access(`${solutionName}.sln`); - return Promise.resolve(true); - } catch (error) { - return exec(`dotnet new sln --name ${solutionName}`); - } -} - -async function slnAdd(solutionFile, projects) { - await hasDotnet(); - return exec(`dotnet sln ${solutionFile} add ${projects.join(' ')}`); -} - -async function newSlnAddProj(solutionName, projects) { - const solutionFile = fs.readFileSync(`${solutionName}.sln`, 'utf8'); - const regex = new RegExp(`Project\\("{([^}"]*)}"\\) = .*Core.csproj", "{([^}"]*)}"`, 'g'); // eslint-disable-line quotes - const exc = regex.exec(solutionFile); - const firstGuid = exc[1]; - const regexp = RegExp(`Project\\("{[^}"]*}"\\) = "client", "client", "{([^}"]*)}"`, 'g'); // eslint-disable-line quotes - const clientDir = regexp.exec(solutionFile)[1]; - const reg = new RegExp(`Project\\("{[^"]*"\\) = "([^"]*)", "[^"]*`, 'g'); // eslint-disable-line quotes - let projectText = ''; - let dirText = ''; - - projectText += `\nProject("{${firstGuid}}") = "Solution Items", "Solution Items", "{${_.toUpper(Guid.newGuid())}}"`; - projectText += '\n\tProjectSection(SolutionItems) = preProject'; - projectText += '\n\t\t.editorconfig = .editorconfig'; - projectText += '\n\t\tDirectory.Packages.props = Directory.Packages.props'; - projectText += '\n\t\tREADME.md = README.md'; - projectText += '\n\tEndProjectSection'; - projectText += '\nEndProject'; - - projects.forEach(project => { - const existingProjects = solutionFile.matchAll(reg); - let alreadyExist = false; - let existingProject = existingProjects.next(); - while (!existingProject.done && !alreadyExist) { - alreadyExist = existingProject.value[1] === project.name; - existingProject = existingProjects.next(); - } - if (!alreadyExist) { - const randomGuid = _.toUpper(Guid.newGuid()); - projectText += `\nProject("{${firstGuid}}") = "${project.name}", "${project.path}", "{${randomGuid}}"\nEndProject`; - dirText += `\n\t\t{${randomGuid}} = {${clientDir}}`; - } - }); - - const projectRe = new RegExp('MinimumVisualStudioVersion = .*\\D', 'g'); - const projectFound = solutionFile.match(projectRe); - projectText = `${projectFound}${projectText}`; - let newBody = solutionFile.replace(projectRe, projectText); - - const dirRe = new RegExp('GlobalSection\\(NestedProjects\\) = .*\\D', 'g'); - const dirFound = solutionFile.match(dirRe); - dirText = `${dirFound}${dirText}`; - newBody = newBody.replace(dirRe, dirText); - - if (solutionFile !== newBody) { - fs.writeFileSync(`${solutionName}.sln`, newBody); - } -} - -function installBlazorDependencies() { - if (!libmanIsInstalled()) { - if (shelljs.exec('dotnet tool install -g Microsoft.Web.LibraryManager.Cli').code !== 0) { - throw new Error('Could not install Microsoft.Web.LibraryManager.Cli'); - } - console.log(chalk.green.bold('Microsoft.Web.LibraryManager.Cli successfully installed.\n')); - } - if (!webcompilerIsInstalled()) { - if (shelljs.exec('dotnet tool install Excubo.WebCompiler --global').code !== 0) { - throw new Error('Could not install Excubo.WebCompiler'); - } - console.log(chalk.green.bold('Excubo.WebCompiler successfully installed.\n')); - } -} - -function libmanIsInstalled() { - if (shelljs.exec('libman', { silent: true }).code !== 0) { - return false; - } - return true; -} - -function webcompilerIsInstalled() { - if (shelljs.exec('webcompiler', { silent: true }).code !== 0) { - return false; - } - return true; -} - -async function restore() { - await hasDotnet(); - return exec('dotnet restore'); -} - -module.exports = { - hasDotnet, - newSlnAddProj, - newSln, - slnAdd, - restore, - installBlazorDependencies, -}; diff --git a/generators/dotnetcore/__snapshots__/generator.spec.js.snap b/generators/dotnetcore/__snapshots__/generator.spec.js.snap new file mode 100644 index 000000000..b61d5c824 --- /dev/null +++ b/generators/dotnetcore/__snapshots__/generator.spec.js.snap @@ -0,0 +1,388 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SubGenerator dotnetcore of dotnetcore JHipster blueprint > run > execute commands 1`] = ` +[ + [ + "spawnCommand", + "dotnet new sln --name Jhipster", + ], + [ + "spawnCommand", + "dotnet sln Jhipster.sln add src/Jhipster/Jhipster.csproj test/Jhipster.Test/Jhipster.Test.csproj src/Jhipster.Crosscutting/Jhipster.Crosscutting.csproj src/Jhipster.Domain/Jhipster.Domain.csproj src/Jhipster.Dto/Jhipster.Dto.csproj src/Jhipster.Domain.Services/Jhipster.Domain.Services.csproj src/Jhipster.Infrastructure/Jhipster.Infrastructure.csproj", + ], +] +`; + +exports[`SubGenerator dotnetcore of dotnetcore JHipster blueprint > run > should succeed 1`] = ` +{ + ".yo-rc.json": { + "stateCleared": "modified", + }, + "Directory.Packages.props": { + "stateCleared": "modified", + }, + "SonarAnalysis.ps1": { + "stateCleared": "modified", + }, + "SonarQube.Analysis.xml": { + "stateCleared": "modified", + }, + "docker/app.yml": { + "stateCleared": "modified", + }, + "docker/grafana/data/dashboard/Docker Monitoring.json": { + "stateCleared": "modified", + }, + "docker/grafana/data/dashboard/default-dashboard.yaml": { + "stateCleared": "modified", + }, + "docker/grafana/data/provisioning/influxdb.yml": { + "stateCleared": "modified", + }, + "docker/influxdb/config/influxdb.conf": { + "stateCleared": "modified", + }, + "docker/kapacitor/config/kapacitor.conf": { + "stateCleared": "modified", + }, + "docker/monitoring.yml": { + "stateCleared": "modified", + }, + "docker/prometheus/prometheus.yml": { + "stateCleared": "modified", + }, + "docker/sonar.yml": { + "stateCleared": "modified", + }, + "docker/telegraf/telegraf.conf": { + "stateCleared": "modified", + }, + "package.json": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Constants/Constants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Constants/ErrorConstants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Constants/JwtConstants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Constants/RolesConstants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/BadRequestAlertException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/BaseException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/EmailAlreadyUsedException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/EmailNotFoundException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/InternalServerErrorException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/InvalidPasswordException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/LoginAlreadyUsedException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/UserNotActivatedException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/UsernameNotFoundException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Jhipster.Crosscutting.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Utilities/RandomUtil.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/AuthenticationService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/Jhipster.Domain.Services.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/MailService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/ServicesClassesAssemblyHelper.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/UserService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/AuditedEntityBase.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/BaseEntity.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/Interfaces/IAuditedEntityBase.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/Role.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/User.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/UserRole.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Jhipster.Domain.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/IFluentRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/IGenericRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/INoSqlFluentRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/IReadOnlyGenericRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/IUnitOfWork.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Services/Interfaces/IAuthenticationService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Services/Interfaces/IMailService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Services/Interfaces/IUserService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/Authentication/KeyAndPasswordDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/Authentication/LoginDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/Authentication/PasswordChangeDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/Jhipster.Dto.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/ManagedUserDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/ProfileInfo/ProfileInfoDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/UserDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Configuration/IMongoDatabaseConfig.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Configuration/MongoDatabaseConfig.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Configuration/SecuritySettings.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/ApplicationDatabaseContext.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Extensions/DbSetExtensions.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Extensions/PropertyAccessorCache.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Repositories/FluentRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Repositories/GenericRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Repositories/UnitOfWork.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Jhipster.Infrastructure.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Web/Rest/Utilities/HeaderUtil.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Web/Rest/Utilities/PaginationUtil.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/AppSettingsStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/AutoMapper/AutoMapperProfile.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/AutoMapperStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/ConfigurationHelper.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/DatabaseStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/IdentityStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/LoggerStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/MvcStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/ProblemDetailsStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/RepositoryStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/SecurityStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/ServiceStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/SwaggerStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/AccountController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/ProfileInfoController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/PublicUsersController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/UserJwtController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/UsersController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/IStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Jhipster.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster/Program.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Properties/launchSettings.json": { + "stateCleared": "modified", + }, + "src/Jhipster/Security/BCryptPasswordHasher.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Security/Jwt/RoleClaimsTransformation.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Security/Jwt/TokenProvider.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Security/PoliciesConstants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Startup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Extensions/ActionResultExtensions.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Extensions/ActionResultWithHeaders.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Extensions/HttpRequestExtensions.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Filters/ValidateModelAttribute.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Rest/Problems/ExceptionTranslator.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Rest/Problems/ProblemDetailsConfiguration.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Rest/Problems/ValidationFailedException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Rest/Utilities/ActionResultUtil.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/appsettings.Development.json": { + "stateCleared": "modified", + }, + "src/Jhipster/appsettings.Production.json": { + "stateCleared": "modified", + }, + "src/Jhipster/appsettings.json": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Configuration/MockClaimsPrincipalProvider.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Configuration/TestMvcStartup.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/AccountResourceIntTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/ProfileInfoControllerIntTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/TestUtil.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/UserJwtControllerIntTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/UsersResourceIntTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Fixme.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Jhipster.Test.csproj": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Properties/launchSettings.json": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Setup/AppWebApplicationFactory.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Setup/MockHttpContextFactory.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Setup/TestStartup.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/xunit.runner.json": { + "stateCleared": "modified", + }, +} +`; diff --git a/generators/dotnetcore/command.js b/generators/dotnetcore/command.js new file mode 100644 index 000000000..1d30295b0 --- /dev/null +++ b/generators/dotnetcore/command.js @@ -0,0 +1,71 @@ +import chalk from 'chalk'; +import { command as serverCommand } from 'generator-jhipster/generators/server'; +import toPascalCase from 'to-pascal-case'; + +const { applicationType } = serverCommand.configs; + +/** + * @type {import('generator-jhipster').JHipsterCommandDefinition} + */ +const command = { + options: {}, + configs: { + applicationType, + namespace: { + prompt: ({ jhipsterConfigWithDefaults: config }) => ({ + type: 'input', + message: 'What is your default C# namespace?', + validate: input => + /^([a-z_A-Z]\w+(?:\.[a-z_A-Z]\w+)*)$/.test(input) ? true : 'The namespace you have provided is not a valid C# namespace', + default: () => toPascalCase(config.baseName), + }), + }, + serverPort: { + prompt: ({ jhipsterConfigWithDefaults: config }) => ({ + validate: input => (/^([0-9]*)$/.test(input) ? true : 'This is not a valid port number.'), + message: + 'On which port would like your server to run ? It should be unique to avoid port conflicts (choose http -> https=httpPort+1).', + default: ({ applicationType }) => ((applicationType ?? config.applicationType) === 'microservice' ? '5004' : '5000'), + }), + }, + authenticationType: { + prompt: { + type: 'list', + message: `Which ${chalk.yellow('*type*')} of authentication would you like to use?`, + }, + choices: [ + { value: 'jwt', name: 'JWT authentication (stateless, with a token)' }, + { value: 'oauth2', name: 'OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)' }, + ], + }, + databaseType: { + prompt: { + type: 'list', + message: 'Which database do you want to use', + }, + choices: [ + { value: 'sqllite', name: 'SQLite in-memory' }, + { value: 'mssql', name: 'Microsoft SQL Server' }, + { value: 'postgresql', name: 'PostgreSQL' }, + { value: 'mysql', name: 'MySQL' }, + { value: 'oracle', name: 'Oracle' }, + { value: 'mongodb', name: 'MongoDB' }, + ], + }, + cqrsEnabled: { + prompt: { + type: 'confirm', + message: 'Do you want to use the CQRS design pattern?', + }, + }, + withTerraformAzureScripts: { + prompt: ({ jhipsterConfigWithDefaults: config }) => ({ + type: 'confirm', + when: ({ applicationType, databaseType }) => + (applicationType ?? config.applicationType) === 'monolith' && (databaseType ?? config.databaseType) === 'mssql', + }), + }, + }, +}; + +export default command; diff --git a/generators/dotnetcore/entity-files.js b/generators/dotnetcore/entity-files.js new file mode 100644 index 000000000..84da7bda7 --- /dev/null +++ b/generators/dotnetcore/entity-files.js @@ -0,0 +1,115 @@ +/** + * Copyright 2019-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* Constants use throughout */ + +import { SERVER_SRC_DIR, SERVER_TEST_DIR, renameDotNetCore } from '../generator-dotnetcore-constants.js'; + +export const entityFiles = { + server: [ + { + path: SERVER_SRC_DIR, + renameTo: renameDotNetCore(), + templates: [ + 'Project.Domain/Entities/_persistClass_.cs', + 'Project/Controllers/_pascalizedEntityClassPlural_Controller.cs', + 'Project.Domain/Repositories/Interfaces/I_persistClass_Repository.cs', + 'Project.Domain/Repositories/Interfaces/IReadOnly_persistClass_Repository.cs', + 'Project.Infrastructure/Data/Repositories/_persistClass_Repository.cs', + 'Project.Infrastructure/Data/Repositories/ReadOnly_persistClass_Repository.cs', + ], + }, + { + condition: generator => generator.cqrsEnabled === true, + path: SERVER_SRC_DIR, + renameTo: renameDotNetCore(), + templates: [ + 'Project.Application/Queries/_persistClass_/_persistClass_GetQuery.cs', + 'Project.Application/Queries/_persistClass_/_persistClass_GetQueryHandler.cs', + 'Project.Application/Queries/_persistClass_/_persistClass_GetAllQuery.cs', + 'Project.Application/Queries/_persistClass_/_persistClass_GetAllQueryHandler.cs', + 'Project.Application/Commands/_persistClass_/_persistClass_DeleteCommand.cs', + 'Project.Application/Commands/_persistClass_/_persistClass_DeleteCommandHandler.cs', + 'Project.Application/Commands/_persistClass_/_persistClass_CreateCommand.cs', + 'Project.Application/Commands/_persistClass_/_persistClass_CreateCommandHandler.cs', + 'Project.Application/Commands/_persistClass_/_persistClass_UpdateCommand.cs', + 'Project.Application/Commands/_persistClass_/_persistClass_UpdateCommandHandler.cs', + ], + }, + { + condition: generator => generator.dto === 'mapstruct', + path: SERVER_SRC_DIR, + renameTo: renameDotNetCore(), + templates: ['Project.Dto/_dtoClass_.cs'], + }, + { + condition: generator => generator.dto === 'mapstruct', + path: SERVER_SRC_DIR, + renameTo: renameDotNetCore(), + templates: ['Project.Dto/AuditedEntityBaseDto.cs'], + }, + ], + test: [ + { + path: SERVER_TEST_DIR, + renameTo: renameDotNetCore(SERVER_TEST_DIR), + templates: ['Project.Test/Controllers/_persistClass_ControllerIntTest.cs'], + }, + ], + service: [ + { + condition: generator => generator.service === 'serviceImpl' && generator.cqrsEnabled !== true, + path: SERVER_SRC_DIR, + renameTo: renameDotNetCore(), + templates: ['Project.Domain.Services/_entityClass_Service.cs', 'Project.Domain/Services/Interfaces/I_entityClass_Service.cs'], + }, + ], +}; + +export const entityCommonFiles = { + server: [ + { + path: SERVER_SRC_DIR, + renameTo: renameDotNetCore(), + templates: ['Project/Configuration/AutoMapper/AutoMapperProfile_withEntities_.cs'], + }, + ], + db: [ + { + condition: generator => generator.databaseType !== 'mongodb', + path: SERVER_SRC_DIR, + renameTo: renameDotNetCore(), + templates: ['Project.Infrastructure/Data/ApplicationDatabaseContext_withEntities_.cs'], + }, + ], +}; + +export const gatlingTestsFiles = { + gatlingTests: [ + { + condition: generator => generator.gatlingTests, + path: SERVER_TEST_DIR, + templates: [ + { + file: 'gatling/user-files/simulations/EntityGatlingTest.scala', + renameTo: generator => `gatling/user-files/simulations/${generator.entityClass}GatlingTest.scala`, + }, + ], + }, + ], +}; diff --git a/generators/dotnetcore/files.js b/generators/dotnetcore/files.js new file mode 100644 index 000000000..78b3ef49c --- /dev/null +++ b/generators/dotnetcore/files.js @@ -0,0 +1,1416 @@ +/** + * Copyright 2019-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { + SERVER_SRC_DIR, + SERVER_TEST_DIR, + PROJECT_DOMAIN_SUFFIX, + PROJECT_APPLICATION_SUFFIX, + PROJECT_DTO_SUFFIX, + PROJECT_CROSSCUTTING_SUFFIX, + PROJECT_INFRASTRUCTURE_SUFFIX, + PROJECT_SERVICE_SUFFIX, + TERRAFORM_DIR, + PROJECT_TEST_SUFFIX, +} from '../generator-dotnetcore-constants.js'; + +export const serverFiles = { + serverCsProj: [ + { + templates: ['README.md.jhi.dotnetcore'], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Project.csproj', + renameTo: generator => `${generator.mainProjectDir}/${generator.pascalizedBaseName}.csproj`, + }, + ], + }, + { + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Project.Test.csproj', + renameTo: generator => `${generator.testProjectDir}/${generator.pascalizedBaseName}${PROJECT_TEST_SUFFIX}.csproj`, + }, + ], + }, + { + path: SERVER_TEST_DIR, + templates: [{ file: 'Project.Test/xunit.runner.json', renameTo: generator => `${generator.testProjectDir}/xunit.runner.json` }], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Project.csproj', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}.csproj`, + }, + ], + }, + { + condition: generator => generator.cqrsEnabled === true, + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Application/Project.csproj', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}.csproj`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Dto/Project.csproj', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}.csproj`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Project.csproj', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}.csproj`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain.Services/Project.csproj', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}.csproj`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Project.csproj', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}.csproj`, + }, + ], + }, + ], + domainFiles: [ + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Entities/Interfaces/IAuditedEntityBase.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/Interfaces/IAuditedEntityBase.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Entities/AuditedEntityBase.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/AuditedEntityBase.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Entities/BaseEntity.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/BaseEntity.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Entities/MongoBaseEntity.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/MongoBaseEntity.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Entities/User.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/User.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Entities/Role.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/Role.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Entities/UserRole.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/UserRole.cs`, + }, + ], + }, + ], + crosscuttingFiles: [ + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Constants/Constants.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Constants/Constants.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Constants/JwtConstants.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Constants/JwtConstants.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Constants/RolesConstants.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Constants/RolesConstants.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Constants/ErrorConstants.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Constants/ErrorConstants.cs`, + }, + ], + }, + { + condition: generator => generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Security/UsernameNotFoundException.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/UsernameNotFoundException.cs`, + }, + ], + }, + { + condition: generator => generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Security/UserNotActivatedException.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/UserNotActivatedException.cs`, + }, + ], + }, + ], + dtoFiles: [ + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Dto/ManagedUserDto.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}/ManagedUserDto.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Dto/PasswordChangeDto.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}/Authentication/PasswordChangeDto.cs`, + }, + ], + }, + { + condition: generator => generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Dto/UserDto.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}/UserDto.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Dto/ProfileInfoDto.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}/ProfileInfo/ProfileInfoDto.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Dto/KeyAndPasswordDto.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}/Authentication/KeyAndPasswordDto.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Dto/LoginDto.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}/Authentication/LoginDto.cs`, + }, + ], + }, + ], + services: [ + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain.Services/ServicesClassesAssemblyHelper.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/ServicesClassesAssemblyHelper.cs`, + }, + ], + }, + ], + repository: [ + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Repositories/Interfaces/IFluentRepository.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/IFluentRepository.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Repositories/Interfaces/INoSqlFluentRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/INoSqlFluentRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType !== 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Repositories/Interfaces/IGenericRepository.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/IGenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType !== 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Repositories/Interfaces/IReadOnlyGenericRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/IReadOnlyGenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Repositories/Interfaces/INoSqlGenericRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/INoSqlGenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType !== 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Repositories/Interfaces/IUnitOfWork.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/IUnitOfWork.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Repositories/FluentRepository.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/FluentRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Repositories/MongoFluentRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/MongoFluentRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType !== 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Repositories/GenericRepository.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/GenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Repositories/MongoGenericRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/MongoGenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType !== 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/ReadOnlyGenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Repositories/MongoReadOnlyGenericRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/MongoReadOnlyGenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType !== 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/ReadOnlyGenericRepository.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType !== 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Repositories/UnitOfWork.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/UnitOfWork.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Repositories/MongoDatabaseUserStore.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/MongoDatabaseUserStore.cs`, + }, + ], + }, + ], + dataExtensions: [ + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Extensions/DbSetExtensions.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Extensions/DbSetExtensions.cs`, + }, + { + file: 'Project.Infrastructure/Data/Extensions/PropertyAccessorCache.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Extensions/PropertyAccessorCache.cs`, + }, + ], + }, + ], + mongoExtension: [ + { + condition: generator => generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/Extensions/NoSqlPagination.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Extensions/NoSqlPagination.cs`, + }, + ], + }, + ], + serverProperties: [ + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Properties/launchSettings.json', + renameTo: generator => `${generator.mainProjectDir}/Properties/launchSettings.json`, + }, + ], + }, + { + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Properties/launchSettings.json', + renameTo: generator => `${generator.testProjectDir}/Properties/launchSettings.json`, + }, + ], + }, + ], + serverProgram: [ + { + path: SERVER_SRC_DIR, + templates: [{ file: 'Project/Program.cs', renameTo: generator => `${generator.mainProjectDir}/Program.cs` }], + }, + ], + serverConfiguration: [ + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Configuration/SecuritySettings.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Configuration/SecuritySettings.cs`, + }, + { + file: 'Project.Infrastructure/Configuration/IMongoDatabaseConfig.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Configuration/IMongoDatabaseConfig.cs`, + }, + { + file: 'Project.Infrastructure/Configuration/MongoDatabaseConfig.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Configuration/MongoDatabaseConfig.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [{ file: 'Project/appsettings.json', renameTo: generator => `${generator.mainProjectDir}/appsettings.json` }], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/appsettings.Development.json', + renameTo: generator => `${generator.mainProjectDir}/appsettings.Development.json`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/appsettings.Production.json', + renameTo: generator => `${generator.mainProjectDir}/appsettings.Production.json`, + }, + ], + }, + ], + serverStartup: [ + { + path: SERVER_SRC_DIR, + templates: [{ file: 'Project/IStartup.cs', renameTo: generator => `${generator.mainProjectDir}/IStartup.cs` }], + }, + { + path: SERVER_SRC_DIR, + templates: [{ file: 'Project/Startup.cs', renameTo: generator => `${generator.mainProjectDir}/Startup.cs` }], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/ConfigurationHelper.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/ConfigurationHelper.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/AutoMapperStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/AutoMapperStartup.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/DatabaseStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/DatabaseStartup.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/IdentityStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/IdentityStartup.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/MvcStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/MvcStartup.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/AppSettingsStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/AppSettingsStartup.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/LoggerStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/LoggerStartup.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/ProblemDetailsStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/ProblemDetailsStartup.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/SecurityStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/SecurityStartup.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/SwaggerStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/SwaggerStartup.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/ServiceStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/ServiceStartup.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/RepositoryStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/RepositoryStartup.cs`, + }, + ], + }, + ], + serverUserManagement: [ + { + condition: generator => generator.databaseType !== 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/ApplicationDatabaseContext.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/ApplicationDatabaseContext.cs`, + }, + ], + }, + { + condition: generator => generator.databaseType === 'mongodb', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Infrastructure/Data/MongoDatabaseContext.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/MongoDatabaseContext.cs`, + }, + { + file: 'Project.Infrastructure/Data/IMongoDatabaseContext.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/IMongoDatabaseContext.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Services/Interfaces/IAuthenticationService.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Services/Interfaces/IAuthenticationService.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain.Services/AuthenticationService.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/AuthenticationService.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Services/Interfaces/IMailService.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Services/Interfaces/IMailService.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain.Services/MailService.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/MailService.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain/Services/Interfaces/IUserService.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Services/Interfaces/IUserService.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Domain.Services/UserService.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/UserService.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Utilities/RandomUtil.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Utilities/RandomUtil.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/AutoMapper/AutoMapperProfile.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/AutoMapper/AutoMapperProfile.cs`, + }, + ], + }, + { + condition: generator => generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Controllers/AccountController.cs', + renameTo: generator => `${generator.mainProjectDir}/Controllers/AccountController.cs`, + }, + ], + }, + { + condition: generator => generator.applicationType !== 'microservice' && generator.cqrsEnabled === true, + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Application/ApplicationClassesAssemblyHelper.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/ApplicationClassesAssemblyHelper.cs`, + }, + ], + }, + { + condition: generator => + generator.applicationType !== 'microservice' && generator.cqrsEnabled === true && generator.authenticationType === 'jwt', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Application/Commands/Account/AccountActivateCommand.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountActivateCommand.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountActivateCommandHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountActivateCommandHandler.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountChangePasswordCommand.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountChangePasswordCommand.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountChangePasswordCommandHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountChangePasswordCommandHandler.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountCreateCommand.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountCreateCommand.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountCreateCommandHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountCreateCommandHandler.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountResetPasswordCommand.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountResetPasswordCommand.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountResetPasswordCommandHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountResetPasswordCommandHandler.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountResetPasswordFinishCommand.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountResetPasswordFinishCommand.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountResetPasswordFinishCommandHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountResetPasswordFinishCommandHandler.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountSaveCommand.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountSaveCommand.cs`, + }, + { + file: 'Project.Application/Commands/Account/AccountSaveCommandHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountSaveCommandHandler.cs`, + }, + { + file: 'Project.Application/Queries/Account/AccountGetAuthenticatedQuery.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/Account/AccountGetAuthenticatedQuery.cs`, + }, + { + file: 'Project.Application/Queries/Account/AccountGetAuthenticatedQueryHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/Account/AccountGetAuthenticatedQueryHandler.cs`, + }, + { + file: 'Project.Application/Queries/Account/AccountGetQuery.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/Account/AccountGetQuery.cs`, + }, + { + file: 'Project.Application/Queries/Account/AccountGetQueryHandler.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/Account/AccountGetQueryHandler.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Controllers/ProfileInfoController.cs', + renameTo: generator => `${generator.mainProjectDir}/Controllers/ProfileInfoController.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'oauth2', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Controllers/AuthController.cs', + renameTo: generator => `${generator.mainProjectDir}/Controllers/AuthController.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Controllers/UsersController.cs', + renameTo: generator => `${generator.mainProjectDir}/Controllers/UsersController.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Controllers/PublicUsersController.cs', + renameTo: generator => `${generator.mainProjectDir}/Controllers/PublicUsersController.cs`, + }, + ], + }, + { + condition: generator => + generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice' && generator.cqrsEnabled === true, + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Application/Commands/User/UserCreateCommand.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserCreateCommand.cs`, + }, + { + file: 'Project.Application/Commands/User/UserCreateCommandHandler.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserCreateCommandHandler.cs`, + }, + { + file: 'Project.Application/Commands/User/UserDeleteCommand.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserDeleteCommand.cs`, + }, + { + file: 'Project.Application/Commands/User/UserDeleteCommandHandler.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserDeleteCommandHandler.cs`, + }, + { + file: 'Project.Application/Commands/User/UserUpdateCommand.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserUpdateCommand.cs`, + }, + { + file: 'Project.Application/Commands/User/UserUpdateCommandHandler.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserUpdateCommandHandler.cs`, + }, + { + file: 'Project.Application/Queries/User/UserGetAllQuery.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAllQuery.cs`, + }, + { + file: 'Project.Application/Queries/User/UserGetAllQueryHandler.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAllQueryHandler.cs`, + }, + { + file: 'Project.Application/Queries/User/UserGetQuery.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetQuery.cs`, + }, + { + file: 'Project.Application/Queries/User/UserGetAllPublicUsersQuery.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAllPublicUsersQuery.cs`, + }, + { + file: 'Project.Application/Queries/User/UserGetAllPublicUsersQueryHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAllPublicUsersQueryHandler.cs`, + }, + { + file: 'Project.Application/Queries/User/UserGetQueryHandler.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetQueryHandler.cs`, + }, + { + file: 'Project.Application/Queries/User/UserGetAuthoritiesQuery.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAuthoritiesQuery.cs`, + }, + { + file: 'Project.Application/Queries/User/UserGetAuthoritiesQueryHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAuthoritiesQueryHandler.cs`, + }, + { + file: 'Project.Application/Commands/UserJwt/UserJwtAuthorizeCommandHandler.cs', + renameTo: generator => + `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/UserJwt/UserJwtAuthorizeCommandHandler.cs`, + }, + { + file: 'Project.Application/Commands/UserJwt/UserJwtAuthorizeCommand.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/UserJwt/UserJwtAuthorizeCommand.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Controllers/AccountResourceIntTest.cs', + renameTo: generator => `${generator.testProjectDir}/Controllers/AccountResourceIntTest.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Controllers/UserJwtControllerIntTest.cs', + renameTo: generator => `${generator.testProjectDir}/Controllers/UserJwtControllerIntTest.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Controllers/UsersResourceIntTest.cs', + renameTo: generator => `${generator.testProjectDir}/Controllers/UsersResourceIntTest.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'oauth2', + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Controllers/AccountControllerTest.cs', + renameTo: generator => `${generator.testProjectDir}/Controllers/AccountControllerTest.cs`, + }, + ], + }, + { + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Controllers/ProfileInfoControllerIntTest.cs', + renameTo: generator => `${generator.testProjectDir}/Controllers/ProfileInfoControllerIntTest.cs`, + }, + ], + }, + ], + serverAuthConfig: [ + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Security/BCryptPasswordHasher.cs', + renameTo: generator => `${generator.mainProjectDir}/Security/BCryptPasswordHasher.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Security/PoliciesConstants.cs', + renameTo: generator => `${generator.mainProjectDir}/Security/PoliciesConstants.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Security/Jwt/RoleClaimsTransformation.cs', + renameTo: generator => `${generator.mainProjectDir}/Security/Jwt/RoleClaimsTransformation.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Security/Jwt/TokenProvider.cs', + renameTo: generator => `${generator.mainProjectDir}/Security/Jwt/TokenProvider.cs`, + }, + ], + }, + { + condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Controllers/UserJwtController.cs', + renameTo: generator => `${generator.mainProjectDir}/Controllers/UserJwtController.cs`, + }, + ], + }, + ], + serverToSort: [ + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Extensions/ActionResultExtensions.cs', + renameTo: generator => `${generator.mainProjectDir}/Web/Extensions/ActionResultExtensions.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Extensions/ActionResultWithHeaders.cs', + renameTo: generator => `${generator.mainProjectDir}/Web/Extensions/ActionResultWithHeaders.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Extensions/HttpRequestExtensions.cs', + renameTo: generator => `${generator.mainProjectDir}/Web/Extensions/HttpRequestExtensions.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Filters/ValidateModelAttribute.cs', + renameTo: generator => `${generator.mainProjectDir}/Web/Filters/ValidateModelAttribute.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Rest/Utilities/ActionResultUtil.cs', + renameTo: generator => `${generator.mainProjectDir}/Web/Rest/Utilities/ActionResultUtil.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Rest/Utilities/HeaderUtil.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Web/Rest/Utilities/HeaderUtil.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Rest/Utilities/PaginationUtil.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Web/Rest/Utilities/PaginationUtil.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Exceptions/BaseException.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/BaseException.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Exceptions/BadRequestAlertException.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/BadRequestAlertException.cs`, + }, + ], + }, + { + condition: generator => generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Exceptions/EmailAlreadyUsedException.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/EmailAlreadyUsedException.cs`, + }, + ], + }, + { + condition: generator => generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Exceptions/EmailNotFoundException.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/EmailNotFoundException.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Rest/Problems/ExceptionTranslator.cs', + renameTo: generator => `${generator.mainProjectDir}/Web/Rest/Problems/ExceptionTranslator.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Exceptions/InternalServerErrorException.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/InternalServerErrorException.cs`, + }, + ], + }, + { + condition: generator => generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Exceptions/InvalidPasswordException.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/InvalidPasswordException.cs`, + }, + ], + }, + { + condition: generator => generator.applicationType !== 'microservice', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project.Crosscutting/Exceptions/LoginAlreadyUsedException.cs', + renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/LoginAlreadyUsedException.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Rest/Problems/ProblemDetailsConfiguration.cs', + renameTo: generator => `${generator.mainProjectDir}/Web/Rest/Problems/ProblemDetailsConfiguration.cs`, + }, + ], + }, + { + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Web/Rest/Problems/ValidationFailedException.cs', + renameTo: generator => `${generator.mainProjectDir}/Web/Rest/Problems/ValidationFailedException.cs`, + }, + ], + }, + ], + serverTestStartup: [ + { + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Configuration/TestMvcStartup.cs', + renameTo: generator => `${generator.testProjectDir}/Configuration/TestMvcStartup.cs`, + }, + ], + }, + { + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Setup/MockClaimsPrincipalProvider.cs', + renameTo: generator => `${generator.testProjectDir}/Configuration/MockClaimsPrincipalProvider.cs`, + }, + ], + }, + { + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Setup/MockHttpContextFactory.cs', + renameTo: generator => `${generator.testProjectDir}/Setup/MockHttpContextFactory.cs`, + }, + ], + }, + { + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Setup/AppWebApplicationFactory.cs', + renameTo: generator => `${generator.testProjectDir}/Setup/AppWebApplicationFactory.cs`, + }, + ], + }, + { + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Setup/TestStartup.cs', + renameTo: generator => `${generator.testProjectDir}/Setup/TestStartup.cs`, + }, + ], + }, + ], + serverMisc: [ + { + condition: generator => + generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice' && generator.databaseType !== 'mongodb', + path: SERVER_TEST_DIR, + templates: [{ file: 'Project.Test/Fixme.cs', renameTo: generator => `${generator.testProjectDir}/Fixme.cs` }], + }, + { + path: SERVER_TEST_DIR, + templates: [ + { + file: 'Project.Test/Controllers/TestUtil.cs', + renameTo: generator => `${generator.testProjectDir}/Controllers/TestUtil.cs`, + }, + ], + }, + ], + serverServiceDiscovery: [ + { + condition: generator => + generator.serviceDiscoveryType && generator.serviceDiscoveryType === 'consul' && generator.applicationType !== 'gateway', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/Configuration/Consul/ConsulOptions.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/Consul/ConsulOptions.cs`, + }, + { + file: 'Project/Configuration/Consul/ConsulStartup.cs', + renameTo: generator => `${generator.mainProjectDir}/Configuration/Consul/ConsulStartup.cs`, + }, + ], + }, + ], + serverGateway: [ + { + condition: generator => generator.applicationType === 'gateway', + path: SERVER_SRC_DIR, + templates: [ + { + file: 'Project/ocelot.json', + renameTo: generator => `${generator.mainProjectDir}/ocelot.json`, + }, + ], + }, + ], + terraform: [ + { + condition: generator => generator.withTerraformAzureScripts, + path: TERRAFORM_DIR, + templates: ['main.tf', 'variables.tf', 'outputs.tf'], + }, + ], +}; + +export const gatlingTestsFiles = { + gatlingTests: [ + { + path: SERVER_TEST_DIR, + templates: [ + // Create Gatling test files + 'gatling/conf/gatling.conf', + 'gatling/conf/logback.xml', + ], + }, + ], +}; diff --git a/generators/dotnetcore/generator.js b/generators/dotnetcore/generator.js new file mode 100644 index 000000000..ace74fd50 --- /dev/null +++ b/generators/dotnetcore/generator.js @@ -0,0 +1,274 @@ +import { access } from 'fs/promises'; +import chalk from 'chalk'; +import BaseApplicationGenerator from 'generator-jhipster/generators/base-application'; +import { createBase64Secret } from 'generator-jhipster/generators/base/support'; +import { getEnumInfo } from 'generator-jhipster/generators/base-application/support'; + +import command from './command.js'; +import { serverFiles } from './files.js'; +import { + PROJECT_APPLICATION_SUFFIX, + PROJECT_CROSSCUTTING_SUFFIX, + PROJECT_DOMAIN_SUFFIX, + PROJECT_DTO_SUFFIX, + PROJECT_INFRASTRUCTURE_SUFFIX, + PROJECT_SERVICE_SUFFIX, + PROJECT_TEST_SUFFIX, + SERVER_SRC_DIR, + SERVER_TEST_DIR, +} from '../generator-dotnetcore-constants.js'; +import { entityCommonFiles, entityFiles } from './entity-files.js'; + +export default class extends BaseApplicationGenerator { + constructor(args, opts, features) { + super(args, opts, { ...features, jhipster7Migration: true }); + } + + async beforeQueue() { + await this.dependsOnJHipster('jhipster-dotnetcore:bootstrap-dotnetcore'); + } + + get [BaseApplicationGenerator.INITIALIZING]() { + return this.asInitializingTaskGroup({ + async initializingTemplateTask() { + this.parseJHipsterCommand(command); + }, + }); + } + + get [BaseApplicationGenerator.PROMPTING]() { + return this.asPromptingTaskGroup({ + async promptingTemplateTask({ control }) { + if (control.existingProject && this.options.askAnswered !== true) return; + await this.prompt(this.prepareQuestions(command.configs)); + }, + }); + } + + get [BaseApplicationGenerator.CONFIGURING]() { + return this.asConfiguringTaskGroup({ + async configuringTemplateTask() { + // Force consul for gateways and microservices + if ((this.jhipsterConfig.applicationType ?? 'monolith') !== 'monolith') { + this.jhipsterConfig.serviceDiscoveryType = 'consul'; + } + if (this.jhipsterConfig.databaseType === 'postgres') { + this.jhipsterConfig.databaseType = 'postgresql'; + } + // Terraform is supported my mssql + if (this.jhipsterConfig.withTerraformAzureScripts && this.jhipsterConfig.database !== 'mssql') { + this.jhipsterConfig.withTerraformAzureScripts = false; + } + if (this.jhipsterConfig.jwtSecretKey === undefined) { + this.jhipsterConfig.jwtSecretKey = createBase64Secret(this.options.reproducibleTests); + } + }, + }); + } + + get [BaseApplicationGenerator.COMPOSING]() { + return this.asComposingTaskGroup({ + async composingTemplateTask() { + await this.composeWithJHipster('docker'); + }, + }); + } + + get [BaseApplicationGenerator.PREPARING]() { + return this.asPreparingTaskGroup({ + async preparingTemplateTask({ source, application }) { + if (application.applicationTypeGateway) { + source.addRouteToGateway = ({ serviceEndpoint, serviceName }) => { + const ocelotConfigPath = `src/${application.mainProjectDir}/ocelot.json`; + const ocelotStorage = this.createStorage(ocelotConfigPath); + const endpoint = `/${serviceName}/api/${serviceEndpoint}`; + ocelotStorage.merge({ + Routes: [ + { + DownstreamPathTemplate: `/api/${serviceEndpoint}`, + DownstreamScheme: 'https', + ServiceName: `${serviceName}-service`, + LoadBalancerOptions: { + Type: 'LeastConnection', + }, + ReRoutesCaseSensitive: false, + UpstreamPathTemplate: endpoint, + UpstreamHttpMethod: ['Get', 'Post', 'Delete', 'Put'], + }, + { + DownstreamPathTemplate: `/api/${serviceEndpoint}/{everything}`, + DownstreamScheme: 'https', + ServiceName: `${serviceName}-service`, + LoadBalancerOptions: { + Type: 'LeastConnection', + }, + ReRoutesCaseSensitive: false, + UpstreamPathTemplate: `${endpoint}/{everything}`, + UpstreamHttpMethod: ['Get', 'Post', 'Delete', 'Put'], + }, + ], + }); + }; + } + }, + }); + } + + get [BaseApplicationGenerator.WRITING]() { + return this.asWritingTaskGroup({ + async writeFiles({ application }) { + await this.writeFiles({ + sections: serverFiles, + context: application, + rootTemplatesPath: 'dotnetcore', + }); + }, + async writeDirectoryTargetsFile({ application }) { + await this.writeFiles({ + blocks: [ + { + templates: [ + { + sourceFile: `dotnetcore/${SERVER_SRC_DIR}/Directory.Packages.props`, + destinationFile: 'Directory.Packages.props', + }, + ], + }, + ], + context: application, + }); + }, + }); + } + + get [BaseApplicationGenerator.WRITING_ENTITIES]() { + return this.asWritingEntitiesTaskGroup({ + async writeServerFiles({ application, entities }) { + for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipServer)) { + entity.fields.forEach(field => { + if (field.fieldIsEnum) { + if (!entity.skipServer) { + const enumInfo = getEnumInfo(field, entity.clientRootFolder); + enumInfo.namespace = application.namespace; + const { fieldType } = field; + this.writeFile( + 'dotnetcore/src/Project.Crosscutting/Enums/Enum.cs.ejs', + `src/${application.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Enums/${fieldType}.cs`, + enumInfo, + ); + } + } + }); + + await this.writeFiles({ + sections: entityFiles, + context: { + ...application, + ...entity, + asDto: str => `${str}${application.dtoSuffix}`, + }, + rootTemplatesPath: ['dotnetcore'], + }); + await this.writeFiles({ + sections: entityCommonFiles, + context: { + ...application, + ...entity, + entities: this.getExistingEntities(), + asDto: str => `${str}${application.dtoSuffix}`, + }, + rootTemplatesPath: ['dotnetcore'], + }); + } + }, + }); + } + + get [BaseApplicationGenerator.POST_WRITING]() { + return this.asPostWritingTaskGroup({ + async postWritingTemplateTask({ application }) { + this.packageJson.merge({ + devDependencies: { + concurrently: application.nodeDependencies.concurrently, + }, + scripts: { + 'ci:e2e:server:start': 'docker compose -f docker/app.yml up --wait', + 'ci:e2e:run': 'concurrently -k -s first "npm run ci:e2e:server:start" "npm run e2e:headless"', + }, + }); + }, + }); + } + + get [BaseApplicationGenerator.POST_WRITING_ENTITIES]() { + return this.asPostWritingEntitiesTaskGroup({ + async postWritingEntitiesTemplateTask({ application, entities, source }) { + if (application.applicationTypeGateway) { + for (const entity of entities.filter(entity => !entity.builtIn && entity.microserviceName)) { + source.addRouteToGateway({ + serviceEndpoint: entity.entityApiUrl, + serviceName: this._.toLower(entity.microserviceName), + }); + } + } + }, + }); + } + + get [BaseApplicationGenerator.INSTALL]() { + return this.asInstallTaskGroup({ + async installTemplateTask({ application }) { + this.log(chalk.green.bold(`\nCreating ${application.solutionName} .Net Core solution if it does not already exist.\n`)); + const slns = [ + `${SERVER_SRC_DIR}${application.mainProjectDir}${application.pascalizedBaseName}.csproj`, + `${SERVER_TEST_DIR}${application.testProjectDir}${application.pascalizedBaseName}${PROJECT_TEST_SUFFIX}.csproj`, + `${SERVER_SRC_DIR}${application.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/${application.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}.csproj`, + `${SERVER_SRC_DIR}${application.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/${application.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}.csproj`, + `${SERVER_SRC_DIR}${application.pascalizedBaseName}${PROJECT_DTO_SUFFIX}/${application.pascalizedBaseName}${PROJECT_DTO_SUFFIX}.csproj`, + `${SERVER_SRC_DIR}${application.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/${application.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}.csproj`, + `${SERVER_SRC_DIR}${application.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/${application.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}.csproj`, + ]; + if (application.cqrsEnabled) { + slns.push( + `${SERVER_SRC_DIR}${application.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/${application.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}.csproj`, + ); + } + try { + await this.newSln(application.solutionName); + await this.slnAdd(`${application.solutionName}.sln`, slns); + } catch (error) { + this.log.warn(`Failed to create ${application.solutionName} .Net Core solution: ${error}`); + } + }, + }); + } + + get [BaseApplicationGenerator.END]() { + return this.asEndTaskGroup({ + async end({ application }) { + this.log.ok('.Net Core application generated successfully.'); + this.log( + chalk.green( + `Run your .Net Core application:\n${chalk.yellow.bold( + `dotnet run --verbosity normal --project ./${SERVER_SRC_DIR}${application.mainProjectDir}/${application.pascalizedBaseName}.csproj`, + )}`, + ), + ); + this.log(chalk.green(`Test your .Net Core application:\n${chalk.yellow.bold('dotnet test --verbosity normal')}`)); + }, + }); + } + + async newSln(solutionName) { + try { + await access(`${solutionName}.sln`); + return true; + } catch (error) { + return this.spawnCommand(`dotnet new sln --name ${solutionName}`); + } + } + + async slnAdd(solutionFile, projects) { + return this.spawnCommand(`dotnet sln ${solutionFile} add ${projects.join(' ')}`); + } +} diff --git a/generators/dotnetcore/generator.spec.js b/generators/dotnetcore/generator.spec.js new file mode 100644 index 000000000..83f297edf --- /dev/null +++ b/generators/dotnetcore/generator.spec.js @@ -0,0 +1,222 @@ +import { beforeAll, describe, expect, it } from 'vitest'; +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +import { SERVER_SRC_DIR } from '../generator-dotnetcore-constants.js'; + +const SUB_GENERATOR = 'dotnetcore'; +const SUB_GENERATOR_NAMESPACE = `jhipster-dotnetcore:${SUB_GENERATOR}`; + +describe('SubGenerator dotnetcore of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig() + .withOptions({ + ignoreNeedlesError: true, + blueprints: 'dotnetcore', + }) + .withJHipsterLookup() + .withSpawnMock() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + + it('execute commands', () => { + expect(result.getSpawnArgsUsingDefaultImplementation()).toMatchSnapshot(); + }); + }); + + describe('Positive - Terraform files (monolithic app with mssql)', () => { + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig({ + baseName: 'sampleApp', + namespace: 'sampleApp', + database: 'mssql', + withTerraformAzureScripts: true, + }) + .withOptions({ + ignoreNeedlesError: true, + blueprints: 'dotnetcore', + }) + .withJHipsterLookup() + .withSpawnMock() + .withParentBlueprintLookup(); + }); + + it('terraform files should be generated', () => { + result.assertFile('terraform/main.tf'); + result.assertFile('terraform/variables.tf'); + result.assertFile('terraform/outputs.tf'); + }); + }); + + describe('Negative - monolithic with non mssql database', () => { + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig({ + baseName: 'sampleApp', + namespace: 'sampleApp', + database: 'mysql', + withTerraformAzureScripts: true, + }) + .withOptions({ + ignoreNeedlesError: true, + blueprints: 'dotnetcore', + }) + .withJHipsterLookup() + .withSpawnMock() + .withParentBlueprintLookup(); + }); + + it('terraform files should not be generated', () => { + result.assertNoFile('terraform/main.tf'); + result.assertNoFile('terraform/variables.tf'); + result.assertNoFile('terraform/outputs.tf'); + }); + }); + + describe('generating dto', () => { + const personClass = `${SERVER_SRC_DIR}JhipsterBlueprint.Domain/Entities/Person.cs`; + const personDto = `${SERVER_SRC_DIR}JhipsterBlueprint.Dto/PersonDto.cs`; + const dtoMappingFile = `${SERVER_SRC_DIR}JhipsterBlueprint/Configuration/AutoMapper/AutoMapperProfile.cs`; + + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig( + { + baseName: 'jhipsterBlueprint', + }, + [ + { + name: 'Person', + dto: 'mapstruct', + }, + ], + ) + .withOptions({ + ignoreNeedlesError: true, + blueprints: 'dotnetcore', + }) + .withJHipsterLookup() + .withSpawnMock() + .withParentBlueprintLookup(); + }); + + it('check if required files for dto are copied', () => { + result.assertFile('.jhipster/Person.json'); + result.assertFile('.yo-rc.json'); + }); + + it('checks dto files', () => { + result.assertFile(personClass); + result.assertFile(personDto); + result.assertFile(dtoMappingFile); + result.assertFileContent(personDto, /public class PersonDto/); + result.assertFileContent(dtoMappingFile, /public class AutoMapperProfile : Profile/); + }); + }); + + describe('generating enum', () => { + const orderClass = `${SERVER_SRC_DIR}JhipsterBlueprint.Domain/Entities/Order.cs`; + const orderStatusEnum = `${SERVER_SRC_DIR}JhipsterBlueprint.Crosscutting/Enums/OrderStatus.cs`; + const efMappings = `${SERVER_SRC_DIR}JhipsterBlueprint.Infrastructure/Data/ApplicationDatabaseContext.cs`; + + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig( + { + baseName: 'jhipsterBlueprint', + }, + [ + { + name: 'Order', + fields: [ + { + fieldName: 'status', + fieldType: 'OrderStatus', + fieldValues: 'IN_PROGRESS,FINISHED', + }, + ], + }, + ], + ) + .withOptions({ + ignoreNeedlesError: true, + blueprints: 'dotnetcore', + }) + .withJHipsterLookup() + .withSpawnMock() + .withParentBlueprintLookup(); + }); + + it('copies entity file', () => { + result.assertFile('.jhipster/Order.json'); + result.assertFile('.yo-rc.json'); + }); + + it('creates entity class', () => { + result.assertFile(orderClass); + }); + + it('generates the enum', () => { + result.assertFile(orderStatusEnum); + result.assertFileContent(orderStatusEnum, /IN_PROGRESS,\s+FINISHED/); + }); + + it('generates the enum to string mapping at ApplicationDatabaseContext', () => { + result.assertFileContent(efMappings, /builder\.Entity\(\)\s+\.Property\(e => e.Status\)\s+\.HasConversion\(\);/); + }); + }); + + describe('generating service interface and implementation', () => { + const personService = `${SERVER_SRC_DIR}JhipsterBlueprint.Domain.Services/PersonService.cs`; + const personServiceInterface = `${SERVER_SRC_DIR}JhipsterBlueprint.Domain/Services/Interfaces/IPersonService.cs`; + + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig( + { + baseName: 'jhipsterBlueprint', + }, + [ + { + name: 'Person', + dto: 'mapstruct', + service: 'serviceImpl', + }, + ], + ) + .withOptions({ + ignoreNeedlesError: true, + blueprints: 'dotnetcore', + }) + .withJHipsterLookup() + .withSpawnMock() + .withParentBlueprintLookup(); + }); + + it('check if required files are copied', () => { + result.assertFile('.yo-rc.json'); + }); + + it('checks if service interface and implementation files exist', () => { + result.assertFile(personService); + result.assertFile(personServiceInterface); + }); + + it('checks service interface and implementation contents', () => { + result.assertFileContent(personService, /public class PersonService/); + result.assertFileContent(personServiceInterface, /public interface IPersonService/); + }); + }); +}); diff --git a/generators/dotnetcore/index.js b/generators/dotnetcore/index.js new file mode 100644 index 000000000..3eccd6e86 --- /dev/null +++ b/generators/dotnetcore/index.js @@ -0,0 +1,2 @@ +export { default } from './generator.js'; +export { default as command } from './command.js'; diff --git a/generators/common/templates/dotnetcore/README.md.ejs b/generators/dotnetcore/templates/dotnetcore/README.md.jhi.dotnetcore.ejs similarity index 59% rename from generators/common/templates/dotnetcore/README.md.ejs rename to generators/dotnetcore/templates/dotnetcore/README.md.jhi.dotnetcore.ejs index e7bdd54a3..9ec88d943 100644 --- a/generators/common/templates/dotnetcore/README.md.ejs +++ b/generators/dotnetcore/templates/dotnetcore/README.md.jhi.dotnetcore.ejs @@ -1,5 +1,5 @@ <%# - Copyright 2019-2023 the original author or authors from the JHipster project. + Copyright 2013-2023 the original author or authors from the JHipster project. This file is part of the JHipster project, see https://www.jhipster.tech/ for more information. @@ -8,7 +8,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -16,14 +16,39 @@ See the License for the specific language governing permissions and limitations under the License. -%> -# <%= baseName %> -<%_ -let DOCUMENTATION_ARCHIVE_URL = `${DOCUMENTATION_URL + DOCUMENTATION_ARCHIVE_PATH}v${jhipsterVersion}`; -_%> -This application was generated using JHipster <%= jhipsterVersion %> and JHipster .Net Core <%= jhipsterDotnetVersion %>, you can find documentation and help at https://jhipsternet.readthedocs.io/en/latest/index.html and [<%= DOCUMENTATION_ARCHIVE_URL %>](<%= DOCUMENTATION_ARCHIVE_URL %>). +<%# + This is a fragment file, it will be merged into to root template if available. + EJS fragments will process % delimiter tags in template and & delimiter tags in the merge process. +-%> +<&_ if (fragment.introSection) { -&> +This application was generated using JHipster <%= jhipsterVersion %> and JHipster .Net Core <%= jhipsterDotnetVersion %>, you can find documentation and help at https://jhipsternet.readthedocs.io/en/latest/index.html and [<%= documentationArchiveUrl %>](<%= documentationArchiveUrl %>). + +<&_ } -&> + +<&_ if (fragment.structureSection) { -&> +Node is required for generation and recommended for development. `package.json` is always generated for a better development experience with prettier, commit hooks, scripts and so on. + +In the project root, JHipster generates configuration files for tools like git, prettier, eslint, husky, and others that are well known and you can find references in the web. + +- `.yo-rc.json` - Yeoman configuration file +JHipster configuration is stored in this file at `generator-jhipster` key. You may find `generator-jhipster-*` for specific blueprints configuration. +- `.yo-resolve` (optional) - Yeoman conflict resolver +Allows to use a specific action when conflicts are found skipping prompts for files that matches a pattern. Each line should match `[pattern] [action]` with pattern been a [Minimatch](https://github.com/isaacs/minimatch#minimatch) pattern and action been one of skip (default if ommited) or force. Lines starting with `#` are considered comments and are ignored. +- `.jhipster/*.json` - JHipster entity configuration files +- `<%- dockerServicesDir %>` - Docker configurations for the application and services that the application depends on +- `<%- clientRootDir %>` - Web Application folder -## Development +<&_ } -&> +<&_ if (fragment.developmentSection) { -&> + <%_ if (skipClient) { _%> +To start your application in the dev profile, run: + +``` +dotnet run --verbosity normal --project ./src/<%= pascalizedBaseName %>/<%= pascalizedBaseName %>.csproj +``` + +<%_ } _%> <%_ if (!skipClient && clientFramework === "Blazor") { _%> Before you can build this project, you need to verify if [libman](https://github.com/aspnet/LibraryManager) and [webcompiler](https://github.com/excubo-ag/WebCompiler) are installed. (If the application is generated, the generator installed this tools for you) @@ -81,7 +106,7 @@ We use npm scripts and [Webpack][] as our build system. Run the following commands in two separate terminals to create a blissful development experience where your browser auto-refreshes when files change on your hard drive. - dotnet run --verbosity normal --project ./src/<%= pascalizedBaseName %>/<%= pascalizedBaseName %>.csproj + npm --prefix ./src/<%= pascalizedBaseName %>/ClientApp start npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by @@ -90,106 +115,57 @@ Add the `help` flag on any command to see how you can use it. For example, `npm The `npm --prefix ./src/<%= pascalizedBaseName %>/ClientApp run` command will list all of the scripts available to run for this project. -### Managing dependencies + <%_ } _%> -For example, to add [Leaflet][] library as a runtime dependency of your application, you would run following command: +<&_ } -&> - npm --prefix ./src/<%= pascalizedBaseName %>/ClientApp install --save --save-exact leaflet +<&_ if (fragment.testingSection) { -&> +### .Net Backend tests -To benefit from TypeScript type definitions from [DefinitelyTyped][] repository in development, you would run following command: - - npm --prefix ./src/<%= pascalizedBaseName %>/ClientApp install --save-dev --save-exact @types/leaflet - -Then you would import the JS and CSS files specified in library's installation instructions so that [Webpack][] knows about them: -<%_ if (clientFramework === 'angularX') { _%> -Edit [<%= mainClientDir %>/app/vendor.ts](<%= mainClientDir %>/app/vendor.ts) file: -~~~ -import 'leaflet/dist/leaflet.js'; -~~~ - -Edit [<%= mainClientDir %>/content/css/vendor.css](<%= mainClientDir %>/content/css/vendor.css) file: -~~~ -@import '~leaflet/dist/leaflet.css'; -~~~ -<%_ } _%> -Note: there are still few other things remaining to do for Leaflet that we won't detail here. -<%_ } _%> - -<%_ if (clientFramework === 'angularX' && applicationType !== 'microservice') { _%> -### Using angular-cli - -You can also use [Angular CLI][] to generate some custom client code. - -For example, the following command: +To launch your application's tests, run: - ng generate component my-component +``` +dotnet test --verbosity normal +``` -will generate few files: +<&_ } -&> - create <%= mainClientDir %>/src/app/my-component/my-component.component.html - create <%= mainClientDir %>/src/app/my-component/my-component.component.ts - update <%= mainClientDir %>/src/app/app.module.ts -<%_ } _%> - -<%_ if (!skipClient && clientFramework !== "Blazor" && clientFramework !== "Xamarin") { _%> -## Building for production +<&_ if (fragment.productionSection) { -&> +### .Net Production builds To build the artifacts and optimize the <%= baseName %> application for production, run: - cd ./src/<%= pascalizedBaseName %> - rm -rf ./src/<%= pascalizedBaseName %>/wwwroot - dotnet publish --verbosity normal -c Release -o ./app/out ./<%= pascalizedBaseName %>.csproj +``` +cd ./src/<%= pascalizedBaseName %> +rm -rf ./src/<%= pascalizedBaseName %>/wwwroot +dotnet publish --verbosity normal -c Release -o ./app/out ./<%= pascalizedBaseName %>.csproj +``` The `./src/<%= pascalizedBaseName %>/app/out` directory will contain your application dll and its depedencies. -<%_ } _%> - -<%_ if (!skipClient) { _%> -This will concatenate and minify the client CSS and JavaScript files. It will also modify `index.html` so it references these new files. -<%_ } _%> - -## Code style / formatting - -To format the dotnet code, run - dotnet format +<&_ } -&> -## Testing +<&_ if (fragment.othersSection) { -&> -To launch your application's tests, run: +### Code style / formatting - dotnet test --verbosity normal -<%_ if (!skipClient && clientFramework !== "Blazor" && clientFramework !== "Xamarin") { _%> -### Client tests - -In ClientApp folder run : - - npm test - -<%_ } _%> - -### Generate entities +To format the dotnet code, run -With cli -```bash -jhipster entity ``` - -or with jdl (https://start.jhipster.tech/jdl-studio/) -```bash -jhipster import-jdl my_file.jdl +dotnet format ``` ### Code quality By Script : -1. Run Sonar in container : ```docker-compose -f ./docker/sonar.yml up -d``` +1. Run Sonar in container : ```docker compose -f ./docker/sonar.yml up -d``` 2. Wait container was up Run ```SonarAnalysis.ps1``` and go to http://localhost:9001 Manually : -1. Run Sonar in container : ```docker-compose -f ./docker/sonar.yml up -d``` +1. Run Sonar in container : ```docker compose -f ./docker/sonar.yml up -d``` 2. Install sonar scanner for .net : @@ -205,7 +181,7 @@ Manually : ### Monitoring -1. Run container (uncomment chronograf and kapacitor if you would use it): ```docker-compose -f ./docker/monitoring.yml up -d``` +1. Run container (uncomment chronograf and kapacitor if you would use it): ```docker compose -f ./docker/monitoring.yml up -d``` 2. Go to http://localhost:3000 (or http://localhost:8888 if you use chronograf) @@ -215,7 +191,7 @@ Manually : 5. (Only for chronograf) You can now add dashboard (like docker), see your app log in Cronograf Log viewer and send alert with kapacitor -## Build a Docker image +### Build a Docker image You can also fully dockerize your application and all the services that it depends on. To achieve this, first build a docker image of your app by running: @@ -248,25 +224,16 @@ docker run -p 8081:80 -e ServerUrl=https://localhost:8080 <%= baseName.toLowerCa Or you can simply run : ```bash -docker-compose -f .\docker\app.yml build +docker compose -f .\docker\app.yml build ``` And ```bash -docker-compose -f .\docker\app.yml up +docker compose -f .\docker\app.yml up ``` -<% if (testFrameworks.includes("gatling")) { %>[Gatling]: http://gatling.io/<% } %> -<%_ if (!skipClient && clientFramework !== "Blazor" && clientFramework !== "Xamarin") {_%> -[Node.js]: https://nodejs.org/ -[Yarn]: https://yarnpkg.org/ -[Webpack]: https://webpack.github.io/ -[Angular CLI]: https://cli.angular.io/ -[BrowserSync]: http://www.browsersync.io/ -[Jest]: https://facebook.github.io/jest/ -[Jasmine]: http://jasmine.github.io/2.0/introduction.html -[Protractor]: https://angular.github.io/protractor/ -[Leaflet]: http://leafletjs.com/ -[DefinitelyTyped]: http://definitelytyped.org/ -<%_ } _%> +<&_ } -&> + +<&_ if (fragment.referenceSection) { -&> +<&_ } -&> diff --git a/generators/server/templates/dotnetcore/src/Directory.Packages.props b/generators/dotnetcore/templates/dotnetcore/src/Directory.Packages.props similarity index 99% rename from generators/server/templates/dotnetcore/src/Directory.Packages.props rename to generators/dotnetcore/templates/dotnetcore/src/Directory.Packages.props index 2fc2c8208..85469ce63 100644 --- a/generators/server/templates/dotnetcore/src/Directory.Packages.props +++ b/generators/dotnetcore/templates/dotnetcore/src/Directory.Packages.props @@ -84,7 +84,7 @@ <%_ break; - case 'postgres': _%> + case 'postgresql': _%> diff --git a/generators/server/templates/dotnetcore/src/Project.Application/ApplicationClassesAssemblyHelper.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/ApplicationClassesAssemblyHelper.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/ApplicationClassesAssemblyHelper.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/ApplicationClassesAssemblyHelper.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountActivateCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountActivateCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountActivateCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountActivateCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountActivateCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountActivateCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountActivateCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountActivateCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountChangePasswordCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountChangePasswordCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountChangePasswordCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountChangePasswordCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountChangePasswordCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountChangePasswordCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountChangePasswordCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountChangePasswordCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountCreateCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountCreateCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountCreateCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountCreateCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountCreateCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountCreateCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountCreateCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountCreateCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordFinishCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordFinishCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordFinishCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordFinishCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordFinishCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordFinishCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordFinishCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountResetPasswordFinishCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountSaveCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountSaveCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountSaveCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountSaveCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountSaveCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountSaveCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/Account/AccountSaveCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/Account/AccountSaveCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserCreateCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserCreateCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserCreateCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserCreateCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserCreateCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserCreateCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserCreateCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserCreateCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserDeleteCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserDeleteCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserDeleteCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserDeleteCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserDeleteCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserDeleteCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserDeleteCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserDeleteCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserUpdateCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserUpdateCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserUpdateCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserUpdateCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserUpdateCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserUpdateCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/User/UserUpdateCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/User/UserUpdateCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/UserJwt/UserJwtAuthorizeCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/UserJwt/UserJwtAuthorizeCommand.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/UserJwt/UserJwtAuthorizeCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/UserJwt/UserJwtAuthorizeCommand.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Commands/UserJwt/UserJwtAuthorizeCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/UserJwt/UserJwtAuthorizeCommandHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Commands/UserJwt/UserJwtAuthorizeCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/UserJwt/UserJwtAuthorizeCommandHandler.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityCreateCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_CreateCommand.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityCreateCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_CreateCommand.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityCreateCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_CreateCommandHandler.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityCreateCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_CreateCommandHandler.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityDeleteCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_DeleteCommand.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityDeleteCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_DeleteCommand.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityDeleteCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_DeleteCommandHandler.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityDeleteCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_DeleteCommandHandler.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityUpdateCommand.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_UpdateCommand.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityUpdateCommand.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_UpdateCommand.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityUpdateCommandHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_UpdateCommandHandler.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Commands/EntityUpdateCommandHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Commands/_persistClass_/_persistClass_UpdateCommandHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Project.csproj.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Project.csproj.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Project.csproj.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Project.csproj.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetAuthenticatedQuery.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetAuthenticatedQuery.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetAuthenticatedQuery.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetAuthenticatedQuery.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetAuthenticatedQueryHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetAuthenticatedQueryHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetAuthenticatedQueryHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetAuthenticatedQueryHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetQuery.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetQuery.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetQuery.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetQuery.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetQueryHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetQueryHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetQueryHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/Account/AccountGetQueryHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllPublicUsersQuery.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllPublicUsersQuery.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllPublicUsersQuery.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllPublicUsersQuery.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllPublicUsersQueryHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllPublicUsersQueryHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllPublicUsersQueryHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllPublicUsersQueryHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllQuery.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllQuery.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllQuery.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllQuery.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllQueryHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllQueryHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllQueryHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAllQueryHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAuthoritiesQuery.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAuthoritiesQuery.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAuthoritiesQuery.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAuthoritiesQuery.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAuthoritiesQueryHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAuthoritiesQueryHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAuthoritiesQueryHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetAuthoritiesQueryHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetQuery.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetQuery.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetQuery.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetQuery.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetQueryHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetQueryHandler.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Application/Queries/User/UserGetQueryHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/User/UserGetQueryHandler.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Queries/EntityGetAllQuery.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/_persistClass_/_persistClass_GetAllQuery.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Queries/EntityGetAllQuery.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/_persistClass_/_persistClass_GetAllQuery.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Queries/EntityGetAllQueryHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/_persistClass_/_persistClass_GetAllQueryHandler.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Queries/EntityGetAllQueryHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/_persistClass_/_persistClass_GetAllQueryHandler.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Queries/EntityGetQuery.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/_persistClass_/_persistClass_GetQuery.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Queries/EntityGetQuery.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/_persistClass_/_persistClass_GetQuery.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Application/Queries/EntityGetQueryHandler.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/_persistClass_/_persistClass_GetQueryHandler.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Application/Queries/EntityGetQueryHandler.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Application/Queries/_persistClass_/_persistClass_GetQueryHandler.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Constants/Constants.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Constants/Constants.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Constants/Constants.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Constants/Constants.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Constants/ErrorConstants.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Constants/ErrorConstants.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Constants/ErrorConstants.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Constants/ErrorConstants.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Constants/JwtConstants.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Constants/JwtConstants.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Constants/JwtConstants.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Constants/JwtConstants.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Constants/RolesConstants.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Constants/RolesConstants.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Constants/RolesConstants.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Constants/RolesConstants.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Crosscutting/Enums/Enum.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Enums/Enum.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Crosscutting/Enums/Enum.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Enums/Enum.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/BadRequestAlertException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/BadRequestAlertException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/BadRequestAlertException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/BadRequestAlertException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/BaseException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/BaseException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/BaseException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/BaseException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/EmailAlreadyUsedException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/EmailAlreadyUsedException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/EmailAlreadyUsedException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/EmailAlreadyUsedException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/EmailNotFoundException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/EmailNotFoundException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/EmailNotFoundException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/EmailNotFoundException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/InternalServerErrorException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/InternalServerErrorException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/InternalServerErrorException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/InternalServerErrorException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/InvalidPasswordException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/InvalidPasswordException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/InvalidPasswordException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/InvalidPasswordException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/LoginAlreadyUsedException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/LoginAlreadyUsedException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Exceptions/LoginAlreadyUsedException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Exceptions/LoginAlreadyUsedException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Project.csproj.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Project.csproj.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Project.csproj.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Project.csproj.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Crosscutting/Utilities/RandomUtil.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Utilities/RandomUtil.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Crosscutting/Utilities/RandomUtil.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Crosscutting/Utilities/RandomUtil.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain.Services/AuthenticationService.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/AuthenticationService.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain.Services/AuthenticationService.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/AuthenticationService.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain.Services/MailService.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/MailService.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain.Services/MailService.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/MailService.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain.Services/Project.csproj.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/Project.csproj.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain.Services/Project.csproj.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/Project.csproj.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain.Services/ServicesClassesAssemblyHelper.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/ServicesClassesAssemblyHelper.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain.Services/ServicesClassesAssemblyHelper.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/ServicesClassesAssemblyHelper.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain.Services/UserService.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/UserService.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain.Services/UserService.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/UserService.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Domain.Services/Service.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/_entityClass_Service.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Domain.Services/Service.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain.Services/_entityClass_Service.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Entities/AuditedEntityBase.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/AuditedEntityBase.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Entities/AuditedEntityBase.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/AuditedEntityBase.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Entities/BaseEntity.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/BaseEntity.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Entities/BaseEntity.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/BaseEntity.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Entities/Interfaces/IAuditedEntityBase.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/Interfaces/IAuditedEntityBase.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Entities/Interfaces/IAuditedEntityBase.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/Interfaces/IAuditedEntityBase.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Entities/MongoBaseEntity.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/MongoBaseEntity.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Entities/MongoBaseEntity.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/MongoBaseEntity.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Entities/Role.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/Role.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Entities/Role.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/Role.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Entities/User.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/User.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Entities/User.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/User.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Entities/UserRole.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/UserRole.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Entities/UserRole.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/UserRole.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Domain/Entities/Entity.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/_persistClass_.cs.ejs similarity index 98% rename from generators/entity-server/templates/dotnetcore/src/Project.Domain/Entities/Entity.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/_persistClass_.cs.ejs index 41d93d9e2..2034dfaf8 100644 --- a/generators/entity-server/templates/dotnetcore/src/Project.Domain/Entities/Entity.cs.ejs +++ b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Entities/_persistClass_.cs.ejs @@ -49,7 +49,7 @@ namespace <%= namespace %>.Domain.Entities let required = false; const fieldValidate = fields[idx].fieldValidate; const fieldValidateRules = fields[idx].fieldValidateRules; - const fieldType = equivalentCSharpType(fields[idx].fieldType); + const fieldType = fields[idx].cSharpType; const fieldNamePascalized = fields[idx].fieldNamePascalized; if (fieldValidate === true) { if (fieldValidateRules.includes('required')) { diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Project.csproj.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Project.csproj.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Project.csproj.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Project.csproj.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IFluentRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IFluentRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IFluentRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IFluentRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IGenericRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IGenericRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IGenericRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IGenericRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlFluentRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlFluentRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlFluentRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlFluentRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlGenericRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlGenericRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlGenericRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlGenericRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IReadOnlyGenericRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IReadOnlyGenericRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IReadOnlyGenericRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IReadOnlyGenericRepository.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IReadOnlyEntityRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IReadOnly_persistClass_Repository.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IReadOnlyEntityRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IReadOnly_persistClass_Repository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IUnitOfWork.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IUnitOfWork.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IUnitOfWork.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IUnitOfWork.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IEntityRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/I_persistClass_Repository.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/IEntityRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Repositories/Interfaces/I_persistClass_Repository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IAuthenticationService.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IAuthenticationService.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IAuthenticationService.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IAuthenticationService.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IMailService.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IMailService.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IMailService.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IMailService.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IUserService.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IUserService.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IUserService.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IUserService.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IService.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/I_entityClass_Service.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/IService.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/I_entityClass_Service.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Domain/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Domain/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Dto/AuditedEntityBaseDto.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/AuditedEntityBaseDto.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Dto/AuditedEntityBaseDto.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Dto/AuditedEntityBaseDto.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Dto/KeyAndPasswordDto.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/KeyAndPasswordDto.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Dto/KeyAndPasswordDto.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Dto/KeyAndPasswordDto.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Dto/LoginDto.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/LoginDto.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Dto/LoginDto.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Dto/LoginDto.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Dto/ManagedUserDto.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/ManagedUserDto.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Dto/ManagedUserDto.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Dto/ManagedUserDto.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Dto/PasswordChangeDto.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/PasswordChangeDto.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Dto/PasswordChangeDto.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Dto/PasswordChangeDto.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Dto/ProfileInfoDto.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/ProfileInfoDto.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Dto/ProfileInfoDto.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Dto/ProfileInfoDto.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Dto/Project.csproj.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/Project.csproj.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Dto/Project.csproj.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Dto/Project.csproj.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Dto/UserDto.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/UserDto.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Dto/UserDto.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Dto/UserDto.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Dto/Dto.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/_dtoClass_.cs.ejs similarity index 96% rename from generators/entity-server/templates/dotnetcore/src/Project.Dto/Dto.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Dto/_dtoClass_.cs.ejs index 1d7e75a7d..7314674c5 100644 --- a/generators/entity-server/templates/dotnetcore/src/Project.Dto/Dto.cs.ejs +++ b/generators/dotnetcore/templates/dotnetcore/src/Project.Dto/_dtoClass_.cs.ejs @@ -62,7 +62,7 @@ namespace <%= namespace %>.Dto <%_ } else if (field && field.fieldIsEnum) { _%> public <%= field.fieldType %> <%= reference.nameCapitalized %> { get; set; } <%_ } else { _%> - public <%= equivalentCSharpType(reference.type) %> <%= reference.nameCapitalized %> { get; set; } + public <%= field.cSharpType %> <%= reference.nameCapitalized %> { get; set; } <%_ } _%> <%_ } _%> diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Configuration/IMongoDatabaseConfig.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Configuration/IMongoDatabaseConfig.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Configuration/IMongoDatabaseConfig.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Configuration/IMongoDatabaseConfig.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Configuration/MongoDatabaseConfig.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Configuration/MongoDatabaseConfig.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Configuration/MongoDatabaseConfig.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Configuration/MongoDatabaseConfig.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Configuration/SecuritySettings.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Configuration/SecuritySettings.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Configuration/SecuritySettings.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Configuration/SecuritySettings.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext_withEntities_.cs.ejs similarity index 98% rename from generators/entity-server/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext_withEntities_.cs.ejs index 987989148..3495e01bb 100644 --- a/generators/entity-server/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext.cs.ejs +++ b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/ApplicationDatabaseContext_withEntities_.cs.ejs @@ -116,7 +116,7 @@ namespace <%= namespace %>.Infrastructure.Data entity.definition.relationships.forEach(relationship => { if (relationship.relationshipType === 'many-to-many') { // executed when importing entities by jdl (jhipster import-jdl fileName.jdl) - if (relationship.ownerSide) { + if (relationship.relationshipSide === 'left') { let relationshipNamePascalized = toPascalCase(relationship.relationshipName); let relationshipNamePascalizedPlural = pluralize(relationshipNamePascalized); let relationshipFieldNamePascalizedPlural = relationship.relationshipFieldNamePascalizedPlural; @@ -146,7 +146,7 @@ namespace <%= namespace %>.Infrastructure.Data relationships.forEach(relationship => { if (relationship.relationshipType === 'many-to-many') { // executed when using the entity generator to add relationships (jhipster entity entityName) - if (relationship.ownerSide) { + if (relationship.relationshipSide === 'left') { let ownerRelationshipFieldName = pascalizedEntityClass; let nonOwnerRelationshipFieldName = relationship.otherEntityNamePascalized; let relationshipNamePascalizedPlural = relationship.relationshipNamePascalizedPlural; diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/DbSetExtensions.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/DbSetExtensions.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/DbSetExtensions.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/DbSetExtensions.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/NoSqlPagination.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/NoSqlPagination.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/NoSqlPagination.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/NoSqlPagination.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/PropertyAccessorCache.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/PropertyAccessorCache.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/PropertyAccessorCache.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Extensions/PropertyAccessorCache.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/IMongoDatabaseContext.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/IMongoDatabaseContext.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/IMongoDatabaseContext.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/IMongoDatabaseContext.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/MongoDatabaseContext.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/MongoDatabaseContext.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/MongoDatabaseContext.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/MongoDatabaseContext.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/FluentRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/FluentRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/FluentRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/FluentRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/GenericRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/GenericRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/GenericRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/GenericRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoDatabaseUserStore.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoDatabaseUserStore.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoDatabaseUserStore.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoDatabaseUserStore.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoFluentRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoFluentRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoFluentRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoFluentRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoGenericRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoGenericRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoGenericRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoGenericRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoReadOnlyGenericRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoReadOnlyGenericRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoReadOnlyGenericRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/MongoReadOnlyGenericRepository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/NoSqlPagination.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/NoSqlPagination.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/NoSqlPagination.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/NoSqlPagination.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/ReadOnlyEntityRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/ReadOnly_persistClass_Repository.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/ReadOnlyEntityRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/ReadOnly_persistClass_Repository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/UnitOfWork.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/UnitOfWork.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/UnitOfWork.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/UnitOfWork.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/EntityRepository.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/_persistClass_Repository.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/EntityRepository.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Data/Repositories/_persistClass_Repository.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Project.csproj.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Project.csproj.ejs similarity index 99% rename from generators/server/templates/dotnetcore/src/Project.Infrastructure/Project.csproj.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Project.csproj.ejs index 90b98982c..ec057c828 100644 --- a/generators/server/templates/dotnetcore/src/Project.Infrastructure/Project.csproj.ejs +++ b/generators/dotnetcore/templates/dotnetcore/src/Project.Infrastructure/Project.csproj.ejs @@ -36,7 +36,7 @@ <%_ break; - case 'postgres': _%> + case 'postgresql': _%> diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/AppSettingsStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/AppSettingsStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/AppSettingsStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/AppSettingsStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/AutoMapper/AutoMapperProfile.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/AutoMapper/AutoMapperProfile.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/AutoMapper/AutoMapperProfile.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/AutoMapper/AutoMapperProfile.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project/Configuration/AutoMapper/AutoMapperProfile.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/AutoMapper/AutoMapperProfile_withEntities_.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project/Configuration/AutoMapper/AutoMapperProfile.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/AutoMapper/AutoMapperProfile_withEntities_.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/AutoMapperStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/AutoMapperStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/AutoMapperStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/AutoMapperStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/ConfigurationHelper.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/ConfigurationHelper.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/ConfigurationHelper.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/ConfigurationHelper.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/Consul/ConsulOptions.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/Consul/ConsulOptions.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/Consul/ConsulOptions.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/Consul/ConsulOptions.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/Consul/ConsulStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/Consul/ConsulStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/Consul/ConsulStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/Consul/ConsulStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/DatabaseStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/DatabaseStartup.cs.ejs similarity index 99% rename from generators/server/templates/dotnetcore/src/Project/Configuration/DatabaseStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/DatabaseStartup.cs.ejs index 4e78369b4..7b8d38a5e 100644 --- a/generators/server/templates/dotnetcore/src/Project/Configuration/DatabaseStartup.cs.ejs +++ b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/DatabaseStartup.cs.ejs @@ -93,7 +93,7 @@ public static class DatabaseConfiguration services.AddScoped(provider => provider.GetService()); <%_ break; - case 'postgres': _%> + case 'postgresql': _%> // Opt out of the new timestamp mapping logic for postgres (https://www.npgsql.org/efcore/release-notes/6.0.html#opting-out-of-the-new-timestamp-mapping-logic) AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); services.AddDbContext(context => { context.UseNpgsql(connectionString); }); @@ -119,7 +119,7 @@ public static class DatabaseConfiguration services.AddScoped(provider => provider.GetService()); <%_ break; - case 'postgres': _%> + case 'postgresql': _%> // Opt out of the new timestamp mapping logic for postgres (https://www.npgsql.org/efcore/release-notes/6.0.html#opting-out-of-the-new-timestamp-mapping-logic) AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); services.AddDbContext(context => { context.UseNpgsql(connectionString); }); diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/IMongoDatabaseConfig.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/IMongoDatabaseConfig.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/IMongoDatabaseConfig.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/IMongoDatabaseConfig.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/IdentityStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/IdentityStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/IdentityStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/IdentityStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/LoggerStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/LoggerStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/LoggerStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/LoggerStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/MongoDatabaseConfig.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/MongoDatabaseConfig.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/MongoDatabaseConfig.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/MongoDatabaseConfig.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/MvcStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/MvcStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/MvcStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/MvcStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/ProblemDetailsStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/ProblemDetailsStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/ProblemDetailsStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/ProblemDetailsStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/RepositoryStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/RepositoryStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/RepositoryStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/RepositoryStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/SecurityStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/SecurityStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/SecurityStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/SecurityStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/ServiceStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/ServiceStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/ServiceStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/ServiceStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Configuration/SwaggerStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/SwaggerStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Configuration/SwaggerStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Configuration/SwaggerStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Controllers/AccountController.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/AccountController.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Controllers/AccountController.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/AccountController.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Controllers/AuthController.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/AuthController.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Controllers/AuthController.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/AuthController.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Controllers/ProfileInfoController.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/ProfileInfoController.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Controllers/ProfileInfoController.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/ProfileInfoController.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Controllers/PublicUsersController.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/PublicUsersController.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Controllers/PublicUsersController.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/PublicUsersController.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Controllers/UserJwtController.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/UserJwtController.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Controllers/UserJwtController.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/UserJwtController.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Controllers/UsersController.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/UsersController.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Controllers/UsersController.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/UsersController.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/src/Project/Controllers/EntityController.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/_pascalizedEntityClassPlural_Controller.cs.ejs similarity index 100% rename from generators/entity-server/templates/dotnetcore/src/Project/Controllers/EntityController.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Controllers/_pascalizedEntityClassPlural_Controller.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/IStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/IStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/IStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/IStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Program.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Program.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Program.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Program.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Project.csproj.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Project.csproj.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Project.csproj.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Project.csproj.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Properties/launchSettings.json.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Properties/launchSettings.json.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Properties/launchSettings.json.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Properties/launchSettings.json.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Security/BCryptPasswordHasher.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Security/BCryptPasswordHasher.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Security/BCryptPasswordHasher.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Security/BCryptPasswordHasher.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Security/Jwt/RoleClaimsTransformation.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Security/Jwt/RoleClaimsTransformation.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Security/Jwt/RoleClaimsTransformation.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Security/Jwt/RoleClaimsTransformation.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Security/Jwt/TokenProvider.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Security/Jwt/TokenProvider.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Security/Jwt/TokenProvider.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Security/Jwt/TokenProvider.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Security/PoliciesConstants.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Security/PoliciesConstants.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Security/PoliciesConstants.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Security/PoliciesConstants.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Security/UserNotActivatedException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Security/UserNotActivatedException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Security/UserNotActivatedException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Security/UserNotActivatedException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Security/UsernameNotFoundException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Security/UsernameNotFoundException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Security/UsernameNotFoundException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Security/UsernameNotFoundException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Startup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Startup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Startup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Startup.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Extensions/ActionResultExtensions.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Extensions/ActionResultExtensions.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Extensions/ActionResultExtensions.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Extensions/ActionResultExtensions.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Extensions/ActionResultWithHeaders.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Extensions/ActionResultWithHeaders.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Extensions/ActionResultWithHeaders.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Extensions/ActionResultWithHeaders.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Extensions/HttpRequestExtensions.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Extensions/HttpRequestExtensions.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Extensions/HttpRequestExtensions.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Extensions/HttpRequestExtensions.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Filters/ValidateModelAttribute.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Filters/ValidateModelAttribute.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Filters/ValidateModelAttribute.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Filters/ValidateModelAttribute.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Rest/Problems/ExceptionTranslator.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Problems/ExceptionTranslator.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Rest/Problems/ExceptionTranslator.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Problems/ExceptionTranslator.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Rest/Problems/ProblemDetailsConfiguration.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Problems/ProblemDetailsConfiguration.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Rest/Problems/ProblemDetailsConfiguration.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Problems/ProblemDetailsConfiguration.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Rest/Problems/ValidationFailedException.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Problems/ValidationFailedException.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Rest/Problems/ValidationFailedException.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Problems/ValidationFailedException.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Rest/Utilities/ActionResultUtil.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Utilities/ActionResultUtil.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Rest/Utilities/ActionResultUtil.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Utilities/ActionResultUtil.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Rest/Utilities/HeaderUtil.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Utilities/HeaderUtil.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Rest/Utilities/HeaderUtil.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Utilities/HeaderUtil.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/Web/Rest/Utilities/PaginationUtil.cs.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Utilities/PaginationUtil.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/src/Project/Web/Rest/Utilities/PaginationUtil.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/Web/Rest/Utilities/PaginationUtil.cs.ejs diff --git a/generators/server/templates/dotnetcore/src/Project/appsettings.Development.json.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/appsettings.Development.json.ejs similarity index 72% rename from generators/server/templates/dotnetcore/src/Project/appsettings.Development.json.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/appsettings.Development.json.ejs index 187881262..0815ec903 100644 --- a/generators/server/templates/dotnetcore/src/Project/appsettings.Development.json.ejs +++ b/generators/dotnetcore/templates/dotnetcore/src/Project/appsettings.Development.json.ejs @@ -36,17 +36,17 @@ <%_ break; case 'mssql': _%> "ConnectionStrings": { - "AppDbContext": "Server=db;Database=master;User=sa;Password=Password!12;Trusted_Connection=False;Encrypt=True;TrustServerCertificate=True;" + "AppDbContext": "Server=mssql;Database=<%= baseName %>;User=<%- databaseData.defaultUsername %>;Password=<%- databaseData.defaultPassword %>;Trusted_Connection=False;Encrypt=True;TrustServerCertificate=True;" }, <%_ break; - case 'postgres': _%> + case 'postgresql': _%> "ConnectionStrings": { - "AppDbContext": "Server=db;Database=jhipster;Port=5432;User Id=postgres;Password=postgres;Integrated Security=true;Pooling=true;" + "AppDbContext": "Server=postgresql;Database=<%= baseName %>;Port=5432;User Id=<%= baseName %>;Password=;Integrated Security=true;Pooling=true;" }, <%_ break; case 'mysql': _%> "ConnectionStrings": { - "AppDbContext": "Server=db;Port=3306;Database=jhipster;User=root;Password=root;" + "AppDbContext": "Server=mysql;Port=3306;Database=<%= baseName.toLowerCase() %>;User=<%- databaseData.defaultUsername %>;Password=;" }, <%_ break; case 'mongodb': _%> @@ -54,13 +54,13 @@ "DataSource": ":memory:" }, "MongoDatabaseConfig": { - "ConnectionString": "mongodb://localhost:27017", + "ConnectionString": "mongodb://mongodb:27017", "DatabaseName": "<%= baseName %>" }, <%_ break; case 'oracle': _%> "ConnectionStrings": { - "AppDbContext": "User Id=system;Password=oracle;Data Source=db:1521/xe" + "AppDbContext": "User Id=<%- databaseData.defaultUsername %>;Password=<%- databaseData.defaultPassword %>;Data Source=oracle:1521/<%- databaseData.defaultDatabaseName %>" }, <%_ break; }_%> diff --git a/generators/server/templates/dotnetcore/src/Project/appsettings.Production.json.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/appsettings.Production.json.ejs similarity index 76% rename from generators/server/templates/dotnetcore/src/Project/appsettings.Production.json.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/appsettings.Production.json.ejs index e0ee5218b..3fb91c2d0 100644 --- a/generators/server/templates/dotnetcore/src/Project/appsettings.Production.json.ejs +++ b/generators/dotnetcore/templates/dotnetcore/src/Project/appsettings.Production.json.ejs @@ -46,17 +46,17 @@ <%_ break; case 'mssql': _%> "ConnectionStrings": { - "AppDbContext": "Server=db;Database=master;User=sa;Password=Password!12;Trusted_Connection=False;Encrypt=True;TrustServerCertificate=True;" + "AppDbContext": "Server=mssql;Database=<%= baseName %>;User=<%- databaseData.defaultUsername %>;Password=<%- databaseData.defaultPassword %>;Trusted_Connection=False;Encrypt=True;TrustServerCertificate=True;" }, <%_ break; - case 'postgres': _%> + case 'postgresql': _%> "ConnectionStrings": { - "AppDbContext": "Server=db;Database=jhipster;Port=5432;User Id=postgres;Password=postgres;Integrated Security=true;Pooling=true;" + "AppDbContext": "Server=postgresql;Database=<%= baseName %>;Port=5432;User Id=<%= baseName %>;Password=;Integrated Security=true;Pooling=true;" }, <%_ break; case 'mysql': _%> "ConnectionStrings": { - "AppDbContext": "Server=db;Port=3306;Database=jhipster;User=root;Password=root;" + "AppDbContext": "Server=mysql;Port=3306;Database=<%= baseName.toLowerCase() %>;User=<%- databaseData.defaultUsername %>;Password=;" }, <%_ break; case 'mongodb': _%> @@ -64,13 +64,13 @@ "DataSource": ":memory:" }, "MongoDatabaseConfig": { - "ConnectionString": "mongodb://db:27017", + "ConnectionString": "mongodb://mongodb:27017", "DatabaseName": "<%= baseName %>" }, <%_ break; case 'oracle': _%> "ConnectionStrings": { - "AppDbContext": "User Id=system;Password=oracle;Data Source=db:1521/xe" + "AppDbContext": "User Id=<%- databaseData.defaultUsername %>;Password=<%- databaseData.defaultPassword %>;Data Source=oracle:1521/<%- databaseData.defaultDatabaseName %>" }, <%_ break; }_%> diff --git a/generators/server/templates/dotnetcore/src/Project/appsettings.json.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/appsettings.json.ejs similarity index 81% rename from generators/server/templates/dotnetcore/src/Project/appsettings.json.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/appsettings.json.ejs index 7ab52efd9..1f7ca8b4c 100644 --- a/generators/server/templates/dotnetcore/src/Project/appsettings.json.ejs +++ b/generators/dotnetcore/templates/dotnetcore/src/Project/appsettings.json.ejs @@ -34,17 +34,17 @@ <%_ break; case 'mssql': _%> "ConnectionStrings": { - "AppDbContext": "Server=db;Database=master;User=sa;Password=Password!12;Trusted_Connection=False;Encrypt=True;TrustServerCertificate=True;" + "AppDbContext": "Server=mssql;Database=<%= baseName %>;User=<%- databaseData.defaultUsername %>;Password=<%- databaseData.defaultPassword %>;Trusted_Connection=False;Encrypt=True;TrustServerCertificate=True;" }, <%_ break; - case 'postgres': _%> + case 'postgresql': _%> "ConnectionStrings": { - "AppDbContext": "Server=db;Database=jhipster;Port=5432;User Id=postgres;Password=postgres;Integrated Security=true;Pooling=true;" + "AppDbContext": "Server=postgresql;Database=<%= baseName %>;Port=5432;User Id=<%= baseName %>;Password=;Integrated Security=true;Pooling=true;" }, <%_ break; case 'mysql': _%> "ConnectionStrings": { - "AppDbContext": "Server=db;Port=3306;Database=jhipster;User=root;Password=root;" + "AppDbContext": "Server=mysql;Port=3306;Database=<%= baseName.toLowerCase() %>;User=<%- databaseData.defaultUsername %>;Password=;" }, <%_ break; case 'mongodb': _%> @@ -52,7 +52,7 @@ "DataSource": ":memory:" }, "MongoDatabaseConfig": { - "ConnectionString": "mongodb://localhost:27017", + "ConnectionString": "mongodb://mongodb:27017", "DatabaseName": "<%= baseName %>" }, "MongoDatabaseConfigUnitTests": { @@ -62,7 +62,7 @@ <%_ break; case 'oracle': _%> "ConnectionStrings": { - "AppDbContext": "User Id=system;Password=oracle;Data Source=db:1521/xe" + "AppDbContext": "User Id=<%- databaseData.defaultUsername %>;Password=<%- databaseData.defaultPassword %>;Data Source=oracle:1521/<%- databaseData.defaultDatabaseName %>" }, <%_ break; }_%> @@ -71,7 +71,7 @@ "Host": "http://localhost:8500", <%_ if (serviceDiscoveryType === 'consul' && applicationType !== 'gateway') { _%> "Enabled": true, - "service": "<%= lowercaseBaseName %>-service", + "service": "<%= lowercaseBaseName %>", "address": "localhost", "Port": <%= serverPortSecured %>, "PingEnabled": false @@ -82,7 +82,7 @@ "Authentication": { <%_ if (authenticationType === 'jwt') { _%> "Jwt": { - "Base64Secret": "bXktc2VjcmV0LWtleS13aGljaC1zaG91bGQtYmUtY2hhbmdlZC1pbi1wcm9kdWN0aW9uLWFuZC1iZS1iYXNlNjQtZW5jb2RlZAo=", + "Base64Secret": "<%- jwtSecretKey %>", "TokenValidityInSeconds": 86400, "TokenValidityInSecondsForRememberMe": 2592000 } diff --git a/generators/server/templates/dotnetcore/src/Project/ocelot.json.ejs b/generators/dotnetcore/templates/dotnetcore/src/Project/ocelot.json.ejs similarity index 59% rename from generators/server/templates/dotnetcore/src/Project/ocelot.json.ejs rename to generators/dotnetcore/templates/dotnetcore/src/Project/ocelot.json.ejs index 77dd845cd..1c426bd39 100644 --- a/generators/server/templates/dotnetcore/src/Project/ocelot.json.ejs +++ b/generators/dotnetcore/templates/dotnetcore/src/Project/ocelot.json.ejs @@ -1,7 +1,5 @@ { - "Routes": [ - // jhipster-needle-add-route-to-gateway - JHipster will add route to gateway - ], + "Routes": [], "GlobalConfiguration": { "ServiceDiscoveryProvider": { "Host": "localhost", diff --git a/generators/server/templates/dotnetcore/src/fakecsproj.csproj b/generators/dotnetcore/templates/dotnetcore/src/fakecsproj.csproj similarity index 53% rename from generators/server/templates/dotnetcore/src/fakecsproj.csproj rename to generators/dotnetcore/templates/dotnetcore/src/fakecsproj.csproj index 560ec8e21..49760972f 100644 --- a/generators/server/templates/dotnetcore/src/fakecsproj.csproj +++ b/generators/dotnetcore/templates/dotnetcore/src/fakecsproj.csproj @@ -1,6 +1,7 @@ + true - \ No newline at end of file + diff --git a/generators/server/templates/dotnetcore/terraform/main.tf.ejs b/generators/dotnetcore/templates/dotnetcore/terraform/main.tf.ejs similarity index 100% rename from generators/server/templates/dotnetcore/terraform/main.tf.ejs rename to generators/dotnetcore/templates/dotnetcore/terraform/main.tf.ejs diff --git a/generators/server/templates/dotnetcore/terraform/outputs.tf.ejs b/generators/dotnetcore/templates/dotnetcore/terraform/outputs.tf.ejs similarity index 100% rename from generators/server/templates/dotnetcore/terraform/outputs.tf.ejs rename to generators/dotnetcore/templates/dotnetcore/terraform/outputs.tf.ejs diff --git a/generators/server/templates/dotnetcore/terraform/variables.tf.ejs b/generators/dotnetcore/templates/dotnetcore/terraform/variables.tf.ejs similarity index 100% rename from generators/server/templates/dotnetcore/terraform/variables.tf.ejs rename to generators/dotnetcore/templates/dotnetcore/terraform/variables.tf.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Configuration/TestMvcStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Configuration/TestMvcStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Configuration/TestMvcStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Configuration/TestMvcStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Controllers/AccountControllerTest.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/AccountControllerTest.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Controllers/AccountControllerTest.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/AccountControllerTest.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Controllers/AccountResourceIntTest.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/AccountResourceIntTest.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Controllers/AccountResourceIntTest.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/AccountResourceIntTest.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Controllers/ProfileInfoControllerIntTest.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/ProfileInfoControllerIntTest.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Controllers/ProfileInfoControllerIntTest.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/ProfileInfoControllerIntTest.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Controllers/PublicUsersControllerTest.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/PublicUsersControllerTest.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Controllers/PublicUsersControllerTest.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/PublicUsersControllerTest.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Controllers/TestUtil.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/TestUtil.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Controllers/TestUtil.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/TestUtil.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Controllers/UserJwtControllerIntTest.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/UserJwtControllerIntTest.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Controllers/UserJwtControllerIntTest.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/UserJwtControllerIntTest.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Controllers/UsersResourceIntTest.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/UsersResourceIntTest.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Controllers/UsersResourceIntTest.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/UsersResourceIntTest.cs.ejs diff --git a/generators/entity-server/templates/dotnetcore/test/Project.Test/Controllers/EntityControllerIntTest.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/_persistClass_ControllerIntTest.cs.ejs similarity index 99% rename from generators/entity-server/templates/dotnetcore/test/Project.Test/Controllers/EntityControllerIntTest.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/_persistClass_ControllerIntTest.cs.ejs index bed787f86..652b2b1c7 100644 --- a/generators/entity-server/templates/dotnetcore/test/Project.Test/Controllers/EntityControllerIntTest.cs.ejs +++ b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Controllers/_persistClass_ControllerIntTest.cs.ejs @@ -184,7 +184,7 @@ namespace <%= namespace %>.Test.Controllers <%_ fields.forEach(field => { if (field.id) return; - const fieldType = equivalentCSharpType(field.fieldType, field); + const fieldType = field.cSharpType; if (field.fieldIsEnum) { _%> private const <%= field.fieldType %> Default<%= field.fieldNamePascalized %> = <%- enumUpdatedValue(field) %>; private const <%= field.fieldType %> Updated<%= field.fieldNamePascalized %> = <%- enumUpdatedValue(field) %>; diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Fixme.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Fixme.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Fixme.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Fixme.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Project.Test.csproj.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Project.Test.csproj.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Project.Test.csproj.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Project.Test.csproj.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Properties/launchSettings.json.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Properties/launchSettings.json.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Properties/launchSettings.json.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Properties/launchSettings.json.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Setup/AppWebApplicationFactory.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Setup/AppWebApplicationFactory.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Setup/AppWebApplicationFactory.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Setup/AppWebApplicationFactory.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Setup/MockClaimsPrincipalProvider.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Setup/MockClaimsPrincipalProvider.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Setup/MockClaimsPrincipalProvider.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Setup/MockClaimsPrincipalProvider.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Setup/MockHttpContextFactory.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Setup/MockHttpContextFactory.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Setup/MockHttpContextFactory.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Setup/MockHttpContextFactory.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/Setup/TestStartup.cs.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/Setup/TestStartup.cs.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/Setup/TestStartup.cs.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/Setup/TestStartup.cs.ejs diff --git a/generators/server/templates/dotnetcore/test/Project.Test/xunit.runner.json.ejs b/generators/dotnetcore/templates/dotnetcore/test/Project.Test/xunit.runner.json.ejs similarity index 100% rename from generators/server/templates/dotnetcore/test/Project.Test/xunit.runner.json.ejs rename to generators/dotnetcore/templates/dotnetcore/test/Project.Test/xunit.runner.json.ejs diff --git a/generators/entities-client/index.js b/generators/entities-client/index.js deleted file mode 100644 index cc5078456..000000000 --- a/generators/entities-client/index.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright 2013-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const EntitiesClientGenerator = require('generator-jhipster/generators/entities-client'); -const chalk = require('chalk'); -const customizeDotnetPaths = require('../utils').customizeDotnetPaths; -const constants = require('../generator-dotnetcore-constants.cjs'); - -const BLAZOR = constants.BLAZOR; -const XAMARIN = constants.XAMARIN; - -module.exports = class extends EntitiesClientGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - - if (this.jhipsterConfig.baseName) { - this.baseName = this.jhipsterConfig.baseName; - this.clientFramework = this.jhipsterConfig.clientFramework; - } - } - - get initializing() { - return super._initializing(); - } - - get loading() { - return super._loading(); - } - - get default() { - return { - ...super._default(), - customizeDotnetPaths, - }; - } - - get end() { - return { - rebuildClient() { - if (!this.options.skipInstall && !this.skipClient && this.clientFramework !== BLAZOR && this.clientFramework !== XAMARIN) { - const done = this.async(); - this.log(`\n${chalk.bold.green('Running `webapp:build` to update client app\n')}`); - this.spawnCommand('npm', ['--prefix', `${constants.SERVER_SRC_DIR}${this.mainClientDir}`, 'run', 'webapp:build']).on( - 'close', - () => { - done(); - } - ); - } - }, - }; - } -}; diff --git a/generators/entity-client/files-blazor.js b/generators/entity-client/files-blazor.js deleted file mode 100644 index bb2d9ba60..000000000 --- a/generators/entity-client/files-blazor.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const constants = require('../generator-dotnetcore-constants.cjs'); - -/* Constants use throughout */ -const CLIENT_SRC_DIR = constants.CLIENT_SRC_DIR; -const CLIENT_TEST_DIR = constants.CLIENT_TEST_DIR; -const BlazorNeedle = require('../client/needle-api/needle-client-blazor'); - -/** - * The default is to use a file path string. It implies use of the template method. - * For any other config an object { file:.., method:.., template:.. } can be used - */ -const files = { - blazorAppModels: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/Model.cs', - renameTo: generator => `${generator.mainClientDir}/Models/${generator.asModel(generator.entityClass)}.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/EntityServices/EntityService/EntityService.cs', - renameTo: generator => - `${generator.mainClientDir}/Services/EntityServices/${generator.entityClass}/${generator.entityClass}Service.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/EntityServices/EntityService/IEntityService.cs', - renameTo: generator => - `${generator.mainClientDir}/Services/EntityServices/${generator.entityClass}/I${generator.entityClass}Service.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Entities/Entity/Entity.razor.cs', - renameTo: generator => - `${generator.mainClientDir}/Pages/Entities/${generator.entityClass}/${generator.entityClass}.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Entities/Entity/Entity.razor', - renameTo: generator => - `${generator.mainClientDir}/Pages/Entities/${generator.entityClass}/${generator.entityClass}.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Entities/Entity/EntityDetail.razor.cs', - renameTo: generator => - `${generator.mainClientDir}/Pages/Entities/${generator.entityClass}/${generator.entityClass}Detail.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Entities/Entity/EntityDetail.razor', - renameTo: generator => - `${generator.mainClientDir}/Pages/Entities/${generator.entityClass}/${generator.entityClass}Detail.razor`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Entities/Entity/EntityUpdate.razor.cs', - renameTo: generator => - `${generator.mainClientDir}/Pages/Entities/${generator.entityClass}/${generator.entityClass}Update.razor.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Pages/Entities/Entity/EntityUpdate.razor', - renameTo: generator => - `${generator.mainClientDir}/Pages/Entities/${generator.entityClass}/${generator.entityClass}Update.razor`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Pages/Entities/Entity/EntityTest.cs', - renameTo: generator => - `${generator.clientTestProject}/Pages/Entities/${generator.entityClass}/${generator.entityClass}Test.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Pages/Entities/Entity/EntityUpdateTest.cs', - renameTo: generator => - `${generator.clientTestProject}/Pages/Entities/${generator.entityClass}/${generator.entityClass}UpdateTest.cs`, - }, - ], - }, - { - path: CLIENT_TEST_DIR, - templates: [ - { - file: 'Project.Client.Test/Pages/Entities/Entity/EntityDetailTest.cs', - renameTo: generator => - `${generator.clientTestProject}/Pages/Entities/${generator.entityClass}/${generator.entityClass}DetailTest.cs`, - }, - ], - }, - ], -}; - -module.exports = { - writeFiles, - files, -}; - -function writeFiles() { - this.writeFilesToDisk(files, this, false, 'blazor'); - const blazorNeedle = new BlazorNeedle(this); - blazorNeedle.addEntityToMenu(this.entityClass); - blazorNeedle.addServiceInDI(this.entityClass); - blazorNeedle.addUsingForService(this.namespace, this.entityClass); - blazorNeedle.addDtoMapping(this.entityClass); -} diff --git a/generators/entity-client/files-xamarin.js b/generators/entity-client/files-xamarin.js deleted file mode 100644 index c28b57b01..000000000 --- a/generators/entity-client/files-xamarin.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright 2013-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const constants = require('../generator-dotnetcore-constants.cjs'); - -/* Constants use throughout */ -const CLIENT_SRC_DIR = constants.CLIENT_SRC_DIR; -const XamarinNeedle = require('../client/needle-api/needle-client-xamarin'); - -/** - * The default is to use a file path string. It implies use of the template method. - * For any other config an object { file:.., method:.., template:.. } can be used - */ -const files = { - xamarinAppModels: [ - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Models/Model.cs', - renameTo: generator => `${generator.mainClientDir}/Models/Entities/${generator.asModel(generator.entityClass)}.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/ViewModels/EntityViewModel.cs', - renameTo: generator => `${generator.mainClientDir}/ViewModels/Entities/${generator.entityClass}ViewModel.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/EntityService.cs', - renameTo: generator => - `${generator.mainClientDir}/Services/Entities/${generator.entityClass}/${generator.entityClass}Service.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Services/IEntityService.cs', - renameTo: generator => - `${generator.mainClientDir}/Services/Entities/${generator.entityClass}/I${generator.entityClass}Service.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Views/EntityView.xaml.cs', - renameTo: generator => - `${generator.mainClientDir}/Views/Entities/${generator.entityClass}/${generator.entityClass}View.cs`, - }, - ], - }, - { - path: CLIENT_SRC_DIR, - templates: [ - { - file: 'Project.Client/Views/EntityView.xaml', - renameTo: generator => - `${generator.mainClientDir}/Views/Entities/${generator.entityClass}/${generator.entityClass}View.xaml`, - }, - ], - }, - ], -}; - -module.exports = { - writeFiles, - files, -}; - -function writeFiles() { - this.writeFilesToDisk(files, this, false, 'xamarin'); - const xamarinNeedle = new XamarinNeedle(this); - xamarinNeedle.addEntityToMenu(this.entityClass); - xamarinNeedle.addServiceInDI(this.entityClass); - xamarinNeedle.addCommandToMenu(this.entityClass); - xamarinNeedle.declareCommandToMenu(this.entityClass); -} diff --git a/generators/entity-client/index.js b/generators/entity-client/index.js deleted file mode 100644 index dbcade0af..000000000 --- a/generators/entity-client/index.js +++ /dev/null @@ -1,73 +0,0 @@ -/* eslint-disable consistent-return */ -const EntityClientGenerator = require('generator-jhipster/generators/entity-client'); -const constants = require('../generator-dotnetcore-constants.cjs'); -const customizeDotnetPaths = require('../utils').customizeDotnetPaths; -const writeBlazorFiles = require('./files-blazor').writeFiles; -const writeXamarinFiles = require('./files-xamarin').writeFiles; - -const BLAZOR = constants.BLAZOR; -const XAMARIN = constants.XAMARIN; - -module.exports = class extends EntityClientGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - - if (this.jhipsterConfig.baseName) { - this.baseName = this.jhipsterConfig.baseName; - this.clientFramework = this.jhipsterConfig.clientFramework; - } - } - - get configuring() { - return { - ...super._configuring(), - dtoWorkaround() { - // only work with relation id rather than complete json - this.dto = 'yes'; - }, - }; - } - - get composing() { - return super._composing(); - } - - get loading() { - return super._loading(); - } - - get preparing() { - return super._preparing(); - } - - get default() { - return { - ...super._default(), - customizeDotnetPaths, - }; - } - - get writing() { - if (this.clientFramework === BLAZOR) { - return { - writeFilesDotnetcore() { - if (this.skipClient) return; - return writeBlazorFiles.call(this); - }, - }; - } - if (this.clientFramework === XAMARIN) { - return { - writeFilesDotnetcore() { - if (this.skipClient) return; - return writeXamarinFiles.call(this); - }, - }; - } - return super._writing(); - } - - get postWriting() { - return super._postWriting(); - } -}; diff --git a/generators/entity-client/templates/blazor/src/Project.Client/Shared/NavMenu.razor.ejs b/generators/entity-client/templates/blazor/src/Project.Client/Shared/NavMenu.razor.ejs deleted file mode 100644 index f8ffe7fa7..000000000 --- a/generators/entity-client/templates/blazor/src/Project.Client/Shared/NavMenu.razor.ejs +++ /dev/null @@ -1,80 +0,0 @@ -@namespace <%= namespace %>.Client.Shared - - - - - - - - - - - - - Home - - - - - - - - - Entities - - - - - Region - - - - Country - - - - - - - - - - - Account - - - - - - - Sign out - - - - - - - - Sign in - - - - Register - - - - - - - - - - -@code { - -} diff --git a/generators/entity-i18n/index.js b/generators/entity-i18n/index.js deleted file mode 100644 index bc3b71782..000000000 --- a/generators/entity-i18n/index.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-disable consistent-return */ -const EntityI18nGenerator = require('generator-jhipster/generators/entity-i18n'); -const customizeDotnetPaths = require('../utils').customizeDotnetPaths; - -module.exports = class extends EntityI18nGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - - if (this.jhipsterConfig.baseName) { - this.baseName = this.jhipsterConfig.baseName; - } - } - - get composing() { - return super._composing(); - } - - get loading() { - return super._loading(); - } - - get preparing() { - return super._preparing(); - } - - get default() { - return { - customizeDotnetPaths, - ...super._default(), - }; - } - - get writing() { - return super._writing(); - } - - get postWriting() { - return super._postWriting(); - } -}; diff --git a/generators/entity-server/files.js b/generators/entity-server/files.js deleted file mode 100644 index 9d236eb0d..000000000 --- a/generators/entity-server/files.js +++ /dev/null @@ -1,277 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const baseConstants = require('generator-jhipster/generators/generator-constants'); -const constants = require('../generator-dotnetcore-constants.cjs'); -const utils = require('../utils'); - -/* Constants use throughout */ - -const INTERPOLATE_REGEX = baseConstants.INTERPOLATE_REGEX; -const SERVER_SRC_DIR = constants.SERVER_SRC_DIR; -const SERVER_TEST_DIR = constants.SERVER_TEST_DIR; -const PROJECT_APPLICATION_SUFFIX = constants.PROJECT_APPLICATION_SUFFIX; -const PROJECT_CROSSCUTTING_SUFFIX = constants.PROJECT_CROSSCUTTING_SUFFIX; -const PROJECT_SERVICE_SUFFIX = constants.PROJECT_SERVICE_SUFFIX; -const PROJECT_INFRASTRUCTURE_SUFFIX = constants.PROJECT_INFRASTRUCTURE_SUFFIX; - -const serverFiles = { - server: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Entities/Entity.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${constants.PROJECT_DOMAIN_SUFFIX}/Entities/${generator.asEntity( - generator.entityClass - )}.cs`, - }, - { - file: 'Project/Controllers/EntityController.cs', - renameTo: generator => `${generator.mainProjectDir}/Controllers/${generator.pascalizedEntityClassPlural}Controller.cs`, - }, - { - file: 'Project.Domain/Repositories/Interfaces/IEntityRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${constants.PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/I${generator.asEntity( - generator.entityClass - )}Repository.cs`, - }, - { - file: 'Project.Infrastructure/Data/Repositories/EntityRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/${generator.asEntity( - generator.entityClass - )}Repository.cs`, - }, - { - file: 'Project.Domain/Repositories/Interfaces/IReadOnlyEntityRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${ - constants.PROJECT_DOMAIN_SUFFIX - }/Repositories/Interfaces/IReadOnly${generator.asEntity(generator.entityClass)}Repository.cs`, - }, - { - file: 'Project.Infrastructure/Data/Repositories/ReadOnlyEntityRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/ReadOnly${generator.asEntity( - generator.entityClass - )}Repository.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/AutoMapper/AutoMapperProfile.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/AutoMapper/AutoMapperProfile.cs`, - }, - ], - }, - { - condition: generator => generator.cqrsEnabled === true, - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Application/Queries/EntityGetQuery.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}GetQuery.cs`, - }, - { - file: 'Project.Application/Queries/EntityGetQueryHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}GetQueryHandler.cs`, - }, - { - file: 'Project.Application/Queries/EntityGetAllQuery.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}GetAllQuery.cs`, - }, - { - file: 'Project.Application/Queries/EntityGetAllQueryHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}GetAllQueryHandler.cs`, - }, - { - file: 'Project.Application/Commands/EntityDeleteCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}DeleteCommand.cs`, - }, - { - file: 'Project.Application/Commands/EntityDeleteCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}DeleteCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/EntityCreateCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}CreateCommand.cs`, - }, - { - file: 'Project.Application/Commands/EntityCreateCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}CreateCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/EntityUpdateCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}UpdateCommand.cs`, - }, - { - file: 'Project.Application/Commands/EntityUpdateCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/${generator.asEntity( - generator.entityClass - )}/${generator.asEntity(generator.entityClass)}UpdateCommandHandler.cs`, - }, - ], - }, - { - condition: generator => generator.dto === 'mapstruct', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Dto/Dto.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}/${generator.asDto(generator.entityClass)}.cs`, - }, - ], - }, - { - condition: generator => generator.dto === 'mapstruct', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Dto/AuditedEntityBaseDto.cs', - renameTo: generator => `${generator.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}/AuditedEntityBaseDto.cs`, - }, - ], - }, - ], - db: [ - { - condition: generator => generator.databaseType !== 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/ApplicationDatabaseContext.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/ApplicationDatabaseContext.cs`, - }, - ], - }, - ], - test: [ - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Controllers/EntityControllerIntTest.cs', - renameTo: generator => - `${generator.testProjectDir}/Controllers/${generator.asEntity(generator.entityClass)}ControllerIntTest.cs`, - }, - ], - }, - ], - service: [ - { - condition: generator => generator.service === 'serviceImpl' && generator.cqrsEnabled !== true, - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain.Services/Service.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/${generator.entityClass}Service.cs`, - }, - { - file: 'Project.Domain/Services/Interfaces/IService.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${constants.PROJECT_DOMAIN_SUFFIX}/Services/Interfaces/I${generator.entityClass}Service.cs`, - }, - ], - }, - ], -}; - -const gatlingTestsFiles = { - gatlingTests: [ - { - condition: generator => generator.gatlingTests, - path: SERVER_TEST_DIR, - templates: [ - { - file: 'gatling/user-files/simulations/EntityGatlingTest.scala', - options: { interpolate: INTERPOLATE_REGEX }, - renameTo: generator => `gatling/user-files/simulations/${generator.entityClass}GatlingTest.scala`, - }, - ], - }, - ], -}; - -function writeFiles() { - return { - writeServerFiles() { - this.fields.forEach(field => { - if (field.fieldIsEnum) { - if (!this.skipServer) { - const enumInfo = utils.getEnumInfo(field, this.clientRootFolder); - enumInfo.namespace = this.namespace; - const fieldType = field.fieldType; - this.template( - 'dotnetcore/src/Project.Crosscutting/Enums/Enum.cs.ejs', - `src/${this.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Enums/${fieldType}.cs`, - this, - {}, - enumInfo - ); - } - } - }); - - this.writeFilesToDisk(serverFiles, this, false, 'dotnetcore'); - }, - writeFilesGatling() { - this.writeFilesToDisk(gatlingTestsFiles, this, false, this.fetchFromInstalledJHipster('entity-server/templates/src')); - }, - }; -} - -module.exports = { - serverFiles, - writeFiles, -}; diff --git a/generators/entity-server/index.js b/generators/entity-server/index.js deleted file mode 100644 index e474b8ffa..000000000 --- a/generators/entity-server/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable consistent-return */ -const _ = require('lodash'); -const EntityServerGenerator = require('generator-jhipster/generators/entity-server'); -const writeFiles = require('./files').writeFiles; -const GatewayNeedle = require('../server/needle-api/needle-server-gateway'); - -module.exports = class extends EntityServerGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - } - - get composing() { - return super._composing(); - } - - get loading() { - return super._loading(); - } - - get preparing() { - return super._preparing(); - } - - get preparingFields() { - return super._preparingFields(); - } - - get default() { - return super._default(); - } - - get writing() { - if (this.applicationType === 'gateway') { - return { - writeFilesNeedle() { - const gatewayNeedle = new GatewayNeedle(this); - gatewayNeedle.addRouteToGateway(this.entityApiUrl, _.toLower(this.microserviceName)); - }, - }; - } - return writeFiles(); - } - - get postWriting() { - return super._postWriting(); - } -}; diff --git a/generators/entity/generator.js b/generators/entity/generator.js new file mode 100644 index 000000000..1436c94a2 --- /dev/null +++ b/generators/entity/generator.js @@ -0,0 +1,47 @@ +/* eslint-disable consistent-return */ +const EntityGenerator = require('generator-jhipster/generators/entity'); +// eslint-disable-next-line import/no-extraneous-dependencies +const prompts = require('./prompts'); + +module.exports = class extends EntityGenerator { + constructor(args, opts) { + super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important + } + + get initializing() { + const phaseFromJHipster = super._initializing(); + const jhipsterNetPhaseSteps = { + getConfigNetBlueprint() { + this.context.namespace = this.jhipsterConfig.namespace; + this.context.cqrsEnabled = this.jhipsterConfig.cqrsEnabled; + this.context.dtoSuffix = 'Dto'; + }, + fixConfig() { + this.context.prodDatabaseType = this.context.databaseType === 'mongodb' ? 'mongodb' : 'mysql'; // set only for jdl-importer compatibility + }, + }; + return Object.assign(phaseFromJHipster, jhipsterNetPhaseSteps); + } + + get prompting() { + return { + /* pre entity hook needs to be written here */ + askForMicroserviceJson: prompts.askForMicroserviceJson, + /* ask question to user if s/he wants to update entity */ + askForUpdate: prompts.askForUpdate, + askForFields: prompts.askForFields, + askForFieldsToRemove: prompts.askForFieldsToRemove, + askForRelationships: prompts.askForRelationships, + askForRelationsToRemove: prompts.askForRelationsToRemove, + askForTableName: prompts.askForTableName, + askForService: prompts.askForService, + askForDTO: prompts.askForDTO, + // askForFiltering: prompts.askForFiltering, + askForPagination: prompts.askForPagination, + }; + } + + get configuring() { + return super._configuring(); + } +}; diff --git a/generators/entity/index.js b/generators/entity/index.js deleted file mode 100644 index 50995f866..000000000 --- a/generators/entity/index.js +++ /dev/null @@ -1,207 +0,0 @@ -/* eslint-disable consistent-return */ -const EntityGenerator = require('generator-jhipster/generators/entity'); -// eslint-disable-next-line import/no-extraneous-dependencies -const toPascalCase = require('to-pascal-case'); -const pluralize = require('pluralize'); -const _ = require('lodash'); -const utilsNet = require('../utils'); -const constants = require('../generator-dotnetcore-constants.cjs'); -const prompts = require('./prompts'); -const asModel = require('../utils').asModel; - -module.exports = class extends EntityGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - } - - get initializing() { - const phaseFromJHipster = super._initializing(); - const jhipsterNetPhaseSteps = { - getConfigNetBlueprint() { - this.context.namespace = this.jhipsterConfig.namespace; - this.context.cqrsEnabled = this.jhipsterConfig.cqrsEnabled; - this.context.dtoSuffix = 'Dto'; - }, - fixConfig() { - this.context.prodDatabaseType = this.context.databaseType === 'mongodb' ? 'mongodb' : 'mysql'; // set only for jdl-importer compatibility - }, - }; - return Object.assign(phaseFromJHipster, jhipsterNetPhaseSteps); - } - - get prompting() { - return { - /* pre entity hook needs to be written here */ - askForMicroserviceJson: prompts.askForMicroserviceJson, - /* ask question to user if s/he wants to update entity */ - askForUpdate: prompts.askForUpdate, - askForFields: prompts.askForFields, - askForFieldsToRemove: prompts.askForFieldsToRemove, - askForRelationships: prompts.askForRelationships, - askForRelationsToRemove: prompts.askForRelationsToRemove, - askForTableName: prompts.askForTableName, - askForService: prompts.askForService, - askForDTO: prompts.askForDTO, - // askForFiltering: prompts.askForFiltering, - askForPagination: prompts.askForPagination, - }; - } - - get configuring() { - return super._configuring(); - } - - get composing() { - return super._composing(); - } - - get loading() { - return super._loading(); - } - - get preparing() { - return { - ...super._preparing(), - preparingDotnet() { - const context = this.context; - context.primaryKeyType = context.databaseType === 'mongodb' ? 'string' : 'long'; - context.pascalizedBaseName = toPascalCase(context.baseName); - context.mainProjectDir = context.pascalizedBaseName; - context.testProjectDir = `${context.pascalizedBaseName}${constants.PROJECT_TEST_SUFFIX}`; - context.pascalizedEntityClass = toPascalCase(context.entityClass); - context.pascalizedEntityClassPlural = toPascalCase(context.entityClassPlural); - context.snakeCasedEntityClass = _.snakeCase(context.entityClass); - context.snakeCasedEntityClassPlural = _.snakeCase(context.entityClassPlural); - context.camelCasedEntityClass = _.camelCase(context.entityClass); - context.camelCasedEntityClassPlural = _.camelCase(context.entityClassPlural); - context.kebabCasedEntityClass = _.kebabCase(context.entityClass); - context.kebabCasedEntityClassPlural = _.kebabCase(context.entityClassPlural); - context.lowerCasedEntityClass = _.toLower(context.entityClass); - context.lowerCasedEntityClassPlural = _.toLower(context.entityClassPlural); - context.entityClassHasManyToMany = false; - context.entities = this.getExistingEntities(); - context.mainClientAppDir = `${context.mainProjectDir}/ClientApp/src`; - context.mainClientDir = `${context.mainProjectDir}/ClientApp`; - - // Embed functions to use in EJS templates - context.toPascalCase = toPascalCase; - context.pluralize = pluralize; - context._ = _; - context.equivalentCSharpType = utilsNet.equivalentCSharpType; - context.asModel = asModel; - - // Load in-memory data for .Net Blueprint fields - context.fields.forEach(field => { - field.fieldNamePascalized = toPascalCase(field.fieldName); - field.fieldNameCamelCased = _.camelCase(field.fieldName); - - const fieldType = field.fieldType; - - field.fieldIsEnum = ![ - 'String', - 'Integer', - 'Long', - 'Float', - 'Double', - 'BigDecimal', - 'LocalDate', - 'Instant', - 'ZonedDateTime', - 'Duration', - 'UUID', - 'Boolean', - 'byte[]', - 'ByteBuffer', - ].includes(fieldType); - - if (field.fieldIsEnum === true) { - context.i18nToLoad.push(field.enumInstance); - } - }); - }, - }; - } - - get preparingFields() { - return super._preparingFields(); - } - - get preparingRelationships() { - return { - ...super._preparingRelationships(), - preparingDotnetRelationships() { - const context = this.context; - - // Load in-memory data for .Net Blueprint relationships - context.relationships.forEach(relationship => { - relationship.relationshipNamePascalized = toPascalCase(relationship.relationshipName); - relationship.relationshipNamePascalizedPlural = pluralize(relationship.relationshipNamePascalized); - relationship.relationshipFieldNamePascalized = toPascalCase(relationship.relationshipFieldName); - relationship.relationshipFieldNameLowerCased = _.toLower(relationship.relationshipFieldName); - relationship.relationshipFieldNamePascalizedPlural = pluralize(relationship.relationshipFieldNamePascalized); - relationship.otherEntityNamePascalized = toPascalCase(relationship.otherEntityName); - relationship.otherEntityNamePascalizedPlural = toPascalCase(relationship.otherEntityNamePlural); - relationship.otherEntityNameCamelCased = _.camelCase(relationship.otherEntityName); - relationship.otherEntityNameLowerCased = _.toLower(relationship.otherEntityName); - relationship.otherEntityNameLowerCasedPlural = _.toLower(relationship.otherEntityNamePlural); - - if ( - relationship.relationshipType === 'one-to-many' || - relationship.relationshipType === 'many-to-many' || - relationship.relationshipType === 'one-to-one' || - relationship.otherEntityName.toLowerCase() === 'user' - ) { - relationship.otherEntityRelationshipNamePascalized = toPascalCase(relationship.otherEntityRelationshipName); - relationship.otherEntityRelationshipFieldName = _.lowerFirst(relationship.otherEntityRelationshipName); - relationship.otherEntityRelationshipFieldNamePascalized = toPascalCase( - relationship.otherEntityRelationshipFieldName - ); - relationship.otherEntityRelationshipFieldNamePascalizedPlural = pluralize( - relationship.otherEntityRelationshipFieldNamePascalized - ); - } - - if (relationship.relationshipType === 'many-to-many') { - if (relationship.ownerSide) { - relationship.otherEntityRelationshipNamePascalizedPlural = pluralize( - relationship.otherEntityRelationshipNamePascalized - ); - relationship.joinEntityName = - relationship.otherEntityRelationshipName + _.upperFirst(relationship.relationshipName); - relationship.joinEntityNamePascalized = - relationship.otherEntityRelationshipNamePascalized + relationship.relationshipNamePascalized; - } else { - relationship.joinEntityName = - relationship.relationshipName + _.upperFirst(relationship.otherEntityRelationshipName); - relationship.joinEntityNamePascalized = - relationship.relationshipNamePascalized + relationship.otherEntityRelationshipNamePascalized; - } - relationship.joinEntityNameSnakeCased = _.snakeCase(relationship.joinEntityName); - relationship.joinEntityNameCamelCased = _.camelCase(relationship.joinEntityName); - relationship.joinEntityFieldNamePascalizedPlural = pluralize(relationship.joinEntityNamePascalized); - context.entityClassHasManyToMany = true; - } - - relationship.joinEntityGenerated = false; - }); - }, - }; - } - - get default() { - return super._default(); - } - - get writing() { - return super._writing(); - } - - get postWriting() { - return super._postWriting(); - } - - get install() { - // Here we are not overriding this phase and hence its being handled by JHipster - return super._install(); - } -}; diff --git a/generators/entity/prompts.js b/generators/entity/prompts.js index a0df9fb06..9dd7418da 100644 --- a/generators/entity/prompts.js +++ b/generators/entity/prompts.js @@ -20,294 +20,294 @@ const chalk = require('chalk'); const _ = require('lodash'); const getFieldNameUndercored = fields => - ['id'].concat( - fields.map(field => { - return _.snakeCase(field.fieldName); - }) - ); + ['id'].concat( + fields.map(field => { + return _.snakeCase(field.fieldName); + }), + ); const path = require('path'); const jhiCore = require('jhipster-core'); const shelljs = require('shelljs'); module.exports = { - askForMicroserviceJson, - askForUpdate, - askForFields, - askForFieldsToRemove, - askForRelationships, - askForRelationsToRemove, - askForTableName, - askForDTO, - askForService, - // askForFiltering, - askForPagination, + askForMicroserviceJson, + askForUpdate, + askForFields, + askForFieldsToRemove, + askForRelationships, + askForRelationsToRemove, + askForTableName, + askForDTO, + askForService, + // askForFiltering, + askForPagination, }; function askForMicroserviceJson() { - const context = this.context; - if (context.applicationType !== 'gateway' || context.useConfigurationFile) { - return; - } + const context = this.context; + if (context.applicationType !== 'gateway' || context.useConfigurationFile) { + return; + } - const done = this.async(); - const databaseType = context.databaseType; + const done = this.async(); + const databaseType = context.databaseType; - const prompts = [ - { - when: () => databaseType !== 'no', - type: 'confirm', - name: 'useMicroserviceJson', - message: 'Do you want to generate this entity from an existing microservice?', - default: true, - }, - { - when: response => response.useMicroserviceJson === true || databaseType === 'no', - type: 'input', - name: 'microservicePath', - message: 'Enter the path to the microservice root directory:', - store: true, - validate: input => { - let fromPath; - if (path.isAbsolute(input)) { - fromPath = `${input}/${context.filename}`; - } else { - fromPath = this.destinationPath(`${input}/${context.filename}`); - } + const prompts = [ + { + when: () => databaseType !== 'no', + type: 'confirm', + name: 'useMicroserviceJson', + message: 'Do you want to generate this entity from an existing microservice?', + default: true, + }, + { + when: response => response.useMicroserviceJson === true || databaseType === 'no', + type: 'input', + name: 'microservicePath', + message: 'Enter the path to the microservice root directory:', + store: true, + validate: input => { + let fromPath; + if (path.isAbsolute(input)) { + fromPath = `${input}/${context.filename}`; + } else { + fromPath = this.destinationPath(`${input}/${context.filename}`); + } - if (shelljs.test('-f', fromPath)) { - return true; - } - return `${context.filename} not found in ${input}/`; - }, - }, - ]; + if (shelljs.test('-f', fromPath)) { + return true; + } + return `${context.filename} not found in ${input}/`; + }, + }, + ]; - this.prompt(prompts).then(props => { - if (props.microservicePath) { - this.log(chalk.green(`\nFound the ${context.filename} configuration file, entity can be automatically generated!\n`)); - if (path.isAbsolute(props.microservicePath)) { - context.microservicePath = props.microservicePath; - } else { - context.microservicePath = path.resolve(props.microservicePath); - } - context.useConfigurationFile = true; - context.useMicroserviceJson = true; - const fromPath = `${context.microservicePath}/${context.jhipsterConfigDirectory}/${context.entityNameCapitalized}.json`; + this.prompt(prompts).then(props => { + if (props.microservicePath) { + this.log(chalk.green(`\nFound the ${context.filename} configuration file, entity can be automatically generated!\n`)); + if (path.isAbsolute(props.microservicePath)) { + context.microservicePath = props.microservicePath; + } else { + context.microservicePath = path.resolve(props.microservicePath); + } + context.useConfigurationFile = true; + context.useMicroserviceJson = true; + const fromPath = `${context.microservicePath}/${context.jhipsterConfigDirectory}/${context.entityNameCapitalized}.json`; - this.loadEntityJson(fromPath); - if (this.context.applicationType === 'gateway') { - this.context.skipServer = false; - } - } - done(); - }); + this.loadEntityJson(fromPath); + if (this.context.applicationType === 'gateway') { + this.context.skipServer = false; + } + } + done(); + }); } function askForUpdate() { - const context = this.context; - // ask only if running an existing entity without arg option --force or --regenerate - const isForce = this.options.force || context.regenerate; - context.updateEntity = 'regenerate'; // default if skipping questions by --force - if (isForce || !context.useConfigurationFile) { - return; - } - const done = this.async(); - const prompts = [ + const context = this.context; + // ask only if running an existing entity without arg option --force or --regenerate + const isForce = this.options.force || context.regenerate; + context.updateEntity = 'regenerate'; // default if skipping questions by --force + if (isForce || !context.useConfigurationFile) { + return; + } + const done = this.async(); + const prompts = [ + { + type: 'list', + name: 'updateEntity', + message: + 'Do you want to update the entity? This will replace the existing files for this entity, all your custom code will be overwritten', + choices: [ { - type: 'list', - name: 'updateEntity', - message: - 'Do you want to update the entity? This will replace the existing files for this entity, all your custom code will be overwritten', - choices: [ - { - value: 'regenerate', - name: 'Yes, re generate the entity', - }, - { - value: 'add', - name: 'Yes, add more fields and relationships', - }, - { - value: 'remove', - name: 'Yes, remove fields and relationships', - }, - { - value: 'none', - name: 'No, exit', - }, - ], - default: 0, + value: 'regenerate', + name: 'Yes, re generate the entity', }, - ]; - this.prompt(prompts).then(props => { - context.updateEntity = props.updateEntity; - if (context.updateEntity === 'none') { - this.env.error(chalk.green('Aborting entity update, no changes were made.')); - } - done(); - }); + { + value: 'add', + name: 'Yes, add more fields and relationships', + }, + { + value: 'remove', + name: 'Yes, remove fields and relationships', + }, + { + value: 'none', + name: 'No, exit', + }, + ], + default: 0, + }, + ]; + this.prompt(prompts).then(props => { + context.updateEntity = props.updateEntity; + if (context.updateEntity === 'none') { + this.env.error(chalk.green('Aborting entity update, no changes were made.')); + } + done(); + }); } function askForFields() { - const context = this.context; - // don't prompt if data is imported from a file - if (context.useConfigurationFile && context.updateEntity !== 'add') { - return; - } + const context = this.context; + // don't prompt if data is imported from a file + if (context.useConfigurationFile && context.updateEntity !== 'add') { + return; + } - if (context.updateEntity === 'add') { - logFieldsAndRelationships.call(this); - } + if (context.updateEntity === 'add') { + logFieldsAndRelationships.call(this); + } - const done = this.async(); + const done = this.async(); - askForField.call(this, done); + askForField.call(this, done); } function askForFieldsToRemove() { - const context = this.context; - // prompt only if data is imported from a file - if (!context.useConfigurationFile || context.updateEntity !== 'remove' || this.entityConfig.fields.length === 0) { - return undefined; - } + const context = this.context; + // prompt only if data is imported from a file + if (!context.useConfigurationFile || context.updateEntity !== 'remove' || this.entityConfig.fields.length === 0) { + return undefined; + } - const prompts = [ - { - type: 'checkbox', - name: 'fieldsToRemove', - message: 'Please choose the fields you want to remove', - choices: () => - this.entityConfig.fields.map(field => { - return { name: field.fieldName, value: field.fieldName }; - }), - }, - { - when: response => response.fieldsToRemove.length !== 0, - type: 'confirm', - name: 'confirmRemove', - message: 'Are you sure to remove these fields?', - default: true, - }, - ]; - return this.prompt(prompts).then(props => { - if (props.confirmRemove) { - this.log(chalk.red(`\nRemoving fields: ${props.fieldsToRemove}\n`)); - const fields = this.entityConfig.fields; - for (let i = fields.length - 1; i >= 0; i -= 1) { - const field = this.entityConfig.fields[i]; - if (props.fieldsToRemove.filter(val => val === field.fieldName).length > 0) { - fields.splice(i, 1); - } - } - this.entityConfig.fields = fields; + const prompts = [ + { + type: 'checkbox', + name: 'fieldsToRemove', + message: 'Please choose the fields you want to remove', + choices: () => + this.entityConfig.fields.map(field => { + return { name: field.fieldName, value: field.fieldName }; + }), + }, + { + when: response => response.fieldsToRemove.length !== 0, + type: 'confirm', + name: 'confirmRemove', + message: 'Are you sure to remove these fields?', + default: true, + }, + ]; + return this.prompt(prompts).then(props => { + if (props.confirmRemove) { + this.log(chalk.red(`\nRemoving fields: ${props.fieldsToRemove}\n`)); + const fields = this.entityConfig.fields; + for (let i = fields.length - 1; i >= 0; i -= 1) { + const field = this.entityConfig.fields[i]; + if (props.fieldsToRemove.filter(val => val === field.fieldName).length > 0) { + fields.splice(i, 1); } - }); + } + this.entityConfig.fields = fields; + } + }); } function askForRelationships() { - const context = this.context; - // don't prompt if data is imported from a file - if (context.useConfigurationFile && context.updateEntity !== 'add') { - return; - } - /* if (context.databaseType === 'cassandra') { + const context = this.context; + // don't prompt if data is imported from a file + if (context.useConfigurationFile && context.updateEntity !== 'add') { + return; + } + /* if (context.databaseType === 'cassandra') { return; } */ - const done = this.async(); + const done = this.async(); - askForRelationship.call(this, done); + askForRelationship.call(this, done); } function askForRelationsToRemove() { - const context = this.context; - // prompt only if data is imported from a file - if (!context.useConfigurationFile || context.updateEntity !== 'remove' || this.entityConfig.relationships.length === 0) { - return undefined; - } + const context = this.context; + // prompt only if data is imported from a file + if (!context.useConfigurationFile || context.updateEntity !== 'remove' || this.entityConfig.relationships.length === 0) { + return undefined; + } - const prompts = [ - { - type: 'checkbox', - name: 'relsToRemove', - message: 'Please choose the relationships you want to remove', - choices: () => - this.entityConfig.relationships.map(rel => { - return { - name: `${rel.relationshipName}:${rel.relationshipType}`, - value: `${rel.relationshipName}:${rel.relationshipType}`, - }; - }), - }, - { - when: response => response.relsToRemove.length !== 0, - type: 'confirm', - name: 'confirmRemove', - message: 'Are you sure to remove these relationships?', - default: true, - }, - ]; - return this.prompt(prompts).then(props => { - if (props.confirmRemove) { - this.log(chalk.red(`\nRemoving relationships: ${props.relsToRemove}\n`)); - const relationships = this.entityConfig.relationships; - for (let i = relationships.length - 1; i >= 0; i -= 1) { - const rel = relationships[i]; - if (props.relsToRemove.filter(val => val === `${rel.relationshipName}:${rel.relationshipType}`).length > 0) { - relationships.splice(i, 1); - } - } - this.entityConfig.relationships = relationships; + const prompts = [ + { + type: 'checkbox', + name: 'relsToRemove', + message: 'Please choose the relationships you want to remove', + choices: () => + this.entityConfig.relationships.map(rel => { + return { + name: `${rel.relationshipName}:${rel.relationshipType}`, + value: `${rel.relationshipName}:${rel.relationshipType}`, + }; + }), + }, + { + when: response => response.relsToRemove.length !== 0, + type: 'confirm', + name: 'confirmRemove', + message: 'Are you sure to remove these relationships?', + default: true, + }, + ]; + return this.prompt(prompts).then(props => { + if (props.confirmRemove) { + this.log(chalk.red(`\nRemoving relationships: ${props.relsToRemove}\n`)); + const relationships = this.entityConfig.relationships; + for (let i = relationships.length - 1; i >= 0; i -= 1) { + const rel = relationships[i]; + if (props.relsToRemove.filter(val => val === `${rel.relationshipName}:${rel.relationshipType}`).length > 0) { + relationships.splice(i, 1); } - }); + } + this.entityConfig.relationships = relationships; + } + }); } function askForTableName() { - const context = this.context; - // don't prompt if there are no relationships - const entityTableName = context.entityTableName; - // const prodDatabaseType = context.prodDatabaseType; - const skipCheckLengthOfIdentifier = context.skipCheckLengthOfIdentifier; - if ( - skipCheckLengthOfIdentifier || - !this.entityConfig.relationships || - this.entityConfig.relationships.length === 0 || - entityTableName.length <= 30 - /* (prodDatabaseType === 'oracle' && entityTableName.length > 14) || */ - ) { - return; - } - const done = this.async(); - const prompts = [ - { - type: 'input', - name: 'entityTableName', - message: 'The table name for this entity is too long to form constraint names. Please use a shorter table name', - validate: input => { - if (!/^([a-zA-Z0-9_]*)$/.test(input)) { - return 'The table name cannot contain special characters'; - } - if (input === '') { - return 'The table name cannot be empty'; - } - /* if (prodDatabaseType === 'oracle' && input.length > 14 && !skipCheckLengthOfIdentifier) { + const context = this.context; + // don't prompt if there are no relationships + const entityTableName = context.entityTableName; + // const prodDatabaseType = context.prodDatabaseType; + const skipCheckLengthOfIdentifier = context.skipCheckLengthOfIdentifier; + if ( + skipCheckLengthOfIdentifier || + !this.entityConfig.relationships || + this.entityConfig.relationships.length === 0 || + entityTableName.length <= 30 + /* (prodDatabaseType === 'oracle' && entityTableName.length > 14) || */ + ) { + return; + } + const done = this.async(); + const prompts = [ + { + type: 'input', + name: 'entityTableName', + message: 'The table name for this entity is too long to form constraint names. Please use a shorter table name', + validate: input => { + if (!/^([a-zA-Z0-9_]*)$/.test(input)) { + return 'The table name cannot contain special characters'; + } + if (input === '') { + return 'The table name cannot be empty'; + } + /* if (prodDatabaseType === 'oracle' && input.length > 14 && !skipCheckLengthOfIdentifier) { return 'The table name is too long for Oracle, try a shorter name'; } */ - if (input.length > 30 && !skipCheckLengthOfIdentifier) { - return 'The table name is too long, try a shorter name'; - } - return true; - }, - default: entityTableName, - }, - ]; - this.prompt(prompts).then(props => { - /* overwrite the table name for the entity using name obtained from the user */ - if (props.entityTableName !== context.entityTableName) { - context.entityTableName = _.snakeCase(props.entityTableName).toLowerCase(); + if (input.length > 30 && !skipCheckLengthOfIdentifier) { + return 'The table name is too long, try a shorter name'; } - done(); - }); + return true; + }, + default: entityTableName, + }, + ]; + this.prompt(prompts).then(props => { + /* overwrite the table name for the entity using name obtained from the user */ + if (props.entityTableName !== context.entityTableName) { + context.entityTableName = _.snakeCase(props.entityTableName).toLowerCase(); + } + done(); + }); } /* function askForFiltering() { @@ -342,198 +342,198 @@ function askForTableName() { } */ function askForDTO() { - const context = this.context; - // don't prompt if data is imported from a file or server is skipped or if no service layer - if (context.useConfigurationFile || context.skipServer || this.entityConfig.service === 'no') { - context.dto = context.dto || 'no'; - return; - } - const done = this.async(); - const prompts = [ + const context = this.context; + // don't prompt if data is imported from a file or server is skipped or if no service layer + if (context.useConfigurationFile || context.skipServer || this.entityConfig.service === 'no') { + context.dto = context.dto || 'no'; + return; + } + const done = this.async(); + const prompts = [ + { + type: 'list', + name: 'dto', + message: 'Do you want to use a Data Transfer Object (DTO)?', + choices: [ { - type: 'list', - name: 'dto', - message: 'Do you want to use a Data Transfer Object (DTO)?', - choices: [ - { - value: 'no', - name: 'No, use the entity directly', - }, - { - value: 'mapstruct', - name: 'Yes, generate a DTO with AutoMapper', - }, - ], - default: 0, + value: 'no', + name: 'No, use the entity directly', }, - ]; - this.prompt(prompts).then(props => { - this.entityConfig.dto = props.dto; - done(); - }); + { + value: 'mapstruct', + name: 'Yes, generate a DTO with AutoMapper', + }, + ], + default: 0, + }, + ]; + this.prompt(prompts).then(props => { + this.entityConfig.dto = props.dto; + done(); + }); } function askForService() { - const context = this.context; - // don't prompt if data is imported from a file or server is skipped - if (context.cqrsEnabled) { - context.service = 'serviceImpl'; - return; - } - if (context.useConfigurationFile || context.skipServer) { - return; - } + const context = this.context; + // don't prompt if data is imported from a file or server is skipped + if (context.cqrsEnabled) { + context.service = 'serviceImpl'; + return; + } + if (context.useConfigurationFile || context.skipServer) { + return; + } - const done = this.async(); - const prompts = [ + const done = this.async(); + const prompts = [ + { + type: 'list', + name: 'service', + message: 'Do you want to use separate service class for your business logic?', + choices: [ { - type: 'list', - name: 'service', - message: 'Do you want to use separate service class for your business logic?', - choices: [ - { - value: 'no', - name: 'No, the REST controller should use the repository directly', - }, - { - value: 'serviceImpl', - name: 'Yes, generate a separate service interface and implementation', - }, - ], - default: 0, + value: 'no', + name: 'No, the REST controller should use the repository directly', }, - ]; - this.prompt(prompts).then(props => { - this.entityConfig.service = props.service; - done(); - }); + { + value: 'serviceImpl', + name: 'Yes, generate a separate service interface and implementation', + }, + ], + default: 0, + }, + ]; + this.prompt(prompts).then(props => { + this.entityConfig.service = props.service; + done(); + }); } function askForPagination() { - const context = this.context; - // don't prompt if data are imported from a file - if (context.useConfigurationFile) { - return; - } - /* if (context.databaseType === 'cassandra') { + const context = this.context; + // don't prompt if data are imported from a file + if (context.useConfigurationFile) { + return; + } + /* if (context.databaseType === 'cassandra') { return; } */ - const done = this.async(); - const prompts = [ - { - type: 'list', - name: 'pagination', - message: 'Do you want pagination on your entity?', - choices: [ - /* { + const done = this.async(); + const prompts = [ + { + type: 'list', + name: 'pagination', + message: 'Do you want pagination on your entity?', + choices: [ + /* { value: 'no', name: 'No' }, */ - { - value: 'pagination', - name: 'Yes, with pagination links', - }, - { - value: 'infinite-scroll', - name: 'Yes, with infinite scroll', - }, - ], - default: 0, + { + value: 'pagination', + name: 'Yes, with pagination links', }, - ]; - this.prompt(prompts).then(props => { - this.entityConfig.pagination = props.pagination; - this.log(chalk.green('\nEverything is configured, generating the entity...\n')); - done(); - }); + { + value: 'infinite-scroll', + name: 'Yes, with infinite scroll', + }, + ], + default: 0, + }, + ]; + this.prompt(prompts).then(props => { + this.entityConfig.pagination = props.pagination; + this.log(chalk.green('\nEverything is configured, generating the entity...\n')); + done(); + }); } /** * ask question for a field creation */ function askForField(done) { - const context = this.context; - this.log(chalk.green(`\nGenerating field #${this.entityConfig.fields.length + 1}\n`)); - // const skipServer = context.skipServer; - const prodDatabaseType = context.prodDatabaseType; - // const databaseType = context.databaseType; - const clientFramework = context.clientFramework; - const skipCheckLengthOfIdentifier = context.skipCheckLengthOfIdentifier; - const prompts = [ + const context = this.context; + this.log(chalk.green(`\nGenerating field #${this.entityConfig.fields.length + 1}\n`)); + // const skipServer = context.skipServer; + const prodDatabaseType = context.prodDatabaseType; + // const databaseType = context.databaseType; + const clientFramework = context.clientFramework; + const skipCheckLengthOfIdentifier = context.skipCheckLengthOfIdentifier; + const prompts = [ + { + type: 'confirm', + name: 'fieldAdd', + message: 'Do you want to add a field to your entity?', + default: true, + }, + { + when: response => response.fieldAdd === true, + type: 'input', + name: 'fieldName', + validate: input => { + if (!/^([a-zA-Z0-9_]*)$/.test(input)) { + return 'Your field name cannot contain special characters'; + } + if (input === '') { + return 'Your field name cannot be empty'; + } + if (input.charAt(0) === input.charAt(0).toUpperCase()) { + return 'Your field name cannot start with an upper case letter'; + } + if (input === 'id' || getFieldNameUndercored(this.entityConfig.fields).includes(_.snakeCase(input))) { + return 'Your field name cannot use an already existing field name'; + } + if ((clientFramework === undefined || clientFramework === 'angularX') && jhiCore.isReservedFieldName(input, 'angularX')) { + return 'Your field name cannot contain a Java or Angular reserved keyword'; + } + if ((clientFramework !== undefined || clientFramework === 'react') && jhiCore.isReservedFieldName(input, 'react')) { + return 'Your field name cannot contain a Java or React reserved keyword'; + } + if (prodDatabaseType === 'oracle' && input.length > 30 && !skipCheckLengthOfIdentifier) { + return 'The field name cannot be of more than 30 characters'; + } + if (input.toLowerCase() === context.name.toLowerCase()) { + return 'Your field name cannot have the same name as the entity'; + } + return true; + }, + message: 'What is the name of your field?', + }, + { + when: response => response.fieldAdd === true, + type: 'list', + name: 'fieldType', + message: 'What is the type of your field?', + choices: [ { - type: 'confirm', - name: 'fieldAdd', - message: 'Do you want to add a field to your entity?', - default: true, + value: 'String', + name: 'string', }, { - when: response => response.fieldAdd === true, - type: 'input', - name: 'fieldName', - validate: input => { - if (!/^([a-zA-Z0-9_]*)$/.test(input)) { - return 'Your field name cannot contain special characters'; - } - if (input === '') { - return 'Your field name cannot be empty'; - } - if (input.charAt(0) === input.charAt(0).toUpperCase()) { - return 'Your field name cannot start with an upper case letter'; - } - if (input === 'id' || getFieldNameUndercored(this.entityConfig.fields).includes(_.snakeCase(input))) { - return 'Your field name cannot use an already existing field name'; - } - if ((clientFramework === undefined || clientFramework === 'angularX') && jhiCore.isReservedFieldName(input, 'angularX')) { - return 'Your field name cannot contain a Java or Angular reserved keyword'; - } - if ((clientFramework !== undefined || clientFramework === 'react') && jhiCore.isReservedFieldName(input, 'react')) { - return 'Your field name cannot contain a Java or React reserved keyword'; - } - if (prodDatabaseType === 'oracle' && input.length > 30 && !skipCheckLengthOfIdentifier) { - return 'The field name cannot be of more than 30 characters'; - } - if (input.toLowerCase() === context.name.toLowerCase()) { - return 'Your field name cannot have the same name as the entity'; - } - return true; - }, - message: 'What is the name of your field?', + value: 'Integer', + name: 'int', }, { - when: response => response.fieldAdd === true, - type: 'list', - name: 'fieldType', - message: 'What is the type of your field?', - choices: [ - { - value: 'String', - name: 'string', - }, - { - value: 'Integer', - name: 'int', - }, - { - value: 'Long', - name: 'long', - }, - { - value: 'Float', - name: 'float', - }, - { - value: 'Double', - name: 'double', - }, - { - value: 'BigDecimal', - name: 'decimal', - }, - { - value: 'LocalDate', - name: 'DateTime', - }, - /* { + value: 'Long', + name: 'long', + }, + { + value: 'Float', + name: 'float', + }, + { + value: 'Double', + name: 'double', + }, + { + value: 'BigDecimal', + name: 'decimal', + }, + { + value: 'LocalDate', + name: 'DateTime', + }, + /* { value: 'Instant', name: 'Instant' }, @@ -545,89 +545,89 @@ function askForField(done) { value: 'Duration', name: 'Duration' }, */ - { - value: 'Boolean', - name: 'bool', - }, - { - value: 'enum', - name: 'Enumeration', - } /* , + { + value: 'Boolean', + name: 'bool', + }, + { + value: 'enum', + name: 'Enumeration', + } /* , { value: 'byte[]', name: '[BETA] Blob' } */, - ], - default: 0, - }, - { - when: response => { - if (response.fieldType === 'enum') { - response.fieldIsEnum = true; - return true; - } - response.fieldIsEnum = false; - return false; - }, - type: 'input', - name: 'enumType', - validate: input => { - if (input === '') { - return 'Your class name cannot be empty.'; - } - if (jhiCore.isReservedKeyword(input, 'JAVA')) { - return 'Your enum name cannot contain a Java reserved keyword'; - } - if (!/^[A-Za-z0-9_]*$/.test(input)) { - return 'Your enum name cannot contain special characters (allowed characters: A-Z, a-z, 0-9 and _)'; - } - if (context.enums.includes(input)) { - context.existingEnum = true; - } else { - context.enums.push(input); - } - return true; - }, - message: 'What is the class name of your enumeration?', - }, - { - when: response => response.fieldIsEnum, - type: 'input', - name: 'fieldValues', - validate: input => { - if (input === '' && context.existingEnum) { - context.existingEnum = false; - return true; - } - if (input === '') { - return 'You must specify values for your enumeration'; - } - // Commas allowed so that user can input a list of values split by commas. - if (!/^[A-Za-z0-9_,]+$/.test(input)) { - return 'Enum values cannot contain special characters (allowed characters: A-Z, a-z, 0-9 and _)'; - } - const enums = input.replace(/\s/g, '').split(','); - if (_.uniq(enums).length !== enums.length) { - return `Enum values cannot contain duplicates (typed values: ${input})`; - } - for (let i = 0; i < enums.length; i++) { - if (/^[0-9].*/.test(enums[i])) { - return `Enum value "${enums[i]}" cannot start with a number`; - } - if (enums[i] === '') { - return 'Enum value cannot be empty (did you accidentally type "," twice in a row?)'; - } - } + ], + default: 0, + }, + { + when: response => { + if (response.fieldType === 'enum') { + response.fieldIsEnum = true; + return true; + } + response.fieldIsEnum = false; + return false; + }, + type: 'input', + name: 'enumType', + validate: input => { + if (input === '') { + return 'Your class name cannot be empty.'; + } + if (jhiCore.isReservedKeyword(input, 'JAVA')) { + return 'Your enum name cannot contain a Java reserved keyword'; + } + if (!/^[A-Za-z0-9_]*$/.test(input)) { + return 'Your enum name cannot contain special characters (allowed characters: A-Z, a-z, 0-9 and _)'; + } + if (context.enums.includes(input)) { + context.existingEnum = true; + } else { + context.enums.push(input); + } + return true; + }, + message: 'What is the class name of your enumeration?', + }, + { + when: response => response.fieldIsEnum, + type: 'input', + name: 'fieldValues', + validate: input => { + if (input === '' && context.existingEnum) { + context.existingEnum = false; + return true; + } + if (input === '') { + return 'You must specify values for your enumeration'; + } + // Commas allowed so that user can input a list of values split by commas. + if (!/^[A-Za-z0-9_,]+$/.test(input)) { + return 'Enum values cannot contain special characters (allowed characters: A-Z, a-z, 0-9 and _)'; + } + const enums = input.replace(/\s/g, '').split(','); + if (_.uniq(enums).length !== enums.length) { + return `Enum values cannot contain duplicates (typed values: ${input})`; + } + for (let i = 0; i < enums.length; i++) { + if (/^[0-9].*/.test(enums[i])) { + return `Enum value "${enums[i]}" cannot start with a number`; + } + if (enums[i] === '') { + return 'Enum value cannot be empty (did you accidentally type "," twice in a row?)'; + } + } - return true; - }, - message: answers => { - if (!context.existingEnum) { - return 'What are the values of your enumeration (separated by comma, no spaces)?'; - } - return 'What are the new values of your enumeration (separated by comma, no spaces)?\nThe new values will replace the old ones.\nNothing will be done if there are no new values.'; - }, - } /* , + return true; + }, + message: answers => { + if (!context.existingEnum) { + return 'What are the values of your enumeration (separated by comma, no spaces)?'; + } + return 'What are the new values of your enumeration (separated by comma, no spaces)?\nThe new values will replace the old ones.\nNothing will be done if there are no new values.'; + }, + } /* , { when: response => response.fieldAdd === true && databaseType === 'cassandra', type: 'list', @@ -723,32 +723,32 @@ function askForField(done) { ], default: 0 } */, - { - when: response => response.fieldAdd === true /* && response.fieldType !== 'ByteBuffer' */, - type: 'confirm', - name: 'fieldValidate', - message: 'Do you want to add validation rules to your field?', - default: false, - }, - { - when: response => response.fieldAdd === true && response.fieldValidate === true, - type: 'checkbox', - name: 'fieldValidateRules', - message: 'Which validation rules do you want to add?', - choices: response => { - // Default rules applicable for fieldType 'LocalDate', 'Instant', - // 'ZonedDateTime', 'Duration', 'UUID', 'Boolean', 'ByteBuffer' and 'Enum' - const opts = [ - { - name: 'Required', - value: 'required', - } /* , + { + when: response => response.fieldAdd === true /* && response.fieldType !== 'ByteBuffer' */, + type: 'confirm', + name: 'fieldValidate', + message: 'Do you want to add validation rules to your field?', + default: false, + }, + { + when: response => response.fieldAdd === true && response.fieldValidate === true, + type: 'checkbox', + name: 'fieldValidateRules', + message: 'Which validation rules do you want to add?', + choices: response => { + // Default rules applicable for fieldType 'LocalDate', 'Instant', + // 'ZonedDateTime', 'Duration', 'UUID', 'Boolean', 'ByteBuffer' and 'Enum' + const opts = [ + { + name: 'Required', + value: 'required', + } /* , { name: 'Unique', value: 'unique' } */, - ]; - /* if (response.fieldType === 'String' || response.fieldTypeBlobContent === 'text') { + ]; + /* if (response.fieldType === 'String' || response.fieldTypeBlobContent === 'text') { opts.push( { name: 'Minimum length', @@ -775,10 +775,10 @@ function askForField(done) { } ); } */ - return opts; - }, - default: 0, - } /* , + return opts; + }, + default: 0, + } /* , { when: response => response.fieldAdd === true && response.fieldValidate === true && response.fieldValidateRules.includes('minlength'), @@ -857,20 +857,20 @@ function askForField(done) { message: 'What is the regular expression pattern you want to apply on your field?', default: '^[a-zA-Z0-9]*$' } */, - ]; - this.prompt(prompts).then(props => { - if (props.fieldAdd) { - if (props.fieldIsEnum) { - props.fieldType = _.upperFirst(props.fieldType); - props.fieldValues = props.fieldValues.toUpperCase(); - } + ]; + this.prompt(prompts).then(props => { + if (props.fieldAdd) { + if (props.fieldIsEnum) { + props.fieldType = _.upperFirst(props.fieldType); + props.fieldValues = props.fieldValues.toUpperCase(); + } - const field = { - fieldName: props.fieldName, - fieldType: props.enumType || props.fieldType, - /* fieldTypeBlobContent: props.fieldTypeBlobContent, */ - fieldValues: props.fieldValues, - fieldValidateRules: props.fieldValidateRules /* , + const field = { + fieldName: props.fieldName, + fieldType: props.enumType || props.fieldType, + /* fieldTypeBlobContent: props.fieldTypeBlobContent, */ + fieldValues: props.fieldValues, + fieldValidateRules: props.fieldValidateRules /* , fieldValidateRulesMinlength: props.fieldValidateRulesMinlength, fieldValidateRulesMaxlength: props.fieldValidateRulesMaxlength, fieldValidateRulesPattern: props.fieldValidateRulesPattern, @@ -878,119 +878,119 @@ function askForField(done) { fieldValidateRulesMax: props.fieldValidateRulesMax, fieldValidateRulesMinbytes: props.fieldValidateRulesMinbytes, fieldValidateRulesMaxbytes: props.fieldValidateRulesMaxbytes */, - }; + }; - this.entityConfig.fields = this.entityConfig.fields.concat(field); - } - logFieldsAndRelationships.call(this); - if (props.fieldAdd) { - askForField.call(this, done); - } else { - done(); - } - }); + this.entityConfig.fields = this.entityConfig.fields.concat(field); + } + logFieldsAndRelationships.call(this); + if (props.fieldAdd) { + askForField.call(this, done); + } else { + done(); + } + }); } /** * ask question for a relationship creation */ function askForRelationship(done) { - const context = this.context; - const name = context.name; - this.log(chalk.green('\nGenerating relationships to other entities\n')); - const prompts = [ - { - type: 'confirm', - name: 'relationshipAdd', - message: 'Do you want to add a relationship to another entity?', - default: true, - }, - { - when: response => response.relationshipAdd === true, - type: 'input', - name: 'otherEntityName', - validate: input => { - if (!/^([a-zA-Z0-9_]*)$/.test(input)) { - return 'Your other entity name cannot contain special characters'; - } - if (input === '') { - return 'Your other entity name cannot be empty'; - } - if (jhiCore.isReservedKeyword(input, 'JAVA')) { - return 'Your other entity name cannot contain a Java reserved keyword'; - } - /* if (input.toLowerCase() === 'user' && context.applicationType === 'microservice') { + const context = this.context; + const name = context.name; + this.log(chalk.green('\nGenerating relationships to other entities\n')); + const prompts = [ + { + type: 'confirm', + name: 'relationshipAdd', + message: 'Do you want to add a relationship to another entity?', + default: true, + }, + { + when: response => response.relationshipAdd === true, + type: 'input', + name: 'otherEntityName', + validate: input => { + if (!/^([a-zA-Z0-9_]*)$/.test(input)) { + return 'Your other entity name cannot contain special characters'; + } + if (input === '') { + return 'Your other entity name cannot be empty'; + } + if (jhiCore.isReservedKeyword(input, 'JAVA')) { + return 'Your other entity name cannot contain a Java reserved keyword'; + } + /* if (input.toLowerCase() === 'user' && context.applicationType === 'microservice') { return "Your entity cannot have a relationship with User because it's a gateway entity"; } */ - return true; - }, - message: 'What is the name of the other entity?', - }, - { - when: response => response.relationshipAdd === true, - type: 'input', - name: 'relationshipName', - validate: input => { - if (!/^([a-zA-Z0-9_]*)$/.test(input)) { - return 'Your relationship cannot contain special characters'; - } - if (input === '') { - return 'Your relationship cannot be empty'; - } - if (input.charAt(0) === input.charAt(0).toUpperCase()) { - return 'Your relationship cannot start with an upper case letter'; - } - if (input === 'id' || getFieldNameUndercored(this.entityConfig.fields).includes(_.snakeCase(input))) { - return 'Your relationship cannot use an already existing field name'; - } - if (jhiCore.isReservedKeyword(input, 'JAVA')) { - return 'Your relationship cannot contain a Java reserved keyword'; - } - return true; - }, - message: 'What is the name of the relationship?', - default: response => _.lowerFirst(response.otherEntityName), - }, - { - when: response => response.relationshipAdd === true, - type: 'list', - name: 'relationshipType', - message: 'What is the type of the relationship?', - choices: response => { - const opts = [ - { - value: 'many-to-one', - name: 'many-to-one', - }, - { - value: 'many-to-many', - name: 'many-to-many', - }, - { - value: 'one-to-one', - name: 'one-to-one', - }, - ]; - if (response.otherEntityName.toLowerCase() !== 'user') { - opts.unshift({ - value: 'one-to-many', - name: 'one-to-many', - }); - } - return opts; - }, - default: 0, - }, - { - when: response => - response.relationshipAdd === true && - response.otherEntityName.toLowerCase() !== 'user' && - (response.relationshipType === 'many-to-many' || response.relationshipType === 'one-to-one'), - type: 'confirm', - name: 'ownerSide', - message: 'Is this entity the owner of the relationship?', - default: false, - } /* , + return true; + }, + message: 'What is the name of the other entity?', + }, + { + when: response => response.relationshipAdd === true, + type: 'input', + name: 'relationshipName', + validate: input => { + if (!/^([a-zA-Z0-9_]*)$/.test(input)) { + return 'Your relationship cannot contain special characters'; + } + if (input === '') { + return 'Your relationship cannot be empty'; + } + if (input.charAt(0) === input.charAt(0).toUpperCase()) { + return 'Your relationship cannot start with an upper case letter'; + } + if (input === 'id' || getFieldNameUndercored(this.entityConfig.fields).includes(_.snakeCase(input))) { + return 'Your relationship cannot use an already existing field name'; + } + if (jhiCore.isReservedKeyword(input, 'JAVA')) { + return 'Your relationship cannot contain a Java reserved keyword'; + } + return true; + }, + message: 'What is the name of the relationship?', + default: response => _.lowerFirst(response.otherEntityName), + }, + { + when: response => response.relationshipAdd === true, + type: 'list', + name: 'relationshipType', + message: 'What is the type of the relationship?', + choices: response => { + const opts = [ + { + value: 'many-to-one', + name: 'many-to-one', + }, + { + value: 'many-to-many', + name: 'many-to-many', + }, + { + value: 'one-to-one', + name: 'one-to-one', + }, + ]; + if (response.otherEntityName.toLowerCase() !== 'user') { + opts.unshift({ + value: 'one-to-many', + name: 'one-to-many', + }); + } + return opts; + }, + default: 0, + }, + { + when: response => + response.relationshipAdd === true && + response.otherEntityName.toLowerCase() !== 'user' && + (response.relationshipType === 'many-to-many' || response.relationshipType === 'one-to-one'), + type: 'confirm', + name: 'ownerSide', + message: 'Is this entity the owner of the relationship?', + default: false, + } /* , { when: response => context.databaseType === 'sql' && @@ -1002,29 +1002,29 @@ function askForRelationship(done) { message: 'Do you want to use JPA Derived Identifier - @MapsId?', default: false } */, - { - when: response => - response.relationshipAdd === true && - (response.relationshipType === 'one-to-many' || - ((response.relationshipType === 'many-to-many' || response.relationshipType === 'one-to-one') && - response.otherEntityName.toLowerCase() !== 'user')), - type: 'input', - name: 'otherEntityRelationshipName', - message: 'What is the name of this relationship in the other entity?', - default: response => _.lowerFirst(name), - }, - { - when: response => - response.relationshipAdd === true && - (response.relationshipType === 'many-to-one' || - (response.relationshipType === 'many-to-many' && response.ownerSide === true) || - (response.relationshipType === 'one-to-one' && response.ownerSide === true)), - type: 'input', - name: 'otherEntityField', - message: response => - `When you display this relationship on client-side, which field from '${response.otherEntityName}' do you want to use? This field will be displayed as a String, so it cannot be a Blob`, - default: 'id', - } /* , + { + when: response => + response.relationshipAdd === true && + (response.relationshipType === 'one-to-many' || + ((response.relationshipType === 'many-to-many' || response.relationshipType === 'one-to-one') && + response.otherEntityName.toLowerCase() !== 'user')), + type: 'input', + name: 'otherEntityRelationshipName', + message: 'What is the name of this relationship in the other entity?', + default: response => _.lowerFirst(name), + }, + { + when: response => + response.relationshipAdd === true && + (response.relationshipType === 'many-to-one' || + (response.relationshipType === 'many-to-many' && response.ownerSide === true) || + (response.relationshipType === 'one-to-one' && response.ownerSide === true)), + type: 'input', + name: 'otherEntityField', + message: response => + `When you display this relationship on client-side, which field from '${response.otherEntityName}' do you want to use? This field will be displayed as a String, so it cannot be a Blob`, + default: 'id', + } /* , { when: response => response.relationshipAdd === true && @@ -1052,55 +1052,55 @@ function askForRelationship(done) { ], default: 0 } */, - ]; - this.prompt(prompts).then(props => { - if (props.relationshipAdd) { - const relationship = { - relationshipName: props.relationshipName, - otherEntityName: _.lowerFirst(props.otherEntityName), - relationshipType: props.relationshipType, - // relationshipValidateRules: props.relationshipValidateRules, - otherEntityField: props.otherEntityField, - ownerSide: props.ownerSide, - // useJPADerivedIdentifier: props.useJPADerivedIdentifier, - otherEntityRelationshipName: props.otherEntityRelationshipName, - }; + ]; + this.prompt(prompts).then(props => { + if (props.relationshipAdd) { + const relationship = { + relationshipName: props.relationshipName, + otherEntityName: _.lowerFirst(props.otherEntityName), + relationshipType: props.relationshipType, + // relationshipValidateRules: props.relationshipValidateRules, + otherEntityField: props.otherEntityField, + ownerSide: props.ownerSide, + // useJPADerivedIdentifier: props.useJPADerivedIdentifier, + otherEntityRelationshipName: props.otherEntityRelationshipName, + }; - if (props.otherEntityName.toLowerCase() === 'user') { - relationship.ownerSide = true; - relationship.otherEntityField = 'login'; - relationship.otherEntityRelationshipName = _.lowerFirst(name); - } - this.entityConfig.relationships = this.entityConfig.relationships.concat(relationship); - } - logFieldsAndRelationships.call(this); - if (props.relationshipAdd) { - askForRelationship.call(this, done); - } else { - this.log('\n'); - done(); - } - }); + if (props.otherEntityName.toLowerCase() === 'user') { + relationship.ownerSide = true; + relationship.otherEntityField = 'login'; + relationship.otherEntityRelationshipName = _.lowerFirst(name); + } + this.entityConfig.relationships = this.entityConfig.relationships.concat(relationship); + } + logFieldsAndRelationships.call(this); + if (props.relationshipAdd) { + askForRelationship.call(this, done); + } else { + this.log('\n'); + done(); + } + }); } /** * Show the entity and it's fields and relationships in console */ function logFieldsAndRelationships() { - const context = this.context; - if (this.entityConfig.fields.length > 0 || this.entityConfig.relationships.length > 0) { - this.log(chalk.red(chalk.white('\n================= ') + context.name + chalk.white(' ================='))); - } - if (this.entityConfig.fields.length > 0) { - this.log(chalk.white('Fields')); - this.entityConfig.fields.forEach(field => { - const validationDetails = []; - const fieldValidate = _.isArray(field.fieldValidateRules) && field.fieldValidateRules.length >= 1; - if (fieldValidate === true) { - if (field.fieldValidateRules.includes('required')) { - validationDetails.push('required'); - } - /* if (field.fieldValidateRules.includes('unique')) { + const context = this.context; + if (this.entityConfig.fields.length > 0 || this.entityConfig.relationships.length > 0) { + this.log(chalk.red(chalk.white('\n================= ') + context.name + chalk.white(' ================='))); + } + if (this.entityConfig.fields.length > 0) { + this.log(chalk.white('Fields')); + this.entityConfig.fields.forEach(field => { + const validationDetails = []; + const fieldValidate = _.isArray(field.fieldValidateRules) && field.fieldValidateRules.length >= 1; + if (fieldValidate === true) { + if (field.fieldValidateRules.includes('required')) { + validationDetails.push('required'); + } + /* if (field.fieldValidateRules.includes('unique')) { validationDetails.push('unique'); } if (field.fieldValidateRules.includes('minlength')) { @@ -1124,28 +1124,28 @@ function logFieldsAndRelationships() { if (field.fieldValidateRules.includes('maxbytes')) { validationDetails.push(`maxbytes='${field.fieldValidateRulesMaxbytes}'`); } */ - } - this.log( - chalk.red(field.fieldName) + - chalk.white(` (${field.fieldType}${field.fieldTypeBlobContent ? ` ${field.fieldTypeBlobContent}` : ''}) `) + - chalk.cyan(validationDetails.join(' ')) - ); - }); - this.log(); - } - if (this.entityConfig.relationships.length > 0) { - this.log(chalk.white('Relationships')); - this.entityConfig.relationships.forEach(relationship => { - // const validationDetails = []; - /* if (relationship.relationshipValidateRules && relationship.relationshipValidateRules.includes('required')) { + } + this.log( + chalk.red(field.fieldName) + + chalk.white(` (${field.fieldType}${field.fieldTypeBlobContent ? ` ${field.fieldTypeBlobContent}` : ''}) `) + + chalk.cyan(validationDetails.join(' ')), + ); + }); + this.log(); + } + if (this.entityConfig.relationships.length > 0) { + this.log(chalk.white('Relationships')); + this.entityConfig.relationships.forEach(relationship => { + // const validationDetails = []; + /* if (relationship.relationshipValidateRules && relationship.relationshipValidateRules.includes('required')) { validationDetails.push('required'); } */ - this.log( - `${chalk.red(relationship.relationshipName)} ${chalk.white(`(${_.upperFirst(relationship.otherEntityName)})`)} ${chalk.cyan( - relationship.relationshipType - )}` // ${chalk.cyan(validationDetails.join(' '))}` - ); - }); - this.log(); - } + this.log( + `${chalk.red(relationship.relationshipName)} ${chalk.white(`(${_.upperFirst(relationship.otherEntityName)})`)} ${chalk.cyan( + relationship.relationshipType, + )}`, // ${chalk.cyan(validationDetails.join(' '))}` + ); + }); + this.log(); + } } diff --git a/generators/generator-base-dotnetcore.js b/generators/generator-base-dotnetcore.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/generators/generator-dotnetcore-constants.cjs b/generators/generator-dotnetcore-constants.cjs index 7e88e5cc1..16e51378f 100644 --- a/generators/generator-dotnetcore-constants.cjs +++ b/generators/generator-dotnetcore-constants.cjs @@ -1,43 +1,5 @@ -const SERVER_SRC_DIR = 'src/'; -const CLIENT_SRC_DIR = 'src/'; -const CLIENT_TEST_DIR = 'test/'; -const SERVER_TEST_DIR = 'test/'; -const PROJECT_TEST_SUFFIX = '.Test'; -const PROJECT_DTO_SUFFIX = '.Dto'; -const PROJECT_DOMAIN_SUFFIX = '.Domain'; -const PROJECT_APPLICATION_SUFFIX = '.Application'; -const DOCKER_DIR = 'docker/'; -const PROJECT_CROSSCUTTING_SUFFIX = '.Crosscutting'; -const PROJECT_INFRASTRUCTURE_SUFFIX = '.Infrastructure'; -const PROJECT_SERVICE_SUFFIX = '.Domain.Services'; -const BLAZOR = 'Blazor'; -const XAMARIN = 'Xamarin'; -const TERRAFORM_DIR = 'terraform/'; -const GITHUB = 'Github'; -const GITLAB = 'Gitlab'; - -// Version of Node, NPM -const NODE_VERSION = '16.14.0'; const NPM_VERSION = '8.6.0'; module.exports = { - SERVER_SRC_DIR, - CLIENT_SRC_DIR, - CLIENT_TEST_DIR, - SERVER_TEST_DIR, - PROJECT_DTO_SUFFIX, - PROJECT_DOMAIN_SUFFIX, - PROJECT_APPLICATION_SUFFIX, - PROJECT_TEST_SUFFIX, - DOCKER_DIR, - PROJECT_CROSSCUTTING_SUFFIX, - PROJECT_INFRASTRUCTURE_SUFFIX, - PROJECT_SERVICE_SUFFIX, - BLAZOR, - XAMARIN, - TERRAFORM_DIR, - NODE_VERSION, - NPM_VERSION, - GITHUB, - GITLAB + NPM_VERSION, }; diff --git a/generators/generator-dotnetcore-constants.js b/generators/generator-dotnetcore-constants.js new file mode 100644 index 000000000..659a51290 --- /dev/null +++ b/generators/generator-dotnetcore-constants.js @@ -0,0 +1,54 @@ +/** + * Copyright 2019-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export const SERVER_SRC_DIR = 'src/'; +export const CLIENT_SRC_DIR = 'src/'; +export const CLIENT_TEST_DIR = 'test/'; +export const SERVER_TEST_DIR = 'test/'; +export const PROJECT_TEST_SUFFIX = '.Test'; +export const PROJECT_DTO_SUFFIX = '.Dto'; +export const PROJECT_DOMAIN_SUFFIX = '.Domain'; +export const PROJECT_APPLICATION_SUFFIX = '.Application'; +export const DOCKER_DIR = 'docker/'; +export const PROJECT_CROSSCUTTING_SUFFIX = '.Crosscutting'; +export const PROJECT_INFRASTRUCTURE_SUFFIX = '.Infrastructure'; +export const PROJECT_SERVICE_SUFFIX = '.Domain.Services'; +export const BLAZOR = 'Blazor'; +export const XAMARIN = 'Xamarin'; +export const TERRAFORM_DIR = 'terraform/'; +export const GITHUB = 'Github'; +export const GITLAB = 'Gitlab'; + +// Version of Node, NPM +export const NODE_VERSION = '16.14.0'; +export const NPM_VERSION = '8.6.0'; + +export const renameDotNetCore = + (prefix = SERVER_SRC_DIR) => + (data, filepath) => + prefix + + filepath + .replace(/^Project\./, `${data.pascalizedBaseName}.`) + .replace(/\/Project\./, `/${data.pascalizedBaseName}.`) + .replace(/^Project\//, `${data.pascalizedBaseName}/`) + .replace('_withEntities_', '') + .replace('_dotnetEntityModel_', data.dotnetEntityModel) + .replaceAll('_persistClass_', data.persistClass) + .replaceAll('_entityClass_', data.entityClass) + .replace('_pascalizedEntityClassPlural_', data.pascalizedEntityClassPlural) + .replace('_dtoClass_', data.dtoClass); diff --git a/generators/heroku/build.js b/generators/heroku/build.js index 3ca5c1f1c..0a504214b 100644 --- a/generators/heroku/build.js +++ b/generators/heroku/build.js @@ -21,28 +21,28 @@ const ChildProcess = require('child_process'); const Which = require('which'); function dockerBuild(appName, dockerFile, log) { - const processType = 'web'; - log(chalk.bold(`\nBuilding ${appName}`)); + const processType = 'web'; + log(chalk.bold(`\nBuilding ${appName}`)); - const dockerBuildCommand = `docker build -f ${dockerFile} -t ${appName}:latest .`; - log(chalk.bold('\nRunning'), chalk.cyan(dockerBuildCommand)); - ChildProcess.execFileSync( - Which.sync('docker'), - ['build', '-f', dockerFile, '--build-arg', 'INCLUDE_BLAZOR=true', '-t', `${appName}:latest`, '.'], - { - shell: false, - stdio: 'inherit', - } - ); + const dockerBuildCommand = `docker build -f ${dockerFile} -t ${appName}:latest .`; + log(chalk.bold('\nRunning'), chalk.cyan(dockerBuildCommand)); + ChildProcess.execFileSync( + Which.sync('docker'), + ['build', '-f', dockerFile, '--build-arg', 'INCLUDE_BLAZOR=true', '-t', `${appName}:latest`, '.'], + { + shell: false, + stdio: 'inherit', + }, + ); - const dockerTagCommand = `docker tag ${appName} registry.heroku.com/${appName}/${processType}`; - log(chalk.bold('\nRunning'), chalk.cyan(dockerTagCommand)); - ChildProcess.execFileSync(Which.sync('docker'), ['tag', appName, `registry.heroku.com/${appName}/${processType}`], { - shell: false, - stdio: 'inherit', - }); + const dockerTagCommand = `docker tag ${appName} registry.heroku.com/${appName}/${processType}`; + log(chalk.bold('\nRunning'), chalk.cyan(dockerTagCommand)); + ChildProcess.execFileSync(Which.sync('docker'), ['tag', appName, `registry.heroku.com/${appName}/${processType}`], { + shell: false, + stdio: 'inherit', + }); } module.exports = { - dockerBuild, + dockerBuild, }; diff --git a/generators/heroku/command.js b/generators/heroku/command.js new file mode 100644 index 000000000..b5a045029 --- /dev/null +++ b/generators/heroku/command.js @@ -0,0 +1,8 @@ +/** + * @type {import('generator-jhipster').JHipsterCommandDefinition} + */ +const command = { + options: {}, +}; + +export default command; diff --git a/generators/heroku/deploy.js b/generators/heroku/deploy.js index 44c097598..01ee7f325 100644 --- a/generators/heroku/deploy.js +++ b/generators/heroku/deploy.js @@ -21,141 +21,141 @@ const ChildProcess = require('child_process'); const util = require('util'); const Which = require('which'); const { OAUTH2 } = require('generator-jhipster/jdl/jhipster/authentication-types'); -const { BLAZOR } = require('../generator-dotnetcore-constants.cjs'); +const { BLAZOR } = require('../generator-dotnetcore-constants.js'); const execFileCmd = util.promisify(ChildProcess.execFile); function setHerokuStack(appName, log) { - const herokuStackSetCommand = `heroku stack:set container --app ${appName}`; - log(chalk.bold('\nRunning'), chalk.cyan(herokuStackSetCommand)); - ChildProcess.execFileSync(Which.sync('heroku'), ['stack:set', 'container', '--app', appName], { - shell: false, - }); + const herokuStackSetCommand = `heroku stack:set container --app ${appName}`; + log(chalk.bold('\nRunning'), chalk.cyan(herokuStackSetCommand)); + ChildProcess.execFileSync(Which.sync('heroku'), ['stack:set', 'container', '--app', appName], { + shell: false, + }); } function setHerokuConfig(appName, configKey, configValue, log) { - const herokuStackSetCommand = `heroku config:set ${configKey}=${configValue} --app ${appName}`; - log(chalk.bold('\nRunning'), chalk.cyan(herokuStackSetCommand)); - ChildProcess.execFileSync(Which.sync('heroku'), ['config:set', `${configKey}=${configValue}`, '--app', appName], { - shell: false, - }); + const herokuStackSetCommand = `heroku config:set ${configKey}=${configValue} --app ${appName}`; + log(chalk.bold('\nRunning'), chalk.cyan(herokuStackSetCommand)); + ChildProcess.execFileSync(Which.sync('heroku'), ['config:set', `${configKey}=${configValue}`, '--app', appName], { + shell: false, + }); } function dockerPush(appName, log) { - const processType = 'web'; - const dockerPushCommand = `docker push registry.heroku.com/${appName}/${processType}`; - log(chalk.bold('\nRunning'), chalk.cyan(dockerPushCommand)); - ChildProcess.execFileSync(Which.sync('docker'), ['push', `registry.heroku.com/${appName}/${processType}`], { - shell: false, - stdio: 'inherit', - }); + const processType = 'web'; + const dockerPushCommand = `docker push registry.heroku.com/${appName}/${processType}`; + log(chalk.bold('\nRunning'), chalk.cyan(dockerPushCommand)); + ChildProcess.execFileSync(Which.sync('docker'), ['push', `registry.heroku.com/${appName}/${processType}`], { + shell: false, + stdio: 'inherit', + }); } function herokuRelease(appName, log) { - const processType = 'web'; - const herokuReleaseCommand = `heroku container:release ${processType} --app ${appName}`; - log(chalk.bold('\nRunning'), chalk.cyan(herokuReleaseCommand)); - ChildProcess.execFileSync(Which.sync('heroku'), ['container:release', processType, '--app', appName], { - shell: false, - stdio: 'inherit', - }); + const processType = 'web'; + const herokuReleaseCommand = `heroku container:release ${processType} --app ${appName}`; + log(chalk.bold('\nRunning'), chalk.cyan(herokuReleaseCommand)); + ChildProcess.execFileSync(Which.sync('heroku'), ['container:release', processType, '--app', appName], { + shell: false, + stdio: 'inherit', + }); } function herokuContainerRegistryDeploy() { - try { - this.log(chalk.bold(`\nDeploying ${this.herokuAppName} to Heroku's Container Registry`)); - const serverUrl = `https://${this.herokuAppName}.herokuapp.com`; - setHerokuStack(this.herokuAppName, this.log); - setHerokuConfig(this.herokuAppName, 'ServerUrl', serverUrl, this.log); - dockerPush(this.herokuAppName, this.log); - herokuRelease(this.herokuAppName, this.log); - - this.log(chalk.green(`\nYour app should now be live. To view it run\n\t${chalk.bold('heroku open')}`)); - this.log(chalk.green('\nOr open the following URL in your browser:')); - this.log(chalk.green(serverUrl)); - const herokuLogCommandDotnetBack = `heroku logs --tail --app ${this.herokuAppName}`; - this.log(chalk.yellow(`And you can view the logs with this command\n\t${chalk.bold(herokuLogCommandDotnetBack)}`)); - - if (this.authenticationType === OAUTH2) { - this.log( - chalk.bold( - '\nYou are using OAuth 2.0. OAuth2/okta requires a manual setup. Please see the documentation for more information at the below url:' - ) - ); - this.log(chalk.green('https://jhipsternet.readthedocs.io/en/latest/Features/heroku.html#oauth2')); - } - this.log(chalk.yellow(`\nAfter application modification, redeploy it with\n\t${chalk.bold('jhipster heroku')}\n`)); - } catch (err) { - this.log.error(err); + try { + this.log(chalk.bold(`\nDeploying ${this.herokuAppName} to Heroku's Container Registry`)); + const serverUrl = `https://${this.herokuAppName}.herokuapp.com`; + setHerokuStack(this.herokuAppName, this.log); + setHerokuConfig(this.herokuAppName, 'ServerUrl', serverUrl, this.log); + dockerPush(this.herokuAppName, this.log); + herokuRelease(this.herokuAppName, this.log); + + this.log(chalk.green(`\nYour app should now be live. To view it run\n\t${chalk.bold('heroku open')}`)); + this.log(chalk.green('\nOr open the following URL in your browser:')); + this.log(chalk.green(serverUrl)); + const herokuLogCommandDotnetBack = `heroku logs --tail --app ${this.herokuAppName}`; + this.log(chalk.yellow(`And you can view the logs with this command\n\t${chalk.bold(herokuLogCommandDotnetBack)}`)); + + if (this.authenticationType === OAUTH2) { + this.log( + chalk.bold( + '\nYou are using OAuth 2.0. OAuth2/okta requires a manual setup. Please see the documentation for more information at the below url:', + ), + ); + this.log(chalk.green('https://jhipsternet.readthedocs.io/en/latest/Features/heroku.html#oauth2')); } + this.log(chalk.yellow(`\nAfter application modification, redeploy it with\n\t${chalk.bold('jhipster heroku')}\n`)); + } catch (err) { + this.log.error(err); + } } async function herokuGitDeploy() { - try { - this.log(chalk.bold('\nUpdating Git repository')); - const serverUrl = `https://${this.herokuAppName}.herokuapp.com`; - const gitAddCmd = 'git add .'; - this.log(chalk.cyan(gitAddCmd)); - - const gitAdd = execFileCmd(Which.sync('git'), ['add', '.']); - gitAdd.child.stdout.on('data', data => { - this.log(data); - }); - - gitAdd.child.stderr.on('data', data => { - this.log(data); - }); - - await gitAdd; - - const gitCommitCmd = 'git commit -m "Deploy to Heroku" --allow-empty'; - this.log(chalk.cyan(gitCommitCmd)); - - const gitCommit = execFileCmd(Which.sync('git'), ['commit', '-m', '"Deploy to Heroku"', '--allow-empty']); - gitCommit.child.stdout.on('data', data => { - this.log(data); - }); - - gitCommit.child.stderr.on('data', data => { - this.log(data); - }); - await gitCommit; - - this.log(chalk.bold('\nConfiguring Heroku')); - setHerokuStack(this.herokuAppName, this.log); - - if (this.clientFramework === BLAZOR) { - setHerokuConfig(this.herokuAppName, 'ServerUrl', serverUrl, this.log); - } - - this.log(chalk.bold('\nDeploying application')); - - const herokuPush = execFileCmd(Which.sync('git'), ['push', 'heroku', 'HEAD:main'], { - maxBuffer: 1024 * 10000, - }); - - herokuPush.child.stdout.on('data', data => { - this.log(data); - }); - - herokuPush.child.stderr.on('data', data => { - this.log(data); - }); - - await herokuPush; - - this.log(chalk.green(`\nYour app should now be live. To view it run\n\t${chalk.bold('heroku open')}`)); - this.log(chalk.green('\nOr open the following URL in your browser:')); - this.log(chalk.green(serverUrl)); - const herokuLogsCommand = `heroku logs --tail --app ${this.herokuAppName}`; - this.log(chalk.yellow(`And you can view the logs with this command\n\t${chalk.bold(herokuLogsCommand)}`)); - this.log(chalk.yellow(`After application modification, redeploy it with\n\t${chalk.bold('jhipster heroku')}`)); - } catch (err) { - this.log.error(err); + try { + this.log(chalk.bold('\nUpdating Git repository')); + const serverUrl = `https://${this.herokuAppName}.herokuapp.com`; + const gitAddCmd = 'git add .'; + this.log(chalk.cyan(gitAddCmd)); + + const gitAdd = execFileCmd(Which.sync('git'), ['add', '.']); + gitAdd.child.stdout.on('data', data => { + this.log(data); + }); + + gitAdd.child.stderr.on('data', data => { + this.log(data); + }); + + await gitAdd; + + const gitCommitCmd = 'git commit -m "Deploy to Heroku" --allow-empty'; + this.log(chalk.cyan(gitCommitCmd)); + + const gitCommit = execFileCmd(Which.sync('git'), ['commit', '-m', '"Deploy to Heroku"', '--allow-empty']); + gitCommit.child.stdout.on('data', data => { + this.log(data); + }); + + gitCommit.child.stderr.on('data', data => { + this.log(data); + }); + await gitCommit; + + this.log(chalk.bold('\nConfiguring Heroku')); + setHerokuStack(this.herokuAppName, this.log); + + if (this.clientFramework === BLAZOR) { + setHerokuConfig(this.herokuAppName, 'ServerUrl', serverUrl, this.log); } + + this.log(chalk.bold('\nDeploying application')); + + const herokuPush = execFileCmd(Which.sync('git'), ['push', 'heroku', 'HEAD:main'], { + maxBuffer: 1024 * 10000, + }); + + herokuPush.child.stdout.on('data', data => { + this.log(data); + }); + + herokuPush.child.stderr.on('data', data => { + this.log(data); + }); + + await herokuPush; + + this.log(chalk.green(`\nYour app should now be live. To view it run\n\t${chalk.bold('heroku open')}`)); + this.log(chalk.green('\nOr open the following URL in your browser:')); + this.log(chalk.green(serverUrl)); + const herokuLogsCommand = `heroku logs --tail --app ${this.herokuAppName}`; + this.log(chalk.yellow(`And you can view the logs with this command\n\t${chalk.bold(herokuLogsCommand)}`)); + this.log(chalk.yellow(`After application modification, redeploy it with\n\t${chalk.bold('jhipster heroku')}`)); + } catch (err) { + this.log.error(err); + } } module.exports = { - herokuContainerRegistryDeploy, - herokuGitDeploy, + herokuContainerRegistryDeploy, + herokuGitDeploy, }; diff --git a/generators/heroku/generator.js b/generators/heroku/generator.js new file mode 100644 index 000000000..28a654d47 --- /dev/null +++ b/generators/heroku/generator.js @@ -0,0 +1,170 @@ +import HerokuGenerator from 'generator-jhipster/generators/heroku'; +import command from './command.mjs'; + +export default class extends HerokuGenerator { + constructor(args, opts, features) { + super(args, opts, { + ...features, + checkBlueprint: true, + // Dropped it once migration is done. + jhipster7Migration: true, + }); + } + + get [HerokuGenerator.INITIALIZING]() { + return this.asInitializingTaskGroup({ + ...super.initializing, + async initializingTemplateTask() { + this.parseJHipsterArguments(command.arguments); + this.parseJHipsterOptions(command.options); + }, + }); + } + + get [HerokuGenerator.PROMPTING]() { + return this.asPromptingTaskGroup({ + ...super.prompting, + async promptingTemplateTask() {}, + }); + } + + get [HerokuGenerator.CONFIGURING]() { + return this.asConfiguringTaskGroup({ + ...super.configuring, + async configuringTemplateTask() {}, + }); + } + + get [HerokuGenerator.COMPOSING]() { + return this.asComposingTaskGroup({ + ...super.composing, + async composingTemplateTask() {}, + }); + } + + get [HerokuGenerator.LOADING]() { + return this.asLoadingTaskGroup({ + ...super.loading, + async loadingTemplateTask() {}, + }); + } + + get [HerokuGenerator.PREPARING]() { + return this.asPreparingTaskGroup({ + ...super.preparing, + async preparingTemplateTask() {}, + }); + } + + get [HerokuGenerator.CONFIGURING_EACH_ENTITY]() { + return this.asConfiguringEachEntityTaskGroup({ + ...super.configuringEachEntity, + async configuringEachEntityTemplateTask() {}, + }); + } + + get [HerokuGenerator.LOADING_ENTITIES]() { + return this.asLoadingEntitiesTaskGroup({ + ...super.loadingEntities, + async loadingEntitiesTemplateTask() {}, + }); + } + + get [HerokuGenerator.PREPARING_EACH_ENTITY]() { + return this.asPreparingEachEntityTaskGroup({ + ...super.preparingEachEntity, + async preparingEachEntityTemplateTask() {}, + }); + } + + get [HerokuGenerator.PREPARING_EACH_ENTITY_FIELD]() { + return this.asPreparingEachEntityFieldTaskGroup({ + ...super.preparingEachEntityField, + async preparingEachEntityFieldTemplateTask() {}, + }); + } + + get [HerokuGenerator.PREPARING_EACH_ENTITY_RELATIONSHIP]() { + return this.asPreparingEachEntityRelationshipTaskGroup({ + ...super.preparingEachEntityRelationship, + async preparingEachEntityRelationshipTemplateTask() {}, + }); + } + + get [HerokuGenerator.POST_PREPARING_EACH_ENTITY]() { + return this.asPostPreparingEachEntityTaskGroup({ + ...super.postPreparingEachEntity, + async postPreparingEachEntityTemplateTask() {}, + }); + } + + get [HerokuGenerator.DEFAULT]() { + return this.asDefaultTaskGroup({ + ...super.default, + async defaultTemplateTask() {}, + }); + } + + get [HerokuGenerator.WRITING]() { + return this.asWritingTaskGroup({ + ...super.writing, + async writingTemplateTask({ application }) { + await this.writeFiles({ + sections: { + files: [{ templates: ['template-file-heroku'] }], + }, + context: application, + }); + }, + }); + } + + get [HerokuGenerator.WRITING_ENTITIES]() { + return this.asWritingEntitiesTaskGroup({ + ...super.writingEntities, + async writingEntitiesTemplateTask() {}, + }); + } + + get [HerokuGenerator.POST_WRITING]() { + return this.asPostWritingTaskGroup({ + ...super.postWriting, + async postWritingTemplateTask() {}, + }); + } + + get [HerokuGenerator.POST_WRITING_ENTITIES]() { + return this.asPostWritingEntitiesTaskGroup({ + ...super.postWritingEntities, + async postWritingEntitiesTemplateTask() {}, + }); + } + + get [HerokuGenerator.LOADING_TRANSLATIONS]() { + return this.asLoadingTranslationsTaskGroup({ + ...super.loadingTranslations, + async loadingTranslationsTemplateTask() {}, + }); + } + + get [HerokuGenerator.INSTALL]() { + return this.asInstallTaskGroup({ + ...super.install, + async installTemplateTask() {}, + }); + } + + get [HerokuGenerator.POST_INSTALL]() { + return this.asPostInstallTaskGroup({ + ...super.postInstall, + async postInstallTemplateTask() {}, + }); + } + + get [HerokuGenerator.END]() { + return this.asEndTaskGroup({ + ...super.end, + async endTemplateTask() {}, + }); + } +} diff --git a/generators/heroku/generator.spec.js b/generators/heroku/generator.spec.js new file mode 100644 index 000000000..d43618a77 --- /dev/null +++ b/generators/heroku/generator.spec.js @@ -0,0 +1,26 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'heroku'; +const BLUEPRINT_NAMESPACE = `jhipster:${SUB_GENERATOR}`; + +describe.skip('SubGenerator heroku of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(BLUEPRINT_NAMESPACE) + .withJHipsterConfig() + .withOptions({ + ignoreNeedlesError: true, + blueprint: 'dotnetcore', + }) + .withJHipsterLookup() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/heroku/index.js b/generators/heroku/index.js index 517c2d662..3eccd6e86 100644 --- a/generators/heroku/index.js +++ b/generators/heroku/index.js @@ -1,248 +1,2 @@ -/** - * Copyright 2013-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-disable consistent-return */ -const crypto = require('crypto'); -const _ = require('lodash'); -const chalk = require('chalk'); -const toPascalCase = require('to-pascal-case'); - -const HerokuGenerator = require('generator-jhipster/generators/heroku'); -const { - INITIALIZING_PRIORITY, - PROMPTING_PRIORITY, - CONFIGURING_PRIORITY, - LOADING_PRIORITY, - DEFAULT_PRIORITY, - WRITING_PRIORITY, - END_PRIORITY, -} = require('generator-jhipster/lib/constants/priorities.cjs').compat; - -const constants = require('../generator-dotnetcore-constants.cjs'); -const build = require('./build'); -const deploy = require('./deploy'); -const provision = require('./provision'); -const prompts = require('./prompts'); - -module.exports = class extends HerokuGenerator { - constructor(args, options, features) { - super(args, { fromBlueprint: true, ...options }, features); - - this.option('skip-build', { - desc: 'Skips building the application', - type: Boolean, - defaults: false, - }); - - this.option('skip-deploy', { - desc: 'Skips deployment to Heroku', - type: Boolean, - defaults: false, - }); - - if (this.options.help) { - return; - } - - this.randomPassword = crypto.randomBytes(20).toString('hex'); - this.herokuSkipBuild = this.options.skipBuild; - this.herokuSkipDeploy = this.options.skipDeploy || this.options.skipBuild; - } - - _initializing() { - return { - validateFromCli() { - this.checkInvocationFromCLI(); - }, - - loadCommonConfig() { - this.loadAppConfig(); - this.loadServerConfig(); - this.loadPlatformConfig(); - }, - - initializing() { - this.log(chalk.bold('Heroku configuration is starting')); - const configuration = this.config; - this.env.options.appPath = configuration.get('appPath') || constants.CLIENT_SRC_DIR; - this.baseName = configuration.get('baseName'); - this.databaseType = configuration.get('databaseType'); - this.frontendAppName = this.getFrontendAppName(); - this.herokuAppName = configuration.get('herokuAppName'); - this.clientFramework = configuration.get('clientFramework'); - this.dynoSize = 'Free'; - this.herokuDeployType = configuration.get('herokuDeployType'); - this.oktaAdminLogin = configuration.get('oktaAdminLogin'); - this.oktaAdminPassword = configuration.get('oktaAdminPassword'); - this.authenticationType = configuration.get('authenticationType'); - this.dasherizedBaseName = _.kebabCase(this.baseName); - this.pascalizedBaseName = toPascalCase(this.baseName); - }, - }; - } - - get [INITIALIZING_PRIORITY]() { - return this._initializing(); - } - - _prompting() { - return { - askForApp() { - prompts.askForDotnetApp.call(this); - }, - - askForHerokuDeployType() { - if (this.abort) return null; - if (this.herokuDeployType) return null; - - return prompts.askForHerokuDeployType.call(this); - }, - }; - } - - get [PROMPTING_PRIORITY]() { - return this._prompting(); - } - - _configuring() { - return { - checkHerokuInstallation() { - if (this.abort) return; - provision.checkHeroku.call(this); - }, - - checkDockerInstallation() { - if (this.abort) return; - provision.checkDocker.call(this); - }, - - checkHerokuContainerRegistryLogin() { - if (this.abort || this.herokuDeployType === 'git') return; - provision.checkContainerRegistry.call(this); - }, - - saveConfig() { - this.config.set({ - herokuAppName: this.herokuAppName, - herokuDeployType: this.herokuDeployType, - oktaAdminLogin: this.oktaAdminLogin, - }); - }, - }; - } - - get [CONFIGURING_PRIORITY]() { - return this._configuring(); - } - - // Public API method used by the getter and also by Blueprints - _loading() { - return { - loadSharedConfig() { - this.loadAppConfig(); - this.loadDerivedAppConfig(); - this.loadClientConfig(); - this.loadDerivedClientConfig(); - this.loadServerConfig(); - this.loadTranslationConfig(); - this.loadPlatformConfig(); - }, - }; - } - - get [LOADING_PRIORITY]() { - return this._loading(); - } - - _default() { - return { - gitInit() { - if (this.abort) return; - provision.gitInit.call(this); - }, - - herokuCreate() { - if (this.abort || this.herokuAppExists) return; - // Create the dotnet backend app - provision.createDotnetApp.call(this); - }, - - herokuAddonsCreate() { - if (this.abort) return; - provision.provisionAddons.call(this); - }, - }; - } - - get [DEFAULT_PRIORITY]() { - return this._default(); - } - - _writing() { - return { - copyHerokuFiles() { - if (this.abort) return; - - this.log(chalk.bold('\nCreating Heroku deployment files')); - this.template('heroku.yml.ejs', 'heroku.yml'); - }, - }; - } - - get [WRITING_PRIORITY]() { - return this._writing(); - } - - _end() { - return { - productionBuild() { - if (this.abort) return; - - if (this.herokuSkipBuild || this.herokuDeployType === 'git') { - this.log(chalk.bold('\nSkipping build')); - return; - } - - this.log(chalk.bold('\nBuilding application')); - - if (this.herokuDeployType === 'containerRegistry') { - build.dockerBuild(this.herokuAppName, './Dockerfile-Back', this.log); - } - }, - - async productionDeploy() { - if (this.abort) return; - - if (this.herokuSkipDeploy) { - this.log(chalk.bold('\nSkipping deployment')); - return; - } - - if (this.herokuDeployType === 'git') { - deploy.herokuGitDeploy.call(this); - } else if (this.herokuDeployType === 'containerRegistry') { - deploy.herokuContainerRegistryDeploy.call(this); - } - }, - }; - } - - get [END_PRIORITY]() { - return this._end(); - } -}; +export { default } from './generator.js'; +export { default as command } from './command.js'; diff --git a/generators/heroku/prompts.js b/generators/heroku/prompts.js index ac77d5435..5f2ca8ca9 100644 --- a/generators/heroku/prompts.js +++ b/generators/heroku/prompts.js @@ -22,84 +22,84 @@ const ChildProcess = require('child_process'); const Which = require('which'); function askForDotnetApp() { - const done = this.async(); + const done = this.async(); - if (this.herokuAppName) { - ChildProcess.execFile(Which.sync('heroku'), ['apps:info', '--json', this.herokuAppName], (err, stdout) => { - if (err) { - this.abort = true; - this.log.error(`Could not find application: ${chalk.cyan(this.herokuAppName)}`); - this.log.error('Run the generator again to create a new application.'); - this.herokuAppName = null; - } else { - const json = JSON.parse(stdout); - this.herokuAppName = json.app.name; - if (json.dynos.length > 0) { - this.dynoSize = json.dynos[0].size; - } - this.log(`Deploying as existing application: ${chalk.bold(this.herokuAppName)}`); - this.herokuAppExists = true; - this.config.set({ - herokuAppName: this.herokuAppName, - herokuDeployType: this.herokuDeployType, - }); - } - done(); + if (this.herokuAppName) { + ChildProcess.execFile(Which.sync('heroku'), ['apps:info', '--json', this.herokuAppName], (err, stdout) => { + if (err) { + this.abort = true; + this.log.error(`Could not find application: ${chalk.cyan(this.herokuAppName)}`); + this.log.error('Run the generator again to create a new application.'); + this.herokuAppName = null; + } else { + const json = JSON.parse(stdout); + this.herokuAppName = json.app.name; + if (json.dynos.length > 0) { + this.dynoSize = json.dynos[0].size; + } + this.log(`Deploying as existing application: ${chalk.bold(this.herokuAppName)}`); + this.herokuAppExists = true; + this.config.set({ + herokuAppName: this.herokuAppName, + herokuDeployType: this.herokuDeployType, }); - } else { - const prompts = [ - { - type: 'input', - name: 'herokuAppName', - message: 'Name to deploy as:', - default: this.baseName, - }, - { - type: 'list', - name: 'herokuRegion', - message: 'On which region do you want to deploy ?', - choices: ['us', 'eu'], - default: 0, - }, - ]; + } + done(); + }); + } else { + const prompts = [ + { + type: 'input', + name: 'herokuAppName', + message: 'Name to deploy as:', + default: this.baseName, + }, + { + type: 'list', + name: 'herokuRegion', + message: 'On which region do you want to deploy ?', + choices: ['us', 'eu'], + default: 0, + }, + ]; - this.prompt(prompts).then(props => { - this.herokuAppName = _.kebabCase(props.herokuAppName); - this.herokuRegion = props.herokuRegion; - this.herokuAppExists = false; - done(); - }); - } + this.prompt(prompts).then(props => { + this.herokuAppName = _.kebabCase(props.herokuAppName); + this.herokuRegion = props.herokuRegion; + this.herokuAppExists = false; + done(); + }); + } } function askForHerokuDeployType() { - if (this.abort) return null; - if (this.herokuDeployType) return null; - const prompts = [ + if (this.abort) return null; + if (this.herokuDeployType) return null; + const prompts = [ + { + type: 'list', + name: 'herokuDeployType', + message: 'Which type of deployment do you want ?', + choices: [ { - type: 'list', - name: 'herokuDeployType', - message: 'Which type of deployment do you want ?', - choices: [ - { - value: 'containerRegistry', - name: 'Heroku Container Registry (build image locally and push)', - }, - { - value: 'git', - name: 'Git (compile on Heroku)', - }, - ], - default: 0, + value: 'containerRegistry', + name: 'Heroku Container Registry (build image locally and push)', }, - ]; + { + value: 'git', + name: 'Git (compile on Heroku)', + }, + ], + default: 0, + }, + ]; - return this.prompt(prompts).then(props => { - this.herokuDeployType = props.herokuDeployType; - }); + return this.prompt(prompts).then(props => { + this.herokuDeployType = props.herokuDeployType; + }); } module.exports = { - askForDotnetApp, - askForHerokuDeployType, + askForDotnetApp, + askForHerokuDeployType, }; diff --git a/generators/heroku/provision.js b/generators/heroku/provision.js index 35439fb40..a41cd4f24 100644 --- a/generators/heroku/provision.js +++ b/generators/heroku/provision.js @@ -25,235 +25,235 @@ const Which = require('which'); const { OAUTH2 } = require('generator-jhipster/jdl/jhipster/authentication-types'); function gitInit() { - const done = this.async(); + const done = this.async(); - try { - fs.lstatSync('.git'); - this.log(chalk.bold('\nUsing existing Git repository')); - done(); - } catch (e) { - // An exception is thrown if the folder doesn't exist - this.log(chalk.bold('\nInitializing Git repository')); - const child = ChildProcess.execFile(Which.sync('git'), ['init'], () => { - done(); - }); - child.stdout.on('data', data => { - this.log(data.toString()); - }); - } + try { + fs.lstatSync('.git'); + this.log(chalk.bold('\nUsing existing Git repository')); + done(); + } catch (e) { + // An exception is thrown if the folder doesn't exist + this.log(chalk.bold('\nInitializing Git repository')); + const child = ChildProcess.execFile(Which.sync('git'), ['init'], () => { + done(); + }); + child.stdout.on('data', data => { + this.log(data.toString()); + }); + } } function checkHeroku() { - const done = this.async(); + const done = this.async(); - ChildProcess.execFile(Which.sync('heroku'), ['--version'], err => { - if (err) { - this.log.error("You don't have the Heroku CLI installed. Download it from https://cli.heroku.com/"); - this.abort = true; - } - done(); - }); + ChildProcess.execFile(Which.sync('heroku'), ['--version'], err => { + if (err) { + this.log.error("You don't have the Heroku CLI installed. Download it from https://cli.heroku.com/"); + this.abort = true; + } + done(); + }); } function checkDocker() { - const done = this.async(); + const done = this.async(); - if (this.herokuDeployType === 'containerRegistry') { - ChildProcess.execFile(Which.sync('docker'), ['--version'], err => { - if (err) { - this.log.error("You don't have the Docker CLI installed."); - this.abort = true; - } + if (this.herokuDeployType === 'containerRegistry') { + ChildProcess.execFile(Which.sync('docker'), ['--version'], err => { + if (err) { + this.log.error("You don't have the Docker CLI installed."); + this.abort = true; + } - done(); - }); - } else { - done(); - } + done(); + }); + } else { + done(); + } } function checkContainerRegistry() { - const done = this.async(); + const done = this.async(); - if (this.herokuDeployType === 'containerRegistry') { - const herokuContainerLoginCommand = 'heroku container:login'; - this.log(chalk.bold('\nRunning'), chalk.cyan(herokuContainerLoginCommand)); - ChildProcess.execFile(Which.sync('heroku'), ['container:login'], (err, stdout) => { - if (err) { - this.log.error(err); - this.log.error( - "There was a problem while running 'heroku container:login' to login to Heroku Container Registry. Make sure that you have docker and heroku CLI installed. Also verify if you have the right Heroku account configured." - ); - this.abort = true; - } else { - this.log(stdout); - } + if (this.herokuDeployType === 'containerRegistry') { + const herokuContainerLoginCommand = 'heroku container:login'; + this.log(chalk.bold('\nRunning'), chalk.cyan(herokuContainerLoginCommand)); + ChildProcess.execFile(Which.sync('heroku'), ['container:login'], (err, stdout) => { + if (err) { + this.log.error(err); + this.log.error( + "There was a problem while running 'heroku container:login' to login to Heroku Container Registry. Make sure that you have docker and heroku CLI installed. Also verify if you have the right Heroku account configured.", + ); + this.abort = true; + } else { + this.log(stdout); + } - done(); - }); - } else { - done(); - } + done(); + }); + } else { + done(); + } } function verifyCredentialsCallback(data, done) { - const output = data.toString(); - if (data.search('Heroku credentials') >= 0) { - this.abort = true; - this.log.error("Error: Not authenticated. Run 'heroku login' to login to your heroku account and try again."); - done(); - } else { - this.log(output.trim()); - } + const output = data.toString(); + if (data.search('Heroku credentials') >= 0) { + this.abort = true; + this.log.error("Error: Not authenticated. Run 'heroku login' to login to your heroku account and try again."); + done(); + } else { + this.log(output.trim()); + } } function gitRemote(done) { - // ensure that the git remote is the same as the appName - ChildProcess.execFile(Which.sync('heroku'), ['git:remote', '--app', this.herokuAppName], errr => { - if (errr) { - this.abort = true; - this.log.error(errr); - } else { - this.config.set({ - herokuAppName: this.herokuAppName, - herokuDeployType: this.herokuDeployType, - }); - } - done(); - }); + // ensure that the git remote is the same as the appName + ChildProcess.execFile(Which.sync('heroku'), ['git:remote', '--app', this.herokuAppName], errr => { + if (errr) { + this.abort = true; + this.log.error(errr); + } else { + this.config.set({ + herokuAppName: this.herokuAppName, + herokuDeployType: this.herokuDeployType, + }); + } + done(); + }); } function createDotnetAppWithRandomName(done) { - ChildProcess.execFile(Which.sync('heroku'), ['create', '--region', this.herokuRegion], { shell: false }, (error, stdoutput) => { - if (error) { - this.abort = true; - this.log.error(error); - } else { - // Extract from "Created random-app-name-1234... done" - this.herokuAppName = stdoutput.substring(stdoutput.indexOf('https://') + 8, stdoutput.indexOf('.herokuapp')); - this.log(stdoutput.trim()); + ChildProcess.execFile(Which.sync('heroku'), ['create', '--region', this.herokuRegion], { shell: false }, (error, stdoutput) => { + if (error) { + this.abort = true; + this.log.error(error); + } else { + // Extract from "Created random-app-name-1234... done" + this.herokuAppName = stdoutput.substring(stdoutput.indexOf('https://') + 8, stdoutput.indexOf('.herokuapp')); + this.log(stdoutput.trim()); - // ensure that the git remote is the same as the appName - gitRemote.call(this, done); - } - }); + // ensure that the git remote is the same as the appName + gitRemote.call(this, done); + } + }); } function createDotnetApp() { - this.log(chalk.bold('\nCreating Heroku application and setting up node environment')); - const done = this.async(); - const child = ChildProcess.execFile( - Which.sync('heroku'), - ['create', this.herokuAppName, '--region', this.herokuRegion], - { shell: false }, - (err, _stdout, stderr) => { - if (err) { - if (stderr.includes('is already taken')) { - const prompts = [ - { - type: 'list', - name: 'herokuForceName', - message: `The Heroku application "${chalk.cyan(this.herokuAppName)}" already exists! Use it anyways?`, - choices: [ - { - value: 'Yes', - name: 'Yes, I have access to it', - }, - { - value: 'No', - name: 'No, generate a random name', - }, - ], - default: 0, - }, - ]; + this.log(chalk.bold('\nCreating Heroku application and setting up node environment')); + const done = this.async(); + const child = ChildProcess.execFile( + Which.sync('heroku'), + ['create', this.herokuAppName, '--region', this.herokuRegion], + { shell: false }, + (err, _stdout, stderr) => { + if (err) { + if (stderr.includes('is already taken')) { + const prompts = [ + { + type: 'list', + name: 'herokuForceName', + message: `The Heroku application "${chalk.cyan(this.herokuAppName)}" already exists! Use it anyways?`, + choices: [ + { + value: 'Yes', + name: 'Yes, I have access to it', + }, + { + value: 'No', + name: 'No, generate a random name', + }, + ], + default: 0, + }, + ]; - this.log(''); - this.prompt(prompts).then(props => { - if (props.herokuForceName === 'Yes') { - gitRemote.call(this, done); - } else { - createDotnetAppWithRandomName.call(this, done); - } - }); - } else { - this.abort = true; - if (stderr.includes('Invalid credentials')) { - this.log.error("Error: Not authenticated. Run 'heroku login' to login to your heroku account and try again."); - } else { - this.log.error(err); - } - done(); - } + this.log(''); + this.prompt(prompts).then(props => { + if (props.herokuForceName === 'Yes') { + gitRemote.call(this, done); } else { - done(); + createDotnetAppWithRandomName.call(this, done); } + }); + } else { + this.abort = true; + if (stderr.includes('Invalid credentials')) { + this.log.error("Error: Not authenticated. Run 'heroku login' to login to your heroku account and try again."); + } else { + this.log.error(err); + } + done(); } - ); + } else { + done(); + } + }, + ); - child.stdout.on('data', data => { - verifyCredentialsCallback.call(this, data, done); - }); + child.stdout.on('data', data => { + verifyCredentialsCallback.call(this, data, done); + }); } function provisionAddons() { - const done = this.async(); - const addonCreateCallback = (addon, err) => { - if (err) { - const verifyAccountUrl = 'https://heroku.com/verify'; - if (_.includes(err, verifyAccountUrl)) { - this.abort = true; - this.log.error(`Account must be verified to use addons. Please go to: ${verifyAccountUrl}`); - this.log.error(err); - } else { - this.log(`No new ${addon} addon created`); - } - } else { - this.log(`Created ${addon} addon`); - } - }; + const done = this.async(); + const addonCreateCallback = (addon, err) => { + if (err) { + const verifyAccountUrl = 'https://heroku.com/verify'; + if (_.includes(err, verifyAccountUrl)) { + this.abort = true; + this.log.error(`Account must be verified to use addons. Please go to: ${verifyAccountUrl}`); + this.log.error(err); + } else { + this.log(`No new ${addon} addon created`); + } + } else { + this.log(`Created ${addon} addon`); + } + }; - this.log(chalk.bold('\nProvisioning addons')); + this.log(chalk.bold('\nProvisioning addons')); - if (this.authenticationType === OAUTH2) { - ChildProcess.execFile(Which.sync('heroku'), ['addons:create', 'okta', '--app', this.herokuAppName], err => { - addonCreateCallback('Okta', err); - }); - } + if (this.authenticationType === OAUTH2) { + ChildProcess.execFile(Which.sync('heroku'), ['addons:create', 'okta', '--app', this.herokuAppName], err => { + addonCreateCallback('Okta', err); + }); + } - let dbAddOn; - if (this.databaseType === 'postgres') { - dbAddOn = 'heroku-postgresql'; - } else if (this.databaseType === 'mysql') { - dbAddOn = 'jawsdb:kitefin'; - } + let dbAddOn; + if (this.databaseType === 'postgresql') { + dbAddOn = 'heroku-postgresql'; + } else if (this.databaseType === 'mysql') { + dbAddOn = 'jawsdb:kitefin'; + } - if (this.databaseType === 'mssql') { - this.log(chalk.yellow("Heroku's MS SQL Server addon is not free of cost and will NOT be provisioned.")); - this.log(chalk.yellow('Please see the documentation link below for more information:')); - this.log(chalk.yellow('https://jhipsternet.readthedocs.io/en/latest/Features/heroku.html#databases')); - } else if (dbAddOn) { - this.log(chalk.bold(`\nProvisioning database addon ${dbAddOn}`)); - ChildProcess.execFile( - Which.sync('heroku'), - ['addons:create', dbAddOn, '--as', 'DATABASE', '--app', this.herokuAppName], - { shell: false }, - err => { - addonCreateCallback('Database', err); - } - ); - } else { - this.log(chalk.bold(`\nNo suitable database addon for database ${this.prodDatabaseType} available.`)); - } + if (this.databaseType === 'mssql') { + this.log(chalk.yellow("Heroku's MS SQL Server addon is not free of cost and will NOT be provisioned.")); + this.log(chalk.yellow('Please see the documentation link below for more information:')); + this.log(chalk.yellow('https://jhipsternet.readthedocs.io/en/latest/Features/heroku.html#databases')); + } else if (dbAddOn) { + this.log(chalk.bold(`\nProvisioning database addon ${dbAddOn}`)); + ChildProcess.execFile( + Which.sync('heroku'), + ['addons:create', dbAddOn, '--as', 'DATABASE', '--app', this.herokuAppName], + { shell: false }, + err => { + addonCreateCallback('Database', err); + }, + ); + } else { + this.log(chalk.bold(`\nNo suitable database addon for database ${this.prodDatabaseType} available.`)); + } - done(); + done(); } module.exports = { - gitInit, - checkHeroku, - checkDocker, - checkContainerRegistry, - createDotnetApp, - provisionAddons, + gitInit, + checkHeroku, + checkDocker, + checkContainerRegistry, + createDotnetApp, + provisionAddons, }; diff --git a/generators/languages/files-languages.js b/generators/languages/files-languages.js deleted file mode 100644 index d9c5d8170..000000000 --- a/generators/languages/files-languages.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const constants = require('../generator-dotnetcore-constants.cjs'); - -/* Constants use throughout */ -const SERVER_SRC_DIR = constants.SERVER_SRC_DIR; - -function updateAngularWebpackCustomJs() { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.custom.js`, - `${SERVER_SRC_DIR}${this.mainClientDir}/`, - '', - true - ); -} - -function updateReactWebpackCommonJs() { - this.replaceContent( - `${SERVER_SRC_DIR}${this.mainClientDir}/webpack/webpack.common.js`, - `${SERVER_SRC_DIR}${this.mainClientDir}/`, - '', - true - ); -} - -function writeFilesAngular() { - updateAngularWebpackCustomJs.call(this); -} -function writeFilesReact() { - updateReactWebpackCommonJs.call(this); -} -function writeFilesVue() { - updateReactWebpackCommonJs.call(this); -} - -module.exports = { - writeFilesAngular, - writeFilesReact, - writeFilesVue, -}; diff --git a/generators/languages/index.js b/generators/languages/index.js deleted file mode 100644 index 1a5a2197d..000000000 --- a/generators/languages/index.js +++ /dev/null @@ -1,89 +0,0 @@ -/* eslint-disable consistent-return */ -const chalk = require('chalk'); -const LanguageGenerator = require('generator-jhipster/generators/languages'); -const baseConstants = require('generator-jhipster/generators/generator-constants'); - -const { ANGULAR, REACT, VUE } = baseConstants.SUPPORTED_CLIENT_FRAMEWORKS; - -const { writeFilesAngular, writeFilesReact, writeFilesVue } = require('./files-languages'); -// eslint-disable-next-line import/no-extraneous-dependencies -const constants = require('../generator-dotnetcore-constants.cjs'); -const customizeDotnetPaths = require('../utils').customizeDotnetPaths; - -const BLAZOR = constants.BLAZOR; - -module.exports = class extends LanguageGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - - const jhContext = (this.jhipsterContext = this.options.jhipsterContext); - - if (!jhContext) { - this.error(`This is a JHipster blueprint and should be used only like ${chalk.yellow('jhipster --blueprint dotnetcore')}`); - } - - if (this.configOptions.baseName) { - this.baseName = this.configOptions.baseName; - } - } - - get initializing() { - return { - ...super._initializing(), - customizeDotnetPaths, - }; - } - - get prompting() { - return super._prompting(); - } - - get configuring() { - return super._configuring(); - } - - get default() { - return super._default(); - } - - get composing() { - return super._composing(); - } - - get loading() { - return super._loading(); - } - - get preparing() { - return { - ...super._preparing(), - preparingDotnet() { - this.skipServer = true; // Skip server transalation for the dotnet - if (this.clientFramework === BLAZOR) { - this.skipClient = true; // Skip client translation for the blazor framework - } - }, - }; - } - - get writing() { - return super._writing(); - } - - get postWriting() { - return { - ...super._postWriting(), - postWritingDotnet() { - if (this.clientFramework === ANGULAR) { - return writeFilesAngular.call(this); - } - if (this.clientFramework === REACT) { - return writeFilesReact.call(this); - } - if (this.clientFramework === VUE) { - return writeFilesVue.call(this); - } - }, - }; - } -}; diff --git a/generators/server/__snapshots__/generator.spec.js.snap b/generators/server/__snapshots__/generator.spec.js.snap new file mode 100644 index 000000000..55016ea13 --- /dev/null +++ b/generators/server/__snapshots__/generator.spec.js.snap @@ -0,0 +1,375 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SubGenerator server of dotnetcore JHipster blueprint > run > should succeed 1`] = ` +{ + ".yo-rc.json": { + "stateCleared": "modified", + }, + "Directory.Packages.props": { + "stateCleared": "modified", + }, + "SonarAnalysis.ps1": { + "stateCleared": "modified", + }, + "SonarQube.Analysis.xml": { + "stateCleared": "modified", + }, + "docker/app.yml": { + "stateCleared": "modified", + }, + "docker/grafana/data/dashboard/Docker Monitoring.json": { + "stateCleared": "modified", + }, + "docker/grafana/data/dashboard/default-dashboard.yaml": { + "stateCleared": "modified", + }, + "docker/grafana/data/provisioning/influxdb.yml": { + "stateCleared": "modified", + }, + "docker/influxdb/config/influxdb.conf": { + "stateCleared": "modified", + }, + "docker/kapacitor/config/kapacitor.conf": { + "stateCleared": "modified", + }, + "docker/monitoring.yml": { + "stateCleared": "modified", + }, + "docker/prometheus/prometheus.yml": { + "stateCleared": "modified", + }, + "docker/sonar.yml": { + "stateCleared": "modified", + }, + "docker/telegraf/telegraf.conf": { + "stateCleared": "modified", + }, + "package.json": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Constants/Constants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Constants/ErrorConstants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Constants/JwtConstants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Constants/RolesConstants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/BadRequestAlertException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/BaseException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/EmailAlreadyUsedException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/EmailNotFoundException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/InternalServerErrorException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/InvalidPasswordException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/LoginAlreadyUsedException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/UserNotActivatedException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Exceptions/UsernameNotFoundException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Jhipster.Crosscutting.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Crosscutting/Utilities/RandomUtil.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/AuthenticationService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/Jhipster.Domain.Services.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/MailService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/ServicesClassesAssemblyHelper.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain.Services/UserService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/AuditedEntityBase.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/BaseEntity.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/Interfaces/IAuditedEntityBase.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/Role.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/User.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Entities/UserRole.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Jhipster.Domain.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/IFluentRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/IGenericRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/INoSqlFluentRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/IReadOnlyGenericRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Repositories/Interfaces/IUnitOfWork.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Services/Interfaces/IAuthenticationService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Services/Interfaces/IMailService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Services/Interfaces/IUserService.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Domain/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/Authentication/KeyAndPasswordDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/Authentication/LoginDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/Authentication/PasswordChangeDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/Jhipster.Dto.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/ManagedUserDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/ProfileInfo/ProfileInfoDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Dto/UserDto.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Configuration/IMongoDatabaseConfig.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Configuration/MongoDatabaseConfig.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Configuration/SecuritySettings.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/ApplicationDatabaseContext.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Extensions/DbSetExtensions.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Extensions/PropertyAccessorCache.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Repositories/FluentRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Repositories/GenericRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Data/Repositories/UnitOfWork.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Jhipster.Infrastructure.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Web/Rest/Utilities/HeaderUtil.cs": { + "stateCleared": "modified", + }, + "src/Jhipster.Infrastructure/Web/Rest/Utilities/PaginationUtil.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/AppSettingsStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/AutoMapper/AutoMapperProfile.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/AutoMapperStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/ConfigurationHelper.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/DatabaseStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/IdentityStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/LoggerStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/MvcStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/ProblemDetailsStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/RepositoryStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/SecurityStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/ServiceStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Configuration/SwaggerStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/AccountController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/ProfileInfoController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/PublicUsersController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/UserJwtController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Controllers/UsersController.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/IStartup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Jhipster.csproj": { + "stateCleared": "modified", + }, + "src/Jhipster/Program.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Properties/launchSettings.json": { + "stateCleared": "modified", + }, + "src/Jhipster/Security/BCryptPasswordHasher.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Security/Jwt/RoleClaimsTransformation.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Security/Jwt/TokenProvider.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Security/PoliciesConstants.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Startup.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Extensions/ActionResultExtensions.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Extensions/ActionResultWithHeaders.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Extensions/HttpRequestExtensions.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Filters/ValidateModelAttribute.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Rest/Problems/ExceptionTranslator.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Rest/Problems/ProblemDetailsConfiguration.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Rest/Problems/ValidationFailedException.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/Web/Rest/Utilities/ActionResultUtil.cs": { + "stateCleared": "modified", + }, + "src/Jhipster/appsettings.Development.json": { + "stateCleared": "modified", + }, + "src/Jhipster/appsettings.Production.json": { + "stateCleared": "modified", + }, + "src/Jhipster/appsettings.json": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Configuration/MockClaimsPrincipalProvider.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Configuration/TestMvcStartup.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/AccountResourceIntTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/ProfileInfoControllerIntTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/TestUtil.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/UserJwtControllerIntTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Controllers/UsersResourceIntTest.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Fixme.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Jhipster.Test.csproj": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Properties/launchSettings.json": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Setup/AppWebApplicationFactory.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Setup/MockHttpContextFactory.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/Setup/TestStartup.cs": { + "stateCleared": "modified", + }, + "test/Jhipster.Test/xunit.runner.json": { + "stateCleared": "modified", + }, +} +`; diff --git a/generators/server/command.js b/generators/server/command.js new file mode 100644 index 000000000..7bf0f8fc4 --- /dev/null +++ b/generators/server/command.js @@ -0,0 +1,10 @@ +/** + * @type {import('generator-jhipster').JHipsterCommandDefinition} + */ +const command = { + options: {}, + import: ['jhipster-dotnetcore:dotnetcore'], + override: true, +}; + +export default command; diff --git a/generators/server/files.js b/generators/server/files.js deleted file mode 100644 index 961ebab9e..000000000 --- a/generators/server/files.js +++ /dev/null @@ -1,1581 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const mkdirp = require('mkdirp'); -const constants = require('../generator-dotnetcore-constants.cjs'); - -/* Constants use throughout */ -const SERVER_SRC_DIR = constants.SERVER_SRC_DIR; -const SERVER_TEST_DIR = constants.SERVER_TEST_DIR; -const DOCKER_DIR = constants.DOCKER_DIR; -const PROJECT_DOMAIN_SUFFIX = constants.PROJECT_DOMAIN_SUFFIX; -const PROJECT_APPLICATION_SUFFIX = constants.PROJECT_APPLICATION_SUFFIX; -const PROJECT_DTO_SUFFIX = constants.PROJECT_DTO_SUFFIX; -const PROJECT_CROSSCUTTING_SUFFIX = constants.PROJECT_CROSSCUTTING_SUFFIX; -const PROJECT_INFRASTRUCTURE_SUFFIX = constants.PROJECT_INFRASTRUCTURE_SUFFIX; -const PROJECT_SERVICE_SUFFIX = constants.PROJECT_SERVICE_SUFFIX; -const TERRAFORM_DIR = constants.TERRAFORM_DIR; - -const serverFiles = { - serverCsProj: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Project.csproj', - renameTo: generator => `${generator.mainProjectDir}/${generator.pascalizedBaseName}.csproj`, - }, - ], - }, - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Project.Test.csproj', - renameTo: generator => - `${generator.testProjectDir}/${generator.pascalizedBaseName}${constants.PROJECT_TEST_SUFFIX}.csproj`, - }, - ], - }, - { - path: SERVER_TEST_DIR, - templates: [{ file: 'Project.Test/xunit.runner.json', renameTo: generator => `${generator.testProjectDir}/xunit.runner.json` }], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Project.csproj', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}.csproj`, - }, - ], - }, - { - condition: generator => generator.cqrsEnabled === true, - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Application/Project.csproj', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}.csproj`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Dto/Project.csproj', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_DTO_SUFFIX}.csproj`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Project.csproj', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}.csproj`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain.Services/Project.csproj', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}.csproj`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Project.csproj', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}.csproj`, - }, - ], - }, - ], - domainFiles: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Entities/Interfaces/IAuditedEntityBase.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/Interfaces/IAuditedEntityBase.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Entities/AuditedEntityBase.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/AuditedEntityBase.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Entities/BaseEntity.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/BaseEntity.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Entities/MongoBaseEntity.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/MongoBaseEntity.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Entities/User.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/User.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Entities/Role.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/Role.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Entities/UserRole.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Entities/UserRole.cs`, - }, - ], - }, - ], - crosscuttingFiles: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Constants/Constants.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Constants/Constants.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Constants/JwtConstants.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Constants/JwtConstants.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Constants/RolesConstants.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Constants/RolesConstants.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Constants/ErrorConstants.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Constants/ErrorConstants.cs`, - }, - ], - }, - { - condition: generator => generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Security/UsernameNotFoundException.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/UsernameNotFoundException.cs`, - }, - ], - }, - { - condition: generator => generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Security/UserNotActivatedException.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/UserNotActivatedException.cs`, - }, - ], - }, - ], - dtoFiles: [ - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Dto/ManagedUserDto.cs', - renameTo: generator => `${generator.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}/ManagedUserDto.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Dto/PasswordChangeDto.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}/Authentication/PasswordChangeDto.cs`, - }, - ], - }, - { - condition: generator => generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Dto/UserDto.cs', - renameTo: generator => `${generator.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}/UserDto.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Dto/ProfileInfoDto.cs', - renameTo: generator => `${generator.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}/ProfileInfo/ProfileInfoDto.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Dto/KeyAndPasswordDto.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}/Authentication/KeyAndPasswordDto.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Dto/LoginDto.cs', - renameTo: generator => `${generator.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}/Authentication/LoginDto.cs`, - }, - ], - }, - ], - services: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Services/Interfaces/ServicesInterfacesAssemblyHelper.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain.Services/ServicesClassesAssemblyHelper.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/ServicesClassesAssemblyHelper.cs`, - }, - ], - }, - ], - repository: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Repositories/Interfaces/IFluentRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/IFluentRepository.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Repositories/Interfaces/INoSqlFluentRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/INoSqlFluentRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType !== 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Repositories/Interfaces/IGenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/IGenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType !== 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Repositories/Interfaces/IReadOnlyGenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/IReadOnlyGenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Repositories/Interfaces/INoSqlGenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/INoSqlGenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/INoSqlReadOnlyGenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType !== 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Repositories/Interfaces/IUnitOfWork.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Repositories/Interfaces/IUnitOfWork.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Repositories/FluentRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/FluentRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Repositories/MongoFluentRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/MongoFluentRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType !== 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Repositories/GenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/GenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Repositories/MongoGenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/MongoGenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType !== 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/ReadOnlyGenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Repositories/MongoReadOnlyGenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/MongoReadOnlyGenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType !== 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Repositories/ReadOnlyGenericRepository.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/ReadOnlyGenericRepository.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType !== 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Repositories/UnitOfWork.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/UnitOfWork.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Repositories/MongoDatabaseUserStore.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Repositories/MongoDatabaseUserStore.cs`, - }, - ], - }, - ], - dataExtensions: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Extensions/DbSetExtensions.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Extensions/DbSetExtensions.cs`, - }, - { - file: 'Project.Infrastructure/Data/Extensions/PropertyAccessorCache.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Extensions/PropertyAccessorCache.cs`, - }, - ], - }, - ], - mongoExtension: [ - { - condition: generator => generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/Extensions/NoSqlPagination.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/Extensions/NoSqlPagination.cs`, - }, - ], - }, - ], - serverProperties: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Properties/launchSettings.json', - renameTo: generator => `${generator.mainProjectDir}/Properties/launchSettings.json`, - }, - ], - }, - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Properties/launchSettings.json', - renameTo: generator => `${generator.testProjectDir}/Properties/launchSettings.json`, - }, - ], - }, - ], - serverProgram: [ - { - path: SERVER_SRC_DIR, - templates: [{ file: 'Project/Program.cs', renameTo: generator => `${generator.mainProjectDir}/Program.cs` }], - }, - ], - serverConfiguration: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Configuration/SecuritySettings.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${constants.PROJECT_INFRASTRUCTURE_SUFFIX}/Configuration/SecuritySettings.cs`, - }, - { - file: 'Project.Infrastructure/Configuration/IMongoDatabaseConfig.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${constants.PROJECT_INFRASTRUCTURE_SUFFIX}/Configuration/IMongoDatabaseConfig.cs`, - }, - { - file: 'Project.Infrastructure/Configuration/MongoDatabaseConfig.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${constants.PROJECT_INFRASTRUCTURE_SUFFIX}/Configuration/MongoDatabaseConfig.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [{ file: 'Project/appsettings.json', renameTo: generator => `${generator.mainProjectDir}/appsettings.json` }], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/appsettings.Development.json', - renameTo: generator => `${generator.mainProjectDir}/appsettings.Development.json`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/appsettings.Production.json', - renameTo: generator => `${generator.mainProjectDir}/appsettings.Production.json`, - }, - ], - }, - ], - serverStartup: [ - { - path: SERVER_SRC_DIR, - templates: [{ file: 'Project/IStartup.cs', renameTo: generator => `${generator.mainProjectDir}/IStartup.cs` }], - }, - { - path: SERVER_SRC_DIR, - templates: [{ file: 'Project/Startup.cs', renameTo: generator => `${generator.mainProjectDir}/Startup.cs` }], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/ConfigurationHelper.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/ConfigurationHelper.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/AutoMapperStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/AutoMapperStartup.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/DatabaseStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/DatabaseStartup.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/IdentityStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/IdentityStartup.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/MvcStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/MvcStartup.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/AppSettingsStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/AppSettingsStartup.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/LoggerStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/LoggerStartup.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/ProblemDetailsStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/ProblemDetailsStartup.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/SecurityStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/SecurityStartup.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/SwaggerStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/SwaggerStartup.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/ServiceStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/ServiceStartup.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/RepositoryStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/RepositoryStartup.cs`, - }, - ], - }, - ], - serverUserManagement: [ - { - condition: generator => generator.databaseType !== 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/ApplicationDatabaseContext.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/ApplicationDatabaseContext.cs`, - }, - ], - }, - { - condition: generator => generator.databaseType === 'mongodb', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Infrastructure/Data/MongoDatabaseContext.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/MongoDatabaseContext.cs`, - }, - { - file: 'Project.Infrastructure/Data/IMongoDatabaseContext.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Data/IMongoDatabaseContext.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Services/Interfaces/IAuthenticationService.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Services/Interfaces/IAuthenticationService.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain.Services/AuthenticationService.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/AuthenticationService.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Services/Interfaces/IMailService.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Services/Interfaces/IMailService.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain.Services/MailService.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/MailService.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain/Services/Interfaces/IUserService.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_DOMAIN_SUFFIX}/Services/Interfaces/IUserService.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Domain.Services/UserService.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_SERVICE_SUFFIX}/UserService.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Utilities/RandomUtil.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Utilities/RandomUtil.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/AutoMapper/AutoMapperProfile.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/AutoMapper/AutoMapperProfile.cs`, - }, - ], - }, - { - condition: generator => generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Controllers/AccountController.cs', - renameTo: generator => `${generator.mainProjectDir}/Controllers/AccountController.cs`, - }, - ], - }, - { - condition: generator => generator.applicationType !== 'microservice' && generator.cqrsEnabled === true, - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Application/ApplicationClassesAssemblyHelper.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/ApplicationClassesAssemblyHelper.cs`, - }, - ], - }, - { - condition: generator => - generator.applicationType !== 'microservice' && generator.cqrsEnabled === true && generator.authenticationType === 'jwt', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Application/Commands/Account/AccountActivateCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountActivateCommand.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountActivateCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountActivateCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountChangePasswordCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountChangePasswordCommand.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountChangePasswordCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountChangePasswordCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountCreateCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountCreateCommand.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountCreateCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountCreateCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountResetPasswordCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountResetPasswordCommand.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountResetPasswordCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountResetPasswordCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountResetPasswordFinishCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountResetPasswordFinishCommand.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountResetPasswordFinishCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountResetPasswordFinishCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountSaveCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountSaveCommand.cs`, - }, - { - file: 'Project.Application/Commands/Account/AccountSaveCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/Account/AccountSaveCommandHandler.cs`, - }, - { - file: 'Project.Application/Queries/Account/AccountGetAuthenticatedQuery.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/Account/AccountGetAuthenticatedQuery.cs`, - }, - { - file: 'Project.Application/Queries/Account/AccountGetAuthenticatedQueryHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/Account/AccountGetAuthenticatedQueryHandler.cs`, - }, - { - file: 'Project.Application/Queries/Account/AccountGetQuery.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/Account/AccountGetQuery.cs`, - }, - { - file: 'Project.Application/Queries/Account/AccountGetQueryHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/Account/AccountGetQueryHandler.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Controllers/ProfileInfoController.cs', - renameTo: generator => `${generator.mainProjectDir}/Controllers/ProfileInfoController.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'oauth2', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Controllers/AuthController.cs', - renameTo: generator => `${generator.mainProjectDir}/Controllers/AuthController.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Controllers/UsersController.cs', - renameTo: generator => `${generator.mainProjectDir}/Controllers/UsersController.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Controllers/PublicUsersController.cs', - renameTo: generator => `${generator.mainProjectDir}/Controllers/PublicUsersController.cs`, - }, - ], - }, - { - condition: generator => - generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice' && generator.cqrsEnabled === true, - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Application/Commands/User/UserCreateCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserCreateCommand.cs`, - }, - { - file: 'Project.Application/Commands/User/UserCreateCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserCreateCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/User/UserDeleteCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserDeleteCommand.cs`, - }, - { - file: 'Project.Application/Commands/User/UserDeleteCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserDeleteCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/User/UserUpdateCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserUpdateCommand.cs`, - }, - { - file: 'Project.Application/Commands/User/UserUpdateCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/User/UserUpdateCommandHandler.cs`, - }, - { - file: 'Project.Application/Queries/User/UserGetAllQuery.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAllQuery.cs`, - }, - { - file: 'Project.Application/Queries/User/UserGetAllQueryHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAllQueryHandler.cs`, - }, - { - file: 'Project.Application/Queries/User/UserGetQuery.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetQuery.cs`, - }, - { - file: 'Project.Application/Queries/User/UserGetAllPublicUsersQuery.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAllPublicUsersQuery.cs`, - }, - { - file: 'Project.Application/Queries/User/UserGetAllPublicUsersQueryHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAllPublicUsersQueryHandler.cs`, - }, - { - file: 'Project.Application/Queries/User/UserGetQueryHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetQueryHandler.cs`, - }, - { - file: 'Project.Application/Queries/User/UserGetAuthoritiesQuery.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAuthoritiesQuery.cs`, - }, - { - file: 'Project.Application/Queries/User/UserGetAuthoritiesQueryHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Queries/User/UserGetAuthoritiesQueryHandler.cs`, - }, - { - file: 'Project.Application/Commands/UserJwt/UserJwtAuthorizeCommandHandler.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/UserJwt/UserJwtAuthorizeCommandHandler.cs`, - }, - { - file: 'Project.Application/Commands/UserJwt/UserJwtAuthorizeCommand.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_APPLICATION_SUFFIX}/Commands/UserJwt/UserJwtAuthorizeCommand.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Controllers/AccountResourceIntTest.cs', - renameTo: generator => `${generator.testProjectDir}/Controllers/AccountResourceIntTest.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Controllers/UserJwtControllerIntTest.cs', - renameTo: generator => `${generator.testProjectDir}/Controllers/UserJwtControllerIntTest.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Controllers/UsersResourceIntTest.cs', - renameTo: generator => `${generator.testProjectDir}/Controllers/UsersResourceIntTest.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'oauth2', - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Controllers/AccountControllerTest.cs', - renameTo: generator => `${generator.testProjectDir}/Controllers/AccountControllerTest.cs`, - }, - ], - }, - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Controllers/ProfileInfoControllerIntTest.cs', - renameTo: generator => `${generator.testProjectDir}/Controllers/ProfileInfoControllerIntTest.cs`, - }, - ], - }, - ], - serverAuthConfig: [ - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Security/BCryptPasswordHasher.cs', - renameTo: generator => `${generator.mainProjectDir}/Security/BCryptPasswordHasher.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Security/PoliciesConstants.cs', - renameTo: generator => `${generator.mainProjectDir}/Security/PoliciesConstants.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Security/Jwt/RoleClaimsTransformation.cs', - renameTo: generator => `${generator.mainProjectDir}/Security/Jwt/RoleClaimsTransformation.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Security/Jwt/TokenProvider.cs', - renameTo: generator => `${generator.mainProjectDir}/Security/Jwt/TokenProvider.cs`, - }, - ], - }, - { - condition: generator => generator.authenticationType === 'jwt' && generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Controllers/UserJwtController.cs', - renameTo: generator => `${generator.mainProjectDir}/Controllers/UserJwtController.cs`, - }, - ], - }, - ], - serverToSort: [ - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Extensions/ActionResultExtensions.cs', - renameTo: generator => `${generator.mainProjectDir}/Web/Extensions/ActionResultExtensions.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Extensions/ActionResultWithHeaders.cs', - renameTo: generator => `${generator.mainProjectDir}/Web/Extensions/ActionResultWithHeaders.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Extensions/HttpRequestExtensions.cs', - renameTo: generator => `${generator.mainProjectDir}/Web/Extensions/HttpRequestExtensions.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Filters/ValidateModelAttribute.cs', - renameTo: generator => `${generator.mainProjectDir}/Web/Filters/ValidateModelAttribute.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Rest/Utilities/ActionResultUtil.cs', - renameTo: generator => `${generator.mainProjectDir}/Web/Rest/Utilities/ActionResultUtil.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Rest/Utilities/HeaderUtil.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Web/Rest/Utilities/HeaderUtil.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Rest/Utilities/PaginationUtil.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_INFRASTRUCTURE_SUFFIX}/Web/Rest/Utilities/PaginationUtil.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Exceptions/BaseException.cs', - renameTo: generator => `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/BaseException.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Exceptions/BadRequestAlertException.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/BadRequestAlertException.cs`, - }, - ], - }, - { - condition: generator => generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Exceptions/EmailAlreadyUsedException.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/EmailAlreadyUsedException.cs`, - }, - ], - }, - { - condition: generator => generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Exceptions/EmailNotFoundException.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/EmailNotFoundException.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Rest/Problems/ExceptionTranslator.cs', - renameTo: generator => `${generator.mainProjectDir}/Web/Rest/Problems/ExceptionTranslator.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Exceptions/InternalServerErrorException.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/InternalServerErrorException.cs`, - }, - ], - }, - { - condition: generator => generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Exceptions/InvalidPasswordException.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/InvalidPasswordException.cs`, - }, - ], - }, - { - condition: generator => generator.applicationType !== 'microservice', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project.Crosscutting/Exceptions/LoginAlreadyUsedException.cs', - renameTo: generator => - `${generator.pascalizedBaseName}${PROJECT_CROSSCUTTING_SUFFIX}/Exceptions/LoginAlreadyUsedException.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Rest/Problems/ProblemDetailsConfiguration.cs', - renameTo: generator => `${generator.mainProjectDir}/Web/Rest/Problems/ProblemDetailsConfiguration.cs`, - }, - ], - }, - { - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Web/Rest/Problems/ValidationFailedException.cs', - renameTo: generator => `${generator.mainProjectDir}/Web/Rest/Problems/ValidationFailedException.cs`, - }, - ], - }, - ], - serverTestStartup: [ - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Configuration/TestMvcStartup.cs', - renameTo: generator => `${generator.testProjectDir}/Configuration/TestMvcStartup.cs`, - }, - ], - }, - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Setup/MockClaimsPrincipalProvider.cs', - renameTo: generator => `${generator.testProjectDir}/Configuration/MockClaimsPrincipalProvider.cs`, - }, - ], - }, - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Setup/MockHttpContextFactory.cs', - renameTo: generator => `${generator.testProjectDir}/Setup/MockHttpContextFactory.cs`, - }, - ], - }, - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Setup/AppWebApplicationFactory.cs', - renameTo: generator => `${generator.testProjectDir}/Setup/AppWebApplicationFactory.cs`, - }, - ], - }, - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Setup/TestStartup.cs', - renameTo: generator => `${generator.testProjectDir}/Setup/TestStartup.cs`, - }, - ], - }, - ], - serverMisc: [ - { - condition: generator => - generator.authenticationType === 'jwt' && - generator.applicationType !== 'microservice' && - generator.databaseType !== 'mongodb', - path: SERVER_TEST_DIR, - templates: [{ file: 'Project.Test/Fixme.cs', renameTo: generator => `${generator.testProjectDir}/Fixme.cs` }], - }, - { - path: SERVER_TEST_DIR, - templates: [ - { - file: 'Project.Test/Controllers/TestUtil.cs', - renameTo: generator => `${generator.testProjectDir}/Controllers/TestUtil.cs`, - }, - ], - }, - ], - docker: [ - { - path: DOCKER_DIR, - templates: ['app.yml', 'sonar.yml', 'monitoring.yml'], - }, - { - path: DOCKER_DIR, - templates: [{ file: 'telegraf/telegraf.conf', renameTo: () => 'telegraf/telegraf.conf' }], - }, - { - path: DOCKER_DIR, - templates: [{ file: 'kapacitor/config/kapacitor.conf', renameTo: () => 'kapacitor/config/kapacitor.conf' }], - }, - { - path: DOCKER_DIR, - templates: [{ file: 'influxdb/config/influxdb.conf', renameTo: () => 'influxdb/config/influxdb.conf' }], - }, - { - path: DOCKER_DIR, - templates: [ - { file: 'grafana/data/dashboard/default-dashboard.yaml', renameTo: () => 'grafana/data/dashboard/default-dashboard.yaml' }, - ], - }, - { - path: DOCKER_DIR, - templates: [ - { file: 'grafana/data/dashboard/Docker Monitoring.json', renameTo: () => 'grafana/data/dashboard/Docker Monitoring.json' }, - ], - }, - { - path: DOCKER_DIR, - templates: [{ file: 'grafana/data/provisioning/influxdb.yml', renameTo: () => 'grafana/data/provisioning/influxdb.yml' }], - }, - { - path: '', - templates: [{ file: 'SonarAnalysis.ps1', renameTo: () => 'SonarAnalysis.ps1' }], - }, - { - path: '', - templates: [{ file: 'SonarQube.Analysis.xml', renameTo: () => 'SonarQube.Analysis.xml' }], - }, - { - condition: generator => generator.authenticationType === 'oauth2', - path: DOCKER_DIR, - templates: [ - 'keycloak.yml', - { - file: 'keycloak/config/realm-config/jhipster-realm.json', - renameTo: () => 'keycloak/config/realm-config/jhipster-realm.json', - }, - { - file: 'keycloak/config/realm-config/jhipster-users-0.json', - method: 'copy', - renameTo: () => 'keycloak/config/realm-config/jhipster-users-0.json', - }, - ], - }, - ], - serverServiceDiscovery: [ - { - condition: generator => - generator.serviceDiscoveryType && generator.serviceDiscoveryType === 'consul' && generator.applicationType !== 'gateway', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/Configuration/Consul/ConsulOptions.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/Consul/ConsulOptions.cs`, - }, - { - file: 'Project/Configuration/Consul/ConsulStartup.cs', - renameTo: generator => `${generator.mainProjectDir}/Configuration/Consul/ConsulStartup.cs`, - }, - ], - }, - { - condition: generator => generator.serviceDiscoveryType && generator.serviceDiscoveryType === 'consul', - path: DOCKER_DIR, - templates: [ - 'consul.yml', - { - file: 'central-server-config/application.json', - method: 'copy', - renameTo: () => 'central-server-config/application.json', - }, - { - file: 'central-server-config/README.md', - method: 'copy', - renameTo: () => 'central-server-config/README.md', - }, - ], - }, - ], - serverGateway: [ - { - condition: generator => generator.applicationType === 'gateway', - path: SERVER_SRC_DIR, - templates: [ - { - file: 'Project/ocelot.json', - renameTo: generator => `${generator.mainProjectDir}/ocelot.json`, - }, - ], - }, - ], - terraform: [ - { - condition: generator => generator.withTerraformAzureScripts, - path: TERRAFORM_DIR, - templates: ['main.tf', 'variables.tf', 'outputs.tf'], - }, - ], -}; - -const gatlingTestsFiles = { - gatlingTests: [ - { - condition: generator => { - if (generator.gatlingTests) { - mkdirp(`${SERVER_TEST_DIR}gatling/user-files/data`); - mkdirp(`${SERVER_TEST_DIR}gatling/user-files/bodies`); - mkdirp(`${SERVER_TEST_DIR}gatling/user-files/simulations`); - return true; - } - return false; - }, - path: SERVER_TEST_DIR, - templates: [ - // Create Gatling test files - 'gatling/conf/gatling.conf', - 'gatling/conf/logback.xml', - ], - }, - ], -}; - -const baseServiceDiscoveryFiles = { - baseServiceDiscovery: [ - { - condition: generator => generator.serviceDiscoveryType && generator.serviceDiscoveryType === 'consul', - path: DOCKER_DIR, - templates: [{ file: 'config/git2consul.json', method: 'copy' }], - }, - ], -}; - -function writeFiles() { - return { - writeFiles() { - this.writeFilesToDisk(serverFiles, this, false, 'dotnetcore'); - }, - writeFilesGatling() { - this.writeFilesToDisk(gatlingTestsFiles, this, false, this.fetchFromInstalledJHipster('server/templates/src')); - }, - writeFilesBaseServiceDiscovery() { - this.writeFilesToDisk(baseServiceDiscoveryFiles, this, false, this.fetchFromInstalledJHipster('server/templates/src/main')); - }, - writeDirectoryTargetsFile() { - this.fs.copyTpl( - this.templatePath(`dotnetcore/${constants.SERVER_SRC_DIR}/Directory.Packages.props`), - this.destinationPath('Directory.Packages.props'), - this - ); - }, - }; -} - -module.exports = { - serverFiles, - writeFiles, -}; diff --git a/generators/server/generator.js b/generators/server/generator.js new file mode 100644 index 000000000..a548a335c --- /dev/null +++ b/generators/server/generator.js @@ -0,0 +1,15 @@ +import ServerGenerator from 'generator-jhipster/generators/server'; + +export default class extends ServerGenerator { + constructor(args, opts, features) { + super(args, opts, { ...features, checkBlueprint: true }); + } + + get [ServerGenerator.COMPOSING]() { + return this.asComposingTaskGroup({ + async composingTemplateTask() { + await this.composeWithJHipster('jhipster-dotnetcore:dotnetcore'); + }, + }); + } +} diff --git a/generators/server/generator.spec.js b/generators/server/generator.spec.js new file mode 100644 index 000000000..3134c8e76 --- /dev/null +++ b/generators/server/generator.spec.js @@ -0,0 +1,26 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'server'; +const BLUEPRINT_NAMESPACE = `jhipster:${SUB_GENERATOR}`; + +describe('SubGenerator server of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(BLUEPRINT_NAMESPACE) + .withJHipsterConfig() + .withOptions({ + ignoreNeedlesError: true, + blueprint: 'dotnetcore', + }) + .withJHipsterLookup() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/server/index.js b/generators/server/index.js index 643121c14..3eccd6e86 100644 --- a/generators/server/index.js +++ b/generators/server/index.js @@ -1,155 +1,2 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-disable consistent-return */ -const chalk = require('chalk'); -const ServerGenerator = require('generator-jhipster/generators/server'); -const constants = require('../generator-dotnetcore-constants.cjs'); -const dotnet = require('../dotnet'); -const customizeDotnetPaths = require('../utils').customizeDotnetPaths; -const writeFiles = require('./files').writeFiles; -const prompts = require('./prompts'); -const packagejs = require('../../package.json'); - -module.exports = class extends ServerGenerator { - constructor(args, opts) { - super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important - dotnet.hasDotnet().catch(err => { - this.warning( - "The 'dotnet' command is not present in the PATH, use it at your own risk! If you encounter a bug, please install .Net Core first (https://dotnet.microsoft.com/download/dotnet-core)." - ); - }); - - if (this.configOptions.baseName) { - this.baseName = this.configOptions.baseName; - } - } - - get initializing() { - return { - ...super._initializing(), - setupServerConsts() { - this.packagejs = packagejs; - this.jhipsterNetVersion = packagejs.version; - this.SERVER_SRC_DIR = constants.SERVER_SRC_DIR; - this.SERVER_TEST_DIR = constants.SERVER_TEST_DIR; - this.namespace = this.jhipsterConfig.namespace; - this.databaseType = this.jhipsterConfig.databaseType; - this.authenticationType = this.jhipsterConfig.authenticationType; - this.serverPort = this.jhipsterConfig.serverPort; - this.cqrsEnabled = this.jhipsterConfig.cqrsEnabled; - this.serverPortSecured = parseInt(this.serverPort, 10) + 1; - this.withTerraformAzureScripts = this.jhipsterConfig.withTerraformAzureScripts; - - const serverConfigFound = - this.namespace !== undefined && this.databaseType !== undefined && this.authenticationType !== undefined; - - if (this.baseName !== undefined && serverConfigFound) { - this.log( - chalk.green( - 'This is an existing project, using the configuration from your .yo-rc.json file \n' + - 'to re-generate the project...\n' - ) - ); - this.existingProject = true; - } - }, - }; - } - - get prompting() { - return { - askForModuleName: prompts.askForModuleName, - askForServerSideOpts: prompts.askForServerSideOpts, - }; - } - - get configuring() { - return { - customizeDotnetPaths, - }; - } - - get default() { - return { - ...super._default(), - fixConfig() { - this.jhipsterConfig.prodDatabaseType = this.jhipsterConfig.databaseType === 'mongodb' ? 'mongodb' : 'mysql'; // set only for jdl-importer compatibility - }, - }; - } - - get composing() { - return super._composing(); - } - - get loading() { - return super._loading(); - } - - get preparing() { - return super._preparing(); - } - - get writing() { - return writeFiles.call(this); - } - - get postWriting() { - return {}; - } - - get end() { - return { - async end() { - this.log(chalk.green.bold(`\nCreating ${this.solutionName} .Net Core solution if it does not already exist.\n`)); - const slns = [ - `${constants.SERVER_SRC_DIR}${this.mainProjectDir}/${this.pascalizedBaseName}.csproj`, - `${constants.SERVER_TEST_DIR}${this.testProjectDir}/${this.pascalizedBaseName}${constants.PROJECT_TEST_SUFFIX}.csproj`, - `${constants.SERVER_SRC_DIR}${this.pascalizedBaseName}${constants.PROJECT_CROSSCUTTING_SUFFIX}/${this.pascalizedBaseName}${constants.PROJECT_CROSSCUTTING_SUFFIX}.csproj`, - `${constants.SERVER_SRC_DIR}${this.pascalizedBaseName}${constants.PROJECT_DOMAIN_SUFFIX}/${this.pascalizedBaseName}${constants.PROJECT_DOMAIN_SUFFIX}.csproj`, - `${constants.SERVER_SRC_DIR}${this.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}/${this.pascalizedBaseName}${constants.PROJECT_DTO_SUFFIX}.csproj`, - `${constants.SERVER_SRC_DIR}${this.pascalizedBaseName}${constants.PROJECT_SERVICE_SUFFIX}/${this.pascalizedBaseName}${constants.PROJECT_SERVICE_SUFFIX}.csproj`, - `${constants.SERVER_SRC_DIR}${this.pascalizedBaseName}${constants.PROJECT_INFRASTRUCTURE_SUFFIX}/${this.pascalizedBaseName}${constants.PROJECT_INFRASTRUCTURE_SUFFIX}.csproj`, - ]; - if (this.cqrsEnabled) { - slns.push( - `${constants.SERVER_SRC_DIR}${this.pascalizedBaseName}${constants.PROJECT_APPLICATION_SUFFIX}/${this.pascalizedBaseName}${constants.PROJECT_APPLICATION_SUFFIX}.csproj` - ); - } - await dotnet - .newSln(this.solutionName) - .then(() => dotnet.slnAdd(`${this.solutionName}.sln`, slns)) - .catch(err => { - this.warning(`Failed to create ${this.solutionName} .Net Core solution: ${err}`); - }) - .finally(() => { - this.log(chalk.green.bold('\nServer application generated successfully.\n')); - this.log( - chalk.green( - `Run your .Net Core application:\n${chalk.yellow.bold( - `dotnet run --verbosity normal --project ./${constants.SERVER_SRC_DIR}${this.mainProjectDir}/${this.pascalizedBaseName}.csproj` - )}` - ) - ); - this.log(chalk.green(`Test your .Net Core application:\n${chalk.yellow.bold('dotnet test --verbosity normal')}`)); - }); - }, - }; - } -}; +export { default } from './generator.js'; +export { default as command } from './command.js'; diff --git a/generators/server/needle-api/needle-server-gateway.js b/generators/server/needle-api/needle-server-gateway.js deleted file mode 100644 index c4430f716..000000000 --- a/generators/server/needle-api/needle-server-gateway.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const needleBase = require('generator-jhipster/generators/needle-base'); -const jhipsterUtils = require('generator-jhipster/generators/utils'); -const chalk = require('chalk'); - -module.exports = class extends needleBase { - constructor(generator) { - super(generator); - - this.mainProjectDir = generator.mainProjectDir; - - if (!this.mainProjectDir) { - generator.error('Server destination folder is missing'); - } - } - - addRouteToGateway(entityName, microserviceName) { - const errorMessage = `${chalk.yellow('Route to ') + entityName} ${chalk.yellow('not added to the gateway.\n')}`; - const ocelotConfigPath = `src/${this.mainProjectDir}/ocelot.json`; - const haveAlreadyOneRoute = jhipsterUtils.checkStringInFile(ocelotConfigPath, 'UpstreamPathTemplate', this.generator); - const isRoutesAlreadyDeclared = jhipsterUtils.checkStringInFile( - ocelotConfigPath, - `${microserviceName}/api/${entityName}`, - this.generator - ); - if (!isRoutesAlreadyDeclared) { - let firstRouteEntry = ''; - if (haveAlreadyOneRoute) { - firstRouteEntry = ','; - } - firstRouteEntry += - // prettier-ignore - this.generator.stripMargin( - `|{ - | "DownstreamPathTemplate": "/api/${entityName}", - | "DownstreamScheme": "https", - | "ServiceName": "${microserviceName}-service", - | "LoadBalancerOptions": { - | "Type": "LeastConnection" - | }, - | "ReRoutesCaseSensitive": false, - | "UpstreamPathTemplate": "/${microserviceName}/api/${entityName}", - | "UpstreamHttpMethod": [ "Get", "Post", "Delete","Put" ] - |}, `); - const secondRouteEntry = - // prettier-ignore - this.generator.stripMargin( - `|{ - | "DownstreamPathTemplate": "/api/${entityName}/{everything}", - | "DownstreamScheme": "https", - | "ServiceName": "${microserviceName}-service", - | "LoadBalancerOptions": { - | "Type": "LeastConnection" - | }, - | "ReRoutesCaseSensitive": false, - | "UpstreamPathTemplate": "/${microserviceName}/api/${entityName}/{everything}", - | "UpstreamHttpMethod": [ "Get", "Post", "Delete","Put" ] - |}`); - const firstRewriteFileModel = this.generateFileModel(ocelotConfigPath, 'jhipster-needle-add-route-to-gateway', firstRouteEntry); - const secondRewriteFileModel = this.generateFileModel( - ocelotConfigPath, - 'jhipster-needle-add-route-to-gateway', - secondRouteEntry - ); - this.addBlockContentToFile(firstRewriteFileModel, errorMessage); - this.addBlockContentToFile(secondRewriteFileModel, errorMessage); - } - } -}; diff --git a/generators/server/prompts.js b/generators/server/prompts.js deleted file mode 100644 index c60b44cde..000000000 --- a/generators/server/prompts.js +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const chalk = require('chalk'); - -function askForModuleName() { - if (this.jhipsterConfig.baseName) return; - - this.askModuleName(this); -} - -function askForServerSideOpts() { - if (this.existingProject) return; - const applicationType = this.jhipsterConfig.applicationType; - const availableDb = [ - { - value: 'sqllite', - name: 'SQLite in-memory', - }, - { - value: 'mssql', - name: 'Microsoft SQL Server', - }, - { - value: 'postgres', - name: 'PostgreSQL', - }, - { - value: 'mysql', - name: 'MySQL', - }, - { - value: 'oracle', - name: 'Oracle', - }, - { - value: 'mongodb', - name: 'MongoDB', - }, - ]; - const defaultPort = applicationType === 'gateway' || applicationType === 'monolith' ? '5000' : '5004'; - const prompts = [ - { - type: 'input', - name: 'serverPort', - validate: input => (/^([0-9]*)$/.test(input) ? true : 'This is not a valid port number.'), - message: - 'On which port would like your server to run ? It should be unique to avoid port conflicts (choose http -> https=httpPort+1).', - default: defaultPort, - }, - { - type: 'confirm', - name: 'cqrsEnabled', - message: 'Do you want to use the CQRS design pattern?', - default: false, - }, - /* - Questions for separate DB - { - when: response => response.cqrsEnabled === true, - type: 'confirm', - name: 'separateDataBase', - message: 'Do you want to use two separate databases for reading and writing?', - default: false, - }, - { - when: response => response.cqrsEnabled === true && response.separateDataBase === true, - type: 'list', - name: 'database', - message: 'Which database do you want to use for reading', - choices: availableDb, - default: 0, - }, - { - when: response => response.cqrsEnabled === true && response.separateDataBase === true, - type: 'list', - name: 'databaseTwo', - message: 'Which database do you want to use for writing', - choices: availableDb, - default: 0, - }, - */ - { - // when: response => response.separateDataBase === false, - type: 'list', - name: 'database', - message: 'Which database do you want to use', - choices: availableDb, - default: 0, - }, - { - when: response => applicationType === 'monolith' && response.database === 'mssql', - type: 'confirm', - name: 'withTerraformAzureScripts', - message: `Would you like to generate ${chalk.yellow('*Terraform*')} script to deploy the application on Azure?`, - default: false, - }, - { - when: response => applicationType === 'monolith' || ['gateway', 'microservice'].includes(applicationType), - type: 'list', - name: 'authenticationType', - message: `Which ${chalk.yellow('*type*')} of authentication would you like to use?`, - choices: response => { - const opts = [ - { - value: 'jwt', - name: 'JWT authentication (stateless, with a token)', - }, - { - value: 'oauth2', - name: 'OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)', - }, - ]; - return opts; - }, - default: 0, - }, - ]; - - const done = this.async(); - - this.prompt(prompts).then(prompt => { - this.separateDataBase = this.jhipsterConfig.separateDataBase = prompt.separateDataBase; - this.databaseWriteType = this.jhipsterConfig.databaseWriteType = prompt.databaseTwo; - this.cqrsEnabled = this.jhipsterConfig.cqrsEnabled = prompt.cqrsEnabled; - this.databaseType = this.jhipsterConfig.databaseType = prompt.database; - this.authenticationType = this.jhipsterConfig.authenticationType = prompt.authenticationType; - this.serverPort = this.jhipsterConfig.serverPort = prompt.serverPort; - this.serverPortSecured = parseInt(this.serverPort, 10) + 1; - this.withTerraformAzureScripts = this.jhipsterConfig.withTerraformAzureScripts = prompt.withTerraformAzureScripts; - done(); - }); -} - -module.exports = { - askForModuleName, - askForServerSideOpts, -}; diff --git a/generators/server/templates/dotnetcore/docker/app.yml.ejs b/generators/server/templates/dotnetcore/docker/app.yml.ejs deleted file mode 100644 index e7f955c5d..000000000 --- a/generators/server/templates/dotnetcore/docker/app.yml.ejs +++ /dev/null @@ -1,97 +0,0 @@ -<%# - Copyright 2019-2023 the original author or authors from the JHipster project. - This file is part of the JHipster project, see https://www.jhipster.tech/ - for more information. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --%> -version: '2.2' -services: -<%_ switch(databaseType) { - case 'mysql': _%> - db: - container_name: db - image: mysql:8.0.19 - environment: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: jhipster - ports: - - "3308:3306" - healthcheck: - test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD - timeout: 20s - retries: 10 - <%_ break; - case 'mssql': _%> - db: - container_name: db - image: mcr.microsoft.com/mssql/server - environment: - SA_PASSWORD: "Password!12" - ACCEPT_EULA: "Y" - healthcheck: - test: /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$${SA_PASSWORD}" -Q "SELECT 1" -b -o /dev/null - interval: 10s - timeout: 3s - retries: 10 - start_period: 10s - <%_ break; - case 'mongodb': _%> - db: - container_name: db - image: mongo:latest - restart: always - healthcheck: - test: echo 'db.runCommand({serverStatus:1}).ok' | mongo admin --quiet | grep 1 - interval: 10s - timeout: 10s - retries: 3 - start_period: 20s - <%_ break; - case 'postgres': _%> - db: - container_name: db - image: postgres:latest - restart: always - environment: - POSTGRES_DB: jhipster - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - ports: - - "5432" - healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres"] - interval: 10s - timeout: 5s - retries: 5 - <%_ break; -} _%> - <%= baseName.toLowerCase() %>-app: - build: - context: ../ - dockerfile: Dockerfile-Back - <%_ if (databaseType !== 'sqllite' && databaseType !== 'oracle' && databaseType !== 'mongodb') { _%> - depends_on: - db: - condition: service_healthy - <%_ } _%> - ports: - - 8080:80 -<%_ if (!skipClient && clientFramework === "Blazor") { _%> - <%= baseName.toLowerCase() %>-front: - build: - context: ../ - dockerfile: Dockerfile-Front - ports: - - 8081:80 - environment: - - ServerUrl=http://localhost:8080 -<%_ } _%> - diff --git a/generators/server/templates/dotnetcore/docker/central-server-config/README.md.ejs b/generators/server/templates/dotnetcore/docker/central-server-config/README.md.ejs deleted file mode 100644 index f4d2fb204..000000000 --- a/generators/server/templates/dotnetcore/docker/central-server-config/README.md.ejs +++ /dev/null @@ -1,6 +0,0 @@ -# Central configuration sources details - -When running the consul.yml or app.yml docker-compose files, files located in `central-server-config/` -will get automatically loaded in Consul's K/V store. Adding or editing files will trigger a reloading. - -For more info, refer to https://www.jhipster.tech/consul/ diff --git a/generators/server/templates/dotnetcore/docker/central-server-config/application.json.ejs b/generators/server/templates/dotnetcore/docker/central-server-config/application.json.ejs deleted file mode 100644 index 6f7dd5577..000000000 --- a/generators/server/templates/dotnetcore/docker/central-server-config/application.json.ejs +++ /dev/null @@ -1,20 +0,0 @@ -{ - "Security": { - "Authentication": { - "Jwt": { - "Base64Secret": "bXktc2VjcmV0LWtleS13aGljaC1zaG91bGQtYmUtY2hhbmdlZC1pbi1wcm9kdWN0aW9uLWFuZC1iZS1iYXNlNjQtZW5jb2RlZAo=", - "TokenValidityInSeconds": 86400, - "TokenValidityInSecondsForRememberMe": 2592000 - } - }, - "Cors": { - "AllowedOrigins": "*", - "AllowedMethods": "*", - "AllowedHeaders": "*", - "ExposedHeaders": "Authorization,Link,X-Total-Count,X-Pagination", - "AllowCredentials": true, - "MaxAge": 1800 - }, - "EnforceHttps": false - } -} diff --git a/generators/server/templates/dotnetcore/docker/consul.yml.ejs b/generators/server/templates/dotnetcore/docker/consul.yml.ejs deleted file mode 100644 index 897d96e53..000000000 --- a/generators/server/templates/dotnetcore/docker/consul.yml.ejs +++ /dev/null @@ -1,44 +0,0 @@ -<%# - Copyright 2019-2023 the original author or authors from the JHipster project. - - This file is part of the JHipster project, see https://www.jhipster.tech/ - for more information. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --%> -# This configuration is intended for development purpose, it's **your** responsibility to harden it for production -version: '<%= DOCKER_COMPOSE_FORMAT_VERSION %>' -services: - consul: - image: <%= DOCKER_CONSUL %> - # If you want to expose these ports outside your dev PC, - # remove the "127.0.0.1:" prefix - ports: - - 127.0.0.1:8300:8300 - - 127.0.0.1:8500:8500 - - 127.0.0.1:8600:8600 - command: consul agent -dev -ui -client 0.0.0.0 - - consul-config-loader: - image: <%= DOCKER_CONSUL_CONFIG_LOADER %> - volumes: - - ./central-server-config:/config - environment: - - INIT_SLEEP_SECONDS=5 - - CONSUL_URL=consul - - CONSUL_PORT=8500 - - CONFIG_FORMAT=json - # Uncomment to load configuration into Consul from a Git repository - # as configured in central-server-config/git2consul.json - # Also set SPRING_CLOUD_CONSUL_CONFIG_FORMAT=files on your apps - # - CONFIG_MODE=git diff --git a/generators/server/templates/dotnetcore/docker/keycloak.yml.ejs b/generators/server/templates/dotnetcore/docker/keycloak.yml.ejs deleted file mode 100644 index 06f643daa..000000000 --- a/generators/server/templates/dotnetcore/docker/keycloak.yml.ejs +++ /dev/null @@ -1,33 +0,0 @@ -<%# - Copyright 2019-2023 the original author or authors from the JHipster project. - - This file is part of the JHipster project, see https://www.jhipster.tech/ - for more information. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --%> -version: '<%= DOCKER_COMPOSE_FORMAT_VERSION %>' -services: - keycloak: - image: <%= DOCKER_KEYCLOAK %> - command: ["-b", "0.0.0.0", "-Dkeycloak.migration.action=import", "-Dkeycloak.migration.provider=dir", "-Dkeycloak.migration.dir=/opt/jboss/keycloak/realm-config", "-Dkeycloak.migration.strategy=OVERWRITE_EXISTING", "-Djboss.socket.binding.port-offset=1000", "-Dkeycloak.profile.feature.upload_scripts=enabled"] - volumes: - - ./keycloak/config/realm-config:/opt/jboss/keycloak/realm-config - environment: - - KEYCLOAK_USER=admin - - KEYCLOAK_PASSWORD=admin - - DB_VENDOR=h2 - ports: - - 9080:9080 - - 9443:9443 - - 10990:10990 diff --git a/generators/server/templates/dotnetcore/docker/keycloak/config/realm-config/jhipster-realm.json.ejs b/generators/server/templates/dotnetcore/docker/keycloak/config/realm-config/jhipster-realm.json.ejs deleted file mode 100644 index ccfec08de..000000000 --- a/generators/server/templates/dotnetcore/docker/keycloak/config/realm-config/jhipster-realm.json.ejs +++ /dev/null @@ -1,2367 +0,0 @@ -{ - "id": "jhipster", - "realm": "jhipster", - "notBefore": 0, - "revokeRefreshToken": false, - "refreshTokenMaxReuse": 0, - "accessTokenLifespan": 300, - "accessTokenLifespanForImplicitFlow": 900, - "ssoSessionIdleTimeout": 1800, - "ssoSessionMaxLifespan": 36000, - "ssoSessionIdleTimeoutRememberMe": 0, - "ssoSessionMaxLifespanRememberMe": 0, - "offlineSessionIdleTimeout": 2592000, - "offlineSessionMaxLifespanEnabled": false, - "offlineSessionMaxLifespan": 5184000, - "accessCodeLifespan": 60, - "accessCodeLifespanUserAction": 300, - "accessCodeLifespanLogin": 1800, - "actionTokenGeneratedByAdminLifespan": 43200, - "actionTokenGeneratedByUserLifespan": 300, - "enabled": true, - "sslRequired": "external", - "registrationAllowed": false, - "registrationEmailAsUsername": false, - "rememberMe": false, - "verifyEmail": false, - "loginWithEmailAllowed": true, - "duplicateEmailsAllowed": false, - "resetPasswordAllowed": false, - "editUsernameAllowed": false, - "bruteForceProtected": false, - "permanentLockout": false, - "maxFailureWaitSeconds": 900, - "minimumQuickLoginWaitSeconds": 60, - "waitIncrementSeconds": 60, - "quickLoginCheckMilliSeconds": 1000, - "maxDeltaTimeSeconds": 43200, - "failureFactor": 30, - "roles": { - "realm": [ - { - "id": "a2350d85-938e-440c-847c-35086fe0f1d8", - "name": "ROLE_ADMIN", - "description": "Jhipster administrator role", - "composite": false, - "clientRole": false, - "containerId": "jhipster", - "attributes": {} - }, - { - "id": "932ca70d-a311-42f9-9042-431cef835b9e", - "name": "offline_access", - "description": "${role_offline-access}", - "composite": false, - "clientRole": false, - "containerId": "jhipster", - "attributes": {} - }, - { - "id": "8b1a0e78-24be-49ed-bc74-6471bd8d0f8f", - "name": "ROLE_USER", - "description": "Jhipster user role", - "composite": false, - "clientRole": false, - "containerId": "jhipster", - "attributes": {} - }, - { - "id": "96c0124c-0f00-4769-8cd3-f7dfd74a0af3", - "name": "uma_authorization", - "description": "${role_uma_authorization}", - "composite": false, - "clientRole": false, - "containerId": "jhipster", - "attributes": {} - } - ], - "client": { - "internal": [ - { - "id": "6ceaaca5-30a4-444b-9078-723b7cc13591", - "name": "uma_protection", - "composite": false, - "clientRole": true, - "containerId": "98ae8603-4547-4218-8fb9-ebc550a0e10b", - "attributes": {} - } - ], - "realm-management": [ - { - "id": "2f58d746-0582-47fe-9b67-30809d5ad461", - "name": "query-users", - "description": "${role_query-users}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "4873b8a8-8035-4b5e-bdd9-99ac74a4a43b", - "name": "query-clients", - "description": "${role_query-clients}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "5aa18f9b-2fb1-4edb-bdde-fb79273eee38", - "name": "view-events", - "description": "${role_view-events}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "84752518-6f2f-451f-ab59-de3ce6674ba1", - "name": "view-users", - "description": "${role_view-users}", - "composite": true, - "composites": { - "client": { - "realm-management": [ - "query-users", - "query-groups" - ] - } - }, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "c9fb6965-e734-46b4-a174-fa9d1fb7e1cc", - "name": "manage-events", - "description": "${role_manage-events}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "42abef51-b33b-4eb3-8515-3c6b16ca3849", - "name": "manage-identity-providers", - "description": "${role_manage-identity-providers}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "a3f9ba91-6ed5-47ff-a1cc-384c00cc203d", - "name": "impersonation", - "description": "${role_impersonation}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "24493c26-5ea3-4e53-b949-ca27a06ff098", - "name": "manage-users", - "description": "${role_manage-users}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "24ba1589-1141-4836-91bb-ad1b10db4944", - "name": "create-client", - "description": "${role_create-client}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "38cbec3e-9ca1-4292-a513-09e86fdcf6b1", - "name": "view-identity-providers", - "description": "${role_view-identity-providers}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "2d8a0ec8-111b-41a2-bf49-7f1ae086c5b1", - "name": "manage-realm", - "description": "${role_manage-realm}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "4ee94804-bc06-4d02-8541-410768b88a49", - "name": "manage-authorization", - "description": "${role_manage-authorization}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "3774414f-db0d-4928-b080-f22599622e97", - "name": "manage-clients", - "description": "${role_manage-clients}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "2a54d26e-7a55-4fc9-92cb-45e613084562", - "name": "view-realm", - "description": "${role_view-realm}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "8fdff21b-f46c-407c-b566-ce4fcc4c51d4", - "name": "view-authorization", - "description": "${role_view-authorization}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "083a848a-49cb-457f-9615-120be8c74d9e", - "name": "realm-admin", - "description": "${role_realm-admin}", - "composite": true, - "composites": { - "client": { - "realm-management": [ - "query-users", - "query-clients", - "view-events", - "view-users", - "manage-events", - "manage-identity-providers", - "impersonation", - "manage-users", - "create-client", - "manage-realm", - "view-identity-providers", - "manage-authorization", - "manage-clients", - "view-realm", - "view-authorization", - "view-clients", - "query-realms", - "query-groups" - ] - } - }, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "11bc32e5-55a6-431d-b6c7-32bd9504d070", - "name": "view-clients", - "description": "${role_view-clients}", - "composite": true, - "composites": { - "client": { - "realm-management": [ - "query-clients" - ] - } - }, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "5ea73aac-d0cf-4303-87a4-c9d7f5852734", - "name": "query-realms", - "description": "${role_query-realms}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - }, - { - "id": "8018bd1e-0b43-4b0c-8e5a-fbf31f8ee6db", - "name": "query-groups", - "description": "${role_query-groups}", - "composite": false, - "clientRole": true, - "containerId": "48fb7988-d909-445a-81db-fe825dca0db2", - "attributes": {} - } - ], - "security-admin-console": [], - "web_app": [], - "admin-cli": [], - "account-console": [],<% if (serviceDiscoveryType === 'eureka') { %> - "jhipster-registry": [],<% } %> - "broker": [ - { - "id": "225066d4-4a07-4550-a851-3d9359cbbac2", - "name": "read-token", - "description": "${role_read-token}", - "composite": false, - "clientRole": true, - "containerId": "274afcdb-7742-4a3a-acc5-17db61a4d200", - "attributes": {} - } - ], - "account": [ - { - "id": "42dcf4f5-8f73-4907-bd90-669cccd66c23", - "name": "manage-consent", - "description": "${role_manage-consent}", - "composite": true, - "composites": { - "client": { - "account": [ - "view-consent" - ] - } - }, - "clientRole": true, - "containerId": "e07da50b-cddc-4524-b630-436a5a6ba8ab", - "attributes": {} - }, - { - "id": "354b3a09-47a6-4051-957c-c6a3ee28a190", - "name": "view-profile", - "description": "${role_view-profile}", - "composite": false, - "clientRole": true, - "containerId": "e07da50b-cddc-4524-b630-436a5a6ba8ab", - "attributes": {} - }, - { - "id": "8d650dc2-d0e7-4ad7-8193-3ce1b7361b02", - "name": "manage-account-links", - "description": "${role_manage-account-links}", - "composite": false, - "clientRole": true, - "containerId": "e07da50b-cddc-4524-b630-436a5a6ba8ab", - "attributes": {} - }, - { - "id": "21b65e52-b4e3-453e-b0f0-10a44a4a887d", - "name": "manage-account", - "description": "${role_manage-account}", - "composite": true, - "composites": { - "client": { - "account": [ - "manage-account-links" - ] - } - }, - "clientRole": true, - "containerId": "e07da50b-cddc-4524-b630-436a5a6ba8ab", - "attributes": {} - }, - { - "id": "5328d093-e39c-4a2d-b664-01ed54505337", - "name": "view-applications", - "description": "${role_view-applications}", - "composite": false, - "clientRole": true, - "containerId": "e07da50b-cddc-4524-b630-436a5a6ba8ab", - "attributes": {} - }, - { - "id": "91f398b2-23a0-4cd3-8bc0-c3097df0e1e5", - "name": "view-consent", - "description": "${role_view-consent}", - "composite": false, - "clientRole": true, - "containerId": "e07da50b-cddc-4524-b630-436a5a6ba8ab", - "attributes": {} - } - ] - } - }, - "groups": [ - { - "id": "c4255caa-6cf7-40fb-8d5a-1b8799a438b8", - "name": "Admins", - "path": "/Admins", - "attributes": {}, - "realmRoles": [ - "ROLE_ADMIN" - ], - "clientRoles": {}, - "subGroups": [] - }, - { - "id": "ab0947d8-3b91-42a0-81e7-953a3c207316", - "name": "Users", - "path": "/Users", - "attributes": {}, - "realmRoles": [ - "ROLE_USER" - ], - "clientRoles": {}, - "subGroups": [] - } - ], - "defaultRoles": [ - "offline_access", - "uma_authorization" - ], - "requiredCredentials": [ - "password" - ], - "otpPolicyType": "totp", - "otpPolicyAlgorithm": "HmacSHA1", - "otpPolicyInitialCounter": 0, - "otpPolicyDigits": 6, - "otpPolicyLookAheadWindow": 1, - "otpPolicyPeriod": 30, - "otpSupportedApplications": [ - "FreeOTP", - "Google Authenticator" - ], - "webAuthnPolicyRpEntityName": "keycloak", - "webAuthnPolicySignatureAlgorithms": [ - "ES256" - ], - "webAuthnPolicyRpId": "", - "webAuthnPolicyAttestationConveyancePreference": "not specified", - "webAuthnPolicyAuthenticatorAttachment": "not specified", - "webAuthnPolicyRequireResidentKey": "not specified", - "webAuthnPolicyUserVerificationRequirement": "not specified", - "webAuthnPolicyCreateTimeout": 0, - "webAuthnPolicyAvoidSameAuthenticatorRegister": false, - "webAuthnPolicyAcceptableAaguids": [], - "webAuthnPolicyPasswordlessRpEntityName": "keycloak", - "webAuthnPolicyPasswordlessSignatureAlgorithms": [ - "ES256" - ], - "webAuthnPolicyPasswordlessRpId": "", - "webAuthnPolicyPasswordlessAttestationConveyancePreference": "not specified", - "webAuthnPolicyPasswordlessAuthenticatorAttachment": "not specified", - "webAuthnPolicyPasswordlessRequireResidentKey": "not specified", - "webAuthnPolicyPasswordlessUserVerificationRequirement": "not specified", - "webAuthnPolicyPasswordlessCreateTimeout": 0, - "webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister": false, - "webAuthnPolicyPasswordlessAcceptableAaguids": [], - "scopeMappings": [ - { - "clientScope": "offline_access", - "roles": [ - "offline_access" - ] - } - ], - "clientScopeMappings": { - "account": [ - { - "client": "account-console", - "roles": [ - "manage-account" - ] - } - ] - }, - "clients": [ - { - "id": "e07da50b-cddc-4524-b630-436a5a6ba8ab", - "clientId": "account", - "name": "${client_account}", - "rootUrl": "${authBaseUrl}", - "baseUrl": "/realms/jhipster/account/", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "**********", - "defaultRoles": [ - "manage-account", - "view-profile" - ], - "redirectUris": [ - "/realms/jhipster/account/*" - ], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": false, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": {}, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "defaultClientScopes": [ - "web-origins", - "role_list", - "roles", - "profile", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "7b6ab455-242e-42aa-96d8-9c9e2b74da9d", - "clientId": "account-console", - "name": "${client_account-console}", - "rootUrl": "${authBaseUrl}", - "baseUrl": "/realms/jhipster/account/", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "**********", - "redirectUris": [ - "/realms/jhipster/account/*" - ], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": true, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": { - "pkce.code.challenge.method": "S256" - }, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "protocolMappers": [ - { - "id": "013df1b5-9a5b-44f2-a0b6-5bf6d448556b", - "name": "audience resolve", - "protocol": "openid-connect", - "protocolMapper": "oidc-audience-resolve-mapper", - "consentRequired": false, - "config": {} - } - ], - "defaultClientScopes": [ - "web-origins", - "role_list", - "roles", - "profile", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "5a9610bf-6a47-46a1-9442-9e43eacd98e8", - "clientId": "admin-cli", - "name": "${client_admin-cli}", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "**********", - "redirectUris": [], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": false, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": true, - "serviceAccountsEnabled": false, - "publicClient": true, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": {}, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "defaultClientScopes": [ - "web-origins", - "role_list", - "roles", - "profile", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "274afcdb-7742-4a3a-acc5-17db61a4d200", - "clientId": "broker", - "name": "${client_broker}", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "**********", - "redirectUris": [], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": false, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": {}, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "defaultClientScopes": [ - "web-origins", - "role_list", - "roles", - "profile", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "98ae8603-4547-4218-8fb9-ebc550a0e10b", - "clientId": "internal", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "internal", - "redirectUris": [], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": false, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": true, - "authorizationServicesEnabled": true, - "publicClient": false, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": { - "saml.assertion.signature": "false", - "saml.force.post.binding": "false", - "saml.multivalued.roles": "false", - "saml.encrypt": "false", - "saml.server.signature": "false", - "saml.server.signature.keyinfo.ext": "false", - "exclude.session.state.from.auth.response": "false", - "saml_force_name_id_format": "false", - "saml.client.signature": "false", - "tls.client.certificate.bound.access.tokens": "false", - "saml.authnstatement": "false", - "display.on.consent.screen": "false", - "saml.onetimeuse.condition": "false" - }, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": true, - "nodeReRegistrationTimeout": -1, - "protocolMappers": [ - { - "id": "46513189-074c-4ba5-bfa7-29bae63faaaf", - "name": "Client IP Address", - "protocol": "openid-connect", - "protocolMapper": "oidc-usersessionmodel-note-mapper", - "consentRequired": false, - "config": { - "user.session.note": "clientAddress", - "userinfo.token.claim": "true", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "clientAddress", - "jsonType.label": "String" - } - }, - { - "id": "974887a2-e14a-4afd-84fc-a848009079ae", - "name": "Client ID", - "protocol": "openid-connect", - "protocolMapper": "oidc-usersessionmodel-note-mapper", - "consentRequired": false, - "config": { - "user.session.note": "clientId", - "userinfo.token.claim": "true", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "clientId", - "jsonType.label": "String" - } - }, - { - "id": "1b1a1f44-66df-4670-badb-46a3d361ec7c", - "name": "Client Host", - "protocol": "openid-connect", - "protocolMapper": "oidc-usersessionmodel-note-mapper", - "consentRequired": false, - "config": { - "user.session.note": "clientHost", - "userinfo.token.claim": "true", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "clientHost", - "jsonType.label": "String" - } - } - ], - "defaultClientScopes": [ - "web-origins", - "role_list", - "roles", - "profile", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ], - "authorizationSettings": { - "allowRemoteResourceManagement": false, - "policyEnforcementMode": "ENFORCING", - "resources": [ - { - "name": "Default Resource", - "type": "urn:internal:resources:default", - "ownerManagedAccess": false, - "attributes": {}, - "_id": "9e347a4d-ab6b-4075-9d24-23d20dfd30bc", - "uris": [ - "/*" - ] - } - ], - "policies": [ - { - "id": "ff09b194-0615-4cfd-9851-74adf540dabd", - "name": "Default Policy", - "description": "A policy that grants access only for users within this realm", - "type": "js", - "logic": "POSITIVE", - "decisionStrategy": "AFFIRMATIVE", - "config": { - "code": "// by default, grants any permission associated with this policy\n$evaluation.grant();\n" - } - }, - { - "id": "4b5c72cc-b8b8-4bfc-95ac-61815669f985", - "name": "Default Permission", - "description": "A permission that applies to the default resource type", - "type": "resource", - "logic": "POSITIVE", - "decisionStrategy": "UNANIMOUS", - "config": { - "defaultResourceType": "urn:internal:resources:default", - "applyPolicies": "[\"Default Policy\"]" - } - } - ], - "scopes": [], - "decisionStrategy": "UNANIMOUS" - } - },<% if (serviceDiscoveryType === 'eureka') { %> - { - "id": "dfaed4f5-716b-4f9c-a81e-e87f5f0db795", - "clientId": "jhipster-registry", - "rootUrl": "http://localhost:8761", - "adminUrl": "http://localhost:8761", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "jhipster-registry", - "redirectUris": [ - "http://127.0.0.1:8761/*", - "http://localhost:8761/*" - ], - "webOrigins": [ - "http://127.0.0.1:8761", - "http://localhost:8761" - ], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": true, - "serviceAccountsEnabled": false, - "publicClient": true, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": { - "saml.assertion.signature": "false", - "saml.force.post.binding": "false", - "saml.multivalued.roles": "false", - "saml.encrypt": "false", - "saml.server.signature": "false", - "saml.server.signature.keyinfo.ext": "false", - "exclude.session.state.from.auth.response": "false", - "saml_force_name_id_format": "false", - "saml.client.signature": "false", - "tls.client.certificate.bound.access.tokens": "false", - "saml.authnstatement": "false", - "display.on.consent.screen": "false", - "saml.onetimeuse.condition": "false" - }, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": true, - "nodeReRegistrationTimeout": -1, - "defaultClientScopes": [ - "web-origins", - "jhipster", - "role_list", - "roles", - "profile", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - },<% } %> - { - "id": "48fb7988-d909-445a-81db-fe825dca0db2", - "clientId": "realm-management", - "name": "${client_realm-management}", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "**********", - "redirectUris": [], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": true, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": false, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": {}, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "defaultClientScopes": [ - "role_list", - "profile", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "0aa176c1-8d28-4a8b-8e97-7e4b49a289ff", - "clientId": "security-admin-console", - "name": "${client_security-admin-console}", - "rootUrl": "${authAdminUrl}", - "baseUrl": "/admin/jhipster/console/", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "**********", - "redirectUris": [ - "/admin/jhipster/console/*" - ], - "webOrigins": [ - "+" - ], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": true, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": { - "pkce.code.challenge.method": "S256" - }, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "protocolMappers": [ - { - "id": "abfaa4cd-4bc1-4223-be5d-c56c641369f2", - "name": "locale", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "locale", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "locale", - "jsonType.label": "String" - } - } - ], - "defaultClientScopes": [ - "web-origins", - "role_list", - "roles", - "profile", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "1eabef67-6473-4ba8-b07c-14bdbae4aaed", - "clientId": "web_app", - "rootUrl": "http://localhost:<%= serverPort %>", - "adminUrl": "http://localhost:<%= serverPort %>", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "web_app", - "redirectUris": [ - "http://localhost:*", - "https://localhost:*", - "http://127.0.0.1:*", - "https://127.0.0.1:*", - "dev.localhost.ionic:*" - ], - "webOrigins": [ - "*" - ], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": true, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": true, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": { - "saml.assertion.signature": "false", - "saml.force.post.binding": "false", - "saml.multivalued.roles": "false", - "saml.encrypt": "false", - "saml.server.signature": "false", - "saml.server.signature.keyinfo.ext": "false", - "exclude.session.state.from.auth.response": "false", - "saml_force_name_id_format": "false", - "saml.client.signature": "false", - "tls.client.certificate.bound.access.tokens": "false", - "saml.authnstatement": "false", - "display.on.consent.screen": "false", - "saml.onetimeuse.condition": "false" - }, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": true, - "nodeReRegistrationTimeout": -1, - "defaultClientScopes": [ - "web-origins", - "jhipster", - "role_list", - "roles", - "profile", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - } - ], - "clientScopes": [ - { - "id": "1dc1e050-891a-4f5b-ac9d-5ea0c2e3c05e", - "name": "address", - "description": "OpenID Connect built-in scope: address", - "protocol": "openid-connect", - "attributes": { - "consent.screen.text": "${addressScopeConsentText}", - "display.on.consent.screen": "true" - }, - "protocolMappers": [ - { - "id": "b9a92105-8ca5-45d1-8a99-626255ac174f", - "name": "address", - "protocol": "openid-connect", - "protocolMapper": "oidc-address-mapper", - "consentRequired": false, - "config": { - "user.attribute.formatted": "formatted", - "user.attribute.country": "country", - "user.attribute.postal_code": "postal_code", - "userinfo.token.claim": "true", - "user.attribute.street": "street", - "id.token.claim": "true", - "user.attribute.region": "region", - "access.token.claim": "true", - "user.attribute.locality": "locality" - } - } - ] - }, - { - "id": "39e1693b-a924-4fbb-b98c-520869771f83", - "name": "email", - "description": "OpenID Connect built-in scope: email", - "protocol": "openid-connect", - "attributes": { - "consent.screen.text": "${emailScopeConsentText}", - "display.on.consent.screen": "true" - }, - "protocolMappers": [ - { - "id": "76f898bc-70e4-4e0a-a259-ae4cb58260f9", - "name": "email verified", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "emailVerified", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "email_verified", - "jsonType.label": "boolean" - } - }, - { - "id": "e348c7f8-e835-4539-a80b-b588510a82a9", - "name": "email", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "email", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "email", - "jsonType.label": "String" - } - } - ] - }, - { - "id": "3880d5d9-fced-4446-97fe-0434f2bb76ea", - "name": "jhipster", - "description": "Jhipster specific claims", - "protocol": "openid-connect", - "attributes": { - "display.on.consent.screen": "false" - }, - "protocolMappers": [ - { - "id": "e7c536ca-1711-4ed5-9f21-20a25435f475", - "name": "login", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "user.attribute": "preferred_username", - "claim.name": "login", - "jsonType.label": "String", - "userinfo.token.claim": "true" - } - }, - { - "id": "646e3a98-5f0c-4192-91f0-9719c295b278", - "name": "langKey", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "user.attribute": "langKey", - "claim.name": "langKey", - "jsonType.label": "String", - "userinfo.token.claim": "true" - } - }, - { - "id": "70b3e85f-e7b4-4c30-9d10-e0b589776951", - "name": "roles", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-realm-role-mapper", - "consentRequired": false, - "config": { - "access.token.claim": "true", - "claim.name": "roles", - "jsonType.label": "String", - "multivalued": "true", - "userinfo.token.claim": "true" - } - } - ] - }, - { - "id": "a72d436e-111b-445b-804a-967d249f6455", - "name": "microprofile-jwt", - "description": "Microprofile - JWT built-in scope", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "true", - "display.on.consent.screen": "false" - }, - "protocolMappers": [ - { - "id": "dec0c468-3c11-429b-844e-dfd632b20ba7", - "name": "upn", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "username", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "upn", - "jsonType.label": "String" - } - }, - { - "id": "1ac09ef6-ab67-4379-b15a-5e54e50783be", - "name": "groups", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-realm-role-mapper", - "consentRequired": false, - "config": { - "multivalued": "true", - "userinfo.token.claim": "true", - "user.attribute": "foo", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "groups", - "jsonType.label": "String" - } - } - ] - }, - { - "id": "5253d2be-3116-4510-ac05-99619ce2494c", - "name": "offline_access", - "description": "OpenID Connect built-in scope: offline_access", - "protocol": "openid-connect", - "attributes": { - "consent.screen.text": "${offlineAccessScopeConsentText}", - "display.on.consent.screen": "true" - } - }, - { - "id": "0d3b55db-e68b-4c83-91d4-7370a6810a24", - "name": "phone", - "description": "OpenID Connect built-in scope: phone", - "protocol": "openid-connect", - "attributes": { - "consent.screen.text": "${phoneScopeConsentText}", - "display.on.consent.screen": "true" - }, - "protocolMappers": [ - { - "id": "bbc582f4-4749-42b8-9c65-71f4edfd3979", - "name": "phone number", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "phoneNumber", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "phone_number", - "jsonType.label": "String" - } - }, - { - "id": "74840763-9b35-4c9a-8789-4008fedc26c2", - "name": "phone number verified", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "phoneNumberVerified", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "phone_number_verified", - "jsonType.label": "boolean" - } - } - ] - }, - { - "id": "d5de6a8a-8894-4e72-b6ef-f9bf3a7a6541", - "name": "profile", - "description": "OpenID Connect built-in scope: profile", - "protocol": "openid-connect", - "attributes": { - "consent.screen.text": "${profileScopeConsentText}", - "display.on.consent.screen": "true" - }, - "protocolMappers": [ - { - "id": "ecb34ff7-d27d-4696-b536-0512044b21a9", - "name": "website", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "website", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "website", - "jsonType.label": "String" - } - }, - { - "id": "f3cf3c8b-891a-48a1-97b3-1d10d55ddecd", - "name": "locale", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "locale", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "locale", - "jsonType.label": "String" - } - }, - { - "id": "fa3b86c8-abaf-4261-b48d-41cd3cf2dc6a", - "name": "full name", - "protocol": "openid-connect", - "protocolMapper": "oidc-full-name-mapper", - "consentRequired": false, - "config": { - "id.token.claim": "true", - "access.token.claim": "true", - "userinfo.token.claim": "true" - } - }, - { - "id": "219532f1-3c5c-4b30-a018-ae99adb6fc87", - "name": "birthdate", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "birthdate", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "birthdate", - "jsonType.label": "String" - } - }, - { - "id": "c443f4cd-1174-49a7-a2b3-65d5ccde5efa", - "name": "nickname", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "nickname", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "nickname", - "jsonType.label": "String" - } - }, - { - "id": "14631b9c-83eb-48ab-a224-29f047015e52", - "name": "username", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "username", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "preferred_username", - "jsonType.label": "String" - } - }, - { - "id": "cedd1f1b-951a-4332-9fa1-2edf1a266283", - "name": "middle name", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "middleName", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "middle_name", - "jsonType.label": "String" - } - }, - { - "id": "5a33d5e4-e124-412e-be4d-b6b28b41382a", - "name": "family name", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "lastName", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "family_name", - "jsonType.label": "String" - } - }, - { - "id": "c4122959-6738-4883-b50a-acd0033a477a", - "name": "profile", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "profile", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "profile", - "jsonType.label": "String" - } - }, - { - "id": "d7db1b88-2c3c-419a-91cf-19ad13355a56", - "name": "zoneinfo", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "zoneinfo", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "zoneinfo", - "jsonType.label": "String" - } - }, - { - "id": "dfd19868-5c87-4a51-80e0-2a82dfabb16c", - "name": "updated at", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "updatedAt", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "updated_at", - "jsonType.label": "String" - } - }, - { - "id": "19551b04-fc0c-44c4-b2bf-966da87ba3c3", - "name": "given name", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "firstName", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "given_name", - "jsonType.label": "String" - } - }, - { - "id": "c422b63f-e809-41c2-854c-e801e8e25485", - "name": "gender", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "gender", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "gender", - "jsonType.label": "String" - } - }, - { - "id": "2ccf435c-c255-4715-8dcd-15091f97c5a5", - "name": "picture", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "picture", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "picture", - "jsonType.label": "String" - } - } - ] - }, - { - "id": "391f1641-cb22-41a3-a0ed-752d9264aaf5", - "name": "role_list", - "description": "SAML role list", - "protocol": "saml", - "attributes": { - "consent.screen.text": "${samlRoleListScopeConsentText}", - "display.on.consent.screen": "true" - }, - "protocolMappers": [ - { - "id": "7cbb4477-af0c-4394-a754-b72a1b4638e0", - "name": "role list", - "protocol": "saml", - "protocolMapper": "saml-role-list-mapper", - "consentRequired": false, - "config": { - "single": "false", - "attribute.nameformat": "Basic", - "attribute.name": "Role" - } - } - ] - }, - { - "id": "021d9ac1-9650-401c-b2a2-efa2f3e6b70c", - "name": "roles", - "description": "OpenID Connect scope for add user roles to the access token", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "false", - "display.on.consent.screen": "true", - "consent.screen.text": "${rolesScopeConsentText}" - }, - "protocolMappers": [ - { - "id": "bbbd7dc1-63d0-468f-9463-4772833ef2fa", - "name": "client roles", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-client-role-mapper", - "consentRequired": false, - "config": { - "user.attribute": "foo", - "access.token.claim": "true", - "claim.name": "resource_access.${client_id}.roles", - "jsonType.label": "String", - "multivalued": "true" - } - }, - { - "id": "9271d821-b803-406d-8574-2f5a2693f065", - "name": "realm roles", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-realm-role-mapper", - "consentRequired": false, - "config": { - "user.attribute": "foo", - "access.token.claim": "true", - "claim.name": "realm_access.roles", - "jsonType.label": "String", - "multivalued": "true" - } - }, - { - "id": "90b1a715-e12e-4af8-89f6-82a370d57d1a", - "name": "audience resolve", - "protocol": "openid-connect", - "protocolMapper": "oidc-audience-resolve-mapper", - "consentRequired": false, - "config": {} - } - ] - }, - { - "id": "84fdcb72-668b-408e-aaea-110d594afe5e", - "name": "web-origins", - "description": "OpenID Connect scope for add allowed web origins to the access token", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "false", - "display.on.consent.screen": "false", - "consent.screen.text": "" - }, - "protocolMappers": [ - { - "id": "134b3451-cf2d-4ead-8fce-bf24b32f014c", - "name": "allowed web origins", - "protocol": "openid-connect", - "protocolMapper": "oidc-allowed-origins-mapper", - "consentRequired": false, - "config": {} - } - ] - } - ], - "defaultDefaultClientScopes": [ - "roles", - "role_list", - "email", - "web-origins", - "profile" - ], - "defaultOptionalClientScopes": [ - "phone", - "address", - "offline_access", - "microprofile-jwt" - ], - "browserSecurityHeaders": { - "contentSecurityPolicyReportOnly": "", - "xContentTypeOptions": "nosniff", - "xRobotsTag": "none", - "xFrameOptions": "SAMEORIGIN", - "contentSecurityPolicy": "frame-src 'self'; frame-ancestors 'self'; object-src 'none';", - "xXSSProtection": "1; mode=block", - "strictTransportSecurity": "max-age=31536000; includeSubDomains" - }, - "smtpServer": {}, - "eventsEnabled": false, - "eventsListeners": [ - "jboss-logging" - ], - "enabledEventTypes": [], - "adminEventsEnabled": false, - "adminEventsDetailsEnabled": false, - "components": { - "org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy": [ - { - "id": "96bb5289-e057-4a3d-a273-89372bbc8cc0", - "name": "Allowed Client Scopes", - "providerId": "allowed-client-templates", - "subType": "authenticated", - "subComponents": {}, - "config": { - "allow-default-scopes": [ - "true" - ] - } - }, - { - "id": "5782d02c-2ba5-47d1-9732-dfaaf0e5cfdf", - "name": "Allowed Protocol Mapper Types", - "providerId": "allowed-protocol-mappers", - "subType": "authenticated", - "subComponents": {}, - "config": { - "allowed-protocol-mapper-types": [ - "oidc-full-name-mapper", - "saml-user-property-mapper", - "oidc-usermodel-attribute-mapper", - "saml-user-attribute-mapper", - "oidc-address-mapper", - "saml-role-list-mapper", - "oidc-usermodel-property-mapper", - "oidc-sha256-pairwise-sub-mapper" - ] - } - }, - { - "id": "c8d395e2-dd81-4118-b838-7095be5cc1c8", - "name": "Allowed Protocol Mapper Types", - "providerId": "allowed-protocol-mappers", - "subType": "anonymous", - "subComponents": {}, - "config": { - "allowed-protocol-mapper-types": [ - "oidc-address-mapper", - "oidc-full-name-mapper", - "oidc-usermodel-attribute-mapper", - "oidc-usermodel-property-mapper", - "saml-user-attribute-mapper", - "saml-user-property-mapper", - "oidc-sha256-pairwise-sub-mapper", - "saml-role-list-mapper" - ] - } - }, - { - "id": "1175c6f8-2d58-437f-bb21-4660c8c1a62c", - "name": "Full Scope Disabled", - "providerId": "scope", - "subType": "anonymous", - "subComponents": {}, - "config": {} - }, - { - "id": "4bd2778a-908f-4ac3-873f-61e674eecc2f", - "name": "Consent Required", - "providerId": "consent-required", - "subType": "anonymous", - "subComponents": {}, - "config": {} - }, - { - "id": "65809493-b60f-4b44-b1dc-28a22772c321", - "name": "Allowed Client Scopes", - "providerId": "allowed-client-templates", - "subType": "anonymous", - "subComponents": {}, - "config": { - "allow-default-scopes": [ - "true" - ] - } - }, - { - "id": "950acf43-614d-47a3-a7c9-d5072433c4b8", - "name": "Max Clients Limit", - "providerId": "max-clients", - "subType": "anonymous", - "subComponents": {}, - "config": { - "max-clients": [ - "200" - ] - } - }, - { - "id": "e2a65f9f-5ad8-4634-ab3a-810409a3e067", - "name": "Trusted Hosts", - "providerId": "trusted-hosts", - "subType": "anonymous", - "subComponents": {}, - "config": { - "host-sending-registration-request-must-match": [ - "true" - ], - "client-uris-must-match": [ - "true" - ] - } - } - ], - "org.keycloak.keys.KeyProvider": [ - { - "id": "8ab3be1d-3e01-4eb6-8ff2-d116b02ffc48", - "name": "aes-generated", - "providerId": "aes-generated", - "subComponents": {}, - "config": { - "priority": [ - "100" - ] - } - }, - { - "id": "2a3661d8-3594-4872-881a-9f2d394b675d", - "name": "rsa-generated", - "providerId": "rsa-generated", - "subComponents": {}, - "config": { - "priority": [ - "100" - ] - } - }, - { - "id": "1d291cea-3d41-41cb-9ab6-ef1513fe3fe8", - "name": "hmac-generated", - "providerId": "hmac-generated", - "subComponents": {}, - "config": { - "priority": [ - "100" - ] - } - } - ] - }, - "internationalizationEnabled": false, - "supportedLocales": [], - "authenticationFlows": [ - { - "id": "20a3af86-1f13-489d-bb67-db3b7df52875", - "alias": "Handle Existing Account", - "description": "Handle what to do if there is existing account with same email/username like authenticated identity provider", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "idp-confirm-link", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "requirement": "REQUIRED", - "priority": 20, - "flowAlias": "Handle Existing Account - Alternatives - 0", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "bd5b10aa-4005-4ea6-8995-9d1caac7b53e", - "alias": "Handle Existing Account - Alternatives - 0", - "description": "Subflow of Handle Existing Account with alternative executions", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "idp-email-verification", - "requirement": "ALTERNATIVE", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "requirement": "ALTERNATIVE", - "priority": 20, - "flowAlias": "Verify Existing Account by Re-authentication", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "1a5ca248-a893-40ad-b184-63f59c06e988", - "alias": "Verify Existing Account by Re-authentication", - "description": "Reauthentication of existing account", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "idp-username-password-form", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "requirement": "CONDITIONAL", - "priority": 20, - "flowAlias": "Verify Existing Account by Re-authentication - auth-otp-form - Conditional", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "e13aa76b-dfe1-4158-82f2-c4bad23cf32a", - "alias": "Verify Existing Account by Re-authentication - auth-otp-form - Conditional", - "description": "Flow to determine if the auth-otp-form authenticator should be used or not.", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "conditional-user-configured", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "auth-otp-form", - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "173ece89-908a-4c0e-9a6e-ccf6c871a2fc", - "alias": "browser", - "description": "browser based authentication", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "auth-cookie", - "requirement": "ALTERNATIVE", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "auth-spnego", - "requirement": "DISABLED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "identity-provider-redirector", - "requirement": "ALTERNATIVE", - "priority": 25, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "requirement": "ALTERNATIVE", - "priority": 30, - "flowAlias": "forms", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "4f469fff-9c0f-40d5-94d2-87ce8ecd34b7", - "alias": "clients", - "description": "Base authentication for clients", - "providerId": "client-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "client-secret", - "requirement": "ALTERNATIVE", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "client-jwt", - "requirement": "ALTERNATIVE", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "client-secret-jwt", - "requirement": "ALTERNATIVE", - "priority": 30, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "client-x509", - "requirement": "ALTERNATIVE", - "priority": 40, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "d17ed54c-9c98-4155-b8eb-c697101a325d", - "alias": "direct grant", - "description": "OpenID Connect Resource Owner Grant", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "direct-grant-validate-username", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "direct-grant-validate-password", - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "requirement": "CONDITIONAL", - "priority": 30, - "flowAlias": "direct grant - direct-grant-validate-otp - Conditional", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "b4d3e6be-fd6d-4588-a4cc-cfe4420c1fba", - "alias": "direct grant - direct-grant-validate-otp - Conditional", - "description": "Flow to determine if the direct-grant-validate-otp authenticator should be used or not.", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "conditional-user-configured", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "direct-grant-validate-otp", - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "7c5067b6-513d-4676-9afa-47b199c7194e", - "alias": "docker auth", - "description": "Used by Docker clients to authenticate against the IDP", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "docker-http-basic-authenticator", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "76be1624-c049-4e13-8ecd-8d01ac9433ac", - "alias": "first broker login", - "description": "Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticatorConfig": "review profile config", - "authenticator": "idp-review-profile", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "requirement": "REQUIRED", - "priority": 20, - "flowAlias": "first broker login - Alternatives - 0", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "91ee6c4e-dedd-4024-b6a8-c332ef2444a5", - "alias": "first broker login - Alternatives - 0", - "description": "Subflow of first broker login with alternative executions", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticatorConfig": "create unique user config", - "authenticator": "idp-create-user-if-unique", - "requirement": "ALTERNATIVE", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "requirement": "ALTERNATIVE", - "priority": 20, - "flowAlias": "Handle Existing Account", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "2dc1cb10-ea2c-48a2-8131-3c950784a60e", - "alias": "forms", - "description": "Username, password, otp and other auth forms.", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "auth-username-password-form", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "requirement": "CONDITIONAL", - "priority": 20, - "flowAlias": "forms - auth-otp-form - Conditional", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "7cdad543-5bdf-4f4a-a527-34e1b30889de", - "alias": "forms - auth-otp-form - Conditional", - "description": "Flow to determine if the auth-otp-form authenticator should be used or not.", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "conditional-user-configured", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "auth-otp-form", - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "98562c33-8964-42c4-8a69-204226d0c4c7", - "alias": "http challenge", - "description": "An authentication flow based on challenge-response HTTP Authentication Schemes", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "no-cookie-redirect", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "basic-auth", - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "basic-auth-otp", - "requirement": "DISABLED", - "priority": 30, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "auth-spnego", - "requirement": "DISABLED", - "priority": 40, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "6f1cb686-0852-4600-8eec-7c00cb465b35", - "alias": "registration", - "description": "registration flow", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "registration-page-form", - "requirement": "REQUIRED", - "priority": 10, - "flowAlias": "registration form", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "f335a41a-4044-43bf-ab0a-c39ea0a9246e", - "alias": "registration form", - "description": "registration form", - "providerId": "form-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "registration-user-creation", - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "registration-profile-action", - "requirement": "REQUIRED", - "priority": 40, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "registration-password-action", - "requirement": "REQUIRED", - "priority": 50, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "registration-recaptcha-action", - "requirement": "DISABLED", - "priority": 60, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "d1364557-be6a-4e58-9db0-d1fda2305e6e", - "alias": "reset credentials", - "description": "Reset credentials for a user if they forgot their password or something", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "reset-credentials-choose-user", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "reset-credential-email", - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "reset-password", - "requirement": "REQUIRED", - "priority": 30, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "requirement": "CONDITIONAL", - "priority": 40, - "flowAlias": "reset credentials - reset-otp - Conditional", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "558b807f-fed5-4c79-a80e-136a4468fbc5", - "alias": "reset credentials - reset-otp - Conditional", - "description": "Flow to determine if the reset-otp authenticator should be used or not.", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "conditional-user-configured", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "reset-otp", - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "e86247fb-5e43-41fb-88f4-355a32d2b89d", - "alias": "saml ecp", - "description": "SAML ECP Profile Authentication Flow", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "http-basic-authenticator", - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - } - ], - "authenticatorConfig": [ - { - "id": "d2ce2a29-3a8f-4797-9529-b5e498d835b7", - "alias": "create unique user config", - "config": { - "require.password.update.after.registration": "false" - } - }, - { - "id": "949fe63b-47a4-41b6-9872-0aabe1806b57", - "alias": "review profile config", - "config": { - "update.profile.on.first.login": "missing" - } - } - ], - "requiredActions": [ - { - "alias": "CONFIGURE_TOTP", - "name": "Configure OTP", - "providerId": "CONFIGURE_TOTP", - "enabled": true, - "defaultAction": false, - "priority": 10, - "config": {} - }, - { - "alias": "terms_and_conditions", - "name": "Terms and Conditions", - "providerId": "terms_and_conditions", - "enabled": false, - "defaultAction": false, - "priority": 20, - "config": {} - }, - { - "alias": "UPDATE_PASSWORD", - "name": "Update Password", - "providerId": "UPDATE_PASSWORD", - "enabled": true, - "defaultAction": false, - "priority": 30, - "config": {} - }, - { - "alias": "UPDATE_PROFILE", - "name": "Update Profile", - "providerId": "UPDATE_PROFILE", - "enabled": true, - "defaultAction": false, - "priority": 40, - "config": {} - }, - { - "alias": "VERIFY_EMAIL", - "name": "Verify Email", - "providerId": "VERIFY_EMAIL", - "enabled": true, - "defaultAction": false, - "priority": 50, - "config": {} - }, - { - "alias": "update_user_locale", - "name": "Update User Locale", - "providerId": "update_user_locale", - "enabled": true, - "defaultAction": false, - "priority": 1000, - "config": {} - } - ], - "browserFlow": "browser", - "registrationFlow": "registration", - "directGrantFlow": "direct grant", - "resetCredentialsFlow": "reset credentials", - "clientAuthenticationFlow": "clients", - "dockerAuthenticationFlow": "docker auth", - "attributes": { - "webAuthnPolicyAuthenticatorAttachment": "not specified", - "_browser_header.xRobotsTag": "none", - "webAuthnPolicyAttestationConveyancePreferencePasswordless": "not specified", - "webAuthnPolicyRequireResidentKeyPasswordless": "not specified", - "webAuthnPolicySignatureAlgorithmsPasswordless": "ES256", - "webAuthnPolicyRpEntityName": "keycloak", - "webAuthnPolicyAvoidSameAuthenticatorRegisterPasswordless": "false", - "failureFactor": "30", - "webAuthnPolicyAuthenticatorAttachmentPasswordless": "not specified", - "actionTokenGeneratedByUserLifespan": "300", - "maxDeltaTimeSeconds": "43200", - "webAuthnPolicySignatureAlgorithms": "ES256", - "webAuthnPolicyRpEntityNamePasswordless": "keycloak", - "offlineSessionMaxLifespan": "5184000", - "_browser_header.contentSecurityPolicyReportOnly": "", - "bruteForceProtected": "false", - "webAuthnPolicyRpIdPasswordless": "", - "_browser_header.contentSecurityPolicy": "frame-src 'self'; frame-ancestors 'self'; object-src 'none';", - "_browser_header.xXSSProtection": "1; mode=block", - "_browser_header.xFrameOptions": "SAMEORIGIN", - "_browser_header.strictTransportSecurity": "max-age=31536000; includeSubDomains", - "webAuthnPolicyUserVerificationRequirement": "not specified", - "permanentLockout": "false", - "quickLoginCheckMilliSeconds": "1000", - "webAuthnPolicyCreateTimeout": "0", - "webAuthnPolicyRequireResidentKey": "not specified", - "webAuthnPolicyRpId": "", - "webAuthnPolicyAttestationConveyancePreference": "not specified", - "maxFailureWaitSeconds": "900", - "minimumQuickLoginWaitSeconds": "60", - "webAuthnPolicyCreateTimeoutPasswordless": "0", - "webAuthnPolicyAvoidSameAuthenticatorRegister": "false", - "webAuthnPolicyUserVerificationRequirementPasswordless": "not specified", - "_browser_header.xContentTypeOptions": "nosniff", - "actionTokenGeneratedByAdminLifespan": "43200", - "waitIncrementSeconds": "60", - "offlineSessionMaxLifespanEnabled": "false" - }, - "keycloakVersion": "9.0.0", - "userManagedAccessAllowed": false -} diff --git a/generators/server/templates/dotnetcore/docker/keycloak/config/realm-config/jhipster-users-0.json.ejs b/generators/server/templates/dotnetcore/docker/keycloak/config/realm-config/jhipster-users-0.json.ejs deleted file mode 100644 index 4576a5057..000000000 --- a/generators/server/templates/dotnetcore/docker/keycloak/config/realm-config/jhipster-users-0.json.ejs +++ /dev/null @@ -1,72 +0,0 @@ -{ - "realm" : "jhipster", - "users" : [ { - "id" : "4c973896-5761-41fc-8217-07c5d13a004b", - "createdTimestamp" : 1505479415590, - "username" : "admin", - "enabled" : true, - "totp" : false, - "emailVerified" : true, - "firstName" : "Admin", - "lastName" : "Administrator", - "email" : "admin@localhost", - "credentials" : [ { - "id" : "b860462b-9b02-48ba-9523-d3a8926a917b", - "type" : "password", - "createdDate" : 1505479429154, - "secretData" : "{\"value\":\"4pf9K2jWSCcHC+CwsZP/qidN5pSmDUe6AX6wBerSGdBVKkExay8MWKx+EKmaaObZW6FVsD8vdW/ZsyUFD9gJ1Q==\",\"salt\":\"1/qNkZ5kr77jOMOBPBogGw==\"}", - "credentialData" : "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\"}" - } ], - "disableableCredentialTypes" : [ ], - "requiredActions" : [ ], - "realmRoles" : [ "offline_access", "uma_authorization" ], - "clientRoles" : { - "account" : [ "view-profile", "manage-account" ] - }, - "notBefore" : 0, - "groups" : [ "/Admins", "/Users" ] - }, { - "id" : "e3ab6777-e2d7-474e-b831-64e785d8be1f", - "createdTimestamp" : 1576348683889, - "username" : "service-account-internal", - "enabled" : true, - "totp" : false, - "emailVerified" : false, - "serviceAccountClientId" : "internal", - "credentials" : [ ], - "disableableCredentialTypes" : [ ], - "requiredActions" : [ ], - "realmRoles" : [ "offline_access", "uma_authorization" ], - "clientRoles" : { - "internal" : [ "uma_protection" ], - "account" : [ "view-profile", "manage-account" ] - }, - "notBefore" : 0, - "groups" : [ ] - }, { - "id" : "c4af4e2f-b432-4c3b-8405-cca86cd5b97b", - "createdTimestamp" : 1505479373742, - "username" : "user", - "enabled" : true, - "totp" : false, - "emailVerified" : true, - "firstName" : "", - "lastName" : "User", - "email" : "user@localhost", - "credentials" : [ { - "id" : "7821832b-1e82-45a2-b8d3-f1a6ad909e64", - "type" : "password", - "createdDate" : 1505479392766, - "secretData" : "{\"value\":\"MbKsMgWPnZyImih8s4SaoCSCq+XIY/c6S9F93sXEidHF1TjPWxCqMkec0+o3860CMLXHt3az61cIJOWI0FW9aw==\",\"salt\":\"fmpBI1r8R1u75hDLMUlwBw==\"}", - "credentialData" : "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\"}" - } ], - "disableableCredentialTypes" : [ ], - "requiredActions" : [ ], - "realmRoles" : [ "offline_access", "uma_authorization" ], - "clientRoles" : { - "account" : [ "view-profile", "manage-account" ] - }, - "notBefore" : 0, - "groups" : [ "/Users" ] - } ] -} diff --git a/generators/server/templates/dotnetcore/docker/sonar.yml.ejs b/generators/server/templates/dotnetcore/docker/sonar.yml.ejs deleted file mode 100644 index b56639477..000000000 --- a/generators/server/templates/dotnetcore/docker/sonar.yml.ejs +++ /dev/null @@ -1,21 +0,0 @@ -<%# - Copyright 2019-2023 the original author or authors from the JHipster project. - This file is part of the JHipster project, see https://www.jhipster.tech/ - for more information. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --%> -version: '<%= DOCKER_COMPOSE_FORMAT_VERSION %>' -services: - <%= baseName.toLowerCase() %>-sonar: - image: <%= DOCKER_SONAR %> - ports: - - 9001:9000 - - 9092:9092 diff --git a/generators/utils.js b/generators/utils.js deleted file mode 100644 index 39db75392..000000000 --- a/generators/utils.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * Copyright 2019-2023 the original author or authors from the JHipster project. - * - * This file is part of the JHipster project, see https://www.jhipster.tech/ - * for more information. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const _ = require('lodash'); -const toPascalCase = require('to-pascal-case'); -const getEnumInfo = require('generator-jhipster/generators/utils').getEnumInfo; -const packagejs = require('../package.json'); -const constants = require('./generator-dotnetcore-constants.cjs'); - -const SERVER_SRC_DIR = constants.SERVER_SRC_DIR; -const BLAZOR = constants.BLAZOR; -const XAMARIN = constants.XAMARIN; - -module.exports = { - copyI18n, - copyEnumI18n, - equivalentCSharpType, - customizeDotnetPaths, - getEnumInfo, - asModel, -}; - -/** - * Copy I18N - * - * @param language - * @param prefix - */ -function copyI18n(language, prefix = '') { - try { - const fileName = this.entityTranslationKey; - this.template( - `${prefix ? `${prefix}/` : ''}i18n/entity_${language}.json.ejs`, - `${SERVER_SRC_DIR}${this.mainClientAppDir}/i18n/${language}/${fileName}.json` - ); - this.addEntityTranslationKey(this.entityTranslationKeyMenu, this.entityClass, language); - } catch (e) { - this.debug('Error:', e); - // An exception is thrown if the folder doesn't exist - // do nothing - } -} - -/** - * Copy Enum I18N - * - * @param language - * @param enumInfo - * @param prefix - */ -function copyEnumI18n(language, enumInfo, prefix = '') { - try { - this.template( - `${prefix ? `${prefix}/` : ''}i18n/enum.json.ejs`, - `${SERVER_SRC_DIR}${this.mainClientAppDir}/i18n/${language}/${enumInfo.clientRootFolder}${enumInfo.enumInstance}.json`, - this, - {}, - enumInfo - ); - } catch (e) { - this.debug('Error:', e); - // An exception is thrown if the folder doesn't exist - // do nothing - } -} - -/** - * Customize dotnet paths - */ -function customizeDotnetPaths() { - this.camelizedBaseName = _.camelCase(this.baseName); - this.dasherizedBaseName = _.kebabCase(this.baseName); - this.pascalizedBaseName = toPascalCase(this.baseName); - this.lowercaseBaseName = this.baseName.toLowerCase(); - this.humanizedBaseName = _.startCase(this.baseName); - this.solutionName = this.pascalizedBaseName; - this.mainProjectDir = this.pascalizedBaseName; - this.mainClientDir = `${this.mainProjectDir}/ClientApp`; - this.mainClientAppDir = `${this.mainProjectDir}/ClientApp/src`; - this.relativeMainClientDir = 'ClientApp'; - this.relativeMainAppDir = `${this.relativeMainClientDir}/src`; - this.relativeMainTestDir = `${this.relativeMainClientDir}/test`; - this.testProjectDir = `${this.pascalizedBaseName}${constants.PROJECT_TEST_SUFFIX}`; - this.clientTestProject = `${this.mainClientDir}/test/`; - this.kebabCasedBaseName = _.kebabCase(this.baseName); - this.jhipsterDotnetVersion = packagejs.version; - this.modelSuffix = 'Model'; - this.backendName = '.Net'; - - this.primaryKeyType = this.databaseType === 'mongodb' ? 'string' : 'long'; - - if (this.clientFramework === BLAZOR) { - this.mainClientDir = `client/${this.pascalizedBaseName}.Client`; - this.sharedClientDir = `client/${this.pascalizedBaseName}.Client.Shared`; - this.clientTestProject = `${this.pascalizedBaseName}.Client${constants.PROJECT_TEST_SUFFIX}`; - } - if (this.clientFramework === XAMARIN) { - this.mainClientDir = `client/${this.pascalizedBaseName}.Client.Xamarin.Core`; - this.sharedClientDir = `client/${this.pascalizedBaseName}.Client.Xamarin.Shared`; - this.androidClientDir = `client/${this.pascalizedBaseName}.Client.Xamarin.Android`; - this.iOSClientDir = `client/${this.pascalizedBaseName}.Client.Xamarin.iOS`; - this.clientTestProject = `${this.pascalizedBaseName}.Client.Xamarin${constants.PROJECT_TEST_SUFFIX}`; - } - - this.options.outputPathCustomizer = [ - paths => (paths ? paths.replace(/^src\/main\/webapp(\/|$)/, `src/${this.mainClientAppDir}$1/`) : paths), - paths => (paths ? paths.replace(/^src\/test\/javascript(\/|$)/, `src/${this.clientTestProject}$1`) : paths), - // paths => (paths ? paths.replace(/^((?!.huskyrc).[a-z]*\.?[a-z]*\.?[a-z]*$)/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(webpack\/.*)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(tsconfig.e2e.json)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(config\/.*)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(package.json)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(tsconfig.json)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(tsconfig.app.json)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(tsconfig.spec.json)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(jest.conf.js)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(.eslintrc.json)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(angular.json)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(ngsw-config.json)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(.browserslistrc)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(.eslintignore)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(cypress.json)$/, `src/${this.mainClientDir}/$1`) : paths), - // React File - paths => (paths ? paths.replace(/^(postcss.config.js)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(tsconfig.test.json)$/, `src/${this.mainClientDir}/$1`) : paths), - // VUE File - paths => (paths ? paths.replace(/^(.postcssrc.js)$/, `src/${this.mainClientDir}/$1`) : paths), - paths => (paths ? paths.replace(/^(.eslintrc.js)$/, `src/${this.mainClientDir}/$1`) : paths), - ]; - - // get the frontend application name. - const frontendAppName = _.camelCase(this.baseName) + (this.baseName.endsWith('App') ? '' : 'App'); - this.frontendAppName = frontendAppName.match(/^\d/) ? 'App' : frontendAppName; -} - -function asModel(name) { - return name + this.modelSuffix; -} - -function equivalentCSharpType(javaType) { - let cSharpType; - - switch (javaType) { - case 'String': - cSharpType = 'string'; - break; - case 'Integer': - cSharpType = 'int?'; - break; - case 'Long': - cSharpType = 'long?'; - break; - case 'Float': - cSharpType = 'float?'; - break; - case 'Double': - cSharpType = 'double?'; - break; - case 'BigDecimal': - cSharpType = 'decimal?'; - break; - case 'LocalDate': - cSharpType = 'DateTime?'; - break; - case 'Instant': - cSharpType = 'DateTime'; - break; - case 'ZonedDateTime': - cSharpType = 'DateTime'; - break; - case 'Duration': - cSharpType = 'TimeSpan'; - break; - case 'Boolean': - cSharpType = 'bool?'; - break; - case 'enum': - cSharpType = 'LOOK_FOR_AN_EQUIVALENT'; - break; - case 'byte[]': - cSharpType = 'LOOK_FOR_AN_EQUIVALENT'; - break; - default: - cSharpType = 'UNKNOWN_TYPE'; - } - - return cSharpType; -} diff --git a/generators/xamarin/__snapshots__/generator.spec.js.snap b/generators/xamarin/__snapshots__/generator.spec.js.snap new file mode 100644 index 000000000..d57293a85 --- /dev/null +++ b/generators/xamarin/__snapshots__/generator.spec.js.snap @@ -0,0 +1,277 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SubGenerator xamarin of dotnetcore JHipster blueprint > run > execute commands 1`] = ` +[ + [ + "spawnCommand", + "dotnet new sln --name Jhipster", + ], + [ + "spawnCommand", + "dotnet sln Jhipster.sln add src/client/Jhipster.Client.Xamarin.Core/Jhipster.Client.Xamarin.Core.csproj src/client/Jhipster.Client.Xamarin.Shared/Jhipster.Client.Xamarin.Shared.csproj", + ], +] +`; + +exports[`SubGenerator xamarin of dotnetcore JHipster blueprint > run > should succeed 1`] = ` +{ + ".jhipster/Person.json": { + "stateCleared": "modified", + }, + ".yo-rc.json": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Jhipster.Client.Xamarin.Android.csproj": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Jhipster.Client.Xamarin.Android.csproj.user": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/MainActivity.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Properties/AndroidManifest.xml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Properties/AssemblyInfo.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/drawable/menu.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/drawable/splashscreen.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/layout/SplashScreen.xml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/layout/Tabbar.xml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/layout/Toolbar.xml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon.xml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon_round.xml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-hdpi/icon.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-mdpi/icon.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-xhdpi/icon.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-xxhdpi/icon.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/icon.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/values/colors.xml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/Resources/values/styles.xml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Android/SplashScreenActivity.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/App.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/AssemblyInfo.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/FormsApp.xaml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/FormsApp.xaml.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Jhipster.Client.Xamarin.Core.csproj": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/LinkerPreserve.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Models/JwtToken.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Models/LoginModel.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Models/RegisterResultRequest.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Models/UserModel.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Models/UserSaveModel.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Resources/Strings.Designer.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Resources/Strings.resx": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Services/AbstractEntityService.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Services/AuthenticationService.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Services/Configuration.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Services/IAbstractEntityService.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Services/IAuthenticationService.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Services/IRegisterService.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Services/RegisterService.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/ViewModels/BaseViewModel.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/ViewModels/HomeViewModel.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/ViewModels/LoginViewModel.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/ViewModels/MenuViewModel.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/ViewModels/RegisterViewModel.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/ViewModels/WelcomeViewModel.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/HomeView.xaml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/HomeView.xaml.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/LoginView.xaml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/LoginView.xaml.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/MenuPage.xaml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/MenuPage.xaml.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/RegisterView.xaml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/RegisterView.xaml.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/WelcomeView.xaml": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Core/Views/WelcomeView.xaml.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Shared/Constants/ErrorConst.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.Shared/Project.Client.Xamarin.Shared.csproj": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/AppDelegate.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Entitlements.plist": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Info.plist": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Jhipster.Client.Xamarin.iOS.csproj": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Jhipster.Client.Xamarin.iOS.csproj.user": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Main.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Properties/AssemblyInfo.cs": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Resources/Default-568h@2x.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Resources/Default-Portrait.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Resources/Default-Portrait@2x.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Resources/Default.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Resources/Default@2x.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Resources/LaunchScreen.storyboard": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Resources/menu.png": { + "stateCleared": "modified", + }, + "client/Jhipster.Client.Xamarin.iOS/Resources/splashscreen.png": { + "stateCleared": "modified", + }, + "src/Project.Client/Models/Entities/_dotnetEntityModel_.cs": { + "stateCleared": "modified", + }, + "src/Project.Client/Services/Entities/_entityClass_/I_entityClass_Service.cs": { + "stateCleared": "modified", + }, + "src/Project.Client/Services/Entities/_entityClass_/_entityClass_Service.cs": { + "stateCleared": "modified", + }, + "src/Project.Client/ViewModels/Entities/_entityClass_/_entityClass_ViewModel.cs": { + "stateCleared": "modified", + }, + "src/Project.Client/Views/Entities/_entityClass_/_entityClass_View.cs": { + "stateCleared": "modified", + }, + "src/Project.Client/Views/Entities/_entityClass_/_entityClass_View.xaml": { + "stateCleared": "modified", + }, +} +`; diff --git a/generators/xamarin/entities-xamarin.js b/generators/xamarin/entities-xamarin.js new file mode 100644 index 000000000..7d116b622 --- /dev/null +++ b/generators/xamarin/entities-xamarin.js @@ -0,0 +1,40 @@ +/** + * Copyright 2013-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CLIENT_SRC_DIR } from '../generator-dotnetcore-constants.js'; + +/** + * The default is to use a file path string. It implies use of the template method. + * For any other config an object { file:.., method:.., template:.. } can be used + */ +export const entityFiles = { + xamarinAppModels: [ + { + path: CLIENT_SRC_DIR, + templates: [ + 'Project.Client/Models/Entities/_dotnetEntityModel_.cs', + 'Project.Client/Services/Entities/_entityClass_/_entityClass_Service.cs', + 'Project.Client/Services/Entities/_entityClass_/I_entityClass_Service.cs', + 'Project.Client/ViewModels/Entities/_entityClass_/_entityClass_ViewModel.cs', + 'Project.Client/Views/Entities/_entityClass_/_entityClass_View.cs', + 'Project.Client/Views/Entities/_entityClass_/_entityClass_View.xaml', + ], + }, + ], +}; diff --git a/generators/xamarin/files-xamarin.js b/generators/xamarin/files-xamarin.js new file mode 100644 index 000000000..63b7e7cc3 --- /dev/null +++ b/generators/xamarin/files-xamarin.js @@ -0,0 +1,234 @@ +/** + * Copyright 2013-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { CLIENT_SRC_DIR } from '../generator-dotnetcore-constants.js'; + +/** + * The default is to use a file path string. It implies use of the template method. + * For any other config an object { file:.., method:.., template:.. } can be used + */ +export const files = { + xamarinAppModels: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Core/', data.mainClientDir), + templates: [ + 'Project.Client.Xamarin.Core/Models/RegisterResultRequest.cs', + 'Project.Client.Xamarin.Core/Models/UserSaveModel.cs', + 'Project.Client.Xamarin.Core/Models/JwtToken.cs', + 'Project.Client.Xamarin.Core/Models/LoginModel.cs', + 'Project.Client.Xamarin.Core/Models/UserModel.cs', + ], + }, + ], + xamarinAppViews: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Core/', data.mainClientDir), + templates: [ + 'Project.Client.Xamarin.Core/Views/HomeView.xaml.cs', + 'Project.Client.Xamarin.Core/Views/HomeView.xaml', + 'Project.Client.Xamarin.Core/Views/LoginView.xaml.cs', + 'Project.Client.Xamarin.Core/Views/LoginView.xaml', + 'Project.Client.Xamarin.Core/Views/MenuPage.xaml.cs', + 'Project.Client.Xamarin.Core/Views/MenuPage.xaml', + 'Project.Client.Xamarin.Core/Views/RegisterView.xaml.cs', + 'Project.Client.Xamarin.Core/Views/RegisterView.xaml', + 'Project.Client.Xamarin.Core/Views/WelcomeView.xaml.cs', + 'Project.Client.Xamarin.Core/Views/WelcomeView.xaml', + ], + }, + ], + xamarinAppViewModels: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Core/', data.mainClientDir), + templates: [ + 'Project.Client.Xamarin.Core/ViewModels/BaseViewModel.cs', + 'Project.Client.Xamarin.Core/ViewModels/HomeViewModel.cs', + 'Project.Client.Xamarin.Core/ViewModels/LoginViewModel.cs', + 'Project.Client.Xamarin.Core/ViewModels/MenuViewModel.cs', + 'Project.Client.Xamarin.Core/ViewModels/RegisterViewModel.cs', + 'Project.Client.Xamarin.Core/ViewModels/WelcomeViewModel.cs', + ], + }, + ], + xamarinAppServices: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Core/', data.mainClientDir), + templates: [ + 'Project.Client.Xamarin.Core/Services/Configuration.cs', + 'Project.Client.Xamarin.Core/Services/IAuthenticationService.cs', + 'Project.Client.Xamarin.Core/Services/AuthenticationService.cs', + 'Project.Client.Xamarin.Core/Services/IAbstractEntityService.cs', + 'Project.Client.Xamarin.Core/Services/AbstractEntityService.cs', + 'Project.Client.Xamarin.Core/Services/IRegisterService.cs', + 'Project.Client.Xamarin.Core/Services/RegisterService.cs', + ], + }, + ], + xamarinAppResources: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Core/', data.mainClientDir), + templates: ['Project.Client.Xamarin.Core/Resources/Strings.Designer.cs', 'Project.Client.Xamarin.Core/Resources/Strings.resx'], + }, + ], + xamarinAppBase: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => + filename + .replace('Project.Client.Xamarin.Core/', data.mainClientDir) + .replace('Project.Client.Xamarin.Core.csproj', `${data.pascalizedBaseName}.Client.Xamarin.Core.csproj`), + templates: [ + 'Project.Client.Xamarin.Core/App.cs', + 'Project.Client.Xamarin.Core/AssemblyInfo.cs', + 'Project.Client.Xamarin.Core/FormsApp.xaml.cs', + 'Project.Client.Xamarin.Core/FormsApp.xaml', + 'Project.Client.Xamarin.Core/LinkerPreserve.cs', + 'Project.Client.Xamarin.Core/Project.Client.Xamarin.Core.csproj', + ], + }, + ], + xamarinAppShared: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Shared/', data.sharedClientDir), + templates: [ + 'Project.Client.Xamarin.Shared/Constants/ErrorConst.cs', + 'Project.Client.Xamarin.Shared/Project.Client.Xamarin.Shared.csproj', + ], + }, + ], + xamarinAppAndroid: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => + filename + .replace('Project.Client.Xamarin.Android/', data.androidClientDir) + .replace('Project.Client.Xamarin.Android.csproj', `${data.pascalizedBaseName}.Client.Xamarin.Android.csproj`), + templates: [ + 'Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj', + 'Project.Client.Xamarin.Android/MainActivity.cs', + 'Project.Client.Xamarin.Android/SplashScreenActivity.cs', + 'Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.user', + ], + }, + ], + xamarinAppAndroidResourcesValues: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Android/', data.androidClientDir), + templates: [ + 'Project.Client.Xamarin.Android/Resources/values/colors.xml', + 'Project.Client.Xamarin.Android/Resources/values/styles.xml', + ], + }, + ], + xamarinAppAndroidResourcesLayout: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Android/', data.androidClientDir), + templates: [ + 'Project.Client.Xamarin.Android/Resources/layout/Tabbar.xml', + 'Project.Client.Xamarin.Android/Resources/layout/Toolbar.xml', + 'Project.Client.Xamarin.Android/Resources/layout/SplashScreen.xml', + ], + }, + ], + xamarinAppAndroidResourcesImage: [ + { + path: CLIENT_SRC_DIR, + transform: false, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Android/', data.androidClientDir), + templates: [ + 'Project.Client.Xamarin.Android/Resources/drawable/splashscreen.png', + 'Project.Client.Xamarin.Android/Resources/drawable/menu.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon.xml', + 'Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon_round.xml', + 'Project.Client.Xamarin.Android/Resources/mipmap-hdpi/icon.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-mdpi/icon.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/icon.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/icon.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/icon.png', + 'Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png', + ], + }, + ], + xamarinAppAndroidProperties: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.Android/', data.androidClientDir), + templates: [ + 'Project.Client.Xamarin.Android/Properties/AndroidManifest.xml', + 'Project.Client.Xamarin.Android/Properties/AssemblyInfo.cs', + ], + }, + ], + xamarinAppiOS: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => + filename + .replace('Project.Client.Xamarin.iOS/', data.iOSClientDir) + .replace('Project.Client.Xamarin.iOS.csproj', `${data.pascalizedBaseName}.Client.Xamarin.iOS.csproj`), + templates: [ + 'Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj', + 'Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.user', + 'Project.Client.Xamarin.iOS/Main.cs', + 'Project.Client.Xamarin.iOS/Info.plist', + 'Project.Client.Xamarin.iOS/Entitlements.plist', + 'Project.Client.Xamarin.iOS/AppDelegate.cs', + ], + }, + ], + xamarinAppiOSProperties: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.iOS/', data.iOSClientDir), + templates: ['Project.Client.Xamarin.iOS/Properties/AssemblyInfo.cs'], + }, + ], + xamarinAppiOSResources: [ + { + path: CLIENT_SRC_DIR, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.iOS/', data.iOSClientDir), + templates: ['Project.Client.Xamarin.iOS/Resources/LaunchScreen.storyboard'], + }, + { + path: CLIENT_SRC_DIR, + transform: false, + renameTo: (data, filename) => filename.replace('Project.Client.Xamarin.iOS/', data.iOSClientDir), + templates: [ + 'Project.Client.Xamarin.iOS/Resources/Default.png', + 'Project.Client.Xamarin.iOS/Resources/Default@2x.png', + 'Project.Client.Xamarin.iOS/Resources/Default-568h@2x.png', + 'Project.Client.Xamarin.iOS/Resources/Default-Portrait@2x.png', + 'Project.Client.Xamarin.iOS/Resources/Default-Portrait.png', + 'Project.Client.Xamarin.iOS/Resources/menu.png', + 'Project.Client.Xamarin.iOS/Resources/splashscreen.png', + ], + }, + ], +}; diff --git a/generators/xamarin/generator.js b/generators/xamarin/generator.js new file mode 100644 index 000000000..2905d472a --- /dev/null +++ b/generators/xamarin/generator.js @@ -0,0 +1,210 @@ +/* eslint-disable prefer-regex-literals */ +import { writeFileSync } from 'fs'; +import BaseApplicationGenerator from 'generator-jhipster/generators/base-application'; +import { createNeedleCallback } from 'generator-jhipster/generators/base/support'; +import chalk from 'chalk'; +import { Guid } from 'js-guid'; +import { files } from './files-xamarin.js'; +import { CLIENT_SRC_DIR } from '../generator-dotnetcore-constants.js'; +import { entityFiles } from './entities-xamarin.js'; + +export default class extends BaseApplicationGenerator { + constructor(args, opts, features) { + super(args, opts, { ...features, jhipster7Migration: true }); + } + + async beforeQueue() { + await this.dependsOnJHipster('jhipster-dotnetcore:bootstrap-dotnetcore'); + } + + get [BaseApplicationGenerator.PREPARING]() { + return this.asPreparingTaskGroup({ + async preparingTemplateTask({ application, source }) { + source.addEntityToMenu = ({ entityName }) => + this.editFile( + `${application.mainClientDir}/Views/MenuPage.xaml`, + createNeedleCallback({ + needle: 'jhipster-needle-add-entity-to-menu', + contentToAdd: ` + + `, + autoIndent: true, + }), + ); + + source.declareCommandToMenu = ({ entityName }) => + this.editFile( + `${application.mainClientDir}/ViewModels/MenuViewModel.cs`, + createNeedleCallback({ + needle: 'jhipster-needle-declare-entity-command', + contentToAdd: `public IMvxCommand Show${entityName}Command => new MvxAsyncCommand(${entityName}CommandClicked);`, + autoIndent: true, + }), + ); + + source.addCommandToMenu = ({ entityName }) => + this.editFile( + `${application.mainClientDir}/ViewModels/MenuViewModel.cs`, + createNeedleCallback({ + needle: 'jhipster-needle-add-entity-command', + contentToAdd: ` + private async Task ${entityName}CommandClicked() { + await _navigationService.Navigate<${entityName}ViewModel>(); + }`, + autoIndent: true, + }), + ); + + source.addServiceInDI = ({ entityName }) => + this.editFile( + `${application.mainClientDir}/App.cs`, + createNeedleCallback({ + needle: 'jhipster-needle-add-services-in-di', + contentToAdd: ` + var ${this._.lowerCase(entityName)}Service = new ${entityName}Service(httpClient); + Mvx.IoCProvider.RegisterSingleton(${this._.lowerCase(entityName)}Service);`, + autoIndent: true, + }), + ); + }, + }); + } + + get [BaseApplicationGenerator.WRITING]() { + return this.asWritingTaskGroup({ + async writingTemplateTask({ application }) { + await this.writeFiles({ + sections: files, + context: application, + }); + }, + }); + } + + get [BaseApplicationGenerator.WRITING_ENTITIES]() { + return this.asWritingEntitiesTaskGroup({ + async writingEntitiesTemplateTask({ application, entities }) { + for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipClient)) { + await this.writeFiles({ + sections: entityFiles, + context: { + ...application, + ...entity, + asModel: str => `${str}${application.modelSuffix}`, + }, + }); + } + }, + }); + } + + get [BaseApplicationGenerator.POST_WRITING_ENTITIES]() { + return this.asPostWritingEntitiesTaskGroup({ + async postWritingEntitiesTemplateTask({ entities, source }) { + for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipClient)) { + source.addEntityToMenu({ entityName: entity.entityClass }); + source.addServiceInDI({ entityName: entity.entityClass }); + source.addCommandToMenu({ entityName: entity.entityClass }); + source.declareCommandToMenu({ entityName: entity.entityClass }); + } + }, + }); + } + + get [BaseApplicationGenerator.INSTALL]() { + return this.asInstallTaskGroup({ + async install({ application }) { + this.log(chalk.green.bold(`\nCreating ${application.solutionName} .Net Core solution if it does not already exist.\n`)); + + try { + await this.spawnCommand(`dotnet new sln --name ${application.solutionName}`); + } catch (err) { + this.log.warn(`Failed to create ${application.solutionName} .Net Core solution: ${err}`); + } + + const projects = [ + `${CLIENT_SRC_DIR}${application.mainClientDir}${application.pascalizedBaseName}.Client.Xamarin.Core.csproj`, + `${CLIENT_SRC_DIR}${application.sharedClientDir}${application.pascalizedBaseName}.Client.Xamarin.Shared.csproj`, + ]; + await this.spawnCommand(`dotnet sln ${application.solutionName}.sln add ${projects.join(' ')}`); + this.log(chalk.green.bold('Client application generated successfully.\n')); + this.log( + chalk.green( + `Run your blazor application:\n${chalk.yellow.bold( + `dotnet run --verbosity normal --project ./${CLIENT_SRC_DIR}${application.mainClientDir}/${application.pascalizedBaseName}.Client.csproj`, + )}`, + ), + ); + + try { + await this.newSlnAddProj(application.solutionName, [ + { + path: `${CLIENT_SRC_DIR}${application.androidClientDir}/${application.pascalizedBaseName}.Client.Xamarin.Android.csproj`, + name: `${application.pascalizedBaseName}.Client.Xamarin.Android`, + }, + { + path: `${CLIENT_SRC_DIR}${application.iOSClientDir}/${application.pascalizedBaseName}.Client.Xamarin.iOS.csproj`, + name: `${application.pascalizedBaseName}.Client.Xamarin.iOS`, + }, + ]); + this.log(chalk.green.bold('Client application generated successfully.\n')); + } catch (error) { + this.log.error('Failed to add project.'); + } + }, + }); + } + + async newSlnAddProj(solutionName, projects) { + const solutionFile = this.readDestination(`${solutionName}.sln`); + const regex = new RegExp(`Project\\("{([^}"]*)}"\\) = .*Core.csproj", "{([^}"]*)}"`, 'g'); // eslint-disable-line quotes + const exc = regex.exec(solutionFile); + const firstGuid = exc[1]; + const regexp = RegExp(`Project\\("{[^}"]*}"\\) = "client", "client", "{([^}"]*)}"`, 'g'); // eslint-disable-line quotes + const clientDir = regexp.exec(solutionFile)[1]; + const reg = new RegExp(`Project\\("{[^"]*"\\) = "([^"]*)", "[^"]*`, 'g'); // eslint-disable-line quotes + let projectText = ''; + let dirText = ''; + + projectText += `\nProject("{${firstGuid}}") = "Solution Items", "Solution Items", "{${this._.toUpper(Guid.newGuid())}}"`; + projectText += '\n\tProjectSection(SolutionItems) = preProject'; + projectText += '\n\t\t.editorconfig = .editorconfig'; + projectText += '\n\t\tDirectory.Packages.props = Directory.Packages.props'; + projectText += '\n\t\tREADME.md = README.md'; + projectText += '\n\tEndProjectSection'; + projectText += '\nEndProject'; + + projects.forEach(project => { + const existingProjects = solutionFile.matchAll(reg); + let alreadyExist = false; + let existingProject = existingProjects.next(); + while (!existingProject.done && !alreadyExist) { + alreadyExist = existingProject.value[1] === project.name; + existingProject = existingProjects.next(); + } + if (!alreadyExist) { + const randomGuid = this._.toUpper(Guid.newGuid()); + projectText += `\nProject("{${firstGuid}}") = "${project.name}", "${project.path}", "{${randomGuid}}"\nEndProject`; + dirText += `\n\t\t{${randomGuid}} = {${clientDir}}`; + } + }); + + const projectRe = new RegExp('MinimumVisualStudioVersion = .*\\D', 'g'); + const projectFound = solutionFile.match(projectRe); + projectText = `${projectFound}${projectText}`; + let newBody = solutionFile.replace(projectRe, projectText); + + const dirRe = new RegExp('GlobalSection\\(NestedProjects\\) = .*\\D', 'g'); + const dirFound = solutionFile.match(dirRe); + dirText = `${dirFound}${dirText}`; + newBody = newBody.replace(dirRe, dirText); + + if (solutionFile !== newBody) { + writeFileSync(`${solutionName}.sln`, newBody); + } + } +} diff --git a/generators/xamarin/generator.spec.js b/generators/xamarin/generator.spec.js new file mode 100644 index 000000000..933cc6b20 --- /dev/null +++ b/generators/xamarin/generator.spec.js @@ -0,0 +1,30 @@ +import { beforeAll, describe, expect, it } from 'vitest'; + +import { defaultHelpers as helpers, result } from 'generator-jhipster/testing'; + +const SUB_GENERATOR = 'xamarin'; +const SUB_GENERATOR_NAMESPACE = `jhipster-dotnetcore:${SUB_GENERATOR}`; + +describe('SubGenerator xamarin of dotnetcore JHipster blueprint', () => { + describe('run', () => { + beforeAll(async function () { + await helpers + .run(SUB_GENERATOR_NAMESPACE) + .withJHipsterConfig({ clientFramework: 'Xamarin' }, [{ name: 'Person', dto: 'mapstruct' }]) + .withOptions({ + ignoreNeedlesError: true, + }) + .withSpawnMock() + .withJHipsterLookup() + .withParentBlueprintLookup(); + }); + + it('should succeed', () => { + expect(result.getStateSnapshot()).toMatchSnapshot(); + }); + + it('execute commands', () => { + expect(result.getSpawnArgsUsingDefaultImplementation()).toMatchSnapshot(); + }); + }); +}); diff --git a/generators/xamarin/index.js b/generators/xamarin/index.js new file mode 100644 index 000000000..01e9dc34d --- /dev/null +++ b/generators/xamarin/index.js @@ -0,0 +1 @@ +export { default } from './generator.js'; diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/MainActivity.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/MainActivity.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/MainActivity.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/MainActivity.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.user.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.user.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.user.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Project.Client.Xamarin.Android.csproj.user.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Properties/AndroidManifest.xml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Properties/AndroidManifest.xml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Properties/AndroidManifest.xml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Properties/AndroidManifest.xml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Properties/AssemblyInfo.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Properties/AssemblyInfo.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Properties/AssemblyInfo.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Properties/AssemblyInfo.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/drawable/menu.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/drawable/menu.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/drawable/menu.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/drawable/menu.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/drawable/splashscreen.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/drawable/splashscreen.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/drawable/splashscreen.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/drawable/splashscreen.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/layout/SplashScreen.xml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/layout/SplashScreen.xml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/layout/SplashScreen.xml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/layout/SplashScreen.xml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/layout/Tabbar.xml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/layout/Tabbar.xml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/layout/Tabbar.xml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/layout/Tabbar.xml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/layout/Toolbar.xml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/layout/Toolbar.xml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/layout/Toolbar.xml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/layout/Toolbar.xml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon.xml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon.xml similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon.xml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon.xml diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon_round.xml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon_round.xml similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon_round.xml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-anydpi-v26/icon_round.xml diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-hdpi/icon.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-hdpi/icon.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-hdpi/icon.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-hdpi/icon.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-mdpi/icon.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-mdpi/icon.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-mdpi/icon.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-mdpi/icon.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/icon.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/icon.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/icon.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/icon.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/icon.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/icon.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/icon.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/icon.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/icon.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/icon.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/icon.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/icon.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/values/colors.xml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/values/colors.xml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/values/colors.xml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/values/colors.xml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/values/styles.xml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/values/styles.xml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/Resources/values/styles.xml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/Resources/values/styles.xml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/SplashScreenActivity.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Android/SplashScreenActivity.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Android/SplashScreenActivity.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Android/SplashScreenActivity.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/App.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/App.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/App.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/App.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/AssemblyInfo.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/AssemblyInfo.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/AssemblyInfo.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/AssemblyInfo.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/FormsApp.xaml.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/FormsApp.xaml.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/FormsApp.xaml.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/FormsApp.xaml.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/FormsApp.xaml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/FormsApp.xaml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/FormsApp.xaml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/FormsApp.xaml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/LinkerPreserve.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/LinkerPreserve.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/LinkerPreserve.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/LinkerPreserve.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/JwtToken.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/JwtToken.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/JwtToken.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/JwtToken.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/LoginModel.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/LoginModel.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/LoginModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/LoginModel.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/RegisterResultRequest.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/RegisterResultRequest.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/RegisterResultRequest.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/RegisterResultRequest.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/UserModel.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/UserModel.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/UserModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/UserModel.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/UserSaveModel.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/UserSaveModel.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Models/UserSaveModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Models/UserSaveModel.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Project.Client.Xamarin.Core.csproj.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Project.Client.Xamarin.Core.csproj.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Project.Client.Xamarin.Core.csproj.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Project.Client.Xamarin.Core.csproj.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Resources/Strings.Designer.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Resources/Strings.Designer.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Resources/Strings.Designer.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Resources/Strings.Designer.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Resources/Strings.resx.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Resources/Strings.resx.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Resources/Strings.resx.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Resources/Strings.resx.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/AbstractEntityService.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/AbstractEntityService.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/AbstractEntityService.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/AbstractEntityService.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/AuthenticationService.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/AuthenticationService.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/AuthenticationService.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/AuthenticationService.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/Configuration.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/Configuration.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/Configuration.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/Configuration.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/IAbstractEntityService.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/IAbstractEntityService.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/IAbstractEntityService.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/IAbstractEntityService.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/IAuthenticationService.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/IAuthenticationService.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/IAuthenticationService.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/IAuthenticationService.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/IRegisterService.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/IRegisterService.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/IRegisterService.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/IRegisterService.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/RegisterService.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/RegisterService.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Services/RegisterService.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Services/RegisterService.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/BaseViewModel.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/BaseViewModel.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/BaseViewModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/BaseViewModel.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/HomeViewModel.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/HomeViewModel.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/HomeViewModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/HomeViewModel.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/LoginViewModel.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/LoginViewModel.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/LoginViewModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/LoginViewModel.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/MenuViewModel.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/MenuViewModel.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/MenuViewModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/MenuViewModel.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/RegisterViewModel.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/RegisterViewModel.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/RegisterViewModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/RegisterViewModel.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/WelcomeViewModel.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/WelcomeViewModel.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/ViewModels/WelcomeViewModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/ViewModels/WelcomeViewModel.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/HomeView.xaml.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/HomeView.xaml.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/HomeView.xaml.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/HomeView.xaml.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/HomeView.xaml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/HomeView.xaml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/HomeView.xaml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/HomeView.xaml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/LoginView.xaml.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/LoginView.xaml.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/LoginView.xaml.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/LoginView.xaml.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/LoginView.xaml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/LoginView.xaml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/LoginView.xaml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/LoginView.xaml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/MenuPage.xaml.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/MenuPage.xaml.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/MenuPage.xaml.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/MenuPage.xaml.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/MenuPage.xaml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/MenuPage.xaml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/MenuPage.xaml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/MenuPage.xaml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/RegisterView.xaml.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/RegisterView.xaml.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/RegisterView.xaml.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/RegisterView.xaml.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/RegisterView.xaml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/RegisterView.xaml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/RegisterView.xaml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/RegisterView.xaml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/WelcomeView.xaml.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/WelcomeView.xaml.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/WelcomeView.xaml.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/WelcomeView.xaml.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/WelcomeView.xaml.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/WelcomeView.xaml.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Core/Views/WelcomeView.xaml.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Core/Views/WelcomeView.xaml.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Shared/.vs/Project.Client.Shared/v16/.suo b/generators/xamarin/templates/src/Project.Client.Xamarin.Shared/.vs/Project.Client.Shared/v16/.suo similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Shared/.vs/Project.Client.Shared/v16/.suo rename to generators/xamarin/templates/src/Project.Client.Xamarin.Shared/.vs/Project.Client.Shared/v16/.suo diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Shared/Constants/ErrorConst.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Shared/Constants/ErrorConst.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Shared/Constants/ErrorConst.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Shared/Constants/ErrorConst.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.Shared/Project.Client.Xamarin.Shared.csproj.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.Shared/Project.Client.Xamarin.Shared.csproj.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.Shared/Project.Client.Xamarin.Shared.csproj.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.Shared/Project.Client.Xamarin.Shared.csproj.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/AppDelegate.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/AppDelegate.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/AppDelegate.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/AppDelegate.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Entitlements.plist.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Entitlements.plist.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Entitlements.plist.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Entitlements.plist.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Info.plist.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Info.plist.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Info.plist.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Info.plist.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Main.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Main.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Main.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Main.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.user.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.user.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.user.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Project.Client.Xamarin.iOS.csproj.user.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Properties/AssemblyInfo.cs.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Properties/AssemblyInfo.cs.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Properties/AssemblyInfo.cs.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Properties/AssemblyInfo.cs.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default-568h@2x.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default-568h@2x.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default-568h@2x.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default-568h@2x.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default-Portrait.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default-Portrait.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default-Portrait.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default-Portrait.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default-Portrait@2x.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default-Portrait@2x.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default-Portrait@2x.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default-Portrait@2x.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default@2x.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default@2x.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/Default@2x.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/Default@2x.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/LaunchScreen.storyboard.ejs b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/LaunchScreen.storyboard.ejs similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/LaunchScreen.storyboard.ejs rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/LaunchScreen.storyboard.ejs diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/menu.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/menu.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/menu.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/menu.png diff --git a/generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/splashscreen.png b/generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/splashscreen.png similarity index 100% rename from generators/client/templates/xamarin/src/Project.Client.Xamarin.iOS/Resources/splashscreen.png rename to generators/xamarin/templates/src/Project.Client.Xamarin.iOS/Resources/splashscreen.png diff --git a/generators/entity-client/templates/xamarin/src/Project.Client/Models/Model.cs.ejs b/generators/xamarin/templates/src/Project.Client/Models/Entities/_dotnetEntityModel_.cs.ejs similarity index 97% rename from generators/entity-client/templates/xamarin/src/Project.Client/Models/Model.cs.ejs rename to generators/xamarin/templates/src/Project.Client/Models/Entities/_dotnetEntityModel_.cs.ejs index c67b1fd2a..03bb820ab 100644 --- a/generators/entity-client/templates/xamarin/src/Project.Client/Models/Model.cs.ejs +++ b/generators/xamarin/templates/src/Project.Client/Models/Entities/_dotnetEntityModel_.cs.ejs @@ -40,7 +40,7 @@ public class <%= asModel(entityClassName) %> let required = false; const fieldValidate = fields[idx].fieldValidate; const fieldValidateRules = fields[idx].fieldValidateRules; - const fieldType = equivalentCSharpType(fields[idx].fieldType); + const fieldType = fields[idx].cSharpType; const fieldNamePascalized = fields[idx].fieldNamePascalized; if (fieldValidate === true) { if (fieldValidateRules.includes('required')) { diff --git a/generators/entity-client/templates/xamarin/src/Project.Client/Services/IEntityService.cs.ejs b/generators/xamarin/templates/src/Project.Client/Services/Entities/_entityClass_/I_entityClass_Service.cs.ejs similarity index 100% rename from generators/entity-client/templates/xamarin/src/Project.Client/Services/IEntityService.cs.ejs rename to generators/xamarin/templates/src/Project.Client/Services/Entities/_entityClass_/I_entityClass_Service.cs.ejs diff --git a/generators/entity-client/templates/xamarin/src/Project.Client/Services/EntityService.cs.ejs b/generators/xamarin/templates/src/Project.Client/Services/Entities/_entityClass_/_entityClass_Service.cs.ejs similarity index 100% rename from generators/entity-client/templates/xamarin/src/Project.Client/Services/EntityService.cs.ejs rename to generators/xamarin/templates/src/Project.Client/Services/Entities/_entityClass_/_entityClass_Service.cs.ejs diff --git a/generators/entity-client/templates/xamarin/src/Project.Client/ViewModels/EntityViewModel.cs.ejs b/generators/xamarin/templates/src/Project.Client/ViewModels/Entities/_entityClass_/_entityClass_ViewModel.cs.ejs similarity index 97% rename from generators/entity-client/templates/xamarin/src/Project.Client/ViewModels/EntityViewModel.cs.ejs rename to generators/xamarin/templates/src/Project.Client/ViewModels/Entities/_entityClass_/_entityClass_ViewModel.cs.ejs index 38732de62..9ea6d2b58 100644 --- a/generators/entity-client/templates/xamarin/src/Project.Client/ViewModels/EntityViewModel.cs.ejs +++ b/generators/xamarin/templates/src/Project.Client/ViewModels/Entities/_entityClass_/_entityClass_ViewModel.cs.ejs @@ -52,7 +52,7 @@ public class <%= entityClassName %>ViewModel : MvxViewModel private List<<%= asModel(entityClassName) %>> _listElement; <%_ for (idx in fields){ - const fieldType = equivalentCSharpType(fields[idx].fieldType); + const fieldType = fields[idx].cSharpType; const fieldNameCamelCased = fields[idx].fieldNameCamelCased; if (fields[idx].fieldIsEnum) { _%> public <%= fields[idx].fieldType %> _<%= fieldNameCamelCased %>; @@ -95,7 +95,7 @@ public class <%= entityClassName %>ViewModel : MvxViewModel } <%_ for (idx in fields) { - const fieldType = equivalentCSharpType(fields[idx].fieldType); + const fieldType = fields[idx].cSharpType; const fieldNamePascalized = fields[idx].fieldNamePascalized; const fieldNameCamelCased = fields[idx].fieldNameCamelCased; if (fields[idx].fieldIsEnum) { _%> diff --git a/generators/entity-client/templates/xamarin/src/Project.Client/Views/EntityView.xaml.cs.ejs b/generators/xamarin/templates/src/Project.Client/Views/Entities/_entityClass_/_entityClass_View.cs.ejs similarity index 100% rename from generators/entity-client/templates/xamarin/src/Project.Client/Views/EntityView.xaml.cs.ejs rename to generators/xamarin/templates/src/Project.Client/Views/Entities/_entityClass_/_entityClass_View.cs.ejs diff --git a/generators/entity-client/templates/xamarin/src/Project.Client/Views/EntityView.xaml.ejs b/generators/xamarin/templates/src/Project.Client/Views/Entities/_entityClass_/_entityClass_View.xaml.ejs similarity index 97% rename from generators/entity-client/templates/xamarin/src/Project.Client/Views/EntityView.xaml.ejs rename to generators/xamarin/templates/src/Project.Client/Views/Entities/_entityClass_/_entityClass_View.xaml.ejs index 814fd7e18..35192d9ab 100644 --- a/generators/entity-client/templates/xamarin/src/Project.Client/Views/EntityView.xaml.ejs +++ b/generators/xamarin/templates/src/Project.Client/Views/Entities/_entityClass_/_entityClass_View.xaml.ejs @@ -23,7 +23,7 @@ _%>