generator-begcode
Version:
Spring Boot + Angular/React/Vue in one handy generator
29 lines (28 loc) • 955 B
JavaScript
export const javaScopeToGradleScope = (artifactType) => {
const { scope = 'compile', type = 'jar' } = artifactType;
if (type === 'pom') {
if (scope === 'import') {
return 'implementation platform';
}
throw new Error(`Unsupported scope for POM artifact: ${scope}`);
}
if (type === 'jar') {
switch (scope) {
case 'compile':
return 'implementation';
case 'provided':
return 'compileOnly';
case 'runtime':
return 'runtimeOnly';
case 'test':
return 'testImplementation';
case 'system':
return 'system';
case 'annotationProcessor':
return 'annotationProcessor';
default:
throw new Error(`Unsupported scope for JAR artifact: ${scope}`);
}
}
throw new Error(`Unsupported type: ${type}`);
};