How to build, test and publish an npm package in ES6

Опубликовано: 10 Октябрь 2024
на канале: Salma Alam-Naylor
1,342
54

I this video I show you how to create, build, test and release a node module package that's hosted on npm.

The most important thing to know is that if you want to write the code for the node module in ES6, you need a way to transpile the code from ES6 to ES5 so that it’s compatible with anyone’s code — that's where babel comes in!

Shout out to this great tutorial I used on stream:   / how-to-publish-an-es6-module-to-npm  

0:00 Intro
0:32 Introducing the random code generator website
0:50 How to create a Node.js module
1:03 Running npm init
1:38 Initialising a git repository using the GitHub CLI
1:45 Publishing the scoped npm package
2:01 Installing the new node module
2:17 Moving the existing code to the new npm package
2:37 Learning how to transpile ES6 to ES5
3:46 Using npm link to test the node module locally
4:32 It's alive!
4:50 Refactoring the code to return more data

This is a highlight of a live Twitch broadcast which aired on Friday 9th April 2021.

Read the blog post: https://whitep4nth3r.com/blog/how-to-...
Visit my Twitch channel:   / whitep4nth3r  
Visit the live random code generator website: https://randomcodegenerator.lol

See the random-code node module on npm: https://www.npmjs.com/package/@whitep...

View the code for the node module on GitHub: https://github.com/whitep4nth3r/rando...

#nodejs #javascript #npm