Skip to content

Commit

Permalink
format tsconfig with prettier before writing
Browse files Browse the repository at this point in the history
  • Loading branch information
madsrasmussen committed Nov 24, 2021
1 parent d5f378c commit 4d9875b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/generate-ts-config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node
const path = require('path');
const fs = require('fs');
const prettier = require('prettier');
const {
packageDirectoryNames,
packagesRoot,
Expand Down Expand Up @@ -51,10 +52,10 @@ const generatePackageTSConfig = () => {
const tsConfig = { ...tsConfigBase, references };
const tsconfigPath = path.join(packageDirectory, 'tsconfig.json');

fs.writeFileSync(
tsconfigPath,
TSCONFIG_COMMENT + JSON.stringify(tsConfig, null, ' ')
);
const content = TSCONFIG_COMMENT + JSON.stringify(tsConfig, null, ' ');
const formattedContent = prettier.format(content, { parser: 'json' });

fs.writeFileSync(tsconfigPath, formattedContent);

console.log(`Generated tsconfig for ${packageJSONData.name}`);
}
Expand Down

0 comments on commit 4d9875b

Please sign in to comment.