当我使用npm install fancyapps/fancybox#v2.6.1 --save
时,将安装v2.6.1标签的fancybox包。 docs中描述了此行为
我想问一下,如何用yarn
做到这一点?
这个命令是正确的选择吗?在yarn docs并不是关于这种格式的。
yarn add fancyapps/fancybox#v2.6.1
yarn add <git remote url> installs a package from a remote git repository.
yarn add <git remote url>#<branch/commit/tag> installs a package from a remote git repository at specific git branch, git commit or git tag.
yarn add https://my-project.org/package.tgz installs a package from a remote gzipped tarball.
2.6.1在fancybox git版本中不可用
yarn add https://github.com/fancyapps/fancybox [remote url]
yarn add https://github.com/fancyapps/fancybox#3.0 [branch]
yarn add https://github.com/fancyapps/fancybox#5cda5b529ce3fb6c167a55d42ee5a316e921d95f [commit]
对于ssh样式的url,只需在url之前添加ssh:
yarn add ssh://<whatever>@<xxx>#<branch,tag,commit>
这里描述:https://yarnpkg.com/en/docs/cli/add#toc-adding-dependencies
例如:
yarn add https://github.com/novnc/noVNC.git#0613d18
对于GitHub(或类似)私有存储库:
yarn add 'ssh://[email protected]:myproject.git#<branch,tag,commit>'
npm install 'ssh://[email protected]:myproject.git#<branch,tag,commit>'