NPM Contact Card
My take on the NPX me contact card.
To run - npx bennewton
To make your own, fork this Repo and update the myData.js, add ascii art to asciiArt.js or leave file empty. When updated, publish to npm as your own new package.
Posted on January 3, 2019
Originally posted at https://benenewton.com/npm-calling-card/
I've recently noticed a trend among some javascript developers in which they are publishing a simple NPM package that they use to share their contact information. I have seen this in the past but I'm not sure who's I saw first, I believe it may have been Elijah Manor. After reading about it again on this dev.to post by Conlin Durbin,
I decided to create my own.
You can view my Repo on GitHub here:
To make it your own, you can fork it and do as little as update the info in myData.js
and package.json
then publish as a new NPM module. Or you can go further and customize the text output with chalk, add your own data, etc. I used tagged template literals, so modifying the output is a breeze. You can just add a modifier like {red ${name}}
to an output function to change the color and/or font variant.
I also added some ascii art for old times' sake (and because why not??). I originally used image-to-ascii to generate the ascii art from a .png on my website, however an external dependency of GraphicsMagick was required for it to work properly. So I removed it and copied the output to a file. I was unable to keep the color, which stinks. I would like to know how to keep the color referenced in the file, I'm not sure what format and how to output that, so if anybody has any ideas, let me know.
To see it all in action, run the following from your command prompt:
npx bennewton
After a quick, temporary install, the downloaded npm module will display the following in your terminal leaving nothing behind on your drive.
The npx command downloads and runs a NPM module on your machine without installing it permanently. This is perfect for this type of text output module.
Of course, this serves very little purpose, it's just for fun. After reading the artice, it reminded me of Apple II games from the 80s. These games were "cracked" and would have the "pirate's" name on the splash screen along with some BBS phone numbers where you could download other games. Those were the days...
So my thought was why don't we use these as calling cards as signatures for our own modules. We are downloading hundreds if not thousands of modules as developers, most of the time knowing nothing about the author and paying little to no homage to them. A simple post-install script calling the author's own NPM calling card could be the answer to get them the recognition they deserve. I think it would be cool and at least make waiting for NPM installs more entertaining. Just a thought, what do you think?
Posted on January 3, 2019
Sign up to receive the latest update from our blog.