Skip to content

Commit

Permalink
update generator-jhipster to v8.7.1 (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Sep 28, 2024
1 parent f486e2f commit c5024fa
Show file tree
Hide file tree
Showing 25 changed files with 3,350 additions and 4,062 deletions.
31 changes: 4 additions & 27 deletions .blueprint/generate-sample/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,17 @@ export default class extends BaseGenerator {
samplesFolder;

constructor(args, opts, features) {
super(args, opts, { ...features, jhipsterBootstrap: false });
}

get [BaseGenerator.INITIALIZING]() {
return this.asInitializingTaskGroup({
async parseCommand() {
await this.parseCurrentJHipsterCommand();
},
});
}

get [BaseGenerator.PROMPTING]() {
return this.asPromptingTaskGroup({
async askForSample() {
await this.promptCurrentJHipsterCommand();
},
});
}

get [BaseGenerator.LOADING]() {
return this.asLoadingTaskGroup({
async loadCommand() {
await this.loadCurrentJHipsterCommandConfig(this);
},
});
super(args, opts, { ...features, queueCommandTasks: true, jhipsterBootstrap: false });
}

get [BaseGenerator.WRITING]() {
return this.asWritingTaskGroup({
async copySample() {
const samplesFolder = `${this.samplesFolder ?? 'samples'}/`;
if (this.all) {
this.copyTemplate(`${this.samplesFolder}/*.jdl`, '');
this.copyTemplate(`${samplesFolder}*.jdl`, '');
} else {
this.copyTemplate(`${this.samplesFolder}/${this.sampleName}`, this.sampleName, { noGlob: true });
this.copyTemplate(`${samplesFolder}${this.sampleName}`, this.sampleName, { noGlob: true });
}
},
});
Expand Down
27 changes: 6 additions & 21 deletions .blueprint/github-build-matrix/generator.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { existsSync, appendFileSync } from 'node:fs';
import { appendFileSync, existsSync } from 'node:fs';
import os from 'node:os';
import BaseGenerator from 'generator-jhipster/generators/base';
import { getSamples } from '../generate-sample/get-samples.mjs';
Expand All @@ -8,32 +8,17 @@ export default class extends BaseGenerator {
samplesFolder;

constructor(args, opts, features) {
super(args, opts, { ...features, jhipsterBootstrap: false });
}

get [BaseGenerator.INITIALIZING]() {
return this.asInitializingTaskGroup({
async parseCommand() {
await this.parseCurrentJHipsterCommand();
},
});
}

get [BaseGenerator.LOADING]() {
return this.asLoadingTaskGroup({
async loadCommand() {
await this.loadCurrentJHipsterCommandConfig(this);
},
});
super(args, opts, { ...features, queueCommandTasks: true, jhipsterBootstrap: false });
}

get [BaseGenerator.WRITING]() {
return this.asWritingTaskGroup({
async buildMatrix() {
const samples = await getSamples(this.templatePath(`../../generate-sample/templates/${this.samplesFolder}`));
const matrix = buildMatrix({ samples, samplesFolder: this.samplesFolder });
const samplesFolder = this.samplesFolder ?? 'samples';
const samples = await getSamples(this.templatePath(`../../generate-sample/templates/${samplesFolder}`));
const matrix = buildMatrix({ samples, samplesFolder });
const matrixoutput = `matrix<<EOF${os.EOL}${JSON.stringify(matrix)}${os.EOL}EOF${os.EOL}`;
const filePath = process.env['GITHUB_OUTPUT'];
const filePath = process.env.GITHUB_OUTPUT;
console.log(matrixoutput);
if (filePath && existsSync(filePath)) {
appendFileSync(filePath, matrixoutput, { encoding: 'utf8' });
Expand Down
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ionic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
working-directory: ${{ github.workspace }}/generator-jhipster-ionic
- name: Check Version
run: $JHIPSTER_INSTALL/02-checkVersion.sh
- run: cli.cjs generate-sample ${{ matrix.jdl }} --force --no-insight --skip-checks --skip-install --skip-jhipster-dependencies
- run: cli.cjs generate-sample ${{ matrix.jdl }} --skip-jhipster-dependencies
- uses: jhipster/actions/compare-sample@v0
id: compare-backend
if: >-
Expand All @@ -86,7 +86,7 @@ jobs:
application-folder: backend
compare-folder: backend
generator-path: generator-jhipster-ionic
cmd: cli.cjs generate-sample ${{ matrix.jdl }} --force --no-insight --skip-checks --skip-git --skip-install --skip-jhipster-dependencies
cmd: cli.cjs generate-sample ${{ matrix.jdl }} --skip-git --skip-jhipster-dependencies --skip-install
- uses: jhipster/actions/compare-sample@v0
id: compare
if: >-
Expand All @@ -97,7 +97,7 @@ jobs:
application-folder: backend
compare-folder: ionic4j
generator-path: generator-jhipster-ionic
cmd: cli.cjs generate-sample ${{ matrix.jdl }} --force --no-insight --skip-checks --skip-git --skip-install --skip-jhipster-dependencies
cmd: cli.cjs generate-sample ${{ matrix.jdl }} --skip-git --skip-jhipster-dependencies --skip-install
- name: Ionic tests
run: cat package.json; npm install; npm test
working-directory: ${{ github.workspace }}/ionic4j
Expand Down
7 changes: 3 additions & 4 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Prettier configuration

printWidth: 140
singleQuote: true
tabWidth: 2
useTabs: false

# js and ts rules:
arrowParens: avoid
bracketSameLine: false
plugins:
- prettier-plugin-packagejson
8 changes: 5 additions & 3 deletions .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,22 @@
"sbs": false,
"written": true
},
"server": {
"spring-boot": {
"command": false,
"priorities": ["writing", "postWriting"],
"sbs": true,
"written": true
}
},
"githubWorkflows": true,
"jhipsterVersion": "7.8.1",
"jhipsterVersion": "8.7.1",
"js": false,
"localBlueprint": false,
"packageJsonType": "module",
"prettierDefaultIndent": 2,
"projectName": "JHipster Ionic Blueprint",
"sampleWritten": true,
"skipCommitHook": true,
"subGenerators": ["app", "ionic", "project-name", "server"]
"subGenerators": ["app", "ionic", "project-name", "spring-boot"]
}
}
2 changes: 0 additions & 2 deletions .yo-resolve
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.github/workflows/** skip
generators/** skip
README.md skip
4 changes: 4 additions & 0 deletions cli/cli-customizations.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This file will not be overwritten by generate-blueprint
module.exports = {
defaultCommand: 'ionic',
};
3 changes: 2 additions & 1 deletion cli/cli.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const blueprint = packageFolderName.startsWith('jhipster-') ? `generator-${packa
runJHipster({
executableName,
executableVersion: version,
defaultCommand: 'ionic',
defaultCommand: 'app',
devBlueprintPath,
blueprints: {
[blueprint]: version,
Expand All @@ -27,6 +27,7 @@ const blueprint = packageFolderName.startsWith('jhipster-') ? `generator-${packa
console.log('');
},
lookups: [{ packagePaths: [packagePath] }],
...require('./cli-customizations.cjs'),
}).catch(done);

process.on('unhandledRejection', up => {
Expand Down
14 changes: 10 additions & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import globals from 'globals';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import jhipsterRecommended from 'generator-jhipster/eslint/recommended';
import prettier from 'eslint-plugin-prettier/recommended';
import jhipster from 'generator-jhipster/eslint/recommended';

// Workaround for jhipster export issue.
delete jhipster.recommended.recommended;
// jhipster-needle-eslint-add-import - JHipster will add additional import here

export default [
{
Expand All @@ -10,6 +14,8 @@ export default [
},
},
},
jhipsterRecommended,
prettierRecommended,
{ ignores: ['coverage/**'] },
jhipster.recommended,
// jhipster-needle-eslint-add-config - JHipster will add additional config here
prettier,
];
11 changes: 4 additions & 7 deletions generators/app/command.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/**
* @type {import('generator-jhipster').JHipsterCommandDefinition}
*/
const command = {
import { asCommand } from 'generator-jhipster';

export default asCommand({
options: {
ionicDir: {
desc: 'Directory of JHipster application',
type: String,
scope: 'blueprint',
},
},
};

export default command;
});
4 changes: 2 additions & 2 deletions generators/app/generator.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('SubGenerator app of ionic JHipster blueprint', () => {
})
.withOptions({
ignoreNeedlesError: true,
blueprint: 'ionic',
blueprint: ['ionic'],
})
.withJHipsterLookup()
.withParentBlueprintLookup();
Expand All @@ -40,7 +40,7 @@ describe('SubGenerator app of ionic JHipster blueprint', () => {
.withOptions({
skipChecks: true,
ignoreNeedlesError: true,
blueprint: 'ionic',
blueprint: ['ionic'],
ionicDir: '../ionic-app',
})
.withJHipsterLookup()
Expand Down
1 change: 1 addition & 0 deletions generators/app/index.mjs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default } from './generator.mjs';
export { default as command } from './command.mjs';
11 changes: 4 additions & 7 deletions generators/ionic/command.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* @type {import('generator-jhipster').JHipsterCommandDefinition}
*/
const command = {
import { asCommand } from 'generator-jhipster';

export default asCommand({
options: {
skipCommitHook: {
desc: 'Skip adding husky commit hooks',
Expand Down Expand Up @@ -29,6 +28,4 @@ const command = {
type: Boolean,
},
},
};

export default command;
});
19 changes: 8 additions & 11 deletions generators/ionic/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@ export default class extends BaseApplicationGenerator {
});
}

get [BaseApplicationGenerator.PREPARING]() {
return this.asPreparingTaskGroup({
husky({ application }) {
application.nodeDependencies.husky = '9.0.11';
application.nodeDependencies['lint-staged'] = '15.2.5';
},
});
}

get [BaseApplicationGenerator.WRITING]() {
return this.asWritingTaskGroup({
async writingTemplateTask({ application }) {
Expand Down Expand Up @@ -197,6 +188,12 @@ export default class extends BaseApplicationGenerator {

get [BaseApplicationGenerator.POST_WRITING]() {
return this.asPostWritingTaskGroup({
ignoreEslint9ConfigFile({ application }) {
const eslintConfigFile = this.env.sharedFs.get(this.destinationPath(application.eslintConfigFile));
if (eslintConfigFile) {
delete eslintConfigFile.state;
}
},
customizePackageJson({ application }) {
const { baseName } = this.jhipsterConfig;
this.packageJson.merge({
Expand Down Expand Up @@ -235,9 +232,9 @@ export default class extends BaseApplicationGenerator {
async install() {
try {
if (this.env.sharedFs.get(this.destinationPath('package.json'))?.committed) {
await this.spawnCommand('npm', ['install']);
await this.spawnCommand('npm install');
}
} catch (error) {
} catch {
this.log.error(`Error executing 'npm install', execute by yourself.`);
}
},
Expand Down
4 changes: 2 additions & 2 deletions generators/ionic/generator.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('SubGenerator ionic of ionic JHipster blueprint', () => {
.run(SUB_GENERATOR_NAMESPACE)
.withJHipsterConfig()
.withOptions({
blueprint: 'ionic',
blueprint: ['ionic'],
appDir: false,
baseName: 'jhipster',
ignoreNeedlesError: true,
Expand All @@ -42,7 +42,7 @@ describe('SubGenerator ionic of ionic JHipster blueprint', () => {
.run(SUB_GENERATOR_NAMESPACE)
.withJHipsterConfig()
.withOptions({
blueprint: 'ionic',
blueprint: ['ionic'],
appDir: false,
baseName: 'jhipster',
authenticationType: 'oauth2',
Expand Down
11 changes: 4 additions & 7 deletions generators/project-name/command.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/**
* @type {import('generator-jhipster').JHipsterCommandDefinition}
*/
const command = {
options: {},
};
import { asCommand } from 'generator-jhipster';

export default command;
export default asCommand({
options: {},
});
2 changes: 1 addition & 1 deletion generators/project-name/generator.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('SubGenerator project-name of ionic JHipster blueprint', () => {
.withJHipsterConfig()
.withOptions({
ignoreNeedlesError: true,
blueprint: 'ionic',
blueprint: ['ionic'],
})
.withJHipsterLookup()
.withParentBlueprintLookup();
Expand Down
5 changes: 5 additions & 0 deletions generators/spring-boot/command.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { asCommand } from 'generator-jhipster';

export default asCommand({
configs: {},
});
2 changes: 1 addition & 1 deletion generators/spring-boot/generator.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('SubGenerator spring-boot of ionic JHipster blueprint', () => {
.withJHipsterConfig()
.withOptions({
ignoreNeedlesError: true,
blueprint: 'ionic',
blueprint: ['ionic'],
})
.withJHipsterLookup()
.withParentBlueprintLookup();
Expand Down
1 change: 1 addition & 0 deletions generators/spring-boot/index.mjs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default } from './generator.mjs';
export { default as command } from './command.mjs';
Loading

0 comments on commit c5024fa

Please sign in to comment.