Skip to content

Commit a3789f6

Browse files
isabellahochstainless-app[bot]
authored andcommitted
update collectFiles / applyChanges helpers (#10)
* change function signatures so we'll be able to modify them in the future without breaking things
1 parent f6acfb1 commit a3789f6

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/lib/helpers.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ const DEFAULT_IGNORE = [
3131
'**/.env*',
3232
];
3333

34-
export async function collectFiles(
35-
basePath: string = process.cwd(),
36-
patterns: string[] = DEFAULT_PATTERNS,
37-
ignore: string[] = DEFAULT_IGNORE,
38-
): Promise<FileData[]> {
34+
export async function collectFiles({
35+
basePath = process.cwd(),
36+
patterns = DEFAULT_PATTERNS,
37+
ignore = DEFAULT_IGNORE,
38+
}: { basePath?: string; patterns?: string[]; ignore?: string[] } = {}): Promise<FileData[]> {
3939
const originalCwd = process.cwd();
4040

4141
try {
@@ -74,8 +74,14 @@ export async function collectFiles(
7474
}
7575
}
7676

77-
export function applyChanges(changedFiles: FileData[], basePath: string = process.cwd()): void {
78-
for (const file of changedFiles) {
77+
export function applyChanges({
78+
files,
79+
basePath = process.cwd(),
80+
}: {
81+
files: FileData[];
82+
basePath?: string;
83+
}): void {
84+
for (const file of files) {
7985
try {
8086
const fullPath = path.resolve(basePath, file.path);
8187
const dirPath = path.dirname(fullPath);

0 commit comments

Comments
 (0)