6 Must Have Advanced Tools for TypeScript Modules
With the tools in this list, your repository (commit, push, etc.) and publishing processes will be much easier. You won't have to do repetitive and tedious work again with automated workflows.
In my previous article, I mentioned seven basic tools. In this article, I will discuss more advanced tools. Perhaps, in the future, I can write another post detailing their installations.
If you would like to setup all the tools with zero-configuration, try this free and open source npm package as below.
$ mkdir my-project
$ npm init @ozum/tsm@latest
1. Commitizen
Commitizen generates a commit message adhering to the standard you set based on the answers you provide to its questions when you commit your code. If you use a common standard like conventional commit
, you can also take advantage of automation features like automatic version number generation and CHANGELOG creation using the other tools in this list.
2. Commitlint
Commitlint is a tool that checks whether commit messages to conform to the standards you configure. You might think, "Why do I need this if Commitizen is already generating the correct message?" Remember that not everyone committing to the project might be using Commitizen or have committed the files using other software or tools. Running Commitlint on your CI/CD server helps prevent incorrectly formatted messages in such cases.
3. Lint Staged
Lint Staged could be the most optional tool in this list. However, as projects grow and the number of files increases, the value of Lint Staged will also increase rapidly. Lint Staged dramatically speeds up the linting and testing processes during the commit stage by only running the desired tools on staged git files. For instance, if you only update and commit three files in a project with ten thousand files, your linting and testing will only run on those three files instead of all ten thousand files.
4. Husky
When discussing Commitlint, we mentioned that some users might not use Commitizen, which you carefully prepared. This is where Husky comes to the rescue. With Husky, you can automatically enable the execution of desired tools with every commit. For example, when your users enter the git commit
command, Commitizen can automatically step in and ask its questions.
5. GitHub Actions
There are many successful CI/CD options available on the market. However, since I keep my code on GitHub, I use the integrated CI/CD service provided by GitHub, known as GitHub Actions. With GitHub Actions, you can execute completely custom commands or use many pre-built GitHub Actions created by the community.
6. Semantic-Release
While we're starting to use ready-made GitHub Actions, let's not overlook the most beneficial tool on CI/CD. Semantic-Release automates your entire package publishing workflow. It automatically updates version numbers, generates release notes, and publishes the package to npm or another registry. Semantic-Release allows you to publish JavaScript and TypeScript projects to npm on GitHub without the need for manual configuration.
Conclusion
Setting up some of these tools can be time-consuming. However, understanding how each tool works and dealing with their installations will be an excellent exercise for your software development skills. Eventually, you'll feel invincible when you have set them all up.
Comments ()