-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from jhipster/generator-jhipster-8.6.0
Update generator-jhipster to 8.6.0
- Loading branch information
Showing
15 changed files
with
1,087 additions
and
833 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { readdir, stat } from 'node:fs/promises'; | ||
import { extname } from 'path'; | ||
|
||
export const getSamples = async samplesFolder => { | ||
const filenames = await readdir(samplesFolder); | ||
const entries = await Promise.all(filenames.map(async filename => [filename, await stat(`${samplesFolder}/${filename}`)])); | ||
return entries | ||
.filter(([filename, statResult]) => extname(filename) === '.jdl' || statResult.isDirectory()) | ||
.map(([filename]) => filename) | ||
.filter(filename => !filename.includes('disabled')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { RECOMMENDED_JAVA_VERSION, RECOMMENDED_NODE_VERSION } from 'generator-jhipster'; | ||
import { fromMatrix } from 'generator-jhipster/testing'; | ||
|
||
const defaultMatrix = { | ||
os: ['ubuntu-latest'], | ||
'node-version': [RECOMMENDED_NODE_VERSION], | ||
'java-version': [RECOMMENDED_JAVA_VERSION], | ||
'default-environment': ['prod'], | ||
}; | ||
|
||
export const buildMatrix = ({ samples, samplesFolder }) => { | ||
return { | ||
include: Object.values( | ||
fromMatrix({ | ||
...defaultMatrix, | ||
'sample-name': samples, | ||
}), | ||
).map(sample => ({ | ||
...sample, | ||
'job-name': sample['sample-name'], | ||
'extra-args': `--samples-folder ${samplesFolder}`, | ||
})), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @type {import('generator-jhipster').JHipsterCommandDefinition} | ||
*/ | ||
const command = { | ||
configs: { | ||
samplesFolder: { | ||
description: 'Samples folder', | ||
cli: { | ||
type: String, | ||
}, | ||
default: 'samples', | ||
scope: 'generator', | ||
}, | ||
}, | ||
options: {}, | ||
}; | ||
|
||
export default command; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { existsSync, appendFileSync } from 'node:fs'; | ||
import os from 'node:os'; | ||
import BaseGenerator from 'generator-jhipster/generators/base'; | ||
import { getSamples } from '../generate-sample/get-samples.mjs'; | ||
import { buildMatrix } from './build-matrix.mjs'; | ||
|
||
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); | ||
}, | ||
}); | ||
} | ||
|
||
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 matrixoutput = `matrix<<EOF${os.EOL}${JSON.stringify(matrix)}${os.EOL}EOF${os.EOL}`; | ||
const filePath = process.env['GITHUB_OUTPUT']; | ||
console.log(matrixoutput); | ||
if (filePath && existsSync(filePath)) { | ||
appendFileSync(filePath, matrixoutput, { encoding: 'utf8' }); | ||
} | ||
}, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ package-lock.json | |
.git | ||
|
||
# blueprint rules: | ||
**/templates/**/ | ||
generators/**/templates/**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import globals from 'globals'; | ||
import prettierRecommended from 'eslint-plugin-prettier/recommended'; | ||
import jhipsterRecommended from 'generator-jhipster/eslint/recommended'; | ||
|
||
export default [ | ||
{ | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
jhipsterRecommended, | ||
prettierRecommended, | ||
]; |
Oops, something went wrong.