I didn't want to commit it to the repository. That's why I write to the file as a pipeline step and I have access to my secret here. When you run the pipeline, the output looks more or less like this. It is on line 12, you have your index.d.ts file, so the file that exports actually methods and functions that are used. But also on line 17, you have exactly the file name that we were testing locally when we were running pnpm pack method. If you get 405, make sure that your package is named properly. Once you publish it, your package is available on GitHub. You have info how to install it, how to add it to packet.json, you have information about the previous releases. On the right-hand side, you have readme as well, and link to repository. Let's talk about versioning now. The standard for versioning is the major, minor patch format. That translates to, let's say, major one, minor three and patch is zero. So, when you will be releasing a breaking change, you want to communicate to the user that they may need to update the usage of your library, and you do it by releasing major versions. And this is commonly known as the egg and chicken problem.
I didn't want to commit it to the repository. That's why I write to the file as a pipeline step and I have access to my secret here. There is the repository secrets. So I create this npmrc file. Install dependencies, run my tests and build the project, and then can publish, as I said, to my GitHub registry that includes my username as well.
When you run the pipeline, the output looks more or less like this. It is on line 12, you have your index.d.ts file, so the file that exports actually methods and functions that are used. But also on line 17, you have exactly the file name that we were testing locally when we were running pnpm pack method. Again, same as previously, it didn't work the first time. Didn't work the second time. When I was trying to publish to my GitHub feed, often, I was getting 404 or 405. And I figured out the way how to authenticate it, so as I was saying, .npmrc file needs to include the secret and correct registry URL. However, name of your package also needs to include your GitHub username. That was interesting learning. If you get 405, make sure that your package is named properly.
OK. So, once you publish it, your package is available on GitHub. You have info how to install it, how to add it to packet.json, you have information about the previous releases. On the right-hand side, you have readme as well, and link to repository. It's really nice, isn't it? So, as you can see here, there are different versions, recent version, there's alpha and so on. Let's talk about versioning now. So, standard for versioning is the major, minor patch format. That translates to, let's say, major one, minor three and patch is zero. So, when you will be releasing a breaking change, you want to communicate to the user that they may need to update the usage of your library, and you do it by releasing major versions. So, let's say bump the major number to two, you will have version 2.0.0. If you release this small change to your application, maybe just add additional helper function, you would just bump the minor version. So, 1.4.0. And when you work with patches, so, like the small fixes, maybe you updated readme or something like this, you would just update the patch version. However, when you work with the package, and you create the PR, you update the code, and you release this package, you would probably create just a patch update 1.3.1. And this is commonly known as the egg and chicken problem.
Comments