Publish an NPM Package that Download & Send Webpage by Email - Lab Task 6


NPM is NodeJS package manager. Its also a dependency management tool that makes it easy to add libraries into your JavaScript project. It can be used to publish your own JavaScript libraries too, to be used by others' or in your own projects later. You can publish Node packages for public or keep them private i.e. limited to be used by yourself or people you authorize. Making and publishing new packages or librareis is way to publish create and manage reuseable software components that help us to create better softwares later (from productivity and quality perspective).

A developer productivity exponentially increase when he/she make use of already available libraries. Generally speaking, any software code is very little fraction of the code that it uses from other libraries or core software development kit. A package may be a finished product for end users but usually packages are libraries that contains pre-implemented and tested functionality that increases developer productivity and software quality. It also help to develop software as modules or components.

Task Description

In this task, you are expected to make and publish your own package. That package must have at least 3-4 dependencies, that means, it must use 3-4 other packages. 

You can also publish the work you did in previous lab task but generally reuseable software components are published. So, I suggest you to make a copy of you work that you did in last lab task. Remove the XLS file creation code. What you package shall do is, it shall create and export a function that shall take two parameter i.e. a webpage URL and the receiver email address. It shall extract the text from the page and send that text as email to given email address. 

For example, I shall import and use your package function like this:
sendEmail("", "");
It shall send the post text (HTML or text, as you like) at given email address. To connect to an email server, you need some credentials of an email account from whom the email would be sent. You can make a property or any configuration file and ask user to define the configurations after installing your package. If user call the sendEmail function without defining those configurations, show an error that he has not configured the package properly. When configured, use those email account/credentials to send email. I have already shared the library to use to send email in previous lab task.

Add more functioanlity and release a MINOR updated version. Update prototype of sendEmail function and release MAJOR new version. You can allow user to email URL only or URL's content by taking some parameter. Add another method that shall make PDF of downloaded content and send that PDF in email as attachment. To generate PDF, you can use or  any other library you like.

To more you hard work, the more you would learn. Remember.