SlideShare a Scribd company logo
Writing a npm module
Writing a npm module
Writing a npm module
This is a simple example of a module
that exports a function. The function is
where all your giving to the community
lies. Make sure when you write your
first module for npm, it is more
significant than the one stated in the
example.
Writing a npm module
Follow the
prompts to sign
in to npm (if you
aren't already
signed in)
This will publish your module to npm and
return a link that you can use to access the
module from the npm website.
Now that we have published our module, let’s install it in a
project.
Let’s create a new directory for our project.
Post that create a package.json file for our project.
We will use the npm init command
to create a package.json file for our
project. We will also use the --yes
option to skip the prompts that npm
init offers us. This will create a basic
package.json file for you to use.
Writing a npm module
Let’s now create an index.js file for our project.
Did you do everything right? Did you
get what you expected?
Maybe/Maybe not. Let's unearth
more secrets in coming episodes.

More Related Content

PDF
GreenButton-201502
PDF
Nzpug google appengine
PDF
Do things faster and better with WebAssembly - Sendil Kumar Nellaiyapen - Cod...
PPTX
How to create your own WordPress plugin
PDF
Better UX using Meteor and Famo.us
PDF
Cloud Automation with Opscode Chef
PPTX
Cross-platform Desktop Apps development using HTML, CSS, JS with Electron
PDF
Public Workspaces: Amplify Your API Engagement
GreenButton-201502
Nzpug google appengine
Do things faster and better with WebAssembly - Sendil Kumar Nellaiyapen - Cod...
How to create your own WordPress plugin
Better UX using Meteor and Famo.us
Cloud Automation with Opscode Chef
Cross-platform Desktop Apps development using HTML, CSS, JS with Electron
Public Workspaces: Amplify Your API Engagement

What's hot (20)

PPTX
Continuous deployment of Rails apps on AWS OpsWorks
PPTX
Building a chrome extension with meteor
PDF
Code fast & Break things with Jenkins & Continuous Integration
PDF
Creating Custom Slack Integrations with Vapor 3 (Redux)
PDF
Drupal Version Control & File System Basics
PDF
Magnolia CMS Tasks & Workflows
PDF
AtlasCamp 2013: Bring your own Stack
PPTX
Deploy an Asp.Net Core App on Azure
PPTX
React in production
PDF
3 tips to make your Wordpress site faster
PPTX
Run C++ as serverless with GCP Cloud Functions
PDF
tus.io – Resumable file uploads for web and mobile apps by Felix Geisendörfer
PPTX
Lets go to the background
PPTX
Making Watir and Cucumber an efficient tool for Web UI Automation
PPTX
Getting started with k8
PPT
Resumable File Upload API using GridFS and TUS
PDF
Npm Shrinkwrap
PPT
Tus.io presentation for iOS devscout meetup
PDF
Get Started in Professional WordPress Design & Development
PPTX
7 maven vsgradle
Continuous deployment of Rails apps on AWS OpsWorks
Building a chrome extension with meteor
Code fast & Break things with Jenkins & Continuous Integration
Creating Custom Slack Integrations with Vapor 3 (Redux)
Drupal Version Control & File System Basics
Magnolia CMS Tasks & Workflows
AtlasCamp 2013: Bring your own Stack
Deploy an Asp.Net Core App on Azure
React in production
3 tips to make your Wordpress site faster
Run C++ as serverless with GCP Cloud Functions
tus.io – Resumable file uploads for web and mobile apps by Felix Geisendörfer
Lets go to the background
Making Watir and Cucumber an efficient tool for Web UI Automation
Getting started with k8
Resumable File Upload API using GridFS and TUS
Npm Shrinkwrap
Tus.io presentation for iOS devscout meetup
Get Started in Professional WordPress Design & Development
7 maven vsgradle
Ad

Similar to Writing a npm module (20)

PPTX
Overview of Node JS
PDF
UNIT-3.pdf, buffer module, treams,file accessing using node js
PDF
NPM THE GUIDE
PPT
Maven: Managing Software Projects for Repeatable Results
PDF
Python in the land of serverless
PDF
Python setup for dummies
PDF
Front end workflow with yeoman
PPTX
Building Open-source React Components
PPTX
Building Open-Source React Components
PPTX
Anton Cherednikov "Modules and Artifacts in NPM"
PDF
Integrating Maven with Eclipse
PDF
Django Article V0
PDF
An Introduction of Node Package Manager (NPM)
PDF
Semantic web, python, construction industry
PDF
How java works
PDF
How java works
PDF
Creating Enterprise Web Applications with Node.js
PPTX
PPTX
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
Overview of Node JS
UNIT-3.pdf, buffer module, treams,file accessing using node js
NPM THE GUIDE
Maven: Managing Software Projects for Repeatable Results
Python in the land of serverless
Python setup for dummies
Front end workflow with yeoman
Building Open-source React Components
Building Open-Source React Components
Anton Cherednikov "Modules and Artifacts in NPM"
Integrating Maven with Eclipse
Django Article V0
An Introduction of Node Package Manager (NPM)
Semantic web, python, construction industry
How java works
How java works
Creating Enterprise Web Applications with Node.js
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
Ad

Recently uploaded (20)

PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Artificial Intelligence
PPT
Project quality management in manufacturing
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
composite construction of structures.pdf
PPTX
Construction Project Organization Group 2.pptx
PPTX
Current and future trends in Computer Vision.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
737-MAX_SRG.pdf student reference guides
DOCX
573137875-Attendance-Management-System-original
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
UNIT 4 Total Quality Management .pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Geodesy 1.pptx...............................................
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Artificial Intelligence
Project quality management in manufacturing
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
composite construction of structures.pdf
Construction Project Organization Group 2.pptx
Current and future trends in Computer Vision.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Foundation to blockchain - A guide to Blockchain Tech
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
737-MAX_SRG.pdf student reference guides
573137875-Attendance-Management-System-original
bas. eng. economics group 4 presentation 1.pptx
UNIT 4 Total Quality Management .pptx
Mechanical Engineering MATERIALS Selection
Geodesy 1.pptx...............................................
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx

Writing a npm module

  • 4. This is a simple example of a module that exports a function. The function is where all your giving to the community lies. Make sure when you write your first module for npm, it is more significant than the one stated in the example.
  • 6. Follow the prompts to sign in to npm (if you aren't already signed in) This will publish your module to npm and return a link that you can use to access the module from the npm website.
  • 7. Now that we have published our module, let’s install it in a project. Let’s create a new directory for our project. Post that create a package.json file for our project. We will use the npm init command to create a package.json file for our project. We will also use the --yes option to skip the prompts that npm init offers us. This will create a basic package.json file for you to use.
  • 9. Let’s now create an index.js file for our project. Did you do everything right? Did you get what you expected? Maybe/Maybe not. Let's unearth more secrets in coming episodes.