Written by Hunter Jansen on August 2, 2016
My Angular 2 plugin has hit it’s 0.1.0 release! It’s been published, tested, advertised and downloaded by others. This post is going to be a quick follow up to my last topic on it, discussing my final steps, the few things I’ve learned, and what’s next.
Wrapping up my first minor version of my first npm package involved a couple of things that I hadn’t done yet.
- Writing unit tests for everything
- Making my demo page look siiiick
- Making sure it was actually usable via NPM
Writing Unit Tests
Considering that this project is something that I’m hoping others might use, I knew that it would be important to get unit testing as complete as possible. Luckily, I’ve been using karma and jasmine with Angular2 a bunch over the last while, so this was pretty simple. All of the unit tests can be found in the github repository. I only ran tests on the plugin, not the demo app, because nobody wants to deal with that. There’s nothing remarkable to say about this here - just standard unit testing.
Making my demo page look siiiick
Thanks to github pages, every public can have an easily created project page; but I knew that my demo needs would be more complicated than the built in gh pages could provide. Soo, I brought in bootstrap to help supplement my plug in’s styling and to add a little pizzazz to the demo page. You can find that here, by the way.
Again, this wasn’t anything spectacular. But it’s astounding just how much of a different a good demo page makes when showing off some functionality. Also, with this structured, and more complete demo page, I can easily add extra documentation as new features and options get added in the future. That’s the plan, too - to continue to expand on the base functionality that’s been laid down as the foundation in this plugin.
Making sure it was actually usable via NPM
This was actually one of the rougher aspects of wrapping up. Mainly because it was my first time going through it all. I went through publishing a few patch versions, pulling it into a test project and making minor tweaks in my package.json file. I ended up going through 4 or 5 versions before I discovered that there’s a better way to to things.
After a few versions, I started to become conscious of the fact that all of this was going to show in my commit log when I finally pushed; so I searched for a better, probably more correct way. Thankfully, I came across this article that explained how to package and install an npm module locally.
Prior to finding this article, I’d been working for a couple hours fighting with a bunch of stupid things related to trimming the package.json file - after this, it took me maybe 15 minutes to discover that the problem I’d been having all along had to do with my webpack parser in my test app, and nothing to do with my plugin. I sure felt inexperienced, frustrated, and ready to be done with the plugin for now.
Publishing At long last it was time to run the covetted command:
npm version minor
which brought my version to 0.1.0. After a quick publish, and a blast on twitter - it was over. With little fanfare, my first NPM package was published, my first open source contribution to be publicly consumed, and the first real thing I’ve done under the new handle of hyperwidget.
Next So, there are a few configuration options that I’m anticipating adding over the next couple of weeks (things like event callbacks and so forth), but after that I expect that there won’t be much development happening on this plugin. However, I’ve been playing a lot recently with electron - a way to create native desktop applications using JS, HTML and CSS. I’ve already completed my first, not-entirely-trivial playthrough, using the demo app for the plugin this post was about, and built native installers for Windows, OSX and Ubuntu. It’s SUPER rad, and while I don’t personally have a project that I necesarily want to use it for at this exact moment - I’m having a lot of fun, and ‘awww shiz’ moments while playing with it.
So that’ll be what my next post is about - probably later this week, or early next week.
Got any feedback, questions, or do you maybe just hate me?
Hit me up on twitter (link in the footer), make an issue on the repo (further up in the post), or drop me a line at firstname.lastname@example.org