Remember, last time we mentioned that NucM could help us manage the account information of NPM through a few simple commands. Click here for the previous article

Nucm has been able to manage account information of all sources since version 1.5.0, and can also manage user accounts of NPM login. These two functions are mainly introduced below:

  • Added the Ability to manage Accounts from Other sources (D12F24D)
  • Add nucM save instruction to check whether the current account information is stored and saved (0e9D5A3)

How do I manage accounts from other sources

When we clone a new project, the first step is usually to install dependencies. NPM install (or YARN) is performed on the terminal, and NPM downloads the project dependencies from the registry.npmjs.org/ source. Because we are in China, we need to use taobao mirror source to improve download speed. If the team has built NPM private storage, we need to use private source.

With so many sources, can we all remember the corresponding account number? How do we manage our accounts?

The latest version of Nucm provides such capability, which can help us to manage account information of various sources simply.

1. Add accounts from different sources

There is only one rule for adding accounts: any account you add or save will be recorded in the current source information.

In other words, if you are currently an NPM source, all new accounts you add will be recorded in the NPM source. If it is currently taobao Source, all newly added accounts will be recorded under Taobao source information.

Nucm add


# Beezen
$ nucm add beezen xxxxxxxxxxxxxxxxx
Copy the code

[Order to save the current account] : Nucm Save (details below)

Note: How to check the current environment is what source?

[Method 1] : The terminal can run NPM config get Registry to view the source address.

Method 2 (recommended) : Use the NRM tool to manage and view information.

$ nrm ls

  npm ---------------- https://registry.npmjs.org/
  yarn --------------- https://registry.yarnpkg.com/
  tencent ------------ https://mirrors.cloud.tencent.com/npm/
  cnpm --------------- https://r.cnpmjs.org/
* taobao ------------- https://registry.npmmirror.com/
  npmMirror ---------- https://skimdb.npmjs.com/registry/
Copy the code

2. View the account information of the current source

# Check the current source account$ nucm ls beezend -- xxxxxx...... xxxx beezen --- xxxxxx...... xxxx * beeze ---- xxxxxx...... xxxx# view the details of the current source account
$ nucm ls -l

  beezend -- xxxxxxxxxxxxxxxx
  beezen --- xxxxxxxxxxxxxxxx
* beeze ---- xxxxxxxxxxxxxxxx
Copy the code

3. View the account information of all sources

# check all source accounts$nucm ls -a [NPM] Beezend -- XXXXXX...... xxxx beezen --- xxxxxx...... xxxx * beeze ---- xxxxxx...... XXXX [maclocal] *test----- xxxxxx...... xxxx# View all source accounts - details$nucm ls-al [NPM] beezend -- XXXXXXXXXXXXXXXX beezen -- XXXXXXXXXXXXXXXX * beeze ---- XXXXXXXXXXXXXXXX [maclocal] *test ----- xxxxxxxxxxxxxxxx
Copy the code

How do I manage the NPM login login account

Initially, NucM version 1.0 only managed access Tokens for NPM accounts. We also know that Access Tokens are more used for continuous integration of projects. For individual developers, it’s customary to use accounts and passwords. To change the account, run NPM login to enter the account and password, and then login through the second authentication of the mobile phone before publishing the NPM package. To be honest, the release process is quite long and cumbersome.

Now, we can use NUCM to manage the account of individual developers, no longer need to rely on memory.

In the latest version 1.5.0 of NUCM, the function of saving the current account is added. Developers only need to execute the NucM save command, nucM will automatically detect whether the current user has logged in and whether the current login account needs to be saved (if the account has been saved through NUCM, there is no need to save it repeatedly), and the successfully saved account will be recorded in the current source information. Then we can view the list of saved account information through NUCM LS and quickly switch accounts through nucm use

.

The basic operation steps are as follows:

Finally, for easier understanding, the overall flow chart of NUCM Save instruction operation is attached:

The last

Finally, welcome to Star + Fork + Watch for more valuable suggestions from the open source community.

Git project address: github.com/beezen/nucm