Publishing to the official registry
Let’s start by creating a small library that uses a structure that can be seen very often in Node.js projects. The structure consists of an src
folder, where the original sources are located, and a lib
folder, containing the output to be used by the target system. The target system could either be something such as a bundler for browser applications or a specific version of Node.js.
To initialize this kind of project, we can use the npm
command-line utility as we did before:
$ npm init -y
Now, we’ll set everything up. First, we will install esbuild
as a development dependency. This can be very helpful for transforming our source files into usable library files:
$ npm install esbuild --save-dev
Next, we change package.json
to fit our needs:
package.json
{
"name": "lib-test-florian-rappl",
"version": "1.0.0",
"description": "...