From f57d2fb6d1559e178d67181ca5214cea2bfd0b41 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sun, 7 May 2017 00:06:07 +0200 Subject: [PATCH] Run prettier on output in build dirs --- scripts/build.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/build.js b/scripts/build.js index 001111e87dce..e91638b3ecc1 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -27,6 +27,7 @@ const path = require('path'); const babel = require('babel-core'); const chalk = require('chalk'); const micromatch = require('micromatch'); +const prettier = require('prettier'); const getPackages = require('./_getPackages'); @@ -126,7 +127,13 @@ function buildFileFor(file, silent, env) { ); } else { const transformed = babel.transformFileSync(file, babelOptions).code; - fs.writeFileSync(destPath, transformed); + const prettyCode = prettier.format(transformed, { + bracketSpacing: false, + printWidth: 80, + singleQuote: true, + trailingComma: 'es5', + }); + fs.writeFileSync(destPath, prettyCode); silent || process.stdout.write( chalk.green(' \u2022 ') +