Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
rnegron committed Dec 3, 2024
1 parent f9a0e95 commit 707a40b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/cli/src/utils/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ const createFile = async (content, filename, dir) => {
endSpinner();
};

const prettifyJs = async (code) =>
prettier.format(code, { singleQuote: true, parser: 'babel' });
const prettifyJs = async (code) => {
return prettier.format(code, { singleQuote: true, parser: 'babel' });
};

const prettifyJSON = (origString) => JSON.stringify(origString, null, 2);

Expand Down Expand Up @@ -203,7 +204,8 @@ const renderDefinitionSlice = async (definitionSlice, filename) => {

const uglyCode = functionBlock + '\n\n' + exportBlock;
try {
return prettifyJs(uglyCode);
const prettyCode = await prettifyJs(uglyCode);
return prettyCode;
} catch (err) {
console.warn(
`Warning: Your code has syntax error in ${chalk.underline.bold(
Expand Down Expand Up @@ -295,9 +297,11 @@ const renderIndex = async (appDefinition) => {
importBlock = importBlock.join('\n');
functionBlock = Object.values(functionBlock).join('\n\n');

return prettifyJs(
const prettyCode = await prettifyJs(
importBlock + '\n\n' + functionBlock + '\n\n' + exportBlock
);

return prettyCode;
};

const renderEnvironment = (appDefinition) => {
Expand Down

0 comments on commit 707a40b

Please sign in to comment.