Skip to content

Commit

Permalink
Update build-tokens.js
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Dec 2, 2024
1 parent cbfe7e8 commit 1aa7a02
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/themes/scripts/build-tokens.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const prettier = require('prettier');

// prettier-ignore
const THEME_COMPONENTS = [
Expand Down Expand Up @@ -101,7 +102,7 @@ try {
console.error(err);
}

THEME_COMPONENTS.forEach((comp) => {
THEME_COMPONENTS.forEach(async (comp) => {
const data = fs.readFileSync(path.resolve(rootDir, `src/presets/${themeName}/${comp.toLowerCase()}/index.js`), { encoding: 'utf8', flag: 'r' });
let theme = data.replace('export default', 'module.exports = ');

Expand Down Expand Up @@ -237,7 +238,10 @@ ${defaultText}
}
`;

fs.writeFileSync(outputFile, text, 'utf8');
const prettierConfig = await prettier.resolveConfig(__dirname);
const formattedText = prettier.format(text, { ...prettierConfig, parser: 'typescript' });

fs.writeFileSync(outputFile, formattedText, 'utf8');
} catch (err) {
console.error(err);
}
Expand Down

0 comments on commit 1aa7a02

Please sign in to comment.