Skip to content

Commit 13ec2ff

Browse files
authored
Upgrade to JHipster 8 (jhipster#1358)
* add yo-rc.json * start migrating * rename generator files * add index.js * new generators * add tests * move server to dotnetcore * apply prettier * rework cypress * fix generator name * migrate blazor client * start migrating xamarin * fixes to xamarin * fixes to blazor * drop files-angular * comment common * cleanup dotnet.js * add bootstrap-dotnetcore * add angular snapshot * add cypress snapshot * add common snapshot * add dotnetcore test * add common snapshot * add server generator * compose bootstrap-dotnetcore with bootstrap-application * add snapshots * implement dotnetcore generator * ci adjusts * fix git command * move samples to generate-samples * samples adjusts * ci script adjust * move entity preparation to bootstrap-dotnetcore * drop entities-client generator * drop entity-i18n generator * drop languages generator * extract logo * add pluralize dependency * bootstrap-dotnetcore improvements * adjusts * add other side relationship * update jhipster branch * bootstrap and test adjusts * update jhipster branch * mock commands at tests. * fix path * improve script check * update jhipster branch * run generate-sample with entities * drop entity-server generator * dotnetcore adjusts * adjusts * Update generator.js * adjusts * continue on client error * fixes * adjusts * add dotnetcore configs * drop app generator * import dotnetcore config in server * add namespace config fallback * drop angular generator * fix * update snapshot * improve common * fix Directory.Packages.props * more adjusts * update jhipster branch * adjusts to client generator * disable readme * update jhipster branch * update snapshots * adjusts * adjusts * migrate entities-client to blazor * migrate entity-client to xamarin * adjusts. * drop sample tests * migrate terraform test * migrate dto tests. * migrate enum test * migrate service test * disable tests. * add blazor with dto test * extract docker generator * update jhipster branch * docker adjusts * replace docker-compose with docker compose * change client root * e2e adjusts * readd gateway insertion * print docker logs * update snapshots * change clientDistDir * disable docker healthcheck * use 5000 port * drop joschi/setup-jdk * load prodDatabaseType * reorganize blazor templates * add configOnly option to generate sample * move needle implementations * convert blazor needles * migrate xamarin needles * more adjusts * skip some cypress tests * Update generator.js * Update files.json * adjusts to docker * update snapshots * mssql container adjusts * replace postgres value with postgresql * migrate dotnetcore prompts * drop client prompts.js * drop needle server gateway * cleanup * database connection adjusts * revert * workflow adjusts * cleanup * client test adjusts * add devcontainer * cleanup * devcontainer * dev container * readd healthcheck * drop mssql docker compose file * drop eslintignore customization * drop clientAppRootDir * update jhipster branch * change temporaryDir * update jhipster branch * fix template * update jhipster branch * update jhipster branch * drop angular from .yo-rc * cleanups and lint fixes * disable healthcheck * update jhipster branch * xamarin adjusts * cleanup * add npm test script to root * update jhipster branch * use npm test * fix error * update jhipster branch * update snapshot * Update files-xamarin.js * enable client errors at jwt workflow * update jhipster branch * add app-react entities sample * update snapshot * remove clientFramework from microservice sample * remove one-to-one relationships * add cypress screenshots * convert readme to jhi file * workaround pagination bug * update os and actions/checkout * update jhipster branch
1 parent d568c68 commit 13ec2ff

File tree

626 files changed

+17541
-34182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

626 files changed

+17541
-34182
lines changed

generators/client/files-vue.js renamed to .blueprint/cli/commands.mjs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* you may not use this file except in compliance with the License.
99
* You may obtain a copy of the License at
1010
*
11-
* http://www.apache.org/licenses/LICENSE-2.0
11+
* https://www.apache.org/licenses/LICENSE-2.0
1212
*
1313
* Unless required by applicable law or agreed to in writing, software
1414
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,20 +17,11 @@
1717
* limitations under the License.
1818
*/
1919

20-
const constants = require('../generator-dotnetcore-constants.cjs');
21-
22-
/* Constants use throughout */
23-
const SERVER_SRC_DIR = constants.SERVER_SRC_DIR;
24-
25-
26-
function updateHomeTitle() {
27-
this.replaceContent(`${SERVER_SRC_DIR}${this.mainClientAppDir}/app/core/home/home.vue`, 'Java', '.Net Core', false);
28-
}
29-
30-
function writeFiles() {
31-
updateHomeTitle.call(this);
32-
}
33-
34-
module.exports = {
35-
writeFiles,
20+
const defaultCommands = {
21+
'generate-sample': {
22+
desc: 'Generate a test sample',
23+
blueprint: '@jhipster/jhipster-dev',
24+
},
3625
};
26+
27+
export default defaultCommands;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Copyright 2013-2023 the original author or authors from the JHipster project.
3+
*
4+
* This file is part of the JHipster project, see https://www.jhipster.tech/
5+
* for more information.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* https://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
import { GENERATOR_APP } from 'generator-jhipster/generators';
20+
/**
21+
* @type {import('generator-jhipster').JHipsterCommandDefinition}
22+
*/
23+
const command = {
24+
arguments: {
25+
sampleName: {
26+
type: String,
27+
},
28+
},
29+
options: {
30+
withEntities: {
31+
type: Boolean,
32+
scope: 'generator',
33+
},
34+
configOnly: {
35+
type: Boolean,
36+
scope: 'generator',
37+
},
38+
},
39+
import: [GENERATOR_APP],
40+
};
41+
42+
export default command;
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import { readdir, stat } from 'node:fs/promises';
2+
import BaseGenerator from 'generator-jhipster/generators/base';
3+
import command from './command.mjs';
4+
import { statSync } from 'node:fs';
5+
6+
export default class extends BaseGenerator {
7+
sampleName;
8+
jdlSample;
9+
withEntities;
10+
configOnly;
11+
12+
get [BaseGenerator.INITIALIZING]() {
13+
return this.asInitializingTaskGroup({
14+
async initializeOptions() {
15+
this.parseJHipsterCommand(command);
16+
},
17+
});
18+
}
19+
20+
get [BaseGenerator.PROMPTING]() {
21+
return this.asPromptingTaskGroup({
22+
async askForSample() {
23+
if (!this.sampleName) {
24+
const answers = await this.prompt({
25+
type: 'list',
26+
name: 'sampleName',
27+
message: 'which sample do you want to generate?',
28+
choices: async () => readdir(this.templatePath('samples')),
29+
});
30+
this.sampleName = answers.sampleName;
31+
}
32+
},
33+
});
34+
}
35+
36+
get [BaseGenerator.WRITING]() {
37+
return this.asWritingTaskGroup({
38+
async copySample() {
39+
let isDir = false;
40+
let jdlFile = false;
41+
try {
42+
const pathStat = await stat(this.templatePath(`samples/${this.sampleName}`));
43+
isDir = pathStat.isDirectory();
44+
jdlFile = pathStat.isFile();
45+
} catch (error) {
46+
try {
47+
this.sampleName += '.jdl';
48+
jdlFile = (await stat(this.templatePath(`samples/${this.sampleName}`))).isFile();
49+
} catch {
50+
throw error;
51+
}
52+
}
53+
54+
if (jdlFile) {
55+
this.jdlSample = this.sampleName;
56+
this.copyTemplate(`samples/${this.sampleName}`, this.sampleName, { noGlob: true });
57+
} else if (isDir) {
58+
this.copyTemplate(`samples/${this.sampleName}/.yo-rc.json`, '.yo-rc.json', { noGlob: true });
59+
} else {
60+
throw new Error(`Sample ${this.sampleName} was not identified`);
61+
}
62+
},
63+
async jdlEntities() {
64+
if (this.withEntities) {
65+
if (this.sampleName.includes('-mongo-')) {
66+
this.jdlSample = 'app_mongo.jdl';
67+
} else if (this.sampleName.includes('-react-')) {
68+
this.jdlSample = 'app-react.jdl';
69+
} else {
70+
this.jdlSample = 'app.jdl';
71+
}
72+
this.copyTemplate(`samples/jdl-default/${this.jdlSample}`, this.jdlSample, { noGlob: true });
73+
}
74+
},
75+
});
76+
}
77+
78+
get [BaseGenerator.END]() {
79+
return this.asEndTaskGroup({
80+
async generateSample() {
81+
if (this.jdlSample && !this.configOnly) {
82+
await this.composeWithJHipster('jdl', {
83+
generatorArgs: [this.jdlSample],
84+
generatorOptions: {
85+
jsonOnly: true,
86+
},
87+
});
88+
}
89+
},
90+
async generateApp() {
91+
if (this.configOnly) {
92+
return;
93+
}
94+
95+
await this.composeWithJHipster('app', {
96+
generatorOptions: {
97+
skipJhipsterDependencies: true,
98+
insight: false,
99+
skipChecks: true,
100+
skipInstall: true,
101+
},
102+
});
103+
},
104+
async jhipsterInfo() {
105+
await this.composeWithJHipster('info');
106+
},
107+
});
108+
}
109+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default } from './generator.mjs';
2+
export { default as command } from './command.mjs';

test-integration/samples/gateway-app/.yo-rc.json renamed to .blueprint/generate-sample/templates/samples/gateway-app/.yo-rc.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,9 @@
1919
"jhiPrefix": "jhi",
2020
"entitySuffix": "",
2121
"dtoSuffix": "DTO",
22-
"otherModules": [
23-
{
24-
"name": "generator-jhipster-dotnetcore",
25-
"version": "3.9.1"
26-
}
27-
],
2822
"blueprints": [
2923
{
30-
"name": "generator-jhipster-dotnetcore",
31-
"version": "2.0.0"
24+
"name": "generator-jhipster-dotnetcore"
3225
}
3326
]
3427
},
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
entity Region {
2+
regionName String
3+
}
4+
5+
entity Country {
6+
countryName String
7+
}
8+
9+
// an ignored comment
10+
/** not an ignored comment */
11+
entity Location {
12+
streetAddress String,
13+
postalCode String,
14+
city String,
15+
stateProvince String
16+
}
17+
18+
entity Department {
19+
departmentName String required
20+
}
21+
22+
/**
23+
* PieceOfWork entity.
24+
* @author The JHipster team.
25+
*/
26+
entity PieceOfWork {
27+
title String,
28+
description String
29+
}
30+
31+
/**
32+
* The Employee entity.
33+
*/
34+
entity Employee {
35+
/**
36+
* The firstname attribute.
37+
*/
38+
firstName String,
39+
lastName String,
40+
email String,
41+
phoneNumber String,
42+
hireDate Instant,
43+
salary Long,
44+
commissionPct Long
45+
}
46+
47+
entity Job {
48+
jobTitle String,
49+
minSalary Long,
50+
maxSalary Long
51+
}
52+
53+
entity JobHistory {
54+
startDate Instant,
55+
endDate Instant,
56+
language Language
57+
}
58+
59+
enum Language {
60+
FRENCH, ENGLISH, SPANISH
61+
}
62+
63+
64+
65+
relationship OneToOne {
66+
Country{region} to Region
67+
}
68+
69+
relationship OneToOne {
70+
Location{country} to Country
71+
}
72+
73+
relationship OneToOne {
74+
Department{location} to Location
75+
}
76+
77+
// defining multiple OneToMany relationships with comments
78+
relationship OneToMany {
79+
Employee to Job{employee},
80+
/**
81+
* A relationship
82+
*/
83+
Department to
84+
/**
85+
* Another side of the same relationship
86+
*/
87+
Employee{department}
88+
}
89+
90+
relationship ManyToOne {
91+
Employee{manager} to Employee
92+
}
93+
94+
// defining multiple oneToOne relationships
95+
relationship OneToOne {
96+
JobHistory{job} to Job,
97+
JobHistory{department} to Department,
98+
JobHistory{employee} to Employee
99+
}
100+
101+
relationship ManyToMany {
102+
Job{chore(title)} to PieceOfWork{job}
103+
}
104+
105+
// Set pagination options
106+
// .Net does not generates link header for pagination.
107+
// paginate JobHistory, Employee with infinite-scroll
108+
// paginate Job with pagination
109+
110+
// Use Data Transfert Objects (DTO)
111+
dto * with mapstruct
112+
113+
// Set service options to all except few
114+
service all with serviceImpl except Employee, Job
115+
116+
// Set an angular suffix
117+
// angularSuffix * with mySuffix

0 commit comments

Comments
 (0)