Skip to content

Add --init command - #1258

Closed
vutran wants to merge 2 commits into
prettier:masterfrom
vutran:init-flag
Closed

vutran wants to merge 2 commits into
prettier:masterfrom
vutran:init-flag

Conversation

@vutran

@vutran vutran commented Apr 13, 2017

Copy link
Copy Markdown
Contributor

Issue: Having to create new projects and copy/paste the same prettier into a package.json on each new project becomes very tedious.

This PR will add a simple --init command that will initialize the current working directory with prettier. This will make it really easy for beginners to get started with prettier.

In addition, it will attempt to read from an existing .editorconfig (#42) file in the directory in which the script is ran. This will void our need to have a custom config file (#62) just for prettier since there's no shortage of dot/rc files.

  • Updates package.json in cwd with a prettier npm script.
    • Default: prettier --write '{**/*.js}'"
    • Optionally reads from an .editorconfig and specify the indentation width/style.
      • indent_style -> --use-tabs
      • indent_size --> --tab-width

Usage:

$ cd myproject

$ prettier --init

@jlongster

Copy link
Copy Markdown
Member

I don't think we want to be in the business of being a CLI for initializing apps. You should use another tool for bootstrapping your app, like yeoman, or something built to do this. This project is a simple CLI/API to prettify your code, and not much else.

@vutran

vutran commented Apr 14, 2017

Copy link
Copy Markdown
Contributor Author

Sounds good. Wasn't sure the extent of the goals of this tool. Thanks!

@vutran vutran closed this Apr 14, 2017
@vutran
vutran deleted the init-flag branch April 15, 2017 04:35
@orta orta mentioned this pull request Jan 7, 2018
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 20, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants