add-prettier-vsc
v1.0.1
Published
A lightweight CLI to add a `.prettierrc` config file (matching VS Code’s defaults) to your project directory.
Readme
add-prettier-vsc
A lightweight CLI to add a .prettierrc config file (matching VS Code’s defaults) to your project directory.
Installation
Install globally with npm:
npm install -g add-prettier-vscThis will expose the add-prettier-vsc command in your PATH.
Usage
add-prettier-vsc [options] [directory]directory(optional): Path to the target folder where you want to add the config. Defaults to the current working directory.Options:
-h, --helpShow help and exit.-d, --displayPrint the target file path and config content without writing.
Examples
Add a
.prettierrcto the current folder:add-prettier-vscPreview (no write) in a subfolder:
add-prettier-vsc --display ./frontendTarget a specific directory:
add-prettier-vsc ../my-project
bin.js behavior
If
.prettierrcdoes not exist, it creates it with the following defaults:{ "printWidth": 80, "tabWidth": 4, "useTabs": false, "semi": true, "singleQuote": false, "trailingComma": "es5", "bracketSpacing": true, "arrowParens": "always", "endOfLine": "lf" }If
.prettierrcalready exists, you'll be prompted to confirm overwrite.
package.json
Your provided package.json is correctly configured for a global CLI:
{
"name": "add-prettier-vsc",
"version": "1.0.0",
"bin": "bin.js",
"author": "ideadesignmedia <[email protected]>",
"license": "MIT"
}Note:
- NPM will symlink
add-prettier-vsctobin.jsautomatically.- You may optionally add fields such as
description,repository, orpreferGlobal: trueif you’d like to indicate this is primarily for global use.
