yarn berry 에 github packages 적용하기
github packages에 배포하기
package.json 수정
...
// organization or user id
"name": "@user_id/package_name",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"repository": {
"type": "git",
// 배포할 패키지가 속해 있는 레포의 url
"url": "https://github.com/your_repo_url"
},
github access token 발급
Github 설정 -> Developer Settings -> Personal access tokens
페이지로 가서 토큰 스코프에서 repo, write:packages, delete:packages
를 선택 후 발급
환경변수에 토큰 적용
$ vi ~/.zshrc
# .zshrc 파일
export GITHUB_NPM_AUTH_TOKEN=<발급받은 토큰> # 해당 라인을 추가
$ source ~/.zshrc
.yarnrc.yml 수정
yarn bery 적용시 .npmrc, .yarnrc 설정을 인식하지 못한다. 반드시 .yarnrc.yml
을 통해서 설정해야한다.
...
npmRegistries:
"https://npm.pkg.github.com/":
npmAlwaysAuth: true
npmAuthToken: ${GITHUB_NPM_AUTH_TOKEN-''}
publish
$ yarn npm publish --tolerate-republish
github packages에서 설치하기
.yarnrc.yml 수정
...
npmScopes:
// organization or user id를 scope로 작성
user_id:
npmRegistryServer: "https://npm.pkg.github.com/"
install
# organization or user id
$ yarn add @user_id/package_name
'개발개발' 카테고리의 다른 글
실행컨텍스트 정리 (0) | 2023.02.11 |
---|---|
@RequestMapping 의 비밀 (0) | 2022.05.13 |
문자열 해싱 (0) | 2020.08.30 |
선언형 프로그래밍이란 무엇일까? (0) | 2020.08.17 |
타입 스크립트에서 배열과 튜플 (0) | 2020.03.11 |