Today, I saw that the dependency of npm can be configured with a git address. I would like to know what files I downloaded through npm if I configured the address of git. How do you specify these documents? And how to specify branches or tag?
Today, I saw that the dependency of npm can be configured with a git address. I would like to know what files I downloaded through npm if I configured the address of git. How do you specify these documents? And how to specify branches or tag?
is equivalent to the content downloaded by git clone.
add-sharp after the path to specify branch/commit/tag
I think npm install document makes it very clear:
npm install < git remote url >:
Installs the package from the hosted git provider, cloning it with git. For a full git remote url, only that URL will be attempted.
<protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[-sharp<commit-ish> | -sharpsemver:<semver>]
< protocol > is one of git, git+ssh, git+http, git+https, or git+file.If-sharp < commit-ish > is provided, it will be used to clone exactly that commit. If the commit-ish has the format-sharpsemver: < semver >, < semver > can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither-sharp < commit-ish > or-sharpsemver: < semver > is specified, then master is used.
If the repository makes use of submodules, those submodules will be cloned as well.
If the package being installed contains a prepare script, its dependencies and devDependencies will be installed, and the prepare script will be run, before the package is packaged and installed.
The following git environment variables are recognized by npm and will be added to the environment when running git:
GIT_ASKPASS
GIT_EXEC_PATH
GIT_PROXY_COMMAND
GIT_SSH
GIT_SSH_COMMAND
GIT_SSL_CAINFO
GIT_SSL_NO_VERIFY
See the git man page for details.Examples:
npm install git+ssh://git@github.com:npm/npm.git-sharpv1.0.27
npm install git+ssh://git@github.com:npm/npm-sharpsemver:^5.0
npm install git+https://isaacs@github.com/npm/npm.git
npm install git://github.com/npm/npm.git-sharpv1.0.27
GIT_SSH_COMMAND='ssh -i ~/.ssh/custom_ident' npm install
Previous: Vue is packaged and put on the server to load for the first time.
Next: Will adding new attributes and assigning values to objects in js also improve variables?