-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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 #26078 from mshima/version-check
Updates to generated blueprint.
- Loading branch information
Showing
14 changed files
with
154 additions
and
40 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
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
22 changes: 22 additions & 0 deletions
22
generators/generate-blueprint/templates/.blueprint/github-build-matrix/build-matrix.mjs.ejs
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,22 @@ | ||
import { readdir } from 'fs/promises'; | ||
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 = async samplesFolder => { | ||
const samples = await readdir(samplesFolder); | ||
return { | ||
include: Object.values( | ||
fromMatrix({ | ||
...defaultMatrix, | ||
'sample-name': samples.filter(sample => !sample.includes('disabled')), | ||
}), | ||
), | ||
}; | ||
}; |
24 changes: 24 additions & 0 deletions
24
generators/generate-blueprint/templates/.blueprint/github-build-matrix/generator.mjs.ejs
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 { existsSync, appendFileSync } from 'node:fs'; | ||
import os from 'node:os'; | ||
import BaseGenerator from 'generator-jhipster/generators/base'; | ||
import { buildMatrix } from './build-matrix.mjs'; | ||
|
||
export default class extends BaseGenerator { | ||
constructor(args, opts, features) { | ||
super(args, opts, { ...features, jhipsterBootstrap: false }); | ||
} | ||
|
||
get [BaseGenerator.WRITING]() { | ||
return this.asWritingTaskGroup({ | ||
async buildMatrix() { | ||
const matrix = await buildMatrix(this.templatePath('../../generate-sample/templates/samples')); | ||
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' }); | ||
} | ||
}, | ||
}); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
generators/generate-blueprint/templates/.blueprint/github-build-matrix/index.mjs.ejs
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 @@ | ||
export { default } from './generator.mjs'; |
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