Skip to content

Commit

Permalink
fix: include typescript parser plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Oct 19, 2021
1 parent e3097ba commit 8b4e765
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import ts, {
createProgram,
} from 'typescript';
import prettier from 'prettier';
import parserBabel from 'prettier/parser-babel';
import parserTypescript from 'prettier/parser-typescript';
import fs from 'fs';
import path from 'path';
import temp from 'temp';
Expand All @@ -55,7 +55,7 @@ export function transpile(
},
}).outputText;

const componentText = prettier.format(transpiledCode, { parser: 'typescript', plugins: [parserBabel] });
const componentText = prettier.format(transpiledCode, { parser: 'typescript', plugins: [parserTypescript] });

/* createProgram is less performant than traspileModule and should only be used when necessary.
* createProgram is used here becuase transpileModule cannot produce type declarations.
Expand Down Expand Up @@ -91,7 +91,7 @@ export function transpile(
};
}

return { componentText: prettier.format(code, { parser: 'typescript', plugins: [parserBabel] }) };
return { componentText: prettier.format(code, { parser: 'typescript', plugins: [parserTypescript] }) };
}

export function buildPrinter(fileName: string, renderConfig: ReactRenderConfig) {
Expand Down
1 change: 0 additions & 1 deletion packages/studio-ui-codegen-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"dependencies": {
"@amzn/amplify-ui-codegen-schema": "^0.0.1",
"@amzn/studio-ui-codegen": "^0.0.1",
"@babel/parser": "^7.15.6",
"@types/temp": "^0.9.1",
"framer-motion": "^4",
"prettier": "2.3.2",
Expand Down

0 comments on commit 8b4e765

Please sign in to comment.