|
4 | 4 | import * as child_process from 'child_process'; |
5 | 5 | import { IPackageDeps } from './IPackageDeps'; |
6 | 6 |
|
7 | | -export type GitStatusChangeType = 'D' | 'M' | 'A'; |
8 | | - |
9 | 7 | /** |
10 | 8 | * Parses the output of the "git ls-tree" command |
11 | 9 | */ |
@@ -43,8 +41,8 @@ export function parseGitLsTree(output: string): Map<string, string> { |
43 | 41 | /** |
44 | 42 | * Parses the output of the "git status" command |
45 | 43 | */ |
46 | | -export function parseGitStatus(output: string, packagePath: string): Map<string, GitStatusChangeType> { |
47 | | - const changes: Map<string, GitStatusChangeType> = new Map<string, GitStatusChangeType>(); |
| 44 | +export function parseGitStatus(output: string, packagePath: string): Map<string, string> { |
| 45 | + const changes: Map<string, string> = new Map<string, string>(); |
48 | 46 |
|
49 | 47 | /* |
50 | 48 | * Typically, output will look something like: |
@@ -80,7 +78,7 @@ export function parseGitStatus(output: string, packagePath: string): Map<string, |
80 | 78 | // We always care about the last filename in the filenames array. In the case of non-rename changes, |
81 | 79 | // the filenames array only contains one item. In the case of rename changes, the last item in the |
82 | 80 | // array is the path to the file in the working tree, which is the only one that we care about. |
83 | | - changes.set(filenames[filenames.length - 1], changeType as GitStatusChangeType); |
| 81 | + changes.set(filenames[filenames.length - 1], changeType); |
84 | 82 | } |
85 | 83 | }); |
86 | 84 |
|
@@ -155,11 +153,11 @@ export function getPackageDeps(packagePath: string = process.cwd(), excludedPath |
155 | 153 |
|
156 | 154 | // Update the checked in hashes with the current repo status |
157 | 155 | const gitStatusOutput: string = gitStatus(packagePath); |
158 | | - const currentlyChangedFiles: Map<string, GitStatusChangeType > = |
| 156 | + const currentlyChangedFiles: Map<string, string> = |
159 | 157 | parseGitStatus(gitStatusOutput, packagePath); |
160 | 158 |
|
161 | 159 | const filesToHash: string[] = []; |
162 | | - currentlyChangedFiles.forEach((changeType: GitStatusChangeType, filename: string) => { |
| 160 | + currentlyChangedFiles.forEach((changeType: string, filename: string) => { |
163 | 161 | if (changeType === 'D') { |
164 | 162 | delete changes.files[filename]; |
165 | 163 | } else { |
|
0 commit comments