Skip to content

Commit

Permalink
Upgrade to JHipster 8 (#1358)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mshima authored Oct 7, 2023
1 parent d568c68 commit 13ec2ff
Show file tree
Hide file tree
Showing 626 changed files with 17,541 additions and 34,182 deletions.
25 changes: 8 additions & 17 deletions generators/client/files-vue.js → .blueprint/cli/commands.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
42 changes: 42 additions & 0 deletions .blueprint/generate-sample/command.mjs
Original file line number Diff line number Diff line change
@@ -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;
109 changes: 109 additions & 0 deletions .blueprint/generate-sample/generator.mjs
Original file line number Diff line number Diff line change
@@ -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');
},
});
}
}
2 changes: 2 additions & 0 deletions .blueprint/generate-sample/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './generator.mjs';
export { default as command } from './command.mjs';
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
},
Expand Down
117 changes: 117 additions & 0 deletions .blueprint/generate-sample/templates/samples/jdl-default/app-react.jdl
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
},
Expand Down
Loading

0 comments on commit 13ec2ff

Please sign in to comment.