npm publish

gateisbug·2024년 4월 2일

Learn

목록 보기
2/4

init

npm init # 일반 배포시
# npm init --scope=<organization_name> # 조직 배포 시

package

version

Code statusStageRuleExample version
First releaseNew productStart with 1.0.01.0.0
Backward compatible bug fixesPatch releaseIncrement the third digit1.0.1
Backward compatible new featuresMinor releaseIncrement the middle digit and reset last digit to zero1.1.0
Changes that break backward compatibilityMajor releaseIncrement the first digit and reset middle and last digits to zero2.0.0

description

  • 패키지의 설명을 지정
{
	"description": "A simple, practical and general-purpose React component library."
}

keywords

  • 패키지의 키워드를 배열로 지정
{
	"keywords": [  
		"react",
		"typescript"
	],
}

homepage

  • 프로젝트 홈페이지로 연결할 URL 제공
{
	"homepage": "https://github.com/gateisbug/practx-ui/tree/main"
}

bug

  • 패키지에 문제가 있을 때 보고될 이슈 트래커 및 이메일 주소 등에 대한 URL 지정
{
	"bugs": {  
		"url": "https://github.com/gateisbug/practx-ui/issues",  
		"email": "luftwaffe04@naver.com"  
	}
}

license

  • 패키지 사용을 허용하는 방법과 제한 사항을 알 수 있도록 라이센스를 지정
{
	"license": "(MIT or Apache-2.0)"
}

author

  • 프로젝트의 제작자 이름을 지정
{
	"author": "gateisbug <luftwaffe04@naver.com> (https://github.com/gateisbug)",
}

contributors

  • 제작자가 여러 명일 경우 author 대신에 사용
{
	"contributors": [ 
		"Evan <evan@zillinks.com> ([https://zillinks.com](https://zillinks.com/))",
		"Lewis <lewis@zillinks.com> ([https://zillinks.com](https://zillinks.com/))",
		"Neo <neo@zillinks.com> ([https://zillinks.com](https://zillinks.com/))" 
	]
}

main

  • 프로그램의 기본 진입 점(entry point)를 지정
  • 패키지의 이름이 axios이고, 사용자가 require('axios') or import 'axios'를 사용하면 진입 점의 메인 모듈에서 exports object가 반환(return)됨
{
	"main": "dist/index.cjs.js",
}

repository

  • 코드가 존재하는 장소(주소)를 지정
  • npm docs 명령을 사용하여 패키지 저장소를 탐색 가능
{
	"repository": "https://github.com/gateisbug/practx-ui.git",
}

publishing

versioning

npm version patch # 1.0.0 -> 1.0.1
npm version minor # 1.0.0 -> 1.1.0
npm version major # 1.0.0 -> 2.0.0

test

npm install ../practx-ui

publish

npm logout # 기존 계정 로그아웃
npm login # npm 회원으로 가입 후 로그인
npm whoami # 로그인된 아이디 표시
npm publish

참고문헌

profile
쉽고, 짧고, 실용적인 코드를 지향하는 코드 디스펜서입니다.

0개의 댓글