How to Write a JavaScript Library

There’s a lot of steps to creating and maintaining an open source library. It’s
like becoming a parent. Open source libraries can be quite demanding,
impatient, and time consuming.

Some libraries are small enough that they’re pretty easy to create and don’t
need to be maintained when they’re “done.” However, once your lib gets to be
more than just a few dozen lines of code, you’re going to be faced with some
challenges in developing, documenting, releasing, updating, and maintaining your
library.

Even with all of these challenges, it’s still totally worth it to open source
your library. Whether it’s the next big JavaScript framework or a simple
utility, we welcome your contributions.

Getting started…

I’ve created a free series on egghead.io that’s intended to help you open source
your stuff. I start at the very very basics and get you up to speed with the
latest and greatest practices for developing open source libraries. The series
is still being developed and there are a lot of lessons in the pipeline waiting
to be published. But here are a few of the concepts you’ll learn from this
series:

  • Setting up GitHub for hosting
  • Setting up npm for publishing
  • Creating the lib and adding dependencies
  • Releasing to npm and GitHub
  • Releasing new and beta versions
  • Unit testing and code coverage
  • Setting up continuous integration
  • Automating the release process
  • Code linting
  • Adding githooks to help prevent mistakes
  • Getting contributors
  • Adding a transpiler for ES6 support
  • Creating an Isomorphic/Universal/Portable JavaScript Library
  • Documentation
  • And more!

Not all libraries need all of this, but many would benefit from having this. If
you’re curious, check out the (free) lesson series on egghead.io:
How to Write a JavaScript Library.
Start writing more open source JavaScript today! 👍

If you have any recommendations or questions, catch me on
Twitter.




Source link

مدونة تقنية تركز على نصائح التدوين ، وتحسين محركات البحث ، ووسائل التواصل الاجتماعي ، وأدوات الهاتف المحمول ، ونصائح الكمبيوتر ، وأدلة إرشادية ونصائح عامة ونصائح