npm-profile-manager
v0.1.1
Published
Profile management for .npmrc files.
Downloads
14
Readme
npm Profile Manager
A cross-platform .npmrc profile manager based on Conrad Pankoff's npmrc. npm Profile Manager seeks to improve on npmrc by enabling:
- Complete management of profiles through the CLI, including creation, deletion, renaming, and upgrading of profiles without having to manipulate the file system directly.
- Availability of an API to be used in other packages in addition to the
npmrc
CLI. - Functionality on Windows
Installation
npm i -g npm-profile-manager
npmrc upgrade default # Upgrades your current .npmrc to a profile named "default"
Windows Users
npm Profile Manager uses symbolic links to both identify which profile is currently in use and redirect npm to the correct profile. Sadly, Windows treats symbolic links as a security threat and requires the SeCreateSymbolicLinkPrivilege
privelage that is by default granted to only the Administrators group. You can grant the permission to other individuals or groups (including the Everyone group) by setting up a local policy. However, if you are an administrator and have the UAC enabled, you must elevate in order to create symbolic links, no matter what permissions are set. This means you must either:
- run
npmrc
with elevated privileges (usingrunas
or elevating the hosting process), or - disable the UAC
As one of the key goals of npm Package Manager is to be cross-platform, a future version of this package may use a different strategy to redirect .npmrc.
Usage
- To see a summary of the available commands, use
npmrc --help
- To see the current version of npm Profile Manager, use
npmrc --version
Commands
list, ls
Lists the available profiles and notes the current one (if any).
$ npmrc list
* default
foo
bar
switch, sw
Switches to the specified profile. Use with --force
to overwrite an existing .npmrc file that is not managed by npm Profile Manager.
$ npmrc switch foo
Switched to profile foo
create, mk
Creates and switches to a profile with the specified name. Use with --force
to overwrite an existing profile with the same name.
$ npmrc mk foo
Created profile foo
Switched to profile foo
remove, rm
Removes the profile with the specified name. Use with --force
to skip the confirmation step.
$ npmrc rm foo
Are you sure you want to delete npmrc profile "foo" and its cache? [yes/no] (no) yes
Removed profile foo
rename, mv
Renames the current profile to the specified name. use with --force
to overwrite an existing profile with the same name.
$ npmrc list
default
* test
$ npmrc rename foo
test is now named foo
Switched to profile foo
upgrade, up
Creates a profile using the current, unmanaged npmrc. Use with --force
to overwrite an existing profile with the same name.
The name of the new profile may be provided as an argument:
$ npmrc upgrade foo
Switched to profile foo
or, if it is not specified, it will be prompted:
$ npmrc upgrade
New profile name: foo
Switched to profile foo