![]() github folder at the root of your directory and for a workflows subfolder. What’s important to know is that GitHub checks if your repository has a. ![]() This article won’t go into depth about that but I do have a few that takes advantage of the functionality. ![]() We will be using GitHub actions to make sure we can publish our package. The main takeaway here is to just create your hook and place it in the src folder: ![]() If the user inputs a certain combination of keys in a row then it'll trigger a callback. In this case, useKonamiCode which just added an event listener for user input. As you may have seen I named my package useless-hooks. You’ll be asked several questions about the new package. Sweet! Now we can initialize npm to generate our package.json In the repo click on code and grab the clone link. With that out of the way let’s open up Visual Studio Code or your IDE of choice and clone it locally. For context, this is GitHub’s official guide for the setup of the package repository as well. GitHub already includes a thorough guide on doing so. GitHub Packages Setupįirst, let’s go ahead and create a new repository. We’ll be creating our React component library as a package to host on Github Packages. This comes with a whole swath of functionalities since it’s tied to the GitHub ecosystem such as integrations with GitHub APIs, GitHub Actions, and webhooks. GitHub Packages allows us to directly host a package we create. Yes, that folder that weighs a ton and should never be committed to Github Repository. These packages typically tend to live in a folder called node_modules when installed locally. Normally these file(s) add functionality to your application.įor example, one of the most popular packages in the world is lodash which is a “JavaScript utility library delivering modularity, performance, & extras” ie most commonly used for the functions it provides to make our lives a whole lot easier. In this tutorial, I’ll go over how to set up the Github Packages repository, then create a simple React hook, publish it and then install it in another project.ĭisclaimer: This tutorial assumes some basic knowledge of React! What is a package?Ī package is a file or directory of code that has been privately or publically available. Github comes in with some pretty useful baked-in features, such as the ability to create your own package.
0 Comments
Leave a Reply. |