Skip to content

Commit 17e9a28

Browse files
committed
Format file
1 parent 4f3f251 commit 17e9a28

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/execute/run-prettier.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export async function runPrettier(
88
project: Project,
99
): Promise<void> {
1010
const repositoryPath = getTargetRepositoryPath(project);
11-
const glob = project ?? ['.']
11+
const glob = project ?? ["."];
1212

1313
const prettierRepositoryBinPath = path.join(
1414
prettierRepositoryPath,
@@ -21,10 +21,10 @@ export async function runPrettier(
2121
"--no-color",
2222
...(Array.isArray(glob) ? glob : [glob]),
2323
];
24+
const run = () => spawn(process.execPath, args, { cwd: repositoryPath });
25+
2426
try {
25-
await spawn(process.execPath, args, {
26-
cwd: repositoryPath,
27-
});
27+
await run();
2828
} catch (
2929
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3030
error: any
@@ -33,9 +33,7 @@ export async function runPrettier(
3333
// e.g. excalidraw: https://github.com/excalidraw/excalidraw/blob/a21db08cae608692d9525fff97f109fb24fec20c/package.json#L83
3434
if (error.message.includes("Cannot find module")) {
3535
await yarn.install(repositoryPath);
36-
await spawn(process.execPath, args, {
37-
cwd: repositoryPath,
38-
});
36+
await run();
3937
} else {
4038
throw error;
4139
}

0 commit comments

Comments
 (0)