From fb2d8590ca452eeb9319a7adc621f54d941225f7 Mon Sep 17 00:00:00 2001 From: Stefan E-K Date: Wed, 8 Nov 2023 13:42:16 +0100 Subject: [PATCH] fix(cli): better error message for tsconfig error --- .changeset/rich-sloths-sort.md | 5 +++++ packages/cli/src/commands/init.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/rich-sloths-sort.md diff --git a/.changeset/rich-sloths-sort.md b/.changeset/rich-sloths-sort.md new file mode 100644 index 00000000..addbae15 --- /dev/null +++ b/.changeset/rich-sloths-sort.md @@ -0,0 +1,5 @@ +--- +"solidui-cli": patch +--- + +fix: trying to read a malformed tsconfig.json now exits and shows a better error message diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index 1d055862..f1be7356 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -146,7 +146,12 @@ function writeTsconfig(alias: string) { indicator.start("Configuring your tsconfig.json") readJsonFile(process.cwd() + "/tsconfig.json", (error, data) => { - if (error) log.error("Something went wrong while configuring your tsconfig.json") + if (error) { + log.error( + "Something went wrong while configuring your tsconfig.json. Please make sure it is formatted correctly and doesn't contain any comments." + ) + process.exit(1) + } const tsconfigData = data as Record }>