npm init -y --silent doesn't suppress Wrote to /path/to/package.json logging, which includes a full listing of the generated packge.json.
npm init -y --silent
Wrote to /path/to/package.json
Run npm init -y --silent
init-package-json supports a silent option, but passing --silent to npm actually sets loglevel to 'silent' in npm config, so when init-package-json calls config.get('silent'), the result is undefined.
I would submit a PR, but I'm not sure which repository it should go to - should init-package-json be updated to also check if config.get('loglevel') === 'silent', or should npm set silent to true in its config when loglevel config is being set to 'silent'?
config.get('loglevel') === 'silent'
I would say the second one, but we would want @iarna's input
Currently --silent is explicitly documented as an alias of --logevel=silent.
## Shorthands and Other CLI Niceties
The following shorthands are parsed on the command-line:
* `-s`, `--silent`: `--loglevel silent`
Changing that for just one command means that --silent would then behave inconsistently. If you'd like to see --silent's behavior change, I'd like to see a proposal for how it should work across the npm cli. Is that suppressing all output? What if someone also passed in --json or --paresable? What if they're running something like npm init but didn't pass in -y? What about auth prompts from git or lifecycle scripts? Are those just hidden? I'd want to see this discussed for each of the commands as those are just the wrinkles I can think of off hand.
Once we've nailed down the details and we have consensus that the proposal is sound then we can discuss how to specifically implement that across all of the cli's commands.
(If you just want to suppress all output in this one case then > /dev/null works pretty well.)