INNER CODE UNIT · TypeScript
getChartBasePath
tim-koehler/Helm-Intellisense · src/utils.ts:187
export function getChartBasePath(fileName: string): string | undefined {
if (!fs.statSync(fileName).isFile()) {
return undefined;
}
let possiblePathToChartDirectory = path.dirname(fileName);
const dirs = ['templates', 'charts', 'crds'];
for (const dir of dirs) {
const lastIndexOf = possiblePathToChartDirectory.lastIndexOf(path.sep + dir);
if (lastIndexOf !== -1) {
possiblePathToChartDirectory = possiblePathToChartDirectory.substr(0, lastIndexOf);
break;
}
}
const currentFilesInDir = fs.readdirSync(possiblePathToChartDirectory);
if (!currentFilesInDir.includes('Chart.yaml')) {
return undefined;