-2

我可以使用yarn create托管在 GitHub 上的存储库而不是已发布的 NPM 包吗?

这对于其他命令是可能的,例如从我可以执行的 GitHub 存储库安装依赖项,yarn add <git remote url>或者yarn add <git remote url>#<branch/commit/tag>针对与默认分支不同的东西。

我试过yarn create <git remote url>但遇到一个错误:

$ yarn create <git remote url>
yarn create v1.22.1
[1/4] Resolving packages...
error An unexpected error occurred: "create-https:: Invalid URI \"create-https:/\"".
info If you think this is a bug, please open a bug report with the information provided in "/home/xxx/.config/yarn/global/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

我正在使用纱线 v1.22.1。

4

1 回答 1

0

如记录 yarn create <starter-kit-package>的只是一个快捷方式

yarn global add create-<starter-kit-package>
create-<starter-kit-package>

虽然看起来yarn create不支持 git 存储库,但底层命令支持。所以代替yarn create <git remote url>或类似的事情我可以做

yarn global add <git remote url>
<repository-name>

让我们以react-app入门套件为例。使用我会做的最新发布打包yarn create react-app,这与

yarn global add create-react-app
create-react-app my-app

要使用功能分支,我可以这样做:

yarn global add https://github.com/facebook/create-react-app#feature-branch
create-react-app my-app
于 2020-03-07T11:45:12.670 回答