Check out a free preview of the full Creating an Open Source JavaScript Library on Github course

The "Setup" Lesson is part of the full, Creating an Open Source JavaScript Library on Github course featured in this preview video. Here's what you'd learn in this lesson:

Kent Dodds opens his workshop on Writing an Open Source Javascript library with a brief overview of what he’ll be covering and setup requirements. Along with instilling Git, Node, and NPM, Kent recommends creating travis-ci.org and codecov.io accounts.

Preview
Close

Transcript from the "Setup" Lesson

[00:00:00]
>> [MUSIC]

[00:00:39]
>> Kent C. Dodds: We're going to build a library from scratch. It's gonna be a really small library. We'll write and run tests. We'll transpile it. We'll add continuous integration. We'll add a browser build, and then we'll publish a real project. So, each one of you will have an NPM module registered on the on the NPM registry, hopefully, if all works out for that part.

[00:01:05]
And it will be unique. It's not just gonna be a clone, like we'll have 100 clones of this same thing. It'll be unique and useful. And then, actually, I have a talk about managing an open source project, and that's how we'll wrap things up. That's not exactly a workshop-y thing.

[00:01:26]
It's more of something you think about and stuff. So I'll kinda give that talk at the end. One thing we're not going to do is I'm not gonna focus on building a library. We have so many different purposes for the different libraries that we're building and so that's pretty hard to teach in a generic way.

[00:01:47]
I'll talk a little bit in that talk about managing an open source library. I'll talk a little bit about how to make it extensible and stuff like that. But for the most part the library is going to be very small and we'll kind of skip over that stuff as we need to.

[00:02:05]
And mostly we're gonna be building the tooling around the library to make your life as an open source author easier. So requirements for the workshop. Hopefully you all have this set up already. But you need git, node, NPM, and then also a travis-ci.org account. So if you don't have that set up, go ahead and set that up.

[00:02:26]
It's pretty quick. Just connect it with GitHub, and a codecov.io account. Connect that with GitHub as well. These are things that we're gonna be using to automate part of our project. So, I leave that up for a second.
>> Kent C. Dodds: So it's travis-ci.org and codecov.io. Actually, you know what, I should just copy this into the chat.

[00:02:55]
That is what I will do.
>> Kent C. Dodds: Whoops
>> Kent C. Dodds: There we go.
>> Kent C. Dodds: Okay, so let's go ahead and jump in. So these are commands that you should have run, hopefully beforehand. I will paste those into that chat again, as well. There was a mistake in the instructions that was sent out, that was my bad.

[00:03:26]
Copy/paste error. But you shouldn't be running any server going to local host 8080. That's not necessary for this workshop. And when it's all said and done, you should have a project that looks like this. You'll have a .git directory, a known modules directory and a .git attributes file.

[00:03:48]
It's totally empty. The reason that you have a node_modules directory, I'll just kind of explain this really quick, is this npm run setup:fem, for friend and masters. What that is doing is it checks out the very last branch of our workshop. At every step is a branch, and it runs NPM Install, to install all the dependencies that we're eventually going to have in the project, and then it checks out the very first branch, so the one that has nothing.

[00:04:19]
But it also deletes a couple directories that are artifacts of running some validation and stuff. And so the reason that we do that is so that throughout the workshop you don't have to be constantly running NPM Install, especially if you're on a bad internet connection. That can be a problem, and so by installing everything upfront you can just skip over that bit.

[00:04:41]
So that's why you have this node modules directory It is not git ignored. We don't have a git ignore in here right now. We'll actually add that a little bit later. Don't commit that. Never commit your node model strength, almost never.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now