Prep Library for Production
In this lesson, you will prep your code for publishing to npm.
The following resources provide more information for this lesson:
- Read more about .npmignore
- TypeScript Handbook: Module Output Options
- • [module](<https://www.typescriptlang.org/tsconfig#module>) which determines what code is used for modules to interact with each other
[0:00] [0: 00] The first thing you need to do is get our package.json in order for publishing. Here, you can see a diff of the changes I've made in the package.json.
[0:07] [0: 07] The most important ones that I want to point out are name and version. We're going to publishing this under your GitHub username, because streak-counter is probably taken. I have -2 in mind, because I've already done this, and version, start of at ..1.
[0:42] [0: 42] Next, we'll be making changes to our tsconfig.json. I went ahead and removed all comments so you can see what we're working with before we make changes. As you can see, we've made a couple of changes which are just going to allow our project to be compiled correctly according to what Microbundle expects. You can refer to the TS handbook if you want to understand what each of these things do.
[1:05] [1: 05] The final thing we're going to do is create a .npmignore at the root of streak-counter, and we'll add two lines in here, _tests_ and .github. This tells npm, when you publish our package, don't bundle these files or, in this case, these directories.
[1:21] [1: 22] That's it for now. In the next video, we will actually publish this to npm.