Skip to content

Instantly share code, notes, and snippets.

@preco21
Forked from coolaj86/how-to-publish-to-npm.md
Last active March 11, 2021 11:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save preco21/f9b0c862e4e2559e3ae3 to your computer and use it in GitHub Desktop.
Save preco21/f9b0c862e4e2559e3ae3 to your computer and use it in GitHub Desktop.
NPM에 패키지(모듈) 배포하는 법

NPM 시작하기(개발자로써)

만약 이전에 NPM author 정보를 설정해놓지 않았다면, 다음 명령으로 등록하세요:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

그리고 package.json을 만든 후 게시합니다:

cd /path/to/your-project
npm init

npm install -g pakmanager
# 이 패키지는 `require`한 종속성들을 보여줍니다
pakmanager deps
# 이제 `package.json`을 수정하고 깜빡하고 추가하지 않은 종속성들을 추가합니다

npm publish ./

베타와 릴리즈 버전

만약 어떤 것이 기본으로 설치되는 것을 원하지 않는다면:

npm publish ./ --tag beta

만약 버그 수정으로 인해 v1.0.7을 게시하고 v1.1.3을 다시 latest로 설정해야 하는 경우:

git checkout v1.0.7
npm publish ./
   
git checkout v1.1.3
# deprecated: https://docs.npmjs.com/cli/tag
npm tag foobar@1.1.3 latest

추가 정보

부가 사항

아직 npm을 설치하지 않았거나 최신 버전을 설치하고 싶은 경우 다음 명령을 사용하세요:

OS X

curl http://npmjs.org/install.sh | sh

Linux

curl http://npmjs.org/install.sh | sudo sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment