Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting flags globally and locally using cosmiconfig #354

Merged
merged 11 commits into from
Mar 31, 2019
Prev Previous commit
Next Next commit
Update readme.md
  • Loading branch information
sindresorhus authored Mar 21, 2019
commit 4aeb1abaf5d13707a2298d71e0f5dc9394910175
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,20 @@ Run `np` without arguments to launch the interactive UI that guides you through
<img src="screenshot-ui.png" width="1290">


## Configuration
## Config

`np` can be configured locally and globally. When using the global `np` binary, you can configure any of the CLI flags in either `.np-config.js` or `.np-config.json`, in the home directory. When using the locally `np` binary (i.e. in a `npm run` script) you can configure `np` by setting the flags in either `.np-config.js`, `.np-config.json` or `package.json` (in the project directory).
`np` can be configured both locally and globally. When using the global `np` binary, you can configure any of the CLI flags in either a `.np-config.js` or `.np-config.json` file in the home directory. When using the local `np` binary, for example, in a `npm run` script, you can configure `np` by setting the flags in either a top-level `np` field in `package.json` or in a `.np-config.js` or `.np-config.json` file in the project directory.

itaisteinherz marked this conversation as resolved.
Show resolved Hide resolved
For example, this configures `np` to never use Yarn and to use `dist` as the subdirectory to publish:

```json
```js
itaisteinherz marked this conversation as resolved.
Show resolved Hide resolved
{
"yarn": true,
"yarn": false,
"contents": "dist"
}
```
itaisteinherz marked this conversation as resolved.
Show resolved Hide resolved

_**Note:** The global configuration only applies when using the global `np` binary, and is never inherited when using a local binary._
_**Note:** The global config only applies when using the global `np` binary, and is never inherited when using a local binary._


## Tips
Expand Down