({
cwd,
ref,
}: {
cwd: string;
ref: string;
})
| 219 | |
| 220 | // below are less generic functions that we use in combination with other things we are doing |
| 221 | export async function getChangedChangesetFilesSinceRef({ |
| 222 | cwd, |
| 223 | ref, |
| 224 | }: { |
| 225 | cwd: string; |
| 226 | ref: string; |
| 227 | }): Promise<Array<string>> { |
| 228 | try { |
| 229 | const divergedAt = await getDivergedCommit(cwd, ref); |
| 230 | // Now we can find which files we added |
| 231 | const cmd = await spawn( |
| 232 | "git", |
| 233 | ["diff", "--name-only", "--diff-filter=d", "--no-relative", divergedAt], |
| 234 | { |
| 235 | cwd, |
| 236 | } |
| 237 | ); |
| 238 | |
| 239 | let tester = /.changeset\/[^/]+\.md$/; |
| 240 | |
| 241 | const files = cmd.stdout |
| 242 | .toString() |
| 243 | .trim() |
| 244 | .split("\n") |
| 245 | .filter((file) => tester.test(file)); |
| 246 | return files; |
| 247 | } catch (err) { |
| 248 | if (err instanceof GitError) return []; |
| 249 | throw err; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | export async function getChangedPackagesSinceRef({ |
| 254 | cwd, |
no test coverage detected