A bot that runs Prettier on all JavaScript code that has been changed. This will inspect the previous commit and run prettier against any updated JavaScript files. It will then commit the changes to master.
It has been written so that it can be easily used with Travis or Circle CI.
You'll need to install both prettier and prettier-master. The easiest set-up is to install them globally.
npm install -g prettier prettier-master
You can alternatively install them however you want, but then your usage will
deviate from below. To use a different location of prettier
you can use the
environment variable PRETTIER_CMD
to specify the relative path to the
executable.
- PRETTIER_CMD - default: 'prettier'
- MASTER_BRANCH - default: 'master'
- PR_ON_CHANGE - default: 'false' - if set to true, then when changes are made a PR will be opened instead of committing straight into the branch. This is the best setting to use.
You can use prettier-master locally but just running prettier-master
within
the directory of the repository you want to make prettier.
For better effect though this script has really been put together so that you can add it as part of CI process using either Travis or Circle.
Add to your install section:
env:
- PR_ON_CHANGE=true
install:
- npm install -g prettier prettier-master
Then add to your script section:
script:
- prettier-master
Push some JavaScript changes to your repo!
Documentation coming soon!