Preparing the environment
There are multiple ways of creating a library, from using an index.js
file with one single format and a package.json
file, to using some JavaScript files that are compiled to multiple formats and published through NPM. We will do the latter.
To compile the JavaScript files, we're going to use a zero-config CLI for package development called Tsdx (https://tsdx.io). This will help us to develop, test, and publish modern libraries with ease so we can focus on just writing our code and let Tsdx do all the complex configuration.
We can quickly bootstrap a new library in seconds, just by writing this in the terminal:
npx tsdx create typed-state-plugin
This will create a folder called typed-state-plugin/
with the basic setup we need to create our library.
This tool is going to create a file structure like this:
├── .gitignore ├── .prettierrc ├── package.json ├──...