Skip to content

Commit c522d26

Browse files
committed
Fix RegExp serialization and add ts-node error handling
- Use serializeString() for RegExp to properly escape quotes/backslashes - Add try-catch around ts-node require with helpful error message - Verified doctor spec still passes with new output text
1 parent 5d1302f commit c522d26

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

package/configExporter/cli.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,15 @@ async function loadConfigsForEnv(
319319
// Load the config
320320
// Register ts-node for TypeScript config files
321321
if (configFile.endsWith(".ts")) {
322-
// eslint-disable-next-line @typescript-eslint/no-var-requires
323-
require("ts-node/register/transpile-only")
322+
try {
323+
// eslint-disable-next-line @typescript-eslint/no-var-requires
324+
require("ts-node/register/transpile-only")
325+
} catch (error) {
326+
throw new Error(
327+
"TypeScript config detected but ts-node is not available. " +
328+
"Install ts-node as a dev dependency: npm install --save-dev ts-node"
329+
)
330+
}
324331
}
325332

326333
// Clear require cache for config file and all related modules

package/configExporter/yamlSerializer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class YamlSerializer {
6868
}
6969

7070
if (value instanceof RegExp) {
71-
return JSON.stringify(value.toString())
71+
return this.serializeString(value.toString())
7272
}
7373

7474
if (Array.isArray(value)) {

0 commit comments

Comments
 (0)