Skip to content

Commit a8d5040

Browse files
authored
fix(cli): gracefully handle missing vp fmt during config initialization (#789)
The `vpFmt` function now gracefully handles cases where `vp fmt` is not available or fails to execute. Instead of throwing an error when formatting fails, it now shows a warning message and continues execution. Additionally, the entire formatting operation is wrapped in a try-catch block to handle cases where `vp fmt` is not yet installed (such as during migration processes), allowing the operation to proceed without formatting rather than failing completely.
1 parent 25b23d8 commit a8d5040

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/cli/src/init-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ async function vpFmt(cwd: string, filePath: string): Promise<void> {
170170
},
171171
});
172172
if (result.exitCode !== 0) {
173-
throw new Error(
173+
warnMsg(
174174
`Failed to format ${filePath} with vp fmt:\n${result.stdout.toString()}${result.stderr.toString()}`,
175175
);
176176
}

0 commit comments

Comments
 (0)