Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run prettier on output in build dirs #3497

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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, {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from prettier.js, except for trailing comma

bracketSpacing: false,
printWidth: 80,
singleQuote: true,
trailingComma: 'es5',
});
fs.writeFileSync(destPath, prettyCode);
silent ||
process.stdout.write(
chalk.green(' \u2022 ') +
Expand Down