How I published my first npm package

TL;DR

how-i-published-my-first-npm-package-5388564bf643

How to publish

Create an account

Login via CLI

$ npm adduser
Username: your-username
Password:
Email: (this IS public) your-email
Logged in as your-username on https://registry.npmjs.org/.
$ mkdir slug-generator && cd $_
$ yarn init
yarn init v1.16.0
warning ../../package.json: No license field
question name (slug-generator): @taishikato/slug-generator
question version (1.0.0):
question description: generate slug string
question entry point (index.js):
question repository url: https://github.com/taishikato/slug-generator
question author: taishikato
question license (MIT):
question private: false
success Saved package.json
✨ Done in 68.06s.
$ npm publish --access=public
npm notice
npm notice 📦 @taishikato/slug-generator@1.0.0
npm notice === Tarball Contents ===
npm notice 258B package.json
npm notice === Tarball Details ===
npm notice name: @taishikato/slug-generator
npm notice version: 1.0.0
npm notice package size: 257 B
npm notice unpacked size: 258 B
npm notice shasum: bf71ac427082c283c6d2cf600f7d1691ab0b5964
npm notice integrity: sha512-clwDAYf181ObB[...]5pwvhOJbTUAiA==
npm notice total files: 1
npm notice
+ @taishikato/slug-generator@1.0.0

Add README!

Let’s add some code.

License

Version

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards compatible manner, and
  3. PATCH version when you make backwards compatible bug fixes.
$ npm version major
v2.0.0

Publish!

$ npm publish
npm notice
npm notice 📦 @taishikato/slug-generator@2.0.0
npm notice === Tarball Contents ===
npm notice 1.1kB LICENSE
npm notice 496B index.js
npm notice 304B package.json
npm notice 901B README.md
npm notice === Tarball Details ===
npm notice name: @taishikato/slug-generator
npm notice version: 2.0.0
npm notice package size: 1.7 kB
npm notice unpacked size: 2.8 kB
npm notice shasum: a43b58c8d1434faaeaf207778619981d5b372bd5
npm notice integrity: sha512-u4jsqO8B7j3PY[...]kfdDVtGHT4+Zw==
npm notice total files: 4
npm notice
+ @taishikato/slug-generator@2.0.0

Add some keywords on package.json

{
"name": "@taishikato/slug-generator",
"version": "2.0.0",
"description": "generate slug string",
"main": "index.js",
"repository": "https://github.com/taishikato/slug-generator",
"author": "taishikato",
"license": "MIT",
"private": false,
"dependencies": {
"uuid": "^7.0.2"
},
"keywords": [
"slug",
"npm",
"package",
"taishikato",
"slug generator"
]
}

Thank you!

Reference

🖊️taishikato/slug-generator🖋️

On Linkedin

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store