gen-jhipster
Version:
VHipster - Spring Boot + Angular/React/Vue in one handy generator
37 lines (36 loc) • 2.04 kB
JavaScript
import { LOGIN_REGEX, MAIN_DIR, TEST_DIR } from "../generator-constants.js";
export const mutateApplication = {
__override__: false,
srcMain: MAIN_DIR,
srcTest: TEST_DIR,
loginRegex: LOGIN_REGEX,
backendType: 'Java',
backendTypeSpringBoot: ({ backendType }) => backendType === 'Java',
backendTypeJavaAny: ({ backendTypeSpringBoot }) => backendTypeSpringBoot,
temporaryDir: ({ backendType, buildTool }) => {
if (['Java'].includes(backendType)) {
return buildTool === 'gradle' ? 'build/' : 'target/';
}
return 'temp/';
},
clientDistDir: ({ backendType, temporaryDir, buildTool }) => {
if (['Java'].includes(backendType)) {
return `${temporaryDir}${buildTool === 'gradle' ? 'resources/main/' : 'classes/'}static/`;
}
return 'dist/';
},
authenticationTypeSession: data => data.authenticationType === 'session',
authenticationTypeJwt: data => data.authenticationType === 'jwt',
authenticationTypeOauth2: data => data.authenticationType === 'oauth2',
authenticationUsesCsrf: ({ authenticationType }) => ['oauth2', 'session'].includes(authenticationType),
endpointPrefix: ({ applicationType, lowercaseBaseName }) => (applicationType === 'microservice' ? `services/${lowercaseBaseName}` : ''),
devServerPort: 9060,
serverPort: ({ applicationTypeMicroservice }) => (applicationTypeMicroservice ? 8081 : 8080),
generateInMemoryUserCredentials: data => data.generateAuthenticationApi && data.skipUserManagement && !data.authenticationTypeUsesRemoteAuthorization,
defaultAdminUsername: 'admin',
defaultAdminPassword: 'admin',
defaultAdminRoles: ['ADMIN', 'USER'],
defaultUserUsername: data => (data.generateInMemoryUserCredentials ? data.defaultAdminUsername : 'user'),
defaultUserPassword: data => (data.generateInMemoryUserCredentials ? data.defaultAdminPassword : 'user'),
defaultUserRoles: data => (data.generateInMemoryUserCredentials ? data.defaultAdminRoles : ['USER']),
};