https://github.com/capaj/be-pretty
:lipstick: a small CLI utility for every lazy prettier maximalist out there
https://github.com/capaj/be-pretty
hacktoberfest prettier
Last synced: 10 months ago
JSON representation
:lipstick: a small CLI utility for every lazy prettier maximalist out there
- Host: GitHub
- URL: https://github.com/capaj/be-pretty
- Owner: capaj
- License: mit
- Created: 2018-11-29T15:17:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-28T16:10:01.000Z (over 1 year ago)
- Last Synced: 2025-04-15T04:11:42.809Z (about 1 year ago)
- Topics: hacktoberfest, prettier
- Language: JavaScript
- Homepage:
- Size: 344 KB
- Stars: 42
- Watchers: 3
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# be-pretty

:lipstick: adds prettier to an existing project with all bells and whistles-including husky and pretty-quick.
Have you ever been bothered by all the steps you need to do in a legacy codebase to get prettier all set up? Well now you don't have to.
## Usage
When you are in an old codebase which needs to be pretty now, and stay pretty forever and ever execute `npx be-pretty`. An output should look like this:
```
be-pretty
✔ Installing prettier husky pretty-quick
✔ Copying custom .prettierrc
✔ Adding pretty-quick pre-commit to package.json
✔ Formatting whole repo
```
Now you should have everything ready to just commit&push.
You may skip formatting step with a flag `--skipFormatting`
## Install(optional)
```
npm i be-pretty -g
```
Requires that you have npm/yarn/pnpm/bun and `npx` globally available. be pretty defaults to running npm, but if there is `yarn.lock` file it will use `yarn`.
## Customize .prettierrc
by default, be-pretty creates this prettier config.
```js
{
"arrowParens": "always", // good for typescript/flow when you want to type your function arguments
"singleQuote": true // IMHO better readability
}
```
if you want to customize this, just run `be-pretty setDefault -p="/path/to/your/defaultPrettierRc"`. You can omit the path and if there is a prettierc file in the current working directory it will be used.
be-pretty will use this as default from now on.
## Format all
if you just want to reformat everything, you can call `be-pretty formatAll`
## All Commands
```
be-pretty setDefault sets a .prettierrc file as your default, if ommited
will look for the .prettierrc file in CWD[aliases: d]
be-pretty formatAll formats everything excluding node_modules[aliases: f]
be-pretty run run the series of commands to make a codebase pretty
[default]
```
## FAQ
### Will this work for a newly added languages as well?
Yes, the list of supported file extensions is not hardcoded anywhere-format all just invokes prettier in the current folder and let's it format all supported extensions.