export async function createApplicationProperties()

in karavan-vscode/src/utils.ts [327:348]


export async function createApplicationProperties(runtime: string, gav: string, target: string) {
    if (workspace.workspaceFolders) {
        const uriFolder: Uri = workspace.workspaceFolders[0].uri;
        const name = currentFolderName() || "";

        const runtimePrefix = runtime.replaceAll("-", "");
        const appPropertyName = "Karavan.".concat(runtimePrefix).concat("ApplicationProperties");
        const targetPropertyName = "Karavan.".concat(runtimePrefix).concat(capitalize(target)).concat("Properties");

        const props: string[] = workspace.getConfiguration().get(appPropertyName) || [];
        const runtimeProps: string[] = workspace.getConfiguration().get(targetPropertyName) || [];

        const text = props.concat(runtimeProps).map(v => {
            if (v.includes('$NAME')) return v.replace('$NAME', name)
            else if (v.includes('$GAV')) return v.replace('$GAV', gav)
            else if (v.includes('$RUNTIME')) return v.replace('$RUNTIME', runtime)
            else if (v.includes('$TARGET')) return v.replace('$TARGET', target)
            else return v;
        }).join('\n');
        write(path.join(uriFolder.path, "application.properties"), text);
    }
}