(name: string)
| 36 | * name like `feature/Foo_Bar` becomes `feature-foo-bar`. |
| 37 | */ |
| 38 | export function sanitizeSnapshotName(name: string): string { |
| 39 | const cleaned = name |
| 40 | .trim() |
| 41 | .toLowerCase() |
| 42 | .replace(/[^a-z0-9]+/g, '-') |
| 43 | .replace(/^-+|-+$/g, ''); |
| 44 | if (!cleaned) { |
| 45 | throw new Error(`Invalid snapshot name "${name}" — must contain at least one alphanumeric character.`); |
| 46 | } |
| 47 | return cleaned; |
| 48 | } |
| 49 | |
| 50 | /** Short (7-char) HEAD sha, or null outside a git repo */ |
| 51 | function shortHeadSha(rootDir: string): string | null { |
no outgoing calls
no test coverage detected
searching dependent graphs…