programing

Github repo in Yarn 패키지 설치 방법

sourcejob 2023. 5. 29. 10:36
반응형

Github repo in Yarn 패키지 설치 방법

사용할 때npm install fancyapps/fancybox#v2.6.1 --savev2.6.1 태그의 고급 상자 패키지가 설치됩니다.이 동작은 문서에 설명되어 있습니다.

질문하고 싶은 것은, 어떻게 해야 하나요?yarn?

이 명령이 올바른 대안입니까?문서는 이런 형식에 관한 것이 아닙니다.

yarn add fancyapps/fancybox#v2.6.1

Git 저장소(또는 tarball)를 다음에 대한 종속성으로 추가할 수 있습니다.yarn원격 URL(HTTPS 또는 SSH)을 지정하여 다음 작업을 수행합니다.

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.

다음은 몇 가지 예입니다.

yarn add https://github.com/fancyapps/fancybox [remote url]
yarn add ssh://github.com/fancyapps/fancybox#3.0  [branch]
yarn add https://github.com/fancyapps/fancybox#5cda5b529ce3fb6c167a55d42ee5a316e921d95f [commit]

(참고: Fancybox v2.6.1은 Git 버전에서 사용할 수 없습니다.)

npm과 yarn을 모두 지원하기 위해 git+url 구문을 사용할 수 있습니다.

git+https://github.com/owner/package.git#commithashortagorbranch
git+ssh://github.com/owner/package.git#commithashortagorbranch

실 2+

원격 URL에서 설치하는 것은 Yarn 2에서 약간 변경되었습니다.특히 원격 URL은 패키지 이름 앞에 와야 합니다.그래서 github에게 이것은 다음을 의미합니다.

yarn add '<package name>@https://github.com/<github user>/<github repo>'

반드시<package name>의 값과 일치합니다."name"레포의 분야package.json파일.

특정 분기를 대상으로 지정하려면 다음 중 하나를 추가합니다.head=<branch>또는commit=<full commit hash>URL 조각을 통해:

yarn add '<package name>@https://github.com/<github user>/<github repo>#head=<branch name>'

Yarn monorepoon github에서 개별 패키지를 설치하려는 경우 추가할 수 있습니다.workspace=<package name>URL 조각으로:

yarn add '<package name>@https://github.com/<github user>/<github repo>#head=<branch name>&workspace=<package name>'

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://git@github.com:myproject.git#<branch,tag,commit>'
npm install 'ssh://git@github.com:myproject.git#<branch,tag,commit>'

github 저장소에는 다음과 같은 짧은 형식을 사용합니다.

yarn add github_user/repository_name#commit_hash

Yarn의 최신 버전에서는 URL 앞에 패키지 이름이 필요합니다.Github Packages에 게시한 개인 패키지를 설치하는 경우 구문은 다음과 같습니다.

yarn add @organization/packagename@https://github.com/organization/packagename,

이 선을 패키지로 생산해야 합니다.json:

"@organization/packagename": "https://github.com/organization/packagename"

언급URL : https://stackoverflow.com/questions/43411864/how-to-install-package-from-github-repo-in-yarn

반응형