There's an easy way to prevent credential leakage when publishing to npm => Explicitly list the files to include in the package through the `files` property in package.json.
Docs: https://docs.npmjs.com/files/package.json#files
Example: https://github.com/sindresorhus/got/blob/2f5d5ba94d625802880...