sindresorhus / np

A better `npm publish`
MIT License
7.56k stars 299 forks source link

CLI default flags is overriding local `np-config.jon` flags #754

Open newfylox opened 3 months ago

newfylox commented 3 months ago

When using local config flags, some of them are overridden by the default CLI flags

Description

I have a local config file with a tests flag set to false, but it gets set to true when running np CLI without any flags.

This is where it happened

https://github.com/sindresorhus/np/blob/main/source/cli-implementation.js#L113-L117

and with here, there is no way to set tests flag to false

https://github.com/sindresorhus/np/blob/main/source/cli-implementation.js#L63-L65

I put some console.log inside ./node_modules/np/source/cli-implementation.js and here are the outputs. First is my local config flags and second is the default CLI ones. Then the third is the final merged options result.

2024-08-15_13-38 2024-08-15_13-38_1

Expected behavior

It should have no default CLI flags if not using it in terminal script.

Environment

np - 10.0.7 Node.js - 20.11.0 npm - 10.8.2 Git - 2.34.1 OS - Linux Mint 21.3