From 1a525ffc8815e211cb9691d8aea99426f672def5 Mon Sep 17 00:00:00 2001 From: Aleksandra Date: Tue, 19 Oct 2021 17:33:22 +0200 Subject: [PATCH 1/2] don't use local blitz config when transforming ts files in js projects --- packages/generator/src/generator.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/generator/src/generator.ts b/packages/generator/src/generator.ts index f8110ca384..054865ad7e 100644 --- a/packages/generator/src/generator.ts +++ b/packages/generator/src/generator.ts @@ -215,6 +215,7 @@ export abstract class Generator< if (!this.useTs && tsExtension.test(pathEnding)) { return ( babel.transform(templatedFile, { + configFile: false, plugins: [[babelTransformTypescript, {isTSX: true}]], })?.code || "" ) From b179db32d74f57849e0d82b53f6c20bca646e33a Mon Sep 17 00:00:00 2001 From: Aleksandra Date: Wed, 20 Oct 2021 13:32:49 +0200 Subject: [PATCH 2/2] format generated js files --- packages/generator/src/generator.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/generator/src/generator.ts b/packages/generator/src/generator.ts index 054865ad7e..2943080f84 100644 --- a/packages/generator/src/generator.ts +++ b/packages/generator/src/generator.ts @@ -213,12 +213,11 @@ export abstract class Generator< } templatedFile = this.replaceTemplateValues(templatedFile, templateValues) if (!this.useTs && tsExtension.test(pathEnding)) { - return ( + templatedFile = babel.transform(templatedFile, { configFile: false, plugins: [[babelTransformTypescript, {isTSX: true}]], })?.code || "" - ) } if ( @@ -230,6 +229,8 @@ export abstract class Generator< const options: Record = {...prettierOptions} if (this.useTs) { options.parser = "babel-ts" + } else { + options.parser = "babel" } try { templatedFile = this.prettier.format(templatedFile, options)