Home

How to publish an npm package

Create a User Account

  1. Create user: npm adduser or register at npm.org
  2. Login user: npm login
  3. Check current user: npm whoami

Prepare package code

{
  "name": "...",
  "version": "0.0.1",
  "description": "...",
  "devDependencies": {},
  "main": "index.js",
  "scripts": {},
  "repository": {
    "type": "git",
    "url": "..."
  },
  "keywords": [],
  "author": "...",
  "license": "MIT",
  "bugs": {
    "url": "..."
  },
  "homepage": "..."
}

Add .npmignore
If you want to exlude some files then just put them in .npmignore

Publish project
Just run npm publish

Npm uses just archive file of package so we don't need Git for publishing npm package. Use Git if you want to maintain/develop source code of package

comments powered by Disqus