prettier-cli-watcher
Runs prettier from CLI on project file(s) when modified.
Last updated 18 days ago by cgabriel5 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install prettier-cli-watcher 
SYNC missed versions from official npm registry.

prettier-cli-watcher

Runs prettier from CLI on project files when modified.

Install

Locally per project:

$ npm install prettier-cli-watcher --save-dev
# or
$ yarn add prettier-cli-watcher --dev

Or globally:

$ sudo npm install -g prettier-cli-watcher
# or
$ yarn global add prettier-cli-watcher

How To Use

$ prettier-cli-watcher

Or use a package.json script:

...
"scripts": {
  "pretty": "prettier-cli-watcher"
}
...

Then run via $ npm run pretty or $ yarn run pretty.

Options

  • --dir: The absolute path of directory to watch (default: process.cwd()).
  • --config: The project's prettier config is automatically located and used via cosmiconfig.
    • Or provide the file's absolute path or relative path to --dir.
  • --ignore: Like the prettier config, the project's .prettierignore file is also located and used.
    • Or provide the file's absolute path or relative path to --dir.
    • Note: By default the entire --dir directory is watched. Make sure to use a .prettierignore file to ignore paths like node_modules/, .git/, and dist/, for example.
  • --notify: Enable OS notifications when prettier errors.
  • --quiet: Disable output.
  • --setup: List setup details.
  • --dry: Run prettier without saving changes (for ignore test runs).
  • --version: List prettier-cli-watcher version.

Configuration Files

<summary>Expand section</summary>

cosmiconfig is used to locate the project's prettier configuration file if one is not explicitly provided. Going from top to bottom, the following places are searched until a prettier configuration file is found. If one is not found the default prettier settings are used.

[
  'package.json',
  '.prettierrc',
  'configs/.prettierrc',
  '.prettierrc.json',
  'configs/.prettierrc.json',
  '.prettierrc.yaml',
  'configs/.prettierrc.yaml',
  '.prettierrc.yml',
  'configs/.prettierrc.yml',
  '.prettierrc.js',
  'configs/.prettierrc.js',
  'prettier.config.js',
  'configs/prettier.config.json',
  'configs/prettier.config.js',
  '.prettierrc.toml',
  'configs/.prettierrc.toml'
]

Likewise, the project's .prettierignore is looked for at the following locations. By default the entire --dir directory is watched so ensure to use a .prettierignore file to ignore paths like node_modules/, .git/, and dist/, for example.

[
  '.prettierignore',
  'configs/.prettierignore',
  'configs/prettierignore'
]

OS Support

  • Made using Node.js v8.14.0 on a Linux machine running Ubuntu 16.04.5 LTS.
  • Tested and working on:
    • macOS High Sierra (v10.13).
    • Windows 10 (v1703 OS Build: 15063.674).

Contributing

Contributions are welcome! Found a bug, feel like documentation is lacking/confusing and needs an update, have performance/feature suggestions or simply found a typo? Let me know! :)

See how to contribute here.

Attribution

License

This project uses the MIT License.

Current Tags

  • 1.0.1                                ...           latest (18 days ago)

19 Versions

  • 1.0.1                                ...           18 days ago
  • 1.0.0                                ...           a month ago
  • 0.3.6                                ...           2 months ago
  • 0.3.5                                ...           7 months ago
  • 0.3.4                                ...           a year ago
  • 0.3.3                                ...           a year ago
  • 0.3.2                                ...           a year ago
  • 0.3.1                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.9                                ...           a year ago
  • 0.2.8                                ...           a year ago
  • 0.2.7                                ...           a year ago
  • 0.2.6                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 23
Dependencies (16)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |