generator-begcode
Version:
Spring Boot + Angular/React/Vue in one handy generator
48 lines (47 loc) • 1.89 kB
JavaScript
import { MatrixMonolith, MatrixMicroservice, MatrixGateway } from './application-samples.js';
import { fromMatrix, extendMatrix, extendFilteredMatrix, buildSamplesFromMatrix } from './matrix-utils.js';
export const buildServerMatrix = (matrix = {}) => {
let serverMatrix = {
...fromMatrix({
...MatrixMonolith,
...matrix,
reactive: [false, true],
}),
...fromMatrix({
...MatrixMicroservice,
...matrix,
reactive: [false, true],
}),
...fromMatrix({
...MatrixGateway,
...matrix,
}),
};
serverMatrix = extendMatrix(serverMatrix, {
buildTool: ['maven', 'gradle'],
enableTranslation: [false, true],
packageName: ['tech.jhipster', 'com.mycompany'],
jhiPrefix: ['jhi', 'fix'],
entitySuffix: ['Entity', ''],
dtoSuffix: ['DTO', 'Rest'],
skipCommitHook: [false, true],
testFrameworks: [[], ['gatling'], ['cucumber']],
serverSideOptions: [[], ['enableSwaggerCodegen:true']],
});
serverMatrix = extendFilteredMatrix(serverMatrix, sample => !sample.reactive, {
websocket: [false, true],
});
serverMatrix = extendFilteredMatrix(serverMatrix, sample => sample.authenticationType !== 'oauth2', {
skipUserManagement: [false, true],
});
serverMatrix = extendFilteredMatrix(serverMatrix, sample => sample.authenticationType === 'session', {
serviceDiscoveryType: ['no', 'consul'],
});
serverMatrix = extendFilteredMatrix(serverMatrix, sample => sample.authenticationType !== 'session', {
serviceDiscoveryType: ['no', 'consul', 'eureka'],
});
return serverMatrix;
};
export const buildServerSamples = (commonConfig, matrix) => {
return buildSamplesFromMatrix(buildServerMatrix(matrix), { commonConfig });
};