(path: string, content: string | AssetProxy, tree: RepoTree)
| 68 | } |
| 69 | |
| 70 | function writeFile(path: string, content: string | AssetProxy, tree: RepoTree) { |
| 71 | const segments = path.split('/'); |
| 72 | let obj = tree; |
| 73 | while (segments.length > 1) { |
| 74 | const segment = segments.shift() as string; |
| 75 | obj[segment] = obj[segment] || {}; |
| 76 | obj = obj[segment] as RepoTree; |
| 77 | } |
| 78 | (obj[segments.shift() as string] as RepoFile) = { content, path }; |
| 79 | } |
| 80 | |
| 81 | function deleteFile(path: string, tree: RepoTree) { |
| 82 | unset(tree, path.split('/')); |
no outgoing calls
no test coverage detected