(filePath: string, cwd?: string)
| 28 | } |
| 29 | |
| 30 | export function getRelativeFilePath(filePath: string, cwd?: string): string { |
| 31 | if (!cwd) return filePath; |
| 32 | |
| 33 | const normalizedFile = normalizeFilePathSlashes(filePath); |
| 34 | const normalizedCwd = normalizeFilePathSlashes(cwd).replace(/\/$/, ""); |
| 35 | if (normalizedFile.startsWith(normalizedCwd + "/")) { |
| 36 | return normalizedFile.slice(normalizedCwd.length + 1); |
| 37 | } |
| 38 | return filePath; |
| 39 | } |
| 40 | |
| 41 | export function joinFilePath(parent: string, child: string): string { |
| 42 | return `${normalizeFilePathSlashes(parent).replace(/\/$/, "")}/${child}`; |
no test coverage detected