The Onist

The Onist


Tags


Publishing My First NPM Package!

The time had finally come, I had been mooching off of awesome, publicly sourced NPM packages for far too long. I had to give something back to the community and so I did. Here are some of the things I learned along the way.

What I Published

I wrote a small Angular 1x module that adds an easy way to enforce required function parameters. It was pretty easy to implement thanks to the new default parameters feature available in ES6. In essence, it works by setting the default values of the functions parameters to call another function which in turn throws an Error if the parameter is missing.

The source code is available on my Github here. Here are links to the package on NPM and Bower.

What I Learned

The public NPM namespace is full

I had known that the NPM namespace was public and package names were available on a first come first served basis. What I didn't realize however is that most of the quality namespaces are already taken. I was lucky enough to snag ng-required-params on both NPM and Bower but I have to assume most aren't so lucky. Thankfully NPM has introduced username based scopes to alleviate this problem! Read more about this feature here.

TravisCI is awesome

After setting up a TravisCI and linking my Github account, I was immediately blown away with how easy it was to have a free and feature rich CI/CD setup in literally minutes. I simply created a .travis.yml file, added a configuration items and build instructions, tweaked a few Karma settings and then instantly had automated builds on every push to master. The builds logs and history of each build is just tremendous. Truly a great tool all around and I hope to use more of it in the future!

WTFPL license

I have always published all of my Github repo's under the MIT License and most NPM packages do the same. However while doing research on this, I came across the simply awesome 'Do What The Fuck You Want To Public License' (WTFPL). The WTFPL allows users of the code to do everything and has no restrictions. How could life be easier? You just DO WHAT THE FUCK YOU WANT TO.

Conclusion

So I finally did it, I published a public repo. Although the code is not at all groundbreaking per say and will never be downloaded millions of times. I do at least feel vindicated that I gave something back to the community however small it may have been. Perhaps someday I will create a truly awesome and innovative project such as Babel or Webpack. Someday.....

Share Post
View Comments