To set npm credentials using npm login without reading from stdin with JavaScript, we run npm set.
For instance, we run
npm set //<registry>/:_authToken $TOKEN
to run npm set to set the authToken to the $TOKEN environment variable value.