feat: configurable filename separator for split command (#610)

* Make file path separator configurable in split command

* chore: add tests for the file name separator

* chore: update snapshots

* docs: split separator option description

* chore: code style fixes
This commit is contained in:
volodymyr-rutskyi
2022-03-28 18:44:43 +03:00
committed by GitHub
parent 3e8b08449d
commit 1f10c7cd77
9 changed files with 54 additions and 15 deletions

View File

@@ -66,12 +66,12 @@ export function printExecutionTime(commandName: string, startedAt: number, entry
process.stderr.write(gray(`\n${entrypoint}: ${commandName} processed in ${elapsed}\n\n`));
}
export function pathToFilename(path: string) {
export function pathToFilename(path: string, pathSeparator: string) {
return path
.replace(/~1/g, '/')
.replace(/~0/g, '~')
.replace(/^\//, '')
.replace(/\//g, '@');
.replace(/\//g, pathSeparator);
}
export class CircularJSONNotSupportedError extends Error {