![]() ![]() ![]() npmrc at the root of your repository and set the contents to the ///:_authToken=YOUR_GITHUB_TOKEN registry=Īnd fill in YOUR_GITHUB_USERNAME and YOUR_GITHUB_TOKEN respectively.Ģ. To do that, go to and press “Generate new token” and make sure you assign the token the following scopes:įigure 2. Authorise to publish on the registryįor this step, you’ll need to generate a github token that will allow us to publish later. Put the package in a Github repositoryįor that, you’ll need to head on over to (and create an account, if you don’t have one yet), create a new repository and push our package code that repository. Once the installation is complete, you’ll need to: cd mylibĪnd also open the directory in your code editor. You’ll be given a couple of options to choose from, but those will not affect how you can publish the package later. Create the packageįor this example, we’ll use to scaffold our package, quite simply because it takes care of all the config that is usually needed when you want to setup a typescript project from scratch: npx tsdx create mylib If you’ve landed here by chance, you might ask, “Why not use ?” If you don’t mind your package to be public, sure, by all means, however, private packages on there will cost you money, not a lot, but some, which is not the case with Github package registry. It could be some utility functions that are really helpful for the way you like to do things in code or it could a set of typescript types, you wish your frontend and backend code to share - whatever the case you’ll probably want to create your own npm package. So you’ve come to a point in your developer where you seem to be repeating and/or copy~pasting the same piece of code across multiple projects.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |