Member-only story

How to create your own module

Shiori Soma
2 min readAug 12, 2021

--

This is a tutorial on creating your own node module.

Photo by Paul Esch-Laurent on Unsplash

You can also read this website

Create a new module

  1. Creating a folder
mkdir folder-name

2. Creating package.json file with the following command

npm init

This utility will walk you through creating a package.json file.

package name: (the name of your module)
version: (1.0.0) /** default **/
description: description of your module
entry point: (index.js)
test command:
git repository: your git repository URL
keywords: keyword people search for
author: name <email@gmail.com> (your website)
license: (ISC)

3. Creating your own module

Maybe you already have files, so just copy and paste them.

exports.functionName = function() {
/* processing */
}

4. Creating and adding a README.md file to a package

touch README.md

You can add the description of your module.

5. Publish your module

npm publish

Update the module

  1. Edit your module

--

--

Shiori Soma
Shiori Soma

Written by Shiori Soma

I’m a front-end web developer based in Vancouver, studying CICCC, an web and mobile app development course. https://shiory602.github.io/portfolio/

No responses yet