Description
Is there an existing issue for this?
- I have searched the existing issues
#5279 was confusing due to tangential, unrelated discussion.
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior A
npm config set init.author.name "AJ ONeal"
npm WARN config init.author.name Use `--init-author-name` instead.
This is incorrect and/or silly.
- The error message is incorrect.
--init-author-name
is NOT a valid config option or flag - It should print a deprecation notice AND do the correct behavior, or throw an actual error
Current Behavior B
npm config set --init-author-name "AJ ONeal"
This is NOT correct. It writes an invalid value to .npmrc
.
Expected Behavior
Either the built-in documentation should be updated to give the output the corresponds to the expected input
Or the parsing should change to allow the given output as input in some way
For example:
npm ERR breaking change: you must now use `npm config set init-author-name` instead of `npm config set init.author.name`.
[exit 1]
Or
npm WARN deprecated use of `npm config set init.author.name`. Use `npm config set init-author-name` instead.
[writes _correct_ version of option to .npmrc]
[exit 0]
Or
npm config --init-author-name "AJ ONeal"
✅ updated `.npmrc` with `init-author-name=AJ ONeal`.
Steps to Reproduce
If I run the config command to set my name:
mv ~/.npmrc ~/".npmrc.$(date '+%F_%H.%M.%S').bak"
npm config set init.author.name "AJ ONeal"
I get a confusing and misleading warning that gives incorrect / useless feedback:
npm WARN config init.author.name Use `--init-author-name` instead.
Either this feedback is incorrect, or the behavior of npm is incorrect.
--init-author-name
is NOT a valid command line flag--init-author-name
is NOT a valid config file entry
So then if I try again a few different ways:
npm config set --init-author-name "AJ ONeal"
npm config --init-author-name "AJ ONeal"
I get usage errors:
npm ERR! code EUSAGE
And if I try the simplest form I can think of:
npm --init-author-name "AJ ONeal"
I get yet a different usage error:
npm <command>
Usage:
...
And I can try putting --init-author-name
in .npmrc
, but this also doesn't work:
--init-author-name="AJ ONeal"
--init-author-email="coolaj86@gmail.com"
These are all ignored on npm init
.
Environment
- npm: 8.11.0
- Node.js: v16.16.0
- OS Name: macOS
- System Model Name:
- npm config:
; N/A
Keywords
Keywords for the sake of SEO and people trying to search for this in the GitHub tool:
- init.author.name
- init-author-name
- --init-author-name
- init.author.email
- init-author-email
- --init-author-email
- init.author.url
- init-author-url
- --init-author-url
- init.license
- init-license
- --init-license
- init.version
- init-version
- --init-version