Nexus Repository
Nexus Repository란, 소프트웨어 개발 및 배포를 위한 오픈 소스 원격 저장소 관리 시스템입니다. 개발자들이 소스 코드, 라이브러리, 컴포넌트, 패키지 등의 아티팩트를 중앙 집중식 저장소에서 관리하고 공유할 수 있게 해줍니다.
Nexus Repository Manager
nexus3.onap.org
첫회사에서 프로젝트 했을 당시에는 저장소 구축이란건 해본경험이 없다. (사실 기회는 있었겠으나 내가 관심이 없었던걸로..)
publish만 할줄 알았지 어떻게 해서 Nexus에 npm이 올라가는지 잘 몰랐다.😢
공통컴포넌트 서비스 배포를 하게되면서 회사에서도 nexus에 프론트 npm을 올릴수 있는 환경이 있었다. (잊기전에 정리하기)
구축이란걸 해봤어야알지 엉엉...😭 열심히 ChatGpt와 구글링의 힘을 빌려 인내의 숲으로 들어갔다.¯\_(ツ)_/¯
일단.. nexus에 배포하기전 ... 아래의 두 전제조건을 만족해야한다.
아래의 두 전제조건은 테스트환경이 없으므로 시간이 날때 업데이트를..
1) FE (React/Nextjs/Vue...)에서 빌드가 정상적인 형태로 진행되었다고 가정 (ex. ~npm run build → success)
2) Nexus내 저장소 생성했다고 가정
1. package.json 에 "publishConfig" 추가
- name : nexus에 올라갈 패키지명
- version : 버전 (publish 할때마다 버전을 변경하는 형태로 관리할 수 있음)
- publishConfig : registry에 있는 주소는 nexus에 올라갈 실제 저장소 주소를 작성하면 된다. (아래는 예시임)
{
...
"name": "@component/test-library",
"version": "0.1.0-test1",
...
"publishConfig" : {
"registry" : "http://localhost:8081/nexus/content/repositories/npm-internal/"
},
}
2. .npmrc 에 추가
아래의 내용을 복사하여 붙여넣으면 되는데 여기서
_auth=에 id:pw (nexus 로그인할 id:pw)를 base64인코딩한 값으로 셋팅하면 된다.
ex) id : admin, pw : test 라고 가정하면id:pw는 admin:test가 되는데 이를 base64인코딩 형태로 변환한다.
-> admin:test를 인코딩하면 아래와 같다.(base64인코딩 사이트 : https://www.base64encode.org/ko/ )
YWRtaW46dGVzdA==
init.author.name = nexus-example
init.author.email = nexus-example@email.com
# an email is required to publish npm packages
nexus-example@email.com
always-auth=true
registry:http://localhost:8081/nexus/content/repositories/npm-internal/
_auth=YWRtaW46dGVzdA==
3. npm publish 실행
- 대충 요런식으로.. 빌드 후 npm publish를 실행하게 되면 에러 없이..진행되었으면 nexus에 잘 올라가는것 확인할 수 있음.
참고
https://help.sonatype.com/repomanager2/node-packaged-modules-and-npm-registries
Node Packaged Modules and npm Registries
We're Updating Our Product Names and Logos As we roll out our updated Sonatype brand, you will see product names and logos begin to change across My Sonatype. You may notice slight product name and logo variations—some new, some old—across resources as
help.sonatype.com
'Frontend' 카테고리의 다른 글
[JS] 페이지 이동 "location.href" 와 "location.replace"의 차이점 (0) | 2024.08.02 |
---|---|
[ETC] Design mode로 웹 페이지를 편집 해보기 (0) | 2024.08.02 |
[디버깅] Chrome 안드로이드 내 브라우저 디버깅 하는방법 (0) | 2024.03.18 |
[React] SPA에서 SEO 처리가 필요한 이유 (0) | 2023.07.02 |
[프론트엔드] FE 기술면접(React) 복기 모음 (0) | 2023.04.16 |