-
-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathgenerator.ts
More file actions
36 lines (33 loc) · 1.19 KB
/
generator.ts
File metadata and controls
36 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { join } from 'node:path';
import {
type GitHubMatrixOutput,
convertToGitHubMatrix,
getGithubOutputFile,
getGithubSamplesGroup,
setGithubTaskOutput,
} from 'generator-jhipster/ci';
import BaseCoreGenerator from 'generator-jhipster/generators/base-core';
export default class extends BaseCoreGenerator {
samplesFolder?: string;
samplesGroup?: string;
matrix?: GitHubMatrixOutput;
get [BaseCoreGenerator.WRITING]() {
return this.asAnyTaskGroup({
async buildMatrix() {
const { samplesGroup = 'samples' } = this;
const templatePath = this.templatePath('../../generate-sample/templates/');
const samplesFolder = this.samplesFolder ? join(templatePath, this.samplesFolder) : templatePath;
const { samples, warnings } = await getGithubSamplesGroup(samplesFolder, samplesGroup);
if (warnings.length > 0) {
this.log.info(warnings.join('\n'));
}
this.matrix = convertToGitHubMatrix(samples);
const githubOutputFile = getGithubOutputFile();
this.log.info('matrix', this.matrix);
if (githubOutputFile) {
setGithubTaskOutput('matrix', JSON.stringify(this.matrix));
}
},
});
}
}